:root {
  color-scheme: light;
  --ink: #191919;
  --muted: #666666;
  --soft: #f1f1f1;
  --line: #d8d8d8;
  --white: #ffffff;
  --navy: #191919;
  --navy-2: #333333;
  --teal: #087f78;
  --teal-dark: #05655f;
  --blue: #2563eb;
  --green: #16845b;
  --amber: #c47a11;
  --orange: #e05b21;
  --red: #c53642;
  --violet: #7356c8;
  --brand-yellow: #ffcc00;
  --brand-yellow-soft: #fff3bf;
  --brand-red: #d40511;
  --brand-red-hover: #b80613;
  --brand-ink: #191919;
  --brand-grey: #666666;
  --shadow: 0 10px 26px rgba(25, 25, 25, 0.08);
  --radius: 8px;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--soft); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--soft);
  font-family: Arial, Verdana, ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 18px 20px;
  color: var(--brand-ink);
  background: var(--brand-yellow);
  border-right: 1px solid #e0b400;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 28px; }
.brand-mark {
  position: relative;
  width: auto;
  height: 34px;
  display: flex;
  align-items: center;
  padding-left: 0;
  color: var(--brand-red);
  font-family: Arial, sans-serif;
  font-size: 21px;
  font-style: italic;
  font-weight: 900;
  letter-spacing: -.08em;
}
.brand strong, .brand small { display: block; }
.brand strong { color: var(--brand-ink); font-size: 14px; line-height: 1.2; letter-spacing: -.02em; }
.brand small { margin-top: 3px; color: #4f450d; font-size: 10px; }

.nav-list { display: grid; gap: 6px; }
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  color: var(--brand-ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  text-align: left;
  transition: .18s ease;
}
.nav-item span { width: 18px; color: #5c5010; font-size: 18px; text-align: center; }
.nav-item:hover { color: var(--brand-ink); background: rgba(255, 255, 255, .42); }
.nav-item.active {
  color: #fff;
  background: var(--brand-red);
  border-color: var(--brand-red);
  box-shadow: inset 3px 0 rgba(0, 0, 0, .16);
}
.nav-item.active span { color: #fff; }
.nav-item:focus-visible { outline-color: var(--brand-ink); }
.sidebar-spacer { flex: 1; }

.clock-card {
  display: flex;
  gap: 10px;
  padding: 14px;
  background: rgba(255, 255, 255, .58);
  border: 1px solid rgba(25, 25, 25, .16);
  border-radius: 4px;
}
.status-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: #3bd1a1; box-shadow: 0 0 0 4px rgba(59, 209, 161, .12); }
.clock-card small, .clock-card strong, .clock-card span { display: block; }
.clock-card small { color: #5f551d; font-size: 11px; }
.clock-card strong { margin-top: 2px; color: var(--brand-ink); font-size: 16px; font-variant-numeric: tabular-nums; }
.clock-card span { margin-top: 3px; color: #5f551d; font-size: 11px; }
.sidebar-footnote { margin: 10px 4px 0; color: #5f551d; font-size: 10px; text-align: center; }

.main-content { min-width: 0; padding: 19px 30px 56px; border-top: 7px solid var(--brand-yellow); }
.topbar { min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-bottom: 14px; border-bottom: 1px solid #d1d1d1; }
.topbar h1 { margin: 2px 0 0; font-size: clamp(24px, 2.6vw, 34px); line-height: 1.08; letter-spacing: -.035em; }
.topbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

.eyebrow { margin: 0; color: var(--brand-red); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
h2, h3, p { margin-top: 0; }
h2 { margin-bottom: 4px; font-size: 20px; letter-spacing: -.02em; }
h3 { margin-bottom: 4px; font-size: 16px; }

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-weight: 700;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .nav-item:focus-visible, .icon-button:focus-visible {
  outline: 3px solid #0050aa;
  outline-offset: 2px;
}
.button.primary { color: #fff; background: var(--brand-red); box-shadow: 0 8px 18px rgba(212, 5, 17, .18); }
.button.primary:hover { background: var(--brand-red-hover); }
.button.secondary { color: var(--brand-red); background: #fff; border-color: var(--brand-red); }
.button.secondary:hover { color: #fff; background: var(--brand-red); border-color: var(--brand-red); box-shadow: 0 6px 16px rgba(212, 5, 17, .12); }
.button.danger { color: var(--red); background: #fff; border-color: #f1c9ce; }
.button.danger:hover { color: #fff; background: var(--red); border-color: var(--red); box-shadow: 0 8px 18px rgba(197, 54, 66, .17); }
.button.small { min-height: 34px; padding: 0 11px; font-size: 12px; }
.button:disabled { cursor: not-allowed; opacity: .48; transform: none; box-shadow: none; }
.button[hidden] { display: none; }

.view { padding-top: 22px; animation: fadeIn .22s ease; }
.view[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(118px, 1fr)); gap: 13px; margin-bottom: 16px; }
.metric-card {
  position: relative;
  min-height: 128px;
  overflow: hidden;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: 0 8px 22px rgba(24, 43, 74, .045);
}
.metric-card::after { content: ""; position: absolute; inset: auto -15px -36px auto; width: 88px; height: 88px; border-radius: 50%; background: currentColor; opacity: .055; }
.metric-card span, .metric-card strong, .metric-card small { display: block; }
.metric-card span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-card strong { margin-top: 8px; color: var(--ink); font-size: 30px; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.metric-card small { margin-top: 9px; color: #8892a2; font-size: 11px; }
.tone-blue { color: var(--blue); border-top: 3px solid var(--blue); }
.tone-red { color: var(--red); border-top: 3px solid var(--red); }
.tone-amber { color: var(--amber); border-top: 3px solid var(--amber); }
.tone-green { color: var(--green); border-top: 3px solid var(--green); }
.tone-violet { color: var(--violet); border-top: 3px solid var(--violet); }
.tone-teal { color: var(--teal); border-top: 3px solid var(--teal); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 285px; gap: 16px; align-items: start; }
.panel, .form-card {
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel { overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px 15px; }
.panel-header h2 { margin-bottom: 0; }
.filters { display: flex; gap: 8px; }
.filters input { width: 210px; }
.filters select { width: 155px; }

input, select, textarea {
  width: 100%;
  color: var(--ink);
  background: #fff;
  border: 1px solid #d9dfe8;
  border-radius: 9px;
  transition: border .15s ease, box-shadow .15s ease;
}
input, select { height: 40px; padding: 0 11px; }
textarea { min-height: 86px; padding: 10px 11px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #bdc6d3; }
input:focus, select:focus, textarea:focus { border-color: #76a8dc; box-shadow: 0 0 0 3px rgba(71, 131, 196, .11); outline: none; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 14px; color: #7b8493; background: #f8f9fb; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 10px; letter-spacing: .07em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 14px; border-bottom: 1px solid #edf0f4; vertical-align: middle; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #fbfcfe; }
.quote-code { display: block; color: var(--ink); font-size: 12px; font-weight: 800; }
.quote-meta { display: block; margin-top: 2px; color: #8a94a2; font-size: 10px; }
.customer-cell strong { display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.customer-cell span { display: block; max-width: 220px; margin-top: 3px; overflow: hidden; color: #7c8797; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; min-height: 25px; padding: 0 8px; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.chip.neutral { color: #526070; background: #eef1f5; }
.chip.air { color: #245db8; background: #eaf1ff; }
.chip.ocean { color: #08766f; background: #e4f7f5; }
.chip.road, .chip.ground { color: #855c0b; background: #fff2d8; }
.chip.urgent { color: #9d2b38; background: #feecef; }
.chip.approved { color: #0b6d4a; background: #e5f6ef; }
.chip.pending { color: #855c0b; background: #fff2d8; }
.chip.information { color: #9d2b38; background: #feecef; }
.chip.hold { color: #725511; background: #fff5d6; }
.chip.declined { color: #616c7b; background: #edf0f4; }
.chip.demo { color: #5f43ad; background: #eee9fb; }
.chip.converted { color: #245db8; background: #eaf1ff; }
.timer-cell { min-width: 112px; }
.timer { display: flex; align-items: center; gap: 7px; font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 800; }
.timer-dot { width: 8px; height: 8px; border-radius: 50%; }
.age-green .timer-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(22, 132, 91, .1); }
.age-amber .timer-dot { background: var(--amber); box-shadow: 0 0 0 4px rgba(196, 122, 17, .1); }
.age-orange .timer-dot { background: var(--orange); box-shadow: 0 0 0 4px rgba(224, 91, 33, .1); }
.age-red .timer-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(197, 54, 66, .11); }
.timer-note { display: block; margin: 3px 0 0 15px; color: #8b95a3; font-size: 9px; }
.sla-state { font-size: 11px; font-weight: 800; }
.sla-state.overdue { color: var(--red); }
.sla-state.due-soon { color: var(--amber); }
.sla-state.on-track { color: var(--green); }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.icon-button { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; color: #5d6878; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.icon-button:hover { color: var(--ink); background: #f7f9fb; }

.empty-state { padding: 54px 20px 58px; text-align: center; }
.empty-state[hidden] { display: none; }
.empty-state > span { width: 50px; height: 50px; display: grid; place-items: center; margin: 0 auto 14px; color: var(--teal); background: #e7f5f3; border-radius: 16px; font-size: 24px; }
.empty-state h3 { margin-bottom: 5px; }
.empty-state p { max-width: 360px; margin: 0 auto 18px; color: var(--muted); font-size: 12px; }

.insights-column { display: grid; gap: 16px; }
.compact-panel .panel-header { padding-bottom: 12px; }
.performance-list { margin: 0; padding: 0 22px 18px; }
.performance-list div { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-top: 1px solid #edf0f4; }
.performance-list dt { color: var(--muted); font-size: 12px; }
.performance-list dd { margin: 0; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.age-bars { display: grid; gap: 12px; padding: 0 22px 22px; }
.age-bar-row { display: grid; grid-template-columns: 65px 1fr 22px; gap: 8px; align-items: center; color: var(--muted); font-size: 10px; }
.bar-track { height: 7px; overflow: hidden; background: #edf0f4; border-radius: 999px; }
.bar-fill { height: 100%; min-width: 2px; border-radius: inherit; }
.bar-green { background: var(--green); }.bar-amber { background: var(--amber); }.bar-orange { background: var(--orange); }.bar-red { background: var(--red); }
.age-bar-row b { color: var(--ink); text-align: right; }

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 4px 0 18px; }
.section-heading h2 { margin: 3px 0 5px; font-size: 25px; letter-spacing: -.03em; }
.section-heading > div > p:last-child { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 11px; padding-bottom: 3px; color: var(--muted); font-size: 10px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; }.dot.green{background:var(--green)}.dot.amber{background:var(--amber)}.dot.orange{background:var(--orange)}.dot.red{background:var(--red)}

.form-card { padding: 25px; }
.form-card.narrow { max-width: 920px; }
.edit-mode-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -3px 0 22px;
  padding: 13px 15px;
  color: #24534f;
  background: #eaf7f5;
  border: 1px solid #bde4df;
  border-radius: 11px;
}
.edit-mode-banner[hidden] { display: none; }
.edit-mode-banner > span { width: 29px; height: 29px; display: grid; place-items: center; flex: 0 0 auto; color: #fff; background: var(--teal); border-radius: 9px; font-size: 15px; }
.edit-mode-banner strong, .edit-mode-banner small { display: block; }
.edit-mode-banner strong { font-size: 12px; }
.edit-mode-banner small { margin-top: 2px; color: #52736f; font-size: 10px; }
.import-mode-banner { color: #254e78; background: #edf6ff; border-color: #c8dff4; }
.import-mode-banner > span { background: var(--blue); }
.import-mode-banner small { color: #58728c; }
input.import-missing, select.import-missing, textarea.import-missing { border-color: #d69b46; box-shadow: 0 0 0 3px rgba(196, 122, 17, .11); background: #fffaf2; }
.form-section-title { display: flex; gap: 12px; align-items: center; margin: 6px 0 16px; }
.form-section-title:not(:first-child) { margin-top: 30px; padding-top: 25px; border-top: 1px solid var(--line); }
.form-section-title > span { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 auto; color: var(--teal); background: #e8f6f4; border-radius: 10px; font-size: 11px; font-weight: 900; }
.form-section-title h3 { margin: 0; }
.form-section-title p { margin: 1px 0 0; color: var(--muted); font-size: 11px; }
.form-grid { display: grid; gap: 15px; margin-bottom: 15px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
label { display: block; color: #3f4a5b; font-size: 11px; font-weight: 700; }
label > input, label > select, label > textarea { margin-top: 6px; font-weight: 400; }
label b { color: var(--red); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 21px; padding-top: 18px; border-top: 1px solid var(--line); }
.action-note { margin: 10px 0 0; color: #778293; font-size: 10px; text-align: right; }
.form-alert { margin-top: 16px; padding: 12px 14px; color: #8c2f3b; background: #fff0f2; border: 1px solid #f1c8ce; border-radius: 10px; font-size: 12px; }
.form-alert.success { color: #0b6d4a; background: #eaf8f2; border-color: #bfe8d7; }

.intake-notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 13px 15px;
  color: #31506f;
  background: #eef6ff;
  border: 1px solid #cfe3f7;
  border-radius: 12px;
}
.intake-notice > span { width: 23px; height: 23px; display: grid; place-items: center; flex: 0 0 auto; color: #fff; background: var(--blue); border-radius: 50%; font-family: Georgia, serif; font-weight: 800; }
.intake-notice strong { font-size: 12px; }
.intake-notice p { margin: 2px 0 0; color: #58718a; font-size: 11px; }
.email-intake-layout { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr); gap: 16px; align-items: start; }
.email-intake-form textarea { min-height: 420px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; line-height: 1.55; }
.recognized-labels { display: grid; gap: 3px; margin-top: 13px; padding: 11px 13px; color: #5e6a79; background: #f7f9fb; border: 1px solid #e9edf2; border-radius: 10px; font-size: 10px; }
.recognized-labels strong { color: #344054; font-size: 11px; }
.intake-actions { flex-wrap: wrap; }
.extraction-panel[hidden] { display: none; }
.extraction-panel { position: sticky; top: 24px; }
.extraction-score { display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; color: #245db8; background: #eaf1ff; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.extraction-content { padding: 0 22px 18px; }
.extraction-summary { margin-bottom: 13px; padding: 11px 13px; color: #3d536b; background: #f4f8fc; border-radius: 10px; font-size: 11px; }
.extraction-summary strong { color: var(--ink); }
.extraction-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.extracted-field { min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; }
.extracted-field.wide { grid-column: 1 / -1; }
.extracted-field small, .extracted-field strong, .extracted-field span { display: block; }
.extracted-field small { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.extracted-field strong { margin-top: 4px; overflow-wrap: anywhere; font-size: 11px; white-space: pre-line; }
.extracted-field span { margin-top: 5px; font-size: 9px; font-weight: 800; }
.extracted-field.found { background: #f3fbf7; border-color: #cdebdc; }
.extracted-field.found span { color: var(--green); }
.extracted-field.missing { background: #fff8f0; border-color: #f0d8b8; }
.extracted-field.missing strong { color: #8a5b19; }
.extracted-field.missing span { color: var(--amber); }
.extraction-warnings { margin-top: 12px; padding: 11px 13px; color: #79551b; background: #fff8e9; border: 1px solid #edd8ad; border-radius: 10px; font-size: 10px; }
.extraction-warnings[hidden] { display: none; }
.extraction-warnings strong { display: block; margin-bottom: 4px; }
.extraction-warnings ul { margin: 0; padding-left: 17px; }
.extraction-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 22px 20px; border-top: 1px solid var(--line); }
.extraction-actions p { max-width: 270px; margin: 0; color: var(--muted); font-size: 10px; }

.demo-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 15px;
  color: #5a448e;
  background: #f4f0ff;
  border: 1px solid #ded3fb;
  border-radius: 12px;
  font-size: 11px;
}
.demo-notice strong { flex: 0 0 auto; font-size: 12px; }
.credit-metric-grid { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 13px; margin-bottom: 16px; }
.credit-metric-grid .metric-card { min-height: 112px; }
.credit-form { margin-bottom: 16px; }
.credit-queue-panel table { min-width: 1060px; }
.credit-account-line { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.credit-value { font-size: 11px; font-weight: 800; white-space: nowrap; }
.credit-value small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 500; }
.credit-followup { font-size: 11px; font-weight: 800; white-space: nowrap; }
.credit-followup.due { color: var(--red); }
.credit-followup.promise { color: var(--amber); }
.credit-row-actions { display: flex; justify-content: flex-end; gap: 6px; min-width: 280px; }
.credit-row-actions .button { white-space: nowrap; }

.email-preview { display: grid; gap: 13px; padding: 20px 24px; }
.email-preview-field { padding: 11px 12px; background: #f7f9fb; border-radius: 10px; }
.email-preview-field small, .email-preview-field strong { display: block; }
.email-preview-field small { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.email-preview-field strong { margin-top: 4px; font-size: 12px; overflow-wrap: anywhere; }
.email-preview pre {
  margin: 7px 0 0;
  overflow: auto;
  color: #344054;
  font: 11px/1.55 Inter, ui-sans-serif, system-ui, sans-serif;
  white-space: pre-wrap;
}
#emailDraftOpenBtn { text-decoration: none; }

.split-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr); gap: 16px; align-items: start; }
.lost-report { min-height: 300px; }
.stack-list { display: grid; gap: 0; }
.stack-item { padding: 15px 20px; border-top: 1px solid var(--line); }
.stack-item-head { display: flex; justify-content: space-between; gap: 12px; }
.stack-item strong { font-size: 12px; }
.stack-item small { color: var(--muted); font-size: 10px; }
.stack-item p { margin: 8px 0 0; color: #5f6a79; font-size: 11px; }
.stack-empty { padding: 38px 20px; color: var(--muted); font-size: 12px; text-align: center; border-top: 1px solid var(--line); }

.admin-section-heading { align-items: center; }
.admin-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 31px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.admin-status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.admin-status-badge.locked { color: #75551a; background: #fff4d9; border: 1px solid #ead39b; }
.admin-status-badge.locked::before { background: var(--amber); box-shadow: 0 0 0 4px rgba(196, 122, 17, .1); }
.admin-status-badge.unlocked { color: #0b6d4a; background: #e8f7f0; border: 1px solid #bfe7d5; }
.admin-status-badge.unlocked::before { background: var(--green); box-shadow: 0 0 0 4px rgba(22, 132, 91, .1); }

.admin-security-notice {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 14px 16px;
  color: #684c1d;
  background: #fff8e9;
  border: 1px solid #ead5a9;
  border-radius: 13px;
}
.admin-security-notice > span {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: var(--amber);
  border-radius: 50%;
  font: 800 13px/1 Georgia, serif;
}
.admin-security-notice strong { font-size: 12px; }
.admin-security-notice p { max-width: 900px; margin: 2px 0 0; color: #7a623a; font-size: 11px; }

.admin-auth-shell { max-width: 640px; }
.admin-auth-panel[hidden], .admin-workspace[hidden] { display: none; }
.admin-auth-panel { padding: 26px; }
.admin-auth-panel form { display: grid; gap: 14px; margin-top: 22px; }
.admin-auth-panel .form-actions { margin-top: 3px; }
.admin-auth-heading { display: flex; gap: 13px; align-items: flex-start; }
.admin-auth-heading h3 { margin: 2px 0 4px; font-size: 19px; }
.admin-auth-heading p:last-child { margin: 0; color: var(--muted); font-size: 11px; }
.admin-auth-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--teal);
  background: #e8f6f4;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 800;
}
.admin-workspace { display: grid; gap: 16px; }
.admin-session-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 15px;
  background: #edf8f4;
  border: 1px solid #c9e8dc;
  border-radius: 13px;
}
.admin-session-bar > div:first-child { display: flex; align-items: center; gap: 10px; }
.admin-session-bar strong, .admin-session-bar small { display: block; }
.admin-session-bar strong { color: #145d46; font-size: 12px; }
.admin-session-bar small { margin-top: 1px; color: #5c796d; font-size: 10px; }
.admin-session-dot { width: 9px; height: 9px; flex: 0 0 auto; background: var(--green); border-radius: 50%; box-shadow: 0 0 0 5px rgba(22, 132, 91, .1); }
.admin-session-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.admin-history-form { padding: 25px; }
.admin-form-intro { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.admin-form-intro h2 { margin: 2px 0 4px; font-size: 22px; }
.admin-form-intro p:last-child { max-width: 690px; margin: 0; color: var(--muted); font-size: 11px; }
.admin-form-intro .button { flex: 0 0 auto; }
.admin-time-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: -2px 0 15px;
  padding: 11px 13px;
  color: #31506f;
  background: #eef6ff;
  border: 1px solid #cfe3f7;
  border-radius: 10px;
}
.admin-time-note > span { color: var(--blue); font-size: 17px; line-height: 1.1; }
.admin-time-note p { margin: 0; font-size: 10px; }
.admin-time-note strong { font-size: 11px; }
.admin-record-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.admin-record-panel { min-height: 250px; }
.admin-panel-note { margin: -5px 22px 13px; color: var(--muted); font-size: 10px; }
.admin-record-panel .stack-list { max-height: 410px; overflow-y: auto; border-top: 1px solid var(--line); }
.admin-record-panel .stack-empty { border-top: 0; }
.admin-record-item, .admin-audit-item { display: flex; justify-content: space-between; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line); }
.admin-record-item:first-child, .admin-audit-item:first-child { border-top: 0; }
.admin-record-item > div, .admin-audit-item > div { min-width: 0; }
.admin-record-item strong, .admin-record-item small, .admin-audit-item strong, .admin-audit-item small { display: block; }
.admin-record-item strong, .admin-audit-item strong { overflow-wrap: anywhere; font-size: 11px; }
.admin-record-item small, .admin-audit-item small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.admin-record-item p, .admin-audit-item p { margin: 6px 0 0; color: #566273; font-size: 10px; }
.admin-record-item .button, .admin-record-item > .chip { flex: 0 0 auto; align-self: center; }
.admin-audit-item { display: grid; grid-template-columns: minmax(145px, .8fr) minmax(160px, 1fr) auto; align-items: start; }
.admin-audit-item p { margin: 0; }
.admin-audit-item time { color: #8993a1; font-size: 9px; white-space: nowrap; }

.settings-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 34px; }
.settings-grid article + article { padding-left: 34px; border-left: 1px solid var(--line); }
.settings-grid article > p { color: var(--muted); font-size: 12px; }
.department-settings { display: grid; gap: 12px; }
.department-row { display: grid; grid-template-columns: 76px minmax(160px, 1fr) 92px 92px; gap: 10px; align-items: end; padding: 12px; background: #f8fafc; border: 1px solid #edf0f4; border-radius: 11px; }
.department-row > strong { align-self: center; font-size: 12px; }

dialog { width: min(650px, calc(100vw - 32px)); max-height: calc(100vh - 50px); padding: 0; color: var(--ink); background: #fff; border: 0; border-radius: 18px; box-shadow: 0 30px 80px rgba(17, 31, 55, .28); }
dialog::backdrop { background: rgba(12, 26, 47, .52); backdrop-filter: blur(3px); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 23px 24px 17px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 2px 0 0; }
#dialogBody { padding: 20px 24px; overflow: auto; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.detail-item { padding: 11px 12px; background: #f7f9fb; border-radius: 10px; }
.detail-item.wide { grid-column: 1 / -1; }
.detail-item small, .detail-item strong { display: block; }
.detail-item small { color: var(--muted); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.detail-item strong { margin-top: 4px; font-size: 12px; white-space: pre-line; }
.activity-log { grid-column: 1 / -1; margin-top: 3px; padding-top: 13px; border-top: 1px solid var(--line); }
.activity-log > small { display: block; margin-bottom: 8px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.activity-entry { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-top: 1px dashed #e8ebef; font-size: 10px; }
.activity-entry:first-of-type { border-top: 0; }
.activity-entry span { color: #455264; }
.activity-entry time { flex: 0 0 auto; color: #8993a1; }
.dialog-lock-notice { margin: 0 24px 4px; padding: 11px 13px; color: #75551a; background: #fff7e5; border: 1px solid #efd9a5; border-radius: 10px; font-size: 11px; }
.dialog-lock-notice[hidden] { display: none; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 24px 22px; border-top: 1px solid var(--line); }

#deleteQuoteDialog { width: min(560px, calc(100vw - 32px)); }
.delete-dialog-head { align-items: center; }
.delete-dialog-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: var(--red);
  border-radius: 50%;
  font: 800 16px/1 Georgia, serif;
}
.delete-dialog-body { display: grid; gap: 15px; padding: 20px 24px 22px; overflow: auto; }
.delete-quote-summary { padding: 12px 13px; color: #344054; background: #f5f7fa; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; font-weight: 800; overflow-wrap: anywhere; }
.delete-dialog-warning { margin: 0; padding: 11px 13px; color: #7e3038; background: #fff1f2; border: 1px solid #f0c9ce; border-radius: 10px; font-size: 10px; }
.delete-dialog-warning strong { display: block; margin-bottom: 2px; font-size: 11px; }
.typed-confirm-label { padding: 12px 13px; color: #7e3038; background: #fff7f7; border: 1px dashed #e5b9bf; border-radius: 10px; }
.typed-confirm-label input { background: #fff; }
.delete-confirm-button { color: #fff !important; background: var(--red) !important; border-color: var(--red) !important; }
.delete-confirm-button:hover { background: #a72b36 !important; border-color: #a72b36 !important; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 10; max-width: 360px; padding: 13px 16px; color: #fff; background: #173453; border-radius: 11px; box-shadow: 0 15px 40px rgba(15, 36, 64, .24); opacity: 0; pointer-events: none; transform: translateY(10px); transition: .2s ease; font-size: 12px; }
.toast.show { opacity: 1; transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .credit-metric-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .email-intake-layout { grid-template-columns: 1fr; }
  .extraction-panel { position: static; }
  .insights-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; z-index: 3; height: auto; padding: 14px; }
  .brand { padding: 0 4px 12px; }
  .nav-list { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 2px; }
  .nav-item { width: auto; flex: 0 0 auto; padding: 9px 11px; font-size: 12px; }
  .nav-item span { display: none; }
  .sidebar-spacer, .clock-card, .sidebar-footnote { display: none; }
  .main-content { padding: 20px 18px 45px; }
  .split-layout, .settings-grid, .admin-record-grid { grid-template-columns: 1fr; }
  .settings-grid article + article { padding: 20px 0 0; border-top: 1px solid var(--line); border-left: 0; }
}

@media (max-width: 650px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; justify-content: flex-start; }
  .topbar-actions .secondary { display: none; }
  .topbar-actions #exportBtn { display: inline-flex; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .credit-metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-card { min-height: 112px; }
  .metric-card strong { font-size: 26px; }
  .panel-header, .section-heading { align-items: flex-start; flex-direction: column; }
  .filters { width: 100%; flex-direction: column; }
  .filters input, .filters select { width: 100%; }
  .insights-column { grid-template-columns: 1fr; }
  .form-card { padding: 18px; }
  .form-grid.cols-2, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .action-note { text-align: left; }
  .extraction-grid { grid-template-columns: 1fr; }
  .extracted-field.wide { grid-column: auto; }
  .extraction-actions { align-items: stretch; flex-direction: column; }
  .extraction-actions .button { width: 100%; }
  .department-row { grid-template-columns: 70px 1fr; }
  .department-row label { grid-column: 2; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-item.wide { grid-column: auto; }
  .demo-notice { align-items: flex-start; flex-direction: column; }
  .admin-session-bar, .admin-form-intro { align-items: stretch; flex-direction: column; }
  .admin-session-actions { justify-content: flex-start; }
  .admin-session-actions .button, .admin-form-intro .button { width: 100%; }
  .admin-security-notice { padding: 12px; }
  .delete-dialog-body { padding: 18px; }
  .delete-quote-form .dialog-actions { flex-direction: column-reverse; }
  .delete-quote-form .dialog-actions .button { width: 100%; }
  .admin-record-item { align-items: stretch; flex-direction: column; }
  .admin-record-item .button { width: 100%; }
  .admin-audit-item { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .main-content { padding-inline: 12px; }
  .metric-grid { gap: 9px; }
  .metric-card { padding: 14px; }
  .topbar h1 { font-size: 25px; }
}
