:root {
  --ink: #202a2e;
  --muted: #68777b;
  --line: #d9e0de;
  --paper: #f4f6f3;
  --surface: #ffffff;
  --forest: #165c4b;
  --forest-dark: #0d4237;
  --amber: #b16818;
  --red: #a33b32;
  --blue: #356780;
  --sidebar: #172326;
  --radius: 6px;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Trebuchet MS", sans-serif; font-size: 14px; letter-spacing: 0; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1.25fr) minmax(360px, .75fr); }
.brand-panel { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(40px, 7vw, 100px); color: #f8fbf7; background: #183d38; }
.brand-panel::after { content: ""; position: absolute; inset: 0; opacity: .18; background: repeating-linear-gradient(90deg, transparent 0 47px, #d7e0a5 48px), repeating-linear-gradient(0deg, transparent 0 47px, #d7e0a5 48px); pointer-events: none; }
.brand-panel > * { position: relative; z-index: 1; }
.brand-panel h1 { margin: 8px 0 18px; max-width: 720px; font: 700 clamp(48px, 7vw, 92px)/.95 Georgia, serif; }
.brand-copy { max-width: 590px; color: #d7e3df; font-size: 18px; line-height: 1.6; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 16px); gap: 4px; width: max-content; }
.brand-mark span { width: 16px; height: 16px; background: #d7e0a5; }
.brand-mark span:nth-child(2), .brand-mark span:nth-child(3) { background: #d8833d; }
.signal-grid { display: grid; grid-template-columns: repeat(12, minmax(8px, 1fr)); gap: 8px; max-width: 520px; }
.signal-grid i { display: block; height: 6px; background: #77ad9e; }
.signal-grid i:nth-child(3n) { background: #d7e0a5; }
.signal-grid i:nth-child(5n) { background: #d8833d; }
.login-panel { display: grid; place-items: center; padding: 48px; background: #fbfcfa; }
.login-form { width: min(100%, 390px); }
.login-form h2 { margin: 8px 0 34px; font: 700 32px/1.15 Georgia, serif; }
.login-form label, .field { display: grid; gap: 8px; margin-bottom: 18px; color: #39474b; font-weight: 700; }
input, select { width: 100%; min-height: 42px; border: 1px solid #b9c5c2; border-radius: 4px; padding: 9px 11px; background: white; color: var(--ink); }
input:focus, select:focus, button:focus-visible { outline: 3px solid rgba(22, 92, 75, .22); outline-offset: 2px; border-color: var(--forest); }
.eyebrow { margin: 0; color: #82908d; font: 700 11px/1.4 "Bahnschrift", sans-serif; text-transform: uppercase; letter-spacing: 1.6px; }
.brand-panel .eyebrow { color: #b9cac5; }
.form-error { min-height: 21px; color: var(--red); }

.primary, .quiet, .danger, .table-action { min-height: 38px; border-radius: 4px; border: 1px solid transparent; padding: 8px 14px; font-weight: 700; }
.primary { color: white; background: var(--forest); }
.primary:hover { background: var(--forest-dark); }
.quiet { color: var(--ink); border-color: #c8d1cf; background: white; }
.quiet:hover { border-color: #83918e; }
.danger { color: white; background: var(--red); }
.table-action { min-height: 32px; padding: 5px 10px; color: var(--forest); border-color: #b8cbc6; background: #f8fbfa; }
.wide { width: 100%; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 18px 18px; color: #e7ecea; background: var(--sidebar); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; margin: 0 8px 42px; color: white; text-decoration: none; font: 700 20px "Bahnschrift", sans-serif; }
.mini-mark { width: 20px; height: 20px; background: conic-gradient(#d8833d 0 25%, #d7e0a5 0 50%, #77ad9e 0 75%, #d7e0a5 0); }
.sidebar nav { display: grid; gap: 5px; }
.nav-button { width: 100%; border: 0; border-radius: 4px; padding: 11px 12px; color: #aebbb8; background: transparent; text-align: left; font-weight: 700; }
.nav-button:hover, .nav-button.active { color: white; background: #27383b; }
.identity { margin-top: auto; display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 10px; border-top: 1px solid #314347; padding: 18px 6px 0; }
.identity-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #17332e; background: #d7e0a5; font-weight: 800; }
.identity strong, .identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity small { margin-top: 3px; color: #90a09c; font-size: 10px; }

.workspace { min-width: 0; }
.topbar { min-height: 110px; display: flex; justify-content: space-between; align-items: center; gap: 24px; border-bottom: 1px solid var(--line); padding: 24px clamp(24px, 4vw, 56px); background: rgba(255,255,255,.72); }
.topbar h1 { margin: 5px 0 0; font: 700 28px/1.15 Georgia, serif; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.sync-state { color: var(--forest); font: 700 11px "Bahnschrift", sans-serif; text-transform: uppercase; }
.sync-state::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #2a9d6f; }
.content { padding: 32px clamp(24px, 4vw, 56px) 64px; }
.notice { margin: 18px clamp(24px, 4vw, 56px) 0; border-left: 4px solid var(--forest); padding: 12px 16px; background: #e8f2ed; }
.notice.error { border-color: var(--red); color: #732a25; background: #faece9; }
.loading { padding: 60px 0; color: var(--muted); text-align: center; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); border: 1px solid var(--line); background: var(--surface); }
.kpi { min-height: 126px; padding: 24px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi small { color: var(--muted); font-weight: 700; }
.kpi strong { display: block; margin-top: 18px; font: 700 30px "Bahnschrift", sans-serif; }
.kpi .subvalue { margin-top: 6px; color: var(--muted); font-size: 12px; }
.section-block { margin-top: 28px; border-top: 2px solid var(--ink); padding-top: 18px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font: 700 19px Georgia, serif; }
.section-heading p { margin: 4px 0 0; color: var(--muted); }
.split { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 28px; }
.form-panel { border-left: 3px solid var(--forest); padding: 4px 0 4px 22px; }
.form-panel h2 { margin: 0 0 20px; font: 700 19px Georgia, serif; }
.form-panel .subheading { margin-top: 34px; }
.inline-form { display: grid; grid-template-columns: 1fr 130px auto; align-items: end; gap: 10px; }
.inline-form .field { margin: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 14px; color: #586568; background: #eef1ee; text-align: left; font: 700 10px "Bahnschrift", sans-serif; text-transform: uppercase; }
td { padding: 13px 14px; border-top: 1px solid #e5e9e7; vertical-align: middle; }
tbody tr:hover { background: #fafbf9; }
.mono { font-family: Consolas, monospace; font-size: 12px; }
.status { display: inline-flex; align-items: center; min-height: 24px; border-radius: 999px; padding: 3px 8px; color: #25634e; background: #e1f0e8; font: 700 10px "Bahnschrift", sans-serif; }
.status.REVOKED, .status.SUSPENDED, .status.EXPIRED { color: #87362f; background: #f7e5e2; }
.status.PENDING { color: #84510f; background: #f8ebd3; }
.meter { width: 100%; height: 9px; overflow: hidden; border: 0; border-radius: 2px; background: #e6ebe8; }
.meter::-webkit-progress-bar { background: #e6ebe8; }
.meter::-webkit-progress-value { background: var(--forest); }
.meter::-moz-progress-bar { background: var(--forest); }
.allocation-list { display: grid; gap: 15px; }
.allocation-row { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr 65px; align-items: center; gap: 12px; }
.empty { border: 1px dashed #bac5c2; padding: 34px; color: var(--muted); text-align: center; }
.search-form { display: flex; gap: 8px; width: min(100%, 420px); }
.search-form input { min-height: 38px; }
.file-drop { display: grid; place-items: center; min-height: 190px; border: 1px dashed #99aaa6; padding: 28px; background: #f8faf7; text-align: center; }
.file-drop input { width: auto; border: 0; background: transparent; }
.file-drop strong { display: block; margin-bottom: 7px; font: 700 18px Georgia, serif; }
.file-drop p { color: var(--muted); }
.policy-list { margin: 0; padding: 0; list-style: none; }
.policy-list li { display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); padding: 13px 0; }
.policy-list span { color: var(--muted); }
dialog { width: min(440px, calc(100vw - 32px)); border: 0; border-radius: var(--radius); padding: 0; box-shadow: 0 24px 70px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(12, 24, 25, .58); }
dialog form { padding: 28px; }
dialog h2 { margin-top: 0; font: 700 21px Georgia, serif; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 26px; }

@media (max-width: 980px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(2) { border-right: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .login-layout { grid-template-columns: 1fr; }
  .brand-panel { min-height: 40vh; padding: 36px 28px; }
  .brand-panel h1 { font-size: 48px; }
  .brand-copy { font-size: 15px; }
  .login-panel { padding: 42px 24px; }
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 16px; }
  .sidebar-brand { margin: 0 0 14px; }
  .sidebar nav { display: flex; overflow-x: auto; }
  .nav-button { width: auto; white-space: nowrap; }
  .identity { display: none; }
  .topbar { min-height: 96px; align-items: flex-start; padding: 20px; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .sync-state { display: none; }
  .content { padding: 24px 16px 48px; }
  .notice { margin-inline: 16px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi { border-right: 0; border-top: 1px solid var(--line); }
  .kpi:first-child { border-top: 0; }
  .inline-form { grid-template-columns: 1fr; }
  .allocation-row { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .search-form { width: 100%; }
}