:root {
  --navy: #1E293B;
  --navy-dark: #0F172A;
  --navy-soft: #334155;
  --teal: #0F766E;
  --teal-soft: #ECFDF5;
  --blue: #2563EB;
  --blue-soft: #EFF6FF;
  --green: #15803D;
  --green-soft: #F0FDF4;
  --amber: #B45309;
  --amber-soft: #FFFBEB;
  --red: #B91C1C;
  --red-soft: #FEF2F2;
  --text: #0F172A;
  --muted: #64748B;
  --line: #E2E8F0;
  --surface: #FFFFFF;
  --page: #F8FAFC;
  --shadow: 0 8px 28px rgba(15, 23, 42, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { color: var(--text); background: var(--page); font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif; font-size: 15px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.kicker { color: var(--teal); font-size: .69rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 9px 15px; border: 1px solid transparent; border-radius: 9px; font-weight: 750; }
.button.primary { color: white; background: var(--teal); }
.button.primary:hover { background: #0B655E; }
.button.quiet { color: var(--navy); background: white; border-color: #CBD5E1; }
.button.danger { color: var(--red); background: var(--red-soft); border-color: #FECACA; }
.button.full { width: 100%; }
.top-quiet { color: white; background: transparent; border: 1px solid rgba(255,255,255,.28); }
.top-quiet:hover { background: rgba(255,255,255,.10); }
label { display: grid; gap: 6px; color: #334155; font-size: .76rem; font-weight: 700; }
input, select, textarea { width: 100%; padding: 10px 11px; color: var(--text); background: white; border: 1px solid #CBD5E1; border-radius: 9px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #60A5FA; box-shadow: 0 0 0 3px rgba(37,99,235,.10); }
.error { color: var(--red); font-size: .78rem; }
.field-error input, .field-error select { border-color: #EF4444; }

.login-layout { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 5vw; padding: 7vw; background: linear-gradient(135deg, #0F172A 0%, #1E293B 52%, #0F766E 130%); }
.login-copy { color: white; }
.login-copy .kicker { color: #5EEAD4; }
.login-copy h1 { margin: 18px 0; font-size: clamp(2.6rem, 6vw, 5.5rem); line-height: .96; letter-spacing: -.055em; }
.login-copy p { max-width: 620px; color: #CBD5E1; font-size: 1.05rem; line-height: 1.65; }
.login-card { width: min(440px, 100%); justify-self: center; padding: 34px; }
.login-card h2 { margin: 8px 0 22px; font-size: 1.8rem; }
.login-card label { margin-bottom: 14px; }
.logo { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; color: #0F172A; background: #FACC15; font-weight: 900; }
.logo.large { width: 56px; height: 56px; margin-bottom: 20px; font-size: 1.25rem; }

.app { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 14px; color: white; background: var(--navy-dark); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; }
.brand > div:last-child { display: grid; }
.brand strong { font-size: 1.05rem; }
.brand span { margin-top: 2px; color: #94A3B8; font-size: .7rem; }
nav { display: grid; gap: 7px; }
.nav-item { width: 100%; display: grid; grid-template-columns: 25px 1fr auto; align-items: center; gap: 8px; padding: 12px 11px; border: 0; border-radius: 9px; color: #CBD5E1; background: transparent; text-align: left; font-weight: 700; }
.nav-item span { color: #64748B; font-size: .65rem; }
.nav-item b { min-width: 22px; padding: 3px 6px; border-radius: 999px; color: white; background: var(--amber); text-align: center; font-size: .65rem; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.10); }
.nav-item.active span { color: #FACC15; }
.sidebar-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: auto; padding: 18px 8px 0; border-top: 1px solid rgba(255,255,255,.1); color: #94A3B8; font-size: .69rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #64748B; }
.status-dot.live { background: #22C55E; box-shadow: 0 0 0 4px rgba(34,197,94,.14); }
.text-button { width: 100%; margin-top: 10px; padding: 7px 0; border: 0; color: #CBD5E1; background: transparent; text-align: left; font-size: .72rem; }
.content-shell { min-width: 0; }

.topbar { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 18px 2.2vw; color: white; background: var(--navy); border-bottom: 1px solid #0F172A; box-shadow: 0 4px 18px rgba(15,23,42,.14); }
.topbar .kicker { color: #5EEAD4; }
.topbar h1 { margin: 3px 0 0; color: white; font-size: 1.6rem; letter-spacing: -.025em; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 11px; min-width: 0; }
.quick-exports { display: flex; align-items: center; gap: 7px; }
.excel-button { min-height: 38px; padding: 8px 11px; border: 1px solid rgba(255,255,255,.20); border-radius: 8px; color: #ECFDF5; background: #0F766E; font-size: .72rem; font-weight: 750; white-space: nowrap; }
.excel-button:hover { background: #0B655E; transform: translateY(-1px); }
.company-select { min-width: 175px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; color: #CBD5E1; }
.company-select select { padding: 8px 9px; }
.identity { display: grid; min-width: 90px; text-align: right; }
.identity span { color: #5EEAD4; font-size: .66rem; font-weight: 800; text-transform: uppercase; }

main { width: min(1500px, 95%); margin: 0 auto; padding: 28px 0 64px; }
.intelligence-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; padding: 12px 15px; border: 1px solid #BBF7D0; border-radius: 11px; color: #166534; background: var(--green-soft); font-size: .78rem; }
.intelligence-banner strong { display: block; margin-bottom: 2px; }
.intelligence-banner small { color: inherit; opacity: .82; }
.intelligence-banner.offline { color: #92400E; border-color: #FDE68A; background: var(--amber-soft); }
.metric-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 25px; }
.executive-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { min-height: 118px; padding: 18px; background: white; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 4px 16px rgba(15,23,42,.045); }
.metric span { color: var(--muted); font-size: .67rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.metric strong { display: block; margin-top: 9px; font-size: 1.75rem; letter-spacing: -.03em; }
.metric small { display: block; margin-top: 8px; color: var(--muted); font-size: .74rem; line-height: 1.35; }
.metric.alert { border-color: #FDE68A; background: #FFFCF3; }
.metric.alert strong { color: var(--amber); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin: 0 0 17px; }
.section-head h2 { margin: 0 0 5px; font-size: 1.28rem; }
.section-head p { margin: 0; color: var(--muted); font-size: .83rem; }
.actions { display: flex; gap: 9px; }

.task-list { display: grid; gap: 10px; }
.task { display: grid; grid-template-columns: 108px minmax(0, 1fr) auto; gap: 17px; align-items: center; padding: 16px; background: white; border: 1px solid var(--line); border-left: 4px solid var(--teal); border-radius: 12px; box-shadow: 0 3px 12px rgba(15,23,42,.035); }
.task.overlift { border-left-color: var(--red); background: #FFFBFB; }
.task-lane { color: var(--teal); font-size: .67rem; font-weight: 850; text-transform: uppercase; }
.task-main strong { display: block; }
.task-action { display: inline-block; margin-top: 5px; color: var(--teal); font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.task-main p { margin: 5px 0; color: #475569; font-size: .81rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-main small { color: var(--muted); }
.missing { display: inline-block; margin-left: 6px; padding: 3px 7px; border-radius: 999px; color: #92400E; background: #FEF3C7; font-size: .62rem; font-weight: 800; }
.control-detail { display: grid; gap: .4rem; min-width: 220px; }
.control-detail small { color: var(--muted); line-height: 1.35; }
.empty { padding: 48px 24px; color: var(--muted); background: white; border: 1px dashed #CBD5E1; border-radius: 13px; text-align: center; }
.empty strong { display: block; margin-bottom: 5px; color: var(--navy); }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab { padding: 9px 13px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: white; font-weight: 750; }
.tab.active { color: white; background: var(--navy); }
.table-card { overflow-x: auto; box-shadow: none; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 14px; color: #64748B; background: #F8FAFC; border-bottom: 1px solid var(--line); text-align: left; font-size: .66rem; letter-spacing: .055em; text-transform: uppercase; }
td { padding: 14px; border-bottom: 1px solid #EEF2F7; font-size: .81rem; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.pill, .status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; font-size: .64rem; font-weight: 800; white-space: nowrap; }
.pill { color: var(--teal); background: #E6FFFB; }
.status-badge.success { color: var(--green); background: var(--green-soft); }
.status-badge.warning { color: var(--amber); background: var(--amber-soft); }
.status-badge.info { color: var(--blue); background: var(--blue-soft); }
.status-badge.danger { color: var(--red); background: var(--red-soft); }
.status-badge.neutral { color: #475569; background: #F1F5F9; }
.progress-wrap { min-width: 260px; }
.progress-title { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; font-size: .76rem; }
.progress-title strong { color: var(--text); }
.progress-track { width: 100%; height: 8px; overflow: hidden; background: #E2E8F0; border-radius: 999px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #0F766E, #2563EB); border-radius: inherit; }
.progress-caption { margin-top: 7px; color: var(--muted); font-size: .7rem; }
.edit-update { color: var(--navy); background: #F8FAFC; border: 1px solid #CBD5E1; }

.summary-note { padding: 28px; box-shadow: none; }
.summary-note h2 { max-width: 800px; margin: 8px 0; font-size: 1.85rem; line-height: 1.2; }
.summary-note p { color: var(--muted); }
.download-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.download-card { display: flex; flex-direction: column; min-height: 240px; padding: 22px; }
.download-card h3 { margin: 16px 0 8px; font-size: 1.18rem; }
.download-card p { flex: 1; color: var(--muted); line-height: 1.55; font-size: .82rem; }
.file-type { align-self: flex-start; padding: 6px 9px; border-radius: 7px; color: var(--navy); background: #FEF3C7; font-size: .67rem; font-weight: 850; }

.setup-grid { display: grid; grid-template-columns: minmax(280px, .7fr) minmax(560px, 1.3fr); gap: 16px; align-items: start; }
.connector-card, .groups-card { padding: 22px; box-shadow: none; }
.connector-state { display: flex; justify-content: space-between; align-items: center; margin: 16px 0; padding: 13px; border-radius: 10px; background: #F1F5F9; }
.connector-actions { display: grid; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.connector-actions .button { justify-self: start; }
.connector-actions small { color: var(--muted); line-height: 1.45; }
.qr { width: min(100%, 310px); display: block; margin: 15px auto; border: 10px solid white; border-radius: 10px; }
.help { color: var(--muted); font-size: .8rem; line-height: 1.5; }
.group-list { display: grid; gap: 10px; margin-top: 15px; }
.group-row { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #FAFCFD; }
.group-row-head { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 11px; }
.group-row-head small { display: block; margin-top: 3px; color: var(--muted); }
.group-form { display: grid; grid-template-columns: 1fr 1fr 1.2fr auto; gap: 8px; align-items: end; }
.group-form label { font-size: .67rem; }

dialog { width: min(1080px, 96vw); max-height: 94vh; border: 0; border-radius: 16px; padding: 0; box-shadow: 0 35px 100px rgba(15,23,42,.35); }
dialog::backdrop { background: rgba(15,23,42,.66); backdrop-filter: blur(4px); }
.dialog-content { max-height: 94vh; overflow-y: auto; padding: 27px; }
.compact-dialog { width: min(720px, 94vw); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 18px; }
.dialog-head h2 { margin: 5px 0 0; }
.icon-button { border: 0; color: var(--muted); background: transparent; font-size: 2rem; }
.review-warning { padding: 11px 13px; margin-bottom: 18px; color: var(--amber); background: var(--amber-soft); border: 1px solid #FDE68A; border-radius: 10px; font-size: .79rem; }
.review-warning.danger { color: var(--red); background: var(--red-soft); border-color: #FECACA; }
.review-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 20px; margin-bottom: 18px; }
.review-grid h3 { margin: 0 0 10px; font-size: .85rem; }
.evidence-list { max-height: 510px; overflow-y: auto; display: grid; gap: 8px; }
.evidence { padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: #F8FAFC; }
.evidence strong, .evidence small { display: block; }
.evidence small { margin: 3px 0 7px; color: var(--muted); }
.evidence p { margin: 0; font-size: .8rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.span-2 { grid-column: span 2; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; max-width: 390px; padding: 13px 16px; border-radius: 10px; color: white; background: var(--navy); box-shadow: var(--shadow); font-weight: 700; font-size: .82rem; }

@media (max-width: 1320px) { .quick-exports { display: none; } }
@media (max-width: 1050px) { .executive-metrics { grid-template-columns: repeat(2, 1fr); } .download-grid { grid-template-columns: 1fr; } .setup-grid { grid-template-columns: 1fr; } .group-form { grid-template-columns: 1fr 1fr; } }
@media (max-width: 780px) {
  .login-layout { grid-template-columns: 1fr; padding: 28px; }
  .login-copy { display: none; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; height: auto; padding: 14px; }
  .brand { padding-bottom: 12px; }
  nav { display: flex; overflow-x: auto; }
  .nav-item { min-width: 140px; }
  .sidebar-foot { display: none; }
  .topbar, .section-head { align-items: stretch; flex-direction: column; }
  .top-actions { justify-content: flex-start; flex-wrap: wrap; }
  .company-select { color: white; }
  .identity { text-align: left; }
  .intelligence-banner { align-items: flex-start; flex-direction: column; }
  .task { grid-template-columns: 1fr; }
  .review-grid, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .metric-row, .executive-metrics { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) { .metric-row, .executive-metrics { grid-template-columns: 1fr; } }


.failed-analysis-list { display: grid; gap: 10px; margin: 12px 0 18px; }
.failed-analysis-list:empty { display: none; }
.failed-analysis-head, .failed-analysis-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.failed-analysis-head { padding: 12px 14px; border: 1px solid var(--border, #d9dee7); border-radius: 12px; background: rgba(148, 163, 184, 0.08); }
.failed-analysis-head div, .failed-analysis-card div { display: grid; gap: 4px; }
.failed-analysis-head small, .failed-analysis-card small { opacity: .72; }
.failed-analysis-card { padding: 14px; border: 1px solid var(--border, #d9dee7); border-radius: 12px; background: var(--surface, #fff); }
.failed-analysis-card p { margin: 2px 0; }
/* Each state reads differently at a glance: a clock you can wait out, or a job for a person. */
.state-tag { display: inline-block; padding: 2px 8px; border-radius: 999px; border: 1px solid transparent; font-size: .64rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; vertical-align: 2px; }
.state-tag.scheduled { color: var(--blue); background: var(--blue-soft); border-color: #BFDBFE; }
.state-tag.cooling { color: var(--amber); background: var(--amber-soft); border-color: #FDE68A; }
.state-tag.inspect { color: var(--red); background: var(--red-soft); border-color: #FECACA; }
.state-tag.ready { color: var(--teal); background: var(--teal-soft); border-color: #A7F3D0; }

.field-provenance { display:block; margin-top:6px; color:#64748b; font-size:12px; line-height:1.35; font-weight:500; }

/* v0.7.6.18 queue visibility. A captured message must never look silently
   stuck: this strip says where each one currently is. */
.queue-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.queue-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border, #d8dee9);
  background: var(--surface, #fff);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}
.queue-chip strong { font-variant-numeric: tabular-nums; font-weight: 600; }
.queue-chip-zero { opacity: 0.55; }
.queue-chip-attention {
  border-color: #c2410c;
  color: #9a3412;
  background: #fff7ed;
}
@media (prefers-color-scheme: dark) {
  .queue-chip-attention { background: #2a1207; color: #fdba74; border-color: #9a3412; }
}

/* v0.7.6.18 Excel Center: company + year + month + workbook type. */
.excel-center { padding: 18px 20px; margin-bottom: 18px; }
.excel-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}
.excel-controls label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.excel-controls select { min-width: 150px; padding: 7px 9px; }
.excel-filename {
  margin: 14px 0 0;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  opacity: 0.8;
}
.excel-months { margin-top: 16px; }
.excel-months h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.7; }
.month-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.month-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border, #d8dee9);
  background: var(--surface, #fff);
  font-size: 12px;
  cursor: pointer;
}
.month-chip:hover { border-color: #2563eb; }
.month-chip span { font-variant-numeric: tabular-nums; opacity: 0.65; }

/* ==========================================================================
   INTERFACE REDESIGN - white ground, navigation moved into a top bar.
   Appended deliberately: every rule above keeps its definition, so content
   the JavaScript injects at runtime can never lose its styling.
   ========================================================================== */

:root {
  --navy: #0D1F1C;
  --navy-dark: #0D1F1C;
  --navy-soft: #3D524E;
  --teal: #0F766E;
  --teal-deep: #0B5D57;
  --teal-soft: #E2F2EE;
  --teal-ink: #0A4A45;
  --text: #0D1F1C;
  --muted: #6D817D;
  --line: #E2EAE8;
  --line-soft: #EEF3F2;
  --surface: #FFFFFF;
  --page: #FFFFFF;
  --panel: #F6F9F8;
  --shadow: 0 1px 2px rgba(13, 31, 28, .05), 0 8px 24px -14px rgba(13, 31, 28, .18);
}

body {
  font-family: Manrope, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}

.app { display: block; min-height: 100vh; }
.sidebar { display: none; }
.content-shell { min-width: 0; }

.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 30;
  min-height: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  padding: 11px 22px;
  color: var(--text);
  background: rgba(255, 255, 255, .93);
  backdrop-filter: saturate(1.6) blur(8px);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}
.topbar h1 { color: var(--text); }
.topbar .kicker { color: var(--teal); }

.brand { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; padding: 0; }
.brand strong { font-size: 1.3rem; font-weight: 800; letter-spacing: -.035em; color: var(--text); }
.brand span { display: none; }
.logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(140deg, var(--teal-deep), #3FBF93);
  font-size: .95rem;
  font-weight: 800;
}

nav#nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
nav#nav::-webkit-scrollbar { display: none; }
.nav-item {
  width: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: .9rem;
  font-weight: 650;
}
.nav-item span { display: none; }
.nav-item b {
  min-width: 20px;
  padding: 1px 7px;
  color: #fff;
  background: var(--teal);
  font-size: .68rem;
  font-weight: 800;
}
.nav-item:hover { color: var(--text); background: var(--panel); }
.nav-item.active { color: var(--teal-deep); background: var(--teal-soft); }
.nav-item.active span { color: inherit; }
.nav-item:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.top-actions { flex: 0 0 auto; gap: 12px; }
.company-select {
  min-width: 0;
  gap: 8px;
  padding: 5px 12px 5px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: .74rem;
}
.company-select select { min-width: 132px; padding: 5px 6px; border: 0; font-weight: 700; }
.company-select select:focus { box-shadow: none; }
.identity { min-width: 0; }
.identity strong { font-size: .86rem; }
.identity span { color: var(--teal); }
.top-quiet { color: var(--muted); background: transparent; border: 1px solid var(--line); }
.top-quiet:hover { color: var(--text); background: var(--panel); }

.pagebar {
  width: min(1500px, 95%);
  margin: 0 auto;
  padding: 26px 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  flex-wrap: wrap;
}
.pagebar h1 { margin: 5px 0 0; font-size: 2rem; letter-spacing: -.03em; text-wrap: balance; }
.pagebar .quick-exports { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
main { padding-top: 22px; }

.appfoot {
  width: min(1500px, 95%);
  margin: 0 auto;
  padding: 16px 0 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: .75rem;
}
.appfoot .text-button {
  width: auto;
  margin: 0 0 0 auto;
  padding: 4px 8px;
  color: var(--muted);
  border-radius: 7px;
}
.appfoot .text-button:hover { color: var(--text); background: var(--panel); }
.status-dot { background: #C3D0CD; }

.card { box-shadow: none; }
.metric { box-shadow: none; border-radius: 14px; }
.metric strong { letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.task { box-shadow: none; }
.excel-button {
  color: #fff;
  background: var(--teal);
  border-color: transparent;
  border-radius: 9px;
  font-size: .74rem;
}
.excel-button:hover { background: var(--teal-deep); transform: none; }
.button.quiet { color: var(--text); background: #fff; border-color: var(--line); }
.button.quiet:hover { border-color: #C9D8D5; }
.button.primary { background: var(--teal); }
.button.primary:hover { background: var(--teal-deep); }
.tab.active { color: #fff; background: var(--teal); border-color: var(--teal); }
th { background: var(--panel); color: var(--muted); }
td { border-bottom-color: var(--line-soft); }
input:focus, select:focus, textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
.toast { background: var(--text); }
.file-type { color: var(--teal-ink); background: var(--teal-soft); }
.pill { color: var(--teal-ink); background: var(--teal-soft); }

.login-layout { background: var(--page); gap: 4vw; }
.login-copy { color: var(--text); }
.login-copy .kicker { color: var(--teal); }
.login-copy h1 { letter-spacing: -.05em; }
.login-copy p { color: var(--muted); }
.login-card { border: 1px solid var(--line); box-shadow: 0 24px 60px -30px rgba(13, 31, 28, .35); }
.logo.large { width: 54px; height: 54px; border-radius: 14px; font-size: 1.5rem; }

@media (max-width: 1180px) { .company-select { display: none; } }
@media (max-width: 900px) {
  .identity { display: none; }
  .pagebar .quick-exports { display: none; }
}
@media (max-width: 780px) {
  .topbar { flex-direction: row; align-items: center; gap: 12px; padding: 10px 16px; }
  .brand strong { display: none; }
  .nav-item { min-width: 0; padding: 7px 10px; font-size: .85rem; }
  .top-actions { justify-content: flex-end; flex-wrap: nowrap; }
  .pagebar { padding-top: 20px; }
  .pagebar h1 { font-size: 1.6rem; }
  .login-layout { padding: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Noor live transport Order/Trip cards (Phase 1). */
.transport-order-cards { display: grid; gap: 14px; padding: 14px; }
.transport-order-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--surface); display: grid; gap: 14px; }
.transport-order-card .section-head { margin: 0; align-items: flex-start; }
.transport-trucks { display: grid; gap: 8px; }
.transport-trucks .control-detail { grid-template-columns: minmax(0,1fr) auto; align-items: center; }
.transport-order-card .evidence-list { max-height: 300px; }
.transport-order-card .evidence-item { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-alt, var(--surface)); }
.transport-order-card .evidence-item pre { margin: 6px 0 0; white-space: pre-wrap; word-break: break-word; font: inherit; color: var(--text); }

#tripSheetDialog{width:min(1100px,95vw);max-height:92vh;border:1px solid #cbd5e1;border-radius:16px;padding:0}#tripSheetDialog .dialog-content{max-height:86vh;overflow:auto;padding:24px}#tripSheetDialog pre{white-space:pre-wrap;overflow-wrap:anywhere}#tripSheetDialog fieldset{margin:16px 0;padding:12px;border:1px solid #cbd5e1}#driverPayButton{margin-left:12px}

/* v0.8.0 trip review: WhatsApp stage times */
.stage-list { display: grid; gap: 8px; margin: 6px 0 12px; }
.stage-row { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(180px, 1.2fr); gap: 2px 12px; align-items: center; padding: 10px 12px; border: 1px solid #d9e2ea; border-radius: 10px; }
.stage-row small { grid-column: 1 / -1; color: #667085; font-size: .75rem; }
.stage-row.locked { background: #f3f8f6; }
.stage-row.missing { background: #fff8e7; border-color: #f0d9a8; }
.check-line { display: flex; gap: 8px; align-items: center; font-weight: 600; margin: 6px 0; }
.check-line input { width: auto; }
#tripSheetForm .notice { padding: 10px 12px; border-radius: 10px; background: #fff8e7; color: #73510d; font-size: .85rem; margin: 8px 0; }
@media (max-width: 640px) { .stage-row { grid-template-columns: 1fr; } }

/* ==========================================================================
   v0.8.4 owner-approved theme (26 Sep 2026). Layered over the styles above.
   Warm ground, deep Noor teal, Fraunces titles over Manrope. Amber = money
   we owe; blue = money owed to us. Nothing here changes behaviour.
   ========================================================================== */
:root { --n-ground: #F5F4EF; --n-ink: #17211E; --n-muted: #5B6661; --n-line: #E3E1D8; --n-soft: #EEEDE6;
  --n-teal: #0F5E52; --n-teal-soft: #E4EFEA; --n-amber: #8A5208; --n-amber-soft: #F8EEDC; --n-blue: #2F4A8A; --n-blue-soft: #E6EBF5; }
body { background: var(--n-ground); color: var(--n-ink); font-family: Manrope, "Segoe UI", sans-serif; }
body .topbar { background: #FFFFFF; border-bottom: 1px solid var(--n-line); box-shadow: none; gap: 24px; padding: 0 32px; min-height: 72px; }
body .brand .logo { background: var(--n-teal); border-radius: 10px; }
body .brand strong { font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 23px; letter-spacing: -0.3px; color: var(--n-ink); }
body .brand span { display: none; }
.company-switch { display: flex; background: var(--n-soft); border-radius: 12px; padding: 4px; gap: 4px; }
.company-switch button { border: 0; border-radius: 9px; padding: 9px 16px; min-height: 40px; background: transparent; color: #3E4944; font: 600 14px Manrope, sans-serif; cursor: pointer; }
.company-switch button.active { background: var(--n-teal); color: #FFFFFF; font-weight: 700; }
.company-switch .company-single { padding: 9px 14px; font-weight: 700; color: var(--n-teal); }
body #nav { display: flex; gap: 2px; flex-grow: 1; }
body #nav .nav-item, body .settings-button { border: 0; background: transparent; border-radius: 9px; padding: 10px 14px; color: #3E4944; font: 600 14px Manrope, sans-serif; min-height: 42px; cursor: pointer; }
body #nav .nav-item.active, body .settings-button.active { background: var(--n-teal-soft); color: var(--n-teal); font-weight: 700; }
body #nav .nav-item b { background: var(--n-teal); color: #FFFFFF; border-radius: 99px; padding: 1px 8px; font-size: 12px; margin-left: 6px; }
body .settings-button { border: 1px solid var(--n-line); background: #FFFFFF; }
body .pagebar { display: flex; justify-content: space-between; align-items: flex-end; padding: 28px 32px 8px; }
body #pageKicker { color: var(--n-teal); font-weight: 800; letter-spacing: 1.4px; font-size: 12px; }
body #pageTitle { font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 38px; letter-spacing: -0.8px; margin: 6px 0 0; color: var(--n-ink); }
.settings-tabs { display: flex; background: var(--n-soft); border-radius: 12px; padding: 4px; gap: 4px; }
.settings-tabs button { border: 0; border-radius: 9px; padding: 9px 16px; min-height: 40px; background: transparent; font: 600 14px Manrope, sans-serif; color: #3E4944; cursor: pointer; }
.settings-tabs button.active { background: #FFFFFF; color: var(--n-ink); font-weight: 700; box-shadow: 0 1px 2px rgba(23, 33, 30, 0.12); }
body .card { background: #FFFFFF; border: 1px solid var(--n-line); border-radius: 16px; box-shadow: none; }
body .button.primary { background: var(--n-teal); border-color: var(--n-teal); color: #FFFFFF; border-radius: 10px; }
body .button.primary:hover { background: #0A4439; }
body .button.quiet { border-radius: 10px; }
body .tabs .tab { border-radius: 9px; font-weight: 600; }
body .tabs .tab.active { background: var(--n-teal-soft); color: var(--n-teal); border-color: transparent; font-weight: 800; }
body .table-card table th { color: var(--n-muted); font-size: 12px; letter-spacing: 0.6px; }
body .num { text-align: right; }
.records-toolbar { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin: 0 0 14px; flex-wrap: wrap; }
.records-toolbar label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--n-muted); }
.records-toolbar select { border: 1px solid #D5D3C9; border-radius: 10px; padding: 9px 12px; min-height: 42px; font: 600 14px Manrope, sans-serif; background: #FFFFFF; }
.test-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: #3E4944; }
.test-toggle input { width: auto; min-height: 0; }
.summary-head { display: flex; justify-content: flex-end; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.summary-label { font-weight: 700; color: #3E4944; margin-right: auto; }
.segmented { display: flex; background: var(--n-soft); border-radius: 12px; padding: 4px; gap: 4px; }
.segmented button { border: 0; border-radius: 9px; padding: 9px 16px; min-height: 40px; background: transparent; font: 600 14px Manrope, sans-serif; color: #3E4944; cursor: pointer; }
.segmented button.active { background: #FFFFFF; color: var(--n-ink); font-weight: 700; box-shadow: 0 1px 2px rgba(23, 33, 30, 0.12); }
.summary-grid { display: grid; gap: 18px; margin-bottom: 18px; }
.summary-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.summary-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.summary-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.side-card { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.side-head { display: flex; justify-content: space-between; align-items: center; }
.side-head h2 { margin: 0; font-size: 19px; font-weight: 800; }
.side-tag { font-size: 12px; font-weight: 800; border-radius: 99px; padding: 5px 11px; }
.side-card.purchase .side-tag { background: var(--n-teal-soft); color: var(--n-teal); }
.side-card.sale .side-tag { background: var(--n-blue-soft); color: var(--n-blue); }
.side-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.side-figures div { background: #F7F6F1; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; }
.side-figures b { font-family: Fraunces, Georgia, serif; font-size: 30px; font-weight: 600; }
.side-figures span, .side-rows span { font-size: 13px; color: var(--n-muted); }
.side-rows { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--n-soft); padding-top: 14px; }
.side-rows div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.side-rows strong { text-align: right; font-size: 15px; }
.side-card.purchase .due, td.purchase { color: var(--n-amber); font-weight: 800; }
.side-card.sale .due, td.sale { color: var(--n-blue); font-weight: 800; }
.side-mini { font-size: 11px; font-weight: 800; margin-left: 6px; }
.side-mini.purchase { color: var(--n-teal); } .side-mini.sale { color: var(--n-blue); }
.metric-card { background: #FFFFFF; border: 1px solid var(--n-line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.metric-card span { font-size: 13px; font-weight: 600; color: var(--n-muted); }
.metric-card b { font-family: Fraunces, Georgia, serif; font-size: 42px; font-weight: 600; }
.metric-card b em { font-style: normal; font-size: 20px; }
.metric-card b.mid { font-family: Manrope, sans-serif; font-size: 26px; font-weight: 800; }
.metric-card b.due { color: var(--n-amber); }
.metric-card small { font-size: 13px; color: var(--n-muted); }
.metric-card.hero { background: var(--n-teal); border-color: var(--n-teal); }
.metric-card.hero span, .metric-card.hero b, .metric-card.hero small { color: #FFFFFF; }
.metric-card.row { flex-direction: row; justify-content: space-between; align-items: center; }
.role-notes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 16px; }
.role-notes div { border: 1px solid var(--n-line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.role-notes span { font-size: 13px; color: #3E4944; }
#teamList select { border: 1px solid #D5D3C9; border-radius: 10px; padding: 9px 12px; min-height: 42px; font: 600 14px Manrope, sans-serif; background: #FFFFFF; }
#teamList select.needs-choice { border-color: #C9913A; }
.row-warn { background: #FBF6EC; }
.hint-warn { display: block; color: var(--n-amber); font-weight: 700; margin-top: 4px; }
@media (max-width: 1100px) {
  .summary-grid.two, .summary-grid.three, .summary-grid.four, .role-notes { grid-template-columns: minmax(0, 1fr); }
  body .topbar { flex-wrap: wrap; padding: 10px 16px; }
}
