:root {
  --bg: #f3efe7;
  --panel: #ffffff;
  --panel-soft: #f9f6ef;
  --ink: #1e261c;
  --muted: #687164;
  --line: rgba(52, 71, 44, 0.12);
  --brand-dark: #34472c;
  --brand: #567649;
  --brand-light: #dce5d4;
  --beige: #e7dfd0;
  --ok: #2f8f52;
  --warn: #c28522;
  --danger: #bd473e;
  --shadow: 0 18px 44px rgba(52, 71, 44, 0.08);
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(86,118,73,.12), transparent 24%),
    linear-gradient(180deg, #f8f3eb 0%, #f1ede5 100%);
  color: var(--ink);
}

a { color: inherit; text-decoration: none; }
button, select { font: inherit; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 290px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, #304228 0%, #23301d 100%);
  color: #f7f3ec;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}
.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--beige), #fff6e8);
  color: var(--brand-dark);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.4rem;
}
.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  opacity: 0.72;
}
.brand-card h1,
.hero h2,
.section-title-row h3,
.card-header h4 {
  margin: 0;
}
.brand-card h1 { font-size: 1.55rem; }

.menu {
  display: grid;
  gap: 10px;
}
.menu a {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
}
.menu a:hover { background: rgba(255,255,255,0.12); }

.sidebar-footer {
  display: grid;
  gap: 12px;
}
.mini-stat {
  background: rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 14px;
}
.mini-stat span {
  display: block;
  font-size: 0.82rem;
  opacity: 0.75;
  margin-bottom: 4px;
}

.main-content {
  padding: 28px;
}
.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow);
}
.hero h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.hero-copy {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 700px;
}
.hero-actions {
  display: flex;
  gap: 12px;
  align-items: end;
}
.month-filter {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}
.month-filter select,
.primary-btn {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  min-height: 48px;
  padding: 0 14px;
}
.primary-btn {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
  border: 0;
  font-weight: 700;
  box-shadow: 0 14px 28px rgba(52,71,44,0.18);
  cursor: pointer;
}
.primary-btn:hover { transform: translateY(-1px); }

.section-block { margin-top: 28px; }
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.section-kicker {
  margin: 0 0 4px;
  color: var(--brand);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.status-pill {
  margin: 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--brand-light);
  color: var(--brand-dark);
  font-weight: 600;
}

.kpi-grid,
.chart-grid {
  display: grid;
  gap: 16px;
}
.kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel-card,
.kpi-card {
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.kpi-card {
  padding: 18px;
}
.kpi-label {
  color: var(--muted);
  font-size: 0.88rem;
}
.kpi-value {
  margin: 10px 0 8px;
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
}
.kpi-subline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}
.kpi-trend.positive { color: var(--ok); font-weight: 700; }
.kpi-trend.negative { color: var(--danger); font-weight: 700; }

.panel-card { padding: 18px; }
.chart-card { min-height: 360px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.info-stack {
  display: grid;
  gap: 12px;
}
.info-block {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.info-block .label {
  color: var(--muted);
  font-size: 0.84rem;
}
.info-block .value {
  display: block;
  margin-top: 6px;
  font-size: 1.4rem;
  font-weight: 800;
}

.table-card { overflow: hidden; }
.table-wrap {
  width: 100%;
  overflow-x: auto;
}
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
}
.table-wrap th,
.table-wrap td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.92rem;
  white-space: nowrap;
}
.table-wrap th {
  color: var(--muted);
  font-weight: 600;
}
.table-wrap tbody tr:last-child td { border-bottom: 0; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}
.badge.pending { background: rgba(194,133,34,.14); color: #9a6515; }
.badge.production { background: rgba(86,118,73,.14); color: #48693a; }
.badge.ready { background: rgba(47,143,82,.14); color: #1d7740; }
.badge.delivered { background: rgba(52,71,44,.12); color: var(--brand-dark); }
.badge.cancelled { background: rgba(189,71,62,.14); color: #9a3028; }
.badge.default { background: rgba(104,113,100,.12); color: #4f574c; }

.empty-row td {
  color: var(--muted);
  text-align: center;
  padding: 22px 10px;
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-radius: 0 0 26px 26px;
  }
}

@media (max-width: 920px) {
  .hero,
  .section-title-row { flex-direction: column; align-items: stretch; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .kpi-grid,
  .two-columns { grid-template-columns: 1fr; }
}
