:root {
  --brand: #475CCC;
  --brand-dark: #3145b7;
  --brand-soft: #eef1ff;
  --cream: #f9fdc1;
  --bg: #f7f8fb;
  --panel: #fff;
  --text: #172033;
  --muted: #677085;
  --line: #e5e8f0;
  --shadow: 0 14px 36px rgba(23, 32, 51, .08);
  --radius: 8px;
  --font-ui: "Montserrat", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "League Spartan", "Montserrat", ui-sans-serif, system-ui, sans-serif;
  font-family: var(--font-ui);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input { font: inherit; }
button { min-height: 40px; border: 0; border-radius: var(--radius); cursor: pointer; font-weight: 700; }
button:disabled { cursor: not-allowed; opacity: .55; }
input { min-height: 40px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px; background: #fff; color: var(--text); }
input:focus, button:focus { outline: 3px solid rgba(71, 92, 204, .2); outline-offset: 2px; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 32px; }
.login-logo { width: 210px; max-width: 100%; display: block; margin-bottom: 28px; }
.login-panel h1 { margin: 0 0 20px; font-size: 28px; }
.stack { display: grid; gap: 14px; }
.stack label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.health-line { margin-top: 18px; color: var(--muted); font-size: 13px; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px 20px; font-family: var(--font-display); font-size: 20px; font-weight: 800; color: var(--brand); }
.brand img { width: 34px; height: 34px; object-fit: contain; }
nav { display: grid; gap: 4px; }
.nav-item { width: 100%; text-align: left; padding: 0 12px; color: var(--muted); background: transparent; }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }

.workspace { padding: 22px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.eyebrow { margin: 0 0 3px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
h1 { margin: 0; font-family: var(--font-display); font-size: clamp(28px, 3vw, 38px); font-weight: 800; letter-spacing: 0; }
h2 { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 800; letter-spacing: 0; }
.userbox { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 700; }

.grid { display: grid; gap: 12px; }
.stats { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 14px; }
.stat-card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(23,32,51,.04); }
.stat-card { padding: 16px; display: grid; gap: 6px; min-height: 116px; }
.stat-card span, .stat-card small, .muted { color: var(--muted); }
.stat-card span { font-size: 12px; font-weight: 800; text-transform: uppercase; }
.stat-card strong { font-family: var(--font-display); font-size: 28px; line-height: 1.05; letter-spacing: 0; }
.stat-card small { font-size: 13px; }
.panel { padding: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.badge, .mini { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 800; }
.mini { margin-left: 8px; min-height: 20px; }
.alert { background: #fff2f0; color: #b42318; border: 1px solid #ffd6d1; border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; font-size: 14px; font-weight: 700; }
.primary { background: var(--brand); color: #fff; padding: 0 16px; }
.primary:hover { background: var(--brand-dark); }
.secondary, .ghost { background: #fff; color: var(--text); border: 1px solid var(--line); padding: 0 14px; }
.ghost { color: var(--muted); }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.toolbar input { width: min(420px, 100%); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 820px; background: #fff; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
th { background: #fbfcff; color: var(--muted); font-size: 12px; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
td small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 600; }
.selected-row td { background: #fbfcff; }
.empty-cell { color: var(--muted); text-align: center; padding: 24px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 14px; }
.placeholder { min-height: 220px; display: grid; align-content: center; justify-items: start; gap: 8px; }
.split-view { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr); gap: 14px; align-items: start; }
.detail-panel { position: sticky; top: 18px; }
.meta-line { margin: 5px 0 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.summary-grid, .detail-kpis { display: grid; gap: 8px; }
.summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 14px; }
.summary-grid div, .detail-kpis span { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; background: #fbfcff; }
.summary-grid span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.summary-grid strong { font-size: 13px; line-height: 1.35; }
.size-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; }
.size-tabs button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 0 12px; }
.size-tabs button.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.size-tabs span { color: inherit; font-size: 12px; font-weight: 700; }
.detail-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 8px 0 12px; color: var(--muted); font-size: 13px; font-weight: 700; }
.compact table { min-width: 620px; }
.note { margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.icon-button { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); background: #fff; color: var(--brand); font-size: 13px; }
.production-list { display: grid; gap: 8px; }
.production-row { display: grid; grid-template-columns: minmax(260px, 1fr) 190px 120px 100px; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: #fff; }
.production-row.closed { background: #fbfcff; }
.production-row strong { display: block; font-size: 15px; }
.progress-cell { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.progress { height: 8px; overflow: hidden; border-radius: 999px; background: var(--brand-soft); }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.pending-pill, .status-pill { justify-self: start; min-height: 28px; display: inline-flex; align-items: center; border-radius: 999px; padding: 0 10px; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 800; }
.status-pill { background: #f6f7fb; color: var(--muted); }

@media (max-width: 1060px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-view { grid-template-columns: 1fr; }
  .detail-panel { position: static; }
  .production-row { grid-template-columns: 1fr 180px; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace { padding: 14px; }
  .topbar { align-items: flex-start; }
  .userbox { flex-direction: column; align-items: flex-end; }
  .stats { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; }
  .summary-grid, .detail-kpis { grid-template-columns: 1fr; }
  .production-row { grid-template-columns: 1fr; }
}
