:root {
  --navy: #13325b;
  --navy-900: #0c2244;
  --green: #1f7a4d;
  --gold: #caa24a;
  --ink: #102034;
  --muted: #657386;
  --line: #d9e2ec;
  --soft: #f5f8fb;
  --white: #fff;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  background: var(--soft);
  color: var(--ink);
  font-family: var(--sans);
}
button, input, select { font: inherit; }
button, select {
  border: 1px solid var(--line);
  background: white;
  color: var(--navy);
  border-radius: 8px;
  min-height: 38px;
  padding: 0 12px;
  font-weight: 800;
}
button { cursor: pointer; }
.primary, .admin-actions .primary { background: var(--navy); color: white; border-color: var(--navy); }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--navy-900);
  color: rgba(255,255,255,.74);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.brand {
  display: block;
  background: white;
  border-radius: 8px;
  padding: 10px;
}
.brand img { display: block; width: 100%; height: auto; }
nav { display: grid; gap: 6px; }
nav a {
  color: rgba(255,255,255,.74);
  text-decoration: none;
  padding: 12px 13px;
  border-radius: 8px;
  font-weight: 800;
}
nav a.active, nav a:hover { background: rgba(255,255,255,.1); color: white; }
.sidebar-card {
  margin-top: auto;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255,255,255,.06);
}
.sidebar-card span, .kicker {
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 11px;
  font-weight: 900;
}
.sidebar-card b { display: block; color: white; margin: 8px 0; font-size: 20px; }
.sidebar-card p { margin: 0; line-height: 1.6; font-size: 13px; }

main { padding: 32px; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: start;
  margin-bottom: 22px;
}
h1, h2, p { margin-top: 0; }
h1 {
  font-family: var(--serif);
  color: var(--navy-900);
  font-size: 48px;
  line-height: 1.02;
  font-weight: 500;
  max-width: 780px;
  margin-bottom: 0;
}
h2 {
  font-family: var(--serif);
  color: var(--navy-900);
  font-size: 30px;
  font-weight: 500;
  margin-bottom: 0;
}
.admin-actions { display: flex; gap: 10px; }
.risk-banner {
  background: var(--navy-900);
  color: white;
  border-radius: 8px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}
.risk-banner b { display: block; margin-bottom: 4px; }
.risk-banner span { color: rgba(255,255,255,.72); }
.risk-banner button { border-color: rgba(255,255,255,.2); background: white; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.metric-grid article, .panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.metric-grid article { padding: 18px; }
.metric-grid span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.metric-grid strong { display: block; color: var(--navy-900); font-family: var(--serif); font-size: 36px; font-weight: 500; }
.metric-grid em { color: var(--green); font-style: normal; font-size: 12px; font-weight: 850; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.4fr .8fr;
  gap: 18px;
  align-items: start;
}
.panel { padding: 20px; overflow: hidden; }
.wide { grid-column: 1 / -1; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
  margin-bottom: 18px;
}
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef8f2;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}
.urgent { color: #8b6818; background: #fff7df; }

.bar-chart {
  height: 260px;
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 24px 8px 0;
  border-bottom: 1px solid var(--line);
}
.bar-chart i {
  flex: 1;
  height: var(--h);
  background: linear-gradient(180deg, var(--green), var(--navy));
  border-radius: 5px 5px 0 0;
}
.chart-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  margin-top: 14px;
}
.chart-legend b {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
  margin-right: 6px;
}

.task-list { display: grid; gap: 10px; }
.task-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: #344559;
}
.task-list input { accent-color: var(--green); }

.segmented {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: #f7fafc;
}
.segmented button {
  border: 0;
  background: transparent;
  min-height: 30px;
}
.segmented button.active { background: var(--navy); color: white; }
.table { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.table-row {
  display: grid;
  grid-template-columns: 110px 1fr 140px 140px 120px;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}
.table-row:last-child { border-bottom: 0; }
.table-head { background: var(--navy-900); color: white; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; font-weight: 900; }
.table-row span { color: var(--muted); }
.table-row div {
  display: grid;
  gap: 4px;
}
.table-row div span {
  display: block;
  font-size: 13px;
}
.status { font-weight: 900; color: var(--green); }
.status.hold { color: #9b6a00; }

.inventory-list { display: grid; gap: 12px; }
.inventory-item {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.inventory-item:last-child { border-bottom: 0; padding-bottom: 0; }
.inventory-item header { display: flex; justify-content: space-between; gap: 10px; }
.inventory-item b { color: var(--navy-900); }
.inventory-item span { color: var(--muted); font-size: 13px; }
.meter {
  height: 8px;
  background: #e7eef5;
  border-radius: 999px;
  overflow: hidden;
}
.meter i {
  display: block;
  width: var(--w);
  height: 100%;
  background: var(--green);
}
.meter.low i { background: var(--gold); }

.coa-record {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 18px;
}
.coa-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfdff;
}
.coa-card span { color: var(--green); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; font-weight: 900; }
.coa-card strong { display: block; color: var(--navy-900); font-size: 26px; margin: 8px 0; }
.coa-card p { color: var(--muted); line-height: 1.6; }
.coa-status { display: flex; gap: 8px; flex-wrap: wrap; }
.coa-status b {
  color: var(--green);
  background: #eef8f2;
  border-radius: 999px;
  padding: 6px 8px;
  font-size: 11px;
}
.mini-plot {
  min-height: 200px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 18px;
  background:
    linear-gradient(transparent 23px, rgba(19,50,91,.07) 24px),
    linear-gradient(90deg, transparent 23px, rgba(19,50,91,.07) 24px),
    white;
  background-size: 24px 24px;
}
.mini-plot i { flex: 1; background: var(--navy); border-radius: 4px 4px 0 0; }
.mini-plot i:nth-child(1) { height: 28%; }
.mini-plot i:nth-child(2) { height: 64%; background: var(--green); }
.mini-plot i:nth-child(3) { height: 44%; }
.mini-plot i:nth-child(4) { height: 82%; background: var(--gold); }
.mini-plot i:nth-child(5) { height: 36%; }

@media (max-width: 1120px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .metric-grid, .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .wide { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  main { padding: 18px; }
  .topbar, .risk-banner, .panel-head { flex-direction: column; }
  .metric-grid, .dashboard-grid, .coa-record { grid-template-columns: 1fr; }
  .table-row { grid-template-columns: 1fr; }
  h1 { font-size: 36px; }
}

.empty-state {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 32px 16px;
  border: 1px dashed rgba(101, 115, 134, 0.3);
  border-radius: 12px;
}
