:root {
  --ink: #172033;
  --ink-soft: #5e6879;
  --ink-faint: #8992a1;
  --canvas: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --line: #dfe4ea;
  --line-strong: #cdd5df;
  --navy: #172a46;
  --navy-soft: #eaf1f9;
  --blue: #1e66ad;
  --blue-hover: #16538e;
  --green: #157b55;
  --green-soft: #e9f7f0;
  --amber: #9a6200;
  --amber-soft: #fff5dc;
  --red: #b33a45;
  --red-soft: #fcedef;
  --shadow: 0 6px 20px rgba(22, 33, 51, 0.07);
  --radius: 10px;
  --radius-small: 7px;
  font-family: "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

body.modal-open { overflow: hidden; }

button, input, select { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

button { cursor: pointer; }

button:disabled { cursor: not-allowed; opacity: 0.55; }

a { color: var(--blue); }

h1, h2, h3, h4, p { margin-top: 0; }

h1, h2, h3, h4 { color: var(--ink); letter-spacing: -0.018em; }

h1 { margin-bottom: 5px; font-size: 26px; }

h2 { margin-bottom: 7px; font-size: 25px; }

h3 { margin-bottom: 4px; font-size: 17px; }

h4 { margin-bottom: 3px; font-size: 15px; }

small { display: block; color: var(--ink-soft); font-size: 12px; }

code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

code {
  padding: 1px 4px;
  border-radius: 4px;
  background: #edf1f5;
  color: #26374e;
}

.hidden { display: none !important; }

.overline {
  margin-bottom: 5px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.095em;
  text-transform: uppercase;
}

.strong { font-weight: 650; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 35px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--ink);
  font-weight: 650;
  line-height: 1.15;
  text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease, color 150ms ease;
}

.button:hover:not(:disabled) { box-shadow: 0 2px 7px rgba(25, 44, 72, 0.12); }

.button:focus-visible, input:focus-visible, select:focus-visible, .nav-item:focus-visible, .subnav-item:focus-visible, .modal-tab:focus-visible {
  outline: 3px solid rgba(38, 115, 190, 0.24);
  outline-offset: 1px;
}

.button.primary { background: var(--blue); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--blue-hover); }
.button.secondary { border-color: var(--line-strong); background: var(--surface); }
.button.secondary:hover:not(:disabled) { border-color: #b4c2d2; background: #f7f9fc; }
.button.ghost { color: var(--ink-soft); }
.button.ghost:hover:not(:disabled) { background: #edf1f5; color: var(--ink); }
.button.danger { background: var(--red); color: #fff; }
.button.danger:hover:not(:disabled) { background: #982d36; }
.button.small { min-height: 29px; padding: 5px 9px; font-size: 12px; }
.button.wide { width: 100%; min-height: 42px; }

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px 18px;
  background: #edf1f5;
}

.login-card {
  width: min(100%, 450px);
  padding: 36px;
  border: 1px solid #d9e0e8;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(20, 34, 55, 0.09);
}

.login-brand { display: flex; align-items: center; gap: 14px; }

.login-brand .overline { margin-bottom: 2px; }

.login-copy { margin: 22px 0 26px; color: var(--ink-soft); font-size: 15px; }

.login-help { margin: 18px 0 0; color: var(--ink-faint); font-size: 12px; }

.brand-logo {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 9px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0.03em;
}

.brand-logo.large { width: 48px; height: 48px; border-radius: 11px; font-size: 18px; }

.brand-logo.preview { width: 72px; height: 72px; border-radius: 14px; font-size: 24px; }

.brand-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }

.form-stack { display: grid; gap: 16px; }

label { display: grid; gap: 6px; color: #334054; font-size: 12px; font-weight: 650; }

input, select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
}

input::placeholder { color: #9ca5b2; }

input:disabled { background: #f1f4f7; color: var(--ink-soft); }

input[type="checkbox"] {
  width: 15px;
  min-height: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--blue);
}

input[type="file"] { padding: 6px 8px; }

.form-error { min-height: 1.2em; margin: -5px 0 0; color: var(--red); font-size: 12px; }

.input-help, label small { margin: -1px 0 0; color: var(--ink-soft); font-size: 12px; font-weight: 400; }

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 242px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-direction: column;
  padding: 20px 13px 16px;
  background: var(--navy);
  color: #dbe6f4;
}

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 9px 24px; }

.sidebar-brand .brand-logo { background: #fff; color: var(--navy); }

.brand-copy { display: grid; min-width: 0; gap: 1px; }
.brand-copy strong { overflow: hidden; color: #fff; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.brand-copy span { color: #aab9ca; font-size: 11px; }

.main-nav { display: grid; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  padding: 10px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #b8c7d9;
  font-weight: 600;
  text-align: left;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.075); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, 0.13); color: #fff; }
.nav-icon { width: 16px; color: #8db9e4; font-size: 16px; text-align: center; }

.sidebar-note {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding: 14px 9px 0;
  border-top: 1px solid rgba(255,255,255,0.12);
  color: #c2cfdd;
}

.sidebar-note strong, .sidebar-note small { display: block; color: inherit; font-size: 11px; }
.sidebar-note small { margin-top: 2px; color: #94a8be; line-height: 1.35; }
.status-dot { width: 7px; height: 7px; flex: 0 0 auto; margin-top: 4px; border-radius: 50%; background: #57c991; }

.app-content { min-width: 0; }

.topbar {
  display: flex;
  position: sticky;
  z-index: 5;
  top: 0;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 18px;
  padding: 12px 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.topbar-title .overline { margin-bottom: 0; }
.topbar-title h2 { margin: 0; font-size: 18px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }

.account-summary { display: grid; min-width: 116px; gap: 0; padding-left: 4px; text-align: right; }
.account-summary span { overflow: hidden; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.account-summary small { color: var(--ink-soft); font-size: 11px; text-transform: capitalize; }

.view-container { max-width: 1580px; padding: 30px; outline: none; }

.page-loading { display: flex; align-items: center; justify-content: center; min-height: 360px; gap: 10px; color: var(--ink-soft); }
.spinner { width: 17px; height: 17px; border: 2px solid #bdc8d5; border-top-color: var(--blue); border-radius: 50%; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.page-header h2 { margin-bottom: 4px; }
.page-header p:not(.overline) { max-width: 720px; margin: 0; color: var(--ink-soft); }
.page-actions { display: flex; flex: 0 0 auto; gap: 8px; }

.subnav {
  display: flex;
  width: max-content;
  max-width: 100%;
  gap: 2px;
  margin-bottom: 20px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.subnav-item {
  padding: 9px 12px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.subnav-item:hover { color: var(--ink); background: #edf2f7; }
.subnav-item.active { border-bottom-color: var(--blue); color: var(--blue); }

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

.metric-card {
  display: grid;
  min-height: 109px;
  align-content: space-between;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(29, 43, 60, 0.025);
}

.metric-card span { color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.metric-card strong { color: var(--ink); font-size: 28px; letter-spacing: -0.04em; line-height: 1; }
.metric-card small { color: var(--ink-faint); }
.metric-card.positive { border-top: 3px solid var(--green); }
.metric-card.warning { border-top: 3px solid #d69924; }

.content-grid { display: grid; gap: 18px; margin-bottom: 18px; }
.workspace-grid { grid-template-columns: minmax(0, 1.5fr) minmax(285px, 0.75fr); }
.admin-grid { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.75fr); }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(29, 43, 60, 0.025);
}

.panel + .panel { margin-top: 18px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 18px 14px; }
.panel-heading h3 { margin-bottom: 2px; }
.panel-heading p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.panel-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 12px; }

.chart-panel { padding: 18px; }
.chart { margin: 0; }
.chart figcaption { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; color: var(--ink); font-size: 13px; font-weight: 700; }
.chart-key { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-soft); font-size: 11px; font-weight: 500; white-space: nowrap; }
.legend { width: 8px; height: 8px; margin-left: 5px; border-radius: 50%; background: #94a4b7; }
.legend.packages { background: var(--blue); }
.legend.approved { background: var(--green); }
.chart svg { display: block; width: 100%; height: 220px; overflow: visible; }
.chart-grid { stroke: #e7ebf0; stroke-width: 1; }
.chart-line { fill: none; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.chart-line.packages { stroke: var(--blue); }
.chart-line.approved { stroke: var(--green); }
.chart-axis { fill: #7d8796; font-size: 10px; }
.chart-axis.label { font-size: 9px; }
.chart-empty { display: grid; min-height: 180px; place-items: center; color: var(--ink-soft); text-align: center; }

.activity-panel { padding-bottom: 5px; }
.activity-list { display: grid; gap: 15px; margin: 0; padding: 0 18px 18px; list-style: none; }
.activity-list li { display: flex; gap: 10px; }
.activity-list strong { display: block; font-size: 13px; }
.activity-list p { margin: 2px 0 0; color: var(--ink-soft); font-size: 12px; }
.activity-dot { width: 8px; height: 8px; flex: 0 0 auto; margin-top: 5px; border-radius: 50%; background: #7aa8d5; }
.muted-item { color: var(--ink-soft); }

.bar-chart { display: grid; gap: 12px; padding: 5px 18px 19px; }
.bar-row { display: grid; grid-template-columns: minmax(70px, 0.8fr) minmax(85px, 2fr) 42px; align-items: center; gap: 9px; }
.bar-row > span { overflow: hidden; color: var(--ink-soft); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.bar-row strong { font-size: 12px; text-align: right; }
.bar-track { height: 8px; overflow: hidden; border-radius: 50px; background: #e8edf2; }
.bar-track i { display: block; height: 100%; border-radius: inherit; background: #4d83b8; }

.table-wrap { overflow: auto; border-top: 1px solid var(--line); }
table { width: 100%; min-width: 680px; border-collapse: collapse; }
th, td { padding: 11px 13px; border-bottom: 1px solid #edf0f3; text-align: left; vertical-align: middle; }
th { color: #647084; background: #f8fafc; font-size: 10px; font-weight: 750; letter-spacing: 0.045em; text-transform: uppercase; }
td { color: #303b4d; font-size: 13px; }
td strong { display: block; color: var(--ink); font-size: 13px; }
td small { margin-top: 2px; }
tbody tr:hover { background: #fbfcfd; }
tbody tr:last-child td { border-bottom: 0; }
.check-cell { width: 38px; text-align: center; }
.table-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 92px; }
.empty-table { padding: 24px; color: var(--ink-soft); text-align: center; }
.metadata-cell { max-width: 260px; color: var(--ink-soft); font-size: 12px; }

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 3px 7px;
  border-radius: 50px;
  background: #eef1f4;
  color: #596576;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.status-badge.verified, .status-badge.completed { background: var(--green-soft); color: var(--green); }
.status-badge.review, .status-badge.processing { background: var(--amber-soft); color: var(--amber); }
.status-badge.unresolved, .status-badge.failed, .status-badge.duplicate { background: var(--red-soft); color: var(--red); }
.approved-label { margin-top: 4px; color: var(--green); font-weight: 700; }

.inline-actions, .template-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }

.table-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 0 18px 14px;
  color: var(--ink-soft);
  font-size: 12px;
}

.search-field { width: min(100%, 330px); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; color: var(--ink-soft); font-size: 12px; }
.pager > div { display: flex; gap: 6px; }

.template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 14px; }
.template-card { display: grid; gap: 12px; min-height: 164px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.template-card h3 { margin: 0; }
.template-card p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.template-card > div { display: flex; align-items: end; gap: 6px; margin-top: auto; }

.empty-state { display: grid; min-height: 270px; place-content: center; padding: 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); text-align: center; }
.empty-state h3 { margin-bottom: 5px; }
.empty-state p { max-width: 400px; margin: 0 0 15px; color: var(--ink-soft); }
.error-state { border-color: #e9b9bf; }

.modal-backdrop { position: fixed; z-index: 29; inset: 0; background: rgba(16, 26, 42, 0.48); }

.modal-panel {
  position: fixed;
  z-index: 30;
  top: 50%;
  left: 50%;
  width: min(calc(100vw - 32px), 650px);
  max-height: min(88vh, 860px);
  overflow: auto;
  transform: translate(-50%, -50%);
  border: 1px solid #cfd7e1;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(13, 25, 43, 0.25);
}

.modal-panel.wide { width: min(calc(100vw - 32px), 900px); }
.modal-panel.full { width: min(calc(100vw - 32px), 1480px); }
.modal-panel.small { width: min(calc(100vw - 32px), 470px); }
.modal-header { display: flex; position: sticky; z-index: 2; top: 0; align-items: center; justify-content: space-between; min-height: 59px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,0.97); backdrop-filter: blur(8px); }
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 18px; }
.icon-button { display: grid; width: 29px; height: 29px; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--ink-soft); font-size: 24px; line-height: 1; }
.icon-button:hover { background: #edf1f5; color: var(--ink); }
.modal-message { margin: 0 0 16px; color: var(--ink-soft); }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.modal-tabs { display: flex; gap: 4px; margin: -18px -18px 18px; padding: 10px 18px 0; overflow-x: auto; border-bottom: 1px solid var(--line); background: #fbfcfd; }
.modal-tab { padding: 8px 10px 10px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ink-soft); font-size: 12px; font-weight: 700; white-space: nowrap; }
.modal-tab:hover { color: var(--ink); }
.modal-tab.active { border-bottom-color: var(--blue); color: var(--blue); }

.upload-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.upload-intro h4 { margin: 0 0 2px; }
.upload-intro p { max-width: 610px; margin: 0; color: var(--ink-soft); }
.inspection-note { padding: 11px 12px; border: 1px solid #cad9e8; border-radius: var(--radius-small); background: #f1f6fb; color: #35516e; }
.inspection-note strong { display: block; font-size: 12px; }
.inspection-note p { margin: 2px 0 0; color: inherit; font-size: 12px; }
.form-grid { display: grid; gap: 13px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.batch-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: #fbfcfd;
}
.batch-summary > div { display: grid; gap: 3px; padding: 11px 13px; border-right: 1px solid var(--line); }
.batch-summary > div:last-child { border-right: 0; }
.batch-summary span { color: var(--ink-soft); font-size: 11px; font-weight: 650; text-transform: uppercase; }
.batch-summary strong { color: var(--ink); font-size: 13px; }
.batch-toolbar { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 15px; }
.review-section { min-height: 260px; }
.review-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.review-heading h4 { margin-bottom: 1px; }
.review-heading p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.review-table { border: 1px solid var(--line); border-radius: var(--radius-small); }
.review-table table { min-width: 1080px; }
.mailbox-review { display: grid; min-width: 200px; gap: 4px; }
.mailbox-review span { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 5px; align-items: center; }
.mailbox-review small { color: var(--ink-faint); font-size: 10px; }
.mailbox-review code { overflow: hidden; padding: 0; background: transparent; color: #314257; text-overflow: ellipsis; white-space: nowrap; }
.inline-details { margin-top: 5px; color: var(--amber); font-size: 11px; }
.inline-details summary { cursor: pointer; }
.inline-details ul { margin: 5px 0 0; padding-left: 15px; color: var(--ink-soft); }

.resolution-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 15px; }
.resolution-summary > div { display: grid; gap: 2px; padding: 10px 11px; border: 1px solid var(--line); border-radius: var(--radius-small); background: #fbfcfd; }
.resolution-summary span { color: var(--ink-soft); font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.resolution-summary strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.comparison-alert { margin-bottom: 15px; padding: 12px 13px; border: 1px solid #e8ce8e; border-radius: var(--radius-small); background: var(--amber-soft); color: #754d06; }
.comparison-alert strong { display: block; font-size: 13px; }
.comparison-alert p { margin: 3px 0 0; font-size: 12px; }
.comparison-alert code { background: rgba(255,255,255,0.55); }

.export-count { margin-bottom: 12px; color: var(--ink-soft); }
.export-count strong { color: var(--ink); font-size: 20px; }
.check-list { display: grid; gap: 7px; margin-top: 8px; }
.check-option { display: flex; grid-template-columns: none; align-items: flex-start; gap: 9px; padding: 10px 11px; border: 1px solid var(--line); border-radius: var(--radius-small); background: #fff; color: var(--ink); }
.check-option.all { margin-bottom: 8px; background: #f7fafc; }
.check-option span { display: grid; gap: 1px; }
.check-option strong { font-size: 13px; }
.check-option small { font-weight: 400; }

.filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 0 18px 16px; }
.filter-row label { min-width: 190px; flex: 1 1 200px; }
.filter-row .button { margin-bottom: 0; }

.branding-summary { overflow: hidden; }
.brand-preview { display: flex; align-items: center; gap: 16px; padding: 24px 18px; }
.brand-preview h3 { margin-bottom: 4px; }
.brand-preview p:not(.overline) { margin: 0; color: var(--ink-soft); }
.brand-inline-preview { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-small); background: #fafbfd; color: var(--ink-soft); font-size: 12px; }
.brand-inline-preview img { width: 42px; height: 42px; object-fit: contain; border-radius: 7px; background: #fff; }

.checkbox-field { display: flex; align-items: center; grid-template-columns: none; gap: 8px; min-height: 38px; padding-top: 23px; font-size: 13px; }

.toast {
  position: fixed;
  z-index: 50;
  right: 22px;
  bottom: 22px;
  width: min(390px, calc(100vw - 36px));
  padding: 12px 14px;
  transform: translateY(14px);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #23334a;
  box-shadow: 0 12px 26px rgba(12, 24, 42, 0.22);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.good { background: #176b4d; }
.toast.warn { background: #8a5d0b; }
.toast.error { background: #9d323d; }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 208px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .view-container { padding: 24px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-grid, .admin-grid { grid-template-columns: 1fr; }
  .topbar { padding-inline: 24px; }
}

@media (max-width: 780px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; padding: 10px 12px; }
  .sidebar-brand { padding: 0 4px 10px; }
  .main-nav { display: flex; overflow-x: auto; gap: 4px; }
  .nav-item { width: auto; flex: 0 0 auto; padding: 8px 10px; font-size: 12px; }
  .sidebar-note { display: none; }
  .topbar { position: static; flex-wrap: wrap; min-height: auto; padding: 13px 16px; }
  .topbar-actions { width: 100%; justify-content: flex-end; }
  .account-summary { margin-right: auto; order: -1; text-align: left; }
  .view-container { padding: 18px 14px; }
  .page-header { align-items: flex-start; flex-direction: column; gap: 12px; }
  .page-actions { width: 100%; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-card { min-height: 95px; padding: 13px; }
  .metric-card strong { font-size: 24px; }
  .panel-heading, .table-controls, .panel-footer { align-items: flex-start; flex-direction: column; }
  .table-controls { gap: 8px; }
  .search-field { width: 100%; }
  .upload-intro { align-items: stretch; flex-direction: column; }
  .form-grid.two, .form-grid.three, .resolution-summary { grid-template-columns: 1fr; }
  .batch-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .batch-summary > div:nth-child(2) { border-right: 0; }
  .batch-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .modal-panel, .modal-panel.wide, .modal-panel.full { width: calc(100vw - 18px); max-height: 92vh; }
  .modal-body { padding: 14px; }
  .modal-tabs { margin: -14px -14px 14px; padding-inline: 14px; }
  .modal-actions { justify-content: stretch; }
  .modal-actions .button { flex: 1 1 auto; }
}

@media (max-width: 480px) {
  .login-card { padding: 27px 22px; }
  .topbar-actions { gap: 6px; }
  #quick-import { flex: 1 1 auto; }
  #logout-button { padding-inline: 8px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .chart figcaption { align-items: flex-start; flex-direction: column; }
  .pager { align-items: flex-start; flex-direction: column; }
  .batch-summary { grid-template-columns: 1fr; }
  .batch-summary > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .batch-summary > div:last-child { border-bottom: 0; }
}
