:root {
  --ink: #172033;
  --muted: #667085;
  --faint: #8b97a8;
  --line: #dce4ef;
  --soft-line: #e8eef6;
  --paper: #ffffff;
  --wash: #f4f7fb;
  --nav: #08182e;
  --nav-2: #10233c;
  --accent: #d83f5f;
  --accent-weak: #fff3f6;
  --green: #168a5b;
  --green-weak: #eaf7f0;
  --amber: #b86b00;
  --amber-weak: #fff5e8;
  --red: #c93636;
  --red-weak: #fff1f1;
  --blue: #2467ad;
  --blue-weak: #edf5ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--wash);
  color: var(--ink);
  display: flex;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.15; letter-spacing: 0; }
h2 { font-size: 15px; line-height: 1.25; letter-spacing: 0; }

.sidebar {
  position: sticky;
  top: 0;
  width: 236px;
  min-width: 236px;
  height: 100vh;
  background: var(--nav);
  color: white;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  font-weight: 900;
}

.brand-name { font-size: 17px; font-weight: 850; }
.brand-sub {
  color: rgba(255,255,255,.58);
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 4px;
  flex: 1;
  min-height: 0;
  padding: 8px;
  overflow-y: auto;
}

.nav-group-label {
  color: rgba(255,255,255,.42);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 1.2px;
  padding: 6px 12px 2px;
  text-transform: uppercase;
}

.nav-item {
  width: 100%;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,.82);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  text-align: left;
  font-weight: 750;
}

.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item.active {
  background: var(--accent);
  color: white;
}

.nav-ico {
  width: 25px;
  height: 25px;
  min-width: 25px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 850;
}

.mobile-more { display: none; }

.sidebar-logout {
  margin: 0 14px 12px;
  width: calc(100% - 28px);
  color: white;
  border-color: rgba(255,255,255,.2);
  background: rgba(255,255,255,.05);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top right, #e8eef9 0, var(--wash) 42%, #edf1f7 100%);
}
.login-shell { width: min(440px, 100%); }
.login-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: 0 24px 70px rgba(8,24,46,.14);
  padding: 28px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.login-brand > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: white;
  font-weight: 900;
}
.login-brand strong,
.login-brand small { display: block; }
.login-brand strong { letter-spacing: 1px; }
.login-brand small { margin-top: 3px; color: var(--muted); }
.login-copy h1 { margin: 6px 0 10px; }
.login-copy p { color: var(--muted); line-height: 1.55; }
.login-form { margin-top: 22px; }
.login-form label { display: grid; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 800; }
.login-form button { min-height: 46px; margin-top: 5px; }
.login-foot { margin-top: 18px; color: var(--faint); font-size: 11px; text-align: center; }

.system-card {
  margin: 0 14px 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.system-card strong { display: block; color: white; font-size: 12px; }
.system-card small {
  display: block;
  color: rgba(255,255,255,.62);
  font-size: 11px;
  margin-top: 2px;
}
.online-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #28c76f;
}
.main {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 44px;
}

.view { display: none; }
.view.active { display: block; }

.topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.topline p {
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.45;
}

