:root {
  --ink: #17201c;
  --muted: #647069;
  --line: #dfe5e1;
  --paper: #f6f7f4;
  --white: #ffffff;
  --forest: #194f3f;
  --forest-dark: #123a2f;
  --mint: #d9efe4;
  --amber: #f5c96a;
  --red: #a33b35;
  --shadow: 0 18px 48px rgba(24, 49, 40, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.brand { display: flex; align-items: center; gap: 11px; color: white; font-weight: 760; text-decoration: none; letter-spacing: -.02em; }
.brand-dark { color: var(--ink); font-size: 20px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--mint); color: var(--forest); font-weight: 850; }
.login-shell { display: grid; grid-template-columns: minmax(420px, 48%) 1fr; min-height: 100vh; background: white; }
.login-panel { display: flex; flex-direction: column; padding: 48px clamp(38px, 7vw, 112px); }
.login-copy { margin: auto 0 36px; max-width: 480px; }
.login-copy h1 { margin: 8px 0 14px; font-size: clamp(42px, 5vw, 68px); line-height: .98; letter-spacing: -.055em; }
.login-copy > p:last-child { color: var(--muted); font-size: 18px; line-height: 1.6; }
.eyebrow { color: var(--forest); font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.stack { display: grid; gap: 18px; max-width: 420px; margin-bottom: auto; }
label { display: grid; gap: 8px; font-size: 13px; font-weight: 700; color: #34433c; }
input, select { width: 100%; border: 1px solid #cbd5cf; border-radius: 10px; background: white; padding: 12px 13px; color: var(--ink); }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(49, 133, 102, .25); outline-offset: 2px; }
.form-error { min-height: 18px; margin: -4px 0; color: var(--red); font-size: 13px; }
.login-art { position: relative; overflow: hidden; margin: 18px; border-radius: 28px; background: linear-gradient(145deg, #143a32, #2d7158); }
.login-art::before { content: ""; position: absolute; inset: 0; opacity: .16; background-image: radial-gradient(#fff 1px, transparent 1px); background-size: 24px 24px; }
.route-map { position: absolute; inset: 10%; }
.route-map svg { width: 100%; height: 100%; overflow: visible; }
.route-map path { fill: none; stroke: #d8f1e4; stroke-width: 4; stroke-dasharray: 10 12; }
.route-dot { position: absolute; z-index: 2; width: 20px; height: 20px; border: 5px solid #d8f1e4; border-radius: 50%; background: var(--forest); box-shadow: 0 0 0 8px rgba(217, 239, 228, .15); }
.dot-a { left: 9%; bottom: 19%; } .dot-b { left: 54%; top: 44%; } .dot-c { right: 5%; top: 13%; }
.art-card { position: absolute; display: grid; gap: 2px; min-width: 142px; padding: 18px; border: 1px solid rgba(255,255,255,.28); border-radius: 16px; color: white; background: rgba(255,255,255,.12); backdrop-filter: blur(10px); }
.art-card b { font-size: 28px; } .art-card span { color: #d4e8de; font-size: 12px; }
.card-a { left: 16%; top: 12%; } .card-b { right: 7%; bottom: 13%; }

.button { border: 0; border-radius: 10px; padding: 11px 17px; font-weight: 750; }
.button-primary { background: var(--forest); color: white; }
.button-primary:hover { background: var(--forest-dark); }
.button-secondary { border: 1px solid var(--line); background: white; color: var(--ink); }
.button-danger { border: 1px solid #edc7c3; background: #fff6f5; color: var(--red); }
.button-full { width: 100%; padding: 13px 18px; }
.button-small { padding: 7px 11px; font-size: 12px; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 9px; color: inherit; background: transparent; font-size: 20px; }
.icon-button:hover { background: rgba(0,0,0,.05); }

.app-shell { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 28px 20px 20px; color: white; background: var(--forest-dark); }
.sidebar nav { display: grid; gap: 5px; margin-top: 46px; }
.sidebar nav a { padding: 11px 13px; border-radius: 9px; color: #c6d9d1; text-decoration: none; font-size: 14px; font-weight: 650; }
.sidebar nav a:hover, .sidebar nav a.active { color: white; background: rgba(255,255,255,.1); }
.sidebar-footer { display: grid; grid-template-columns: 38px minmax(0,1fr) 34px; align-items: center; gap: 10px; margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.12); }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: #e9b960; color: #2d281e; font-size: 12px; font-weight: 850; }
.account-copy { display: grid; min-width: 0; }
.account-copy strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.account-copy span { color: #9fb8ae; font-size: 11px; text-transform: capitalize; }
.workspace { min-width: 0; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; min-height: 122px; padding: 30px clamp(28px, 5vw, 72px) 24px; border-bottom: 1px solid var(--line); background: rgba(246,247,244,.92); }
.topbar h1 { margin: 3px 0 0; font-size: 30px; letter-spacing: -.035em; }
.org-name { margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.page-content { padding: 32px clamp(28px, 5vw, 72px) 80px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h2 { margin: 0 0 5px; font-size: 20px; }
.page-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card, .panel { border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: 0 1px 2px rgba(12, 30, 23, .025); }
.stat-card { padding: 20px; }
.stat-card span { color: var(--muted); font-size: 12px; font-weight: 650; }
.stat-card strong { display: block; margin-top: 10px; font-size: 28px; letter-spacing: -.04em; }
.panel { overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; font-size: 15px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 11px 18px; color: var(--muted); background: #fafbf9; font-size: 11px; letter-spacing: .05em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 14px 18px; border-top: 1px solid #edf0ee; vertical-align: middle; }
.data-table tr:first-child td { border-top: 0; }
.data-table tbody tr:hover { background: #fbfcfa; }
.table-actions { display: flex; justify-content: flex-end; gap: 6px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; background: #eef2ef; color: #48564f; font-size: 11px; font-weight: 760; text-transform: capitalize; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #86938d; }
.pill-dispatched::before, .pill-delivered::before { background: #39916c; }
.pill-draft::before { background: #d49b32; }
.pill-cancelled::before { background: #bc534b; }
.inventory-name { display: grid; gap: 3px; }
.inventory-name span { color: var(--muted); font-size: 11px; }
.stock-meter { display: flex; align-items: center; gap: 10px; }
.stock-meter > span:first-child { min-width: 30px; font-weight: 750; }
.meter { width: 80px; height: 5px; overflow: hidden; border-radius: 999px; background: #edf0ee; }
.meter i { display: block; height: 100%; border-radius: inherit; background: #4a9b78; }
.notice { padding: 15px 17px; border: 1px solid #e7ddc5; border-radius: 10px; color: #6a552b; background: #fffaf0; font-size: 13px; }
.empty { padding: 48px 20px; color: var(--muted); text-align: center; }
.report-card { max-width: 680px; padding: 28px; }
.report-card h2 { margin: 0 0 8px; }
.report-card > p { margin: 0 0 24px; color: var(--muted); line-height: 1.55; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.checkbox { display: flex; align-items: center; gap: 9px; min-height: 44px; }
.checkbox input { width: auto; }
.modal-frame { min-width: min(540px, calc(100vw - 40px)); margin: 0; }
dialog { padding: 0; border: 0; border-radius: 17px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(12, 25, 20, .46); backdrop-filter: blur(3px); }
.modal-frame > header { display: flex; justify-content: space-between; padding: 24px 26px 18px; border-bottom: 1px solid var(--line); }
.modal-frame h2 { margin: 4px 0 0; font-size: 22px; }
#modal-content { padding: 24px 26px 28px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.toast-region { position: fixed; z-index: 20; right: 24px; bottom: 24px; display: grid; gap: 9px; }
.toast { max-width: 360px; padding: 13px 16px; border-radius: 10px; color: white; background: #20372e; box-shadow: var(--shadow); font-size: 13px; animation: toast-in .2s ease-out; }
.toast.error { background: #8e342f; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 960px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .app-shell { grid-template-columns: 82px minmax(0,1fr); }
  .sidebar { padding-inline: 14px; }
  .sidebar .brand > span:last-child, .sidebar nav span, .account-copy { display: none; }
  .sidebar-footer { grid-template-columns: 38px; justify-content: center; }
  .sidebar-footer .icon-button { display: none; }
  .sidebar nav a { text-align: center; }
}

@media (max-width: 640px) {
  .login-panel { padding: 30px 24px; }
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 14px 18px; }
  .sidebar nav { display: flex; overflow-x: auto; margin-top: 14px; }
  .sidebar-footer { display: none; }
  .stats-grid, .form-grid { grid-template-columns: 1fr; }
  .topbar { min-height: 104px; padding: 24px 20px 18px; }
  .page-content { padding: 22px 20px 60px; overflow-x: auto; }
  .data-table { min-width: 700px; }
}