.status-pill,
.local-badge {
  border: 1px solid #c9ead9;
  background: var(--green-weak);
  color: #24784f;
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.status-pill[data-environment="testing"],
.local-badge[data-environment="testing"] { border-color: #f2d3a8; background: var(--amber-weak); color: var(--amber); }
.status-pill[data-environment="development"],
.local-badge[data-environment="development"] { border-color: #bfd4ef; background: var(--blue-weak); color: var(--blue); }

.dashboard-actions,
.setup-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.signal {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  text-align: left;
}
.signal:hover { border-color: #c5d0df; }
.signal > span { color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .5px; }
.signal > div { display: grid; gap: 2px; text-align: right; }
.signal strong { font-size: 18px; }
.signal small { color: var(--muted); font-size: 11px; }

.setup-card {
  border: 1px solid #bfd4ef;
  border-radius: 9px;
  background: var(--blue-weak);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  padding: 17px 18px;
}
.setup-card[hidden] { display: none; }
.setup-card h2 { font-size: 17px; margin: 3px 0 5px; }
.setup-card p { color: #50617b; line-height: 1.45; }
.setup-kicker { color: var(--blue); font-size: 10px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; }

.command-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr);
  gap: 16px;
  align-items: start;
}
.command-grid > * { min-width: 0; }

.metric {
  min-height: 98px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 16px;
  text-align: left;
}
.metric:hover { border-color: #c5d0df; }
.metric span,
.metric small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}
.metric span {
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.metric strong {
  color: var(--ink);
  font-size: 25px;
  line-height: 1.1;
}

.band,
.queue-panel,
.tips-panel,
.activity-panel,
.routing-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}
.band {
  padding: 18px;
  margin-bottom: 16px;
}
.band-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-note,
.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.panel-note { font-weight: 800; }

.two-col,
.three-col,
.management-grid,
.lower-grid,
.inbox-layout {
  display: grid;
  gap: 16px;
  align-items: start;
}
.two-col > *,
.three-col > *,
.management-grid > *,
.lower-grid > *,
.inbox-layout > * {
  min-width: 0;
}
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.two-col.wide-left { grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); }
.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.management-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.capture-row,
.inline-form,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stack-form,
.upload-card {
  display: grid;
  gap: 10px;
}
.compact-form { margin-bottom: 12px; }
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}
.check-row input { width: auto; }

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}
textarea {
  min-height: 104px;
  resize: vertical;
  line-height: 1.5;
}
input::placeholder,
textarea::placeholder { color: #8a95a6; }
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}

button,
.button-link,
.link-btn {
  min-height: 38px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: var(--accent);
  color: white;
  padding: 8px 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button:hover,
.button-link:hover,
.link-btn:hover { border-color: rgba(0,0,0,.08); }
button.ghost,
.ghost,
.button-link,
.link-btn {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}
.danger {
  background: var(--red);
  color: white;
  border-color: var(--red);
}
.link-btn {
  min-height: 28px;
  padding: 3px 8px;
  font-size: 12px;
}

.search { max-width: 300px; }

.list {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.item {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  min-width: 0;
}
.alert-item {
  width: 100%;
  text-align: left;
  white-space: normal;
}
.alert-item.high { border-color: #f3b6b6; background: var(--red-weak); }
.alert-item.medium { border-color: #f2d3a8; background: var(--amber-weak); }
.item-main { min-width: 0; flex: 1; }
.item-title {
  font-weight: 850;
  line-height: 1.35;
  word-break: break-word;
}
.item-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 4px;
  word-break: break-word;
}
.meta-block {
  display: block;
  margin-top: 2px;
}
.item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
  max-width: 46%;
}
.item-actions button,
.item-actions .button-link {
  min-height: 31px;
  padding: 5px 9px;
  font-size: 12px;
}
.item strong { white-space: nowrap; }
.done .item-title {
  color: var(--muted);
  text-decoration: line-through;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  padding: 12px;
  font-size: 13px;
  line-height: 1.45;
}
.notice.ok {
  border-color: #b9e4cf;
  background: var(--green-weak);
  color: var(--green);
}
.notice.err {
  border-color: #efb8b8;
  background: var(--red-weak);
  color: var(--red);
}

.chip,
.status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 850;
  background: #edf2f8;
  color: var(--blue);
  margin-right: 5px;
  line-height: 1.35;
}
.chip.green,
.status-chip.green { background: var(--green-weak); color: var(--green); }
.chip.red,
.status-chip.red { background: var(--red-weak); color: var(--red); }
.chip.amber,
.status-chip.amber { background: var(--amber-weak); color: var(--amber); }
.status-chip.blue { background: var(--blue-weak); color: var(--blue); }
.status-chip.purple { background: #f4edff; color: #7c3bd6; }

.count-list {
  display: grid;
  gap: 10px;
}
.count-list div,
.report-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--soft-line);
  padding: 8px 0;
}
.count-list span,
.report-line span { color: var(--muted); }
.report-stack { display: grid; gap: 8px; }
.report-line.good strong { color: var(--green); }
.report-line.bad strong { color: var(--red); }

.workflow-title {
  color: var(--nav-2);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .8px;
  margin: 22px 0 10px;
  text-transform: uppercase;
}

.invoice-grid,
.invoice-line-editor {
  display: grid;
  gap: 10px;
  align-items: center;
}
.invoice-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
.invoice-line-editor { grid-template-columns: 1.6fr .65fr .8fr .7fr auto; }

.aging-grid,
.gst-summary-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}
.aging-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gst-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.aging-card,
.gst-card {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}
.aging-card span,
.gst-card span,
.gst-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}
.aging-card strong,
.gst-card strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}
.subhead { margin-bottom: 10px; }

.activity-table {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  overflow: auto;
  background: white;
}
.activity-head,
.activity-row {
  min-width: 720px;
  display: grid;
  grid-template-columns: minmax(180px, 2fr) minmax(110px, .9fr) minmax(110px, .9fr) minmax(130px, 1fr) minmax(80px, .55fr);
  gap: 12px;
  align-items: center;
  padding: 9px 12px;
  font-size: 12px;
}
.activity-head {
  background: #f8fafd;
  color: var(--muted);
  font-weight: 900;
}
.activity-row { border-top: 1px solid var(--soft-line); }
.empty-row { color: var(--muted); }
.mini-table { min-height: 45px; }
.mini-table .activity-head,
.mini-table .activity-row {
  min-width: 0;
  grid-template-columns: minmax(140px, 2fr) minmax(52px, .55fr) minmax(70px, .75fr) minmax(55px, .55fr) minmax(78px, .85fr);
}
.activity-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.activity-table th,
.activity-table td {
  border-bottom: 1px solid var(--soft-line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
.activity-table th {
  background: #f8fafd;
  color: var(--muted);
  font-weight: 900;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.doc-card {
  min-height: 132px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: white;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 13px;
}
.doc-card a {
  color: var(--nav-2);
  font-weight: 850;
  text-decoration: none;
  word-break: break-word;
}
.doc-card a:hover { text-decoration: underline; }
.doc-path {
  color: var(--muted);
  font-family: Consolas, monospace;
  font-size: 12px;
  word-break: break-word;
}

.capture-shell {
  min-height: calc(100vh - 48px);
  max-width: none;
}
.capture-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.capture-head h1 { font-size: 28px; }
.capture-head p {
  color: #50617b;
  margin-top: 6px;
  line-height: 1.45;
}
.capture-actions-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.inbox-layout {
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
}
.inbox-main { min-width: 0; }
.universal-drop {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  padding: 16px;
}
.universal-drop.dragover { border-color: var(--accent); }
.command-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.tool-btn,
.clear-btn {
  min-height: 38px;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}
.tool-btn.active {
  border-color: #efb5c2;
  background: var(--accent-weak);
  color: #c93155;
}
.clear-btn { margin-left: auto; color: var(--muted); }
.drop-center {
  min-height: 205px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-bottom: 1px solid var(--soft-line);
}
.drop-icon {
  width: 64px;
  height: 64px;
  border: 10px solid #fff7f9;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff0f4;
  color: var(--accent);
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 12px;
}
.drop-center h2 { font-size: 19px; margin-bottom: 8px; }
.drop-center p { color: var(--muted); font-size: 13px; }
.shortcut-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}
.shortcut-row span {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcff;
  padding: 7px 12px;
  color: #394862;
  font-size: 12px;
  font-weight: 750;
}
.universal-drop textarea {
  min-height: 92px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #fbfcff;
  margin: 14px 0;
  padding: 13px 14px;
  font-size: 14px;
}
.attached-block {
  border-bottom: 1px solid var(--soft-line);
  padding-bottom: 12px;
}
.attached-head,
.preview-title,
.panel-title {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 10px;
}
.preview-title span {
  color: var(--green);
  background: var(--green-weak);
  border-radius: 999px;
  margin-left: 8px;
  padding: 3px 8px;
  font-size: 11px;
}
.capture-queue {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.queue-chip {
  min-height: 50px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fbfcff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  font-size: 12px;
  min-width: 0;
}
.queue-chip span { min-width: 0; overflow-wrap: anywhere; }
.draft-list {
  display: grid;
  gap: 12px;
}
.draft-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  padding: 14px;
}
.draft-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--soft-line);
  padding-bottom: 12px;
  margin-bottom: 12px;
}
.draft-kicker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.draft-head h3 {
  margin-top: 3px;
  font-size: 15px;
  overflow-wrap: anywhere;
}
.draft-head p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}
.draft-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.draft-grid-top {
  margin-bottom: 10px;
}
.draft-grid label {
  display: grid;
  gap: 6px;
  color: #44536a;
  font-size: 12px;
  font-weight: 850;
}
.draft-grid .wide {
  grid-column: 1 / -1;
}
.draft-grid input,
.draft-grid select,
.draft-grid textarea {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcff;
  color: var(--ink);
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 650;
}
.draft-grid textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.45;
}
.draft-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--soft-line);
  margin-top: 12px;
  padding-top: 12px;
}
.live-preview { padding-top: 14px; }
.preview-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.route-pill {
  position: relative;
  min-height: 58px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: white;
  display: grid;
  gap: 2px;
  padding: 10px 12px;
}
.route-pill.selected {
  border-color: #efb5c2;
  background: var(--accent-weak);
}
.route-pill strong { font-size: 12px; }
.route-pill small { color: var(--muted); font-size: 11px; }
.route-pill em {
  color: var(--green);
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
  justify-self: start;
}
.drop-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 14px;
}
.drop-footer button { min-width: 136px; min-height: 44px; }
.local-note { color: var(--muted); font-size: 12px; }
.lower-grid {
  grid-template-columns: minmax(0, 1fr) 264px;
  gap: 12px;
  margin-top: 14px;
}
.queue-panel,
.tips-panel,
.activity-panel,
.routing-panel { padding: 14px; }
.queue-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border-radius: 8px;
  background: #fbfcff;
  color: #59687e;
  padding: 10px;
  font-size: 12px;
}
.tips-panel ul {
  margin: 0;
  padding-left: 18px;
  color: #4f6079;
  font-size: 12px;
  line-height: 1.8;
}
.activity-panel { margin-top: 14px; }
.routing-panel {
  position: sticky;
  top: 20px;
}
.routing-title {
  font-weight: 900;
  margin-bottom: 8px;
}
.routing-panel p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 14px;
}
.intel-card {
  position: relative;
  border: 1px solid var(--soft-line);
  border-left-width: 3px;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 13px;
}
.intel-card.strong { border-left-color: #43b36c; }
.intel-card.orange { border-left-color: #ff8d36; }
.intel-card.blue { border-left-color: #4d8df7; }
.intel-card.purple { border-left-color: #9b5cf6; }
.intel-card.cyan { border-left-color: #27b5bf; }
.intel-card strong { display: block; font-size: 13px; }
.intel-card span,
.intel-card small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  margin-top: 4px;
}
.intel-card em {
  position: absolute;
  top: 12px;
  right: 12px;
  border-radius: 999px;
  background: var(--green-weak);
  color: var(--green);
  padding: 4px 8px;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.export-list {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 32px));
  border-radius: 8px;
  background: #151a29;
  color: white;
  padding: 12px 16px;
  opacity: 0;
  transform: translateY(80px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

.action-dialog {
  width: min(460px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 18px;
}
.action-dialog::backdrop { background: rgba(11,23,42,.35); }
.action-dialog h2 { margin-bottom: 6px; }
.dialog-actions { justify-content: flex-end; }

.mobile-nav-dialog {
  width: min(520px, calc(100vw - 24px));
  max-width: none;
  margin: auto auto 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  color: var(--ink);
  padding: 0;
}
.mobile-nav-dialog::backdrop { background: rgba(11,23,42,.48); }
.mobile-nav-sheet { padding: 18px; }
.mobile-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.mobile-nav-head h2 { margin: 2px 0 0; }
.mobile-nav-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.mobile-nav-grid button {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  background: var(--soft);
  color: var(--ink);
  border: 1px solid var(--line);
}
.mobile-nav-grid button span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--nav);
  color: white;
  font-size: 11px;
}

.credit-line { margin-top: 7px; }
.return-lines {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.return-row {
  display: grid;
  grid-template-columns: 1.4fr .7fr .7fr;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
.return-row:last-child { border-bottom: 0; }
.return-row input { width: 100%; }
.return-title { font-weight: 800; }

@media (max-width: 1280px) {
  .inbox-layout { grid-template-columns: 1fr; }
  .routing-panel { position: static; }
  .management-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .metric-grid,
  .signal-grid,
  .three-col,
  .two-col,
  .two-col.wide-left,
  .invoice-grid,
  .invoice-line-editor,
  .gst-summary-grid,
  .lower-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .three-col,
  .two-col,
  .two-col.wide-left,
  .invoice-grid,
  .invoice-line-editor,
  .gst-summary-grid,
  .lower-grid,
  .command-grid { grid-template-columns: 1fr; }
  .aging-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-grid,
  .capture-queue,
  .draft-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item { flex-wrap: wrap; }
  .item-actions { max-width: none; width: 100%; justify-content: flex-start; }
}

@media (max-width: 760px) {
  body { display: block; padding-bottom: 68px; }
  .sidebar {
    position: fixed;
    z-index: 15;
    top: auto;
    bottom: 0;
    width: 100%;
    min-width: 0;
    height: 64px;
    border-right: 0;
    border-top: 1px solid rgba(255,255,255,.12);
  }
  .brand { display: none; }
  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 10px;
    scrollbar-width: none;
  }
  .nav-group-label { display: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item {
    width: auto;
    flex: 0 0 auto;
    min-height: 40px;
    padding: 9px 11px;
  }
  .nav-item[data-view="purchases"],
  .nav-item[data-view="inventory"],
  .nav-item[data-view="reports"],
  .nav-item[data-view="documents"],
  .nav-item[data-view="work"],
  .nav-item[data-view="admin"] { display: none; }
  .mobile-more { display: flex; }
  .nav-ico { width: 22px; height: 22px; min-width: 22px; }
  .system-card,
  .sidebar-logout { display: none; }
  .main { padding: 18px 14px 36px; }
  h1 { font-size: 24px; }
  .topline,
  .capture-head,
  .drop-footer,
  .capture-row,
  .inline-form,
  .button-row {
    flex-direction: column;
    align-items: stretch;
  }
  .dashboard-actions,
  .setup-actions { justify-content: flex-start; }
  .setup-card { align-items: stretch; flex-direction: column; }
  .metric-grid,
  .signal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .aging-grid,
  .preview-grid,
  .capture-queue,
  .draft-grid {
    grid-template-columns: 1fr;
  }
  .metric { min-height: 92px; padding: 13px; }
  .metric strong { font-size: 21px; }
  .signal { min-height: 78px; align-items: flex-start; flex-direction: column; }
  .signal > div { text-align: left; }
  .draft-head,
  .draft-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .command-bar {
    align-items: stretch;
    flex-wrap: wrap;
  }
  .clear-btn { margin-left: 0; }
  .drop-center {
    min-height: 178px;
    padding: 10px;
  }
  .shortcut-row span { width: 100%; }
  .search { max-width: none; }
  .activity-head,
  .activity-row {
    min-width: 0;
    grid-template-columns: minmax(120px, 1.5fr) minmax(72px, .8fr) minmax(72px, .8fr) minmax(84px, .9fr) minmax(56px, .6fr);
  }
  .mini-table .activity-head,
  .mini-table .activity-row {
    grid-template-columns: minmax(120px, 1.4fr) minmax(44px, .55fr) minmax(56px, .7fr) minmax(44px, .55fr) minmax(58px, .7fr);
  }
}
