@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-400-700.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-ext-400-700.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

:root {
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: var(--font-body);
  --shell-width: 1600px;
  --bg: #f4f7fa;
  --bg-soft: #eaf0f4;
  --surface: #fff;
  --surface-soft: #f8fafc;
  --surface-muted: #eaf0f4;
  --line: #dce4ea;
  --line-strong: #c9d5de;
  --text: #10212f;
  --text-soft: #4b6272;
  --text-muted: #6b7f8d;
  --brand: #0078d4;
  --brand-strong: #005a9e;
  --brand-soft: #e8f4fc;
  --navy: #003b7a;
  --navy-strong: #003265;
  --navy-deep: #002b59;
  --accent-sky: #50a8e8;
  --accent-gold: #a06400;
  --accent-coral: #b54835;
  --accent-violet: #4b6272;
  --danger: #a32d3b;
  --warning: #8a5800;
  --success: #176b4d;
  --shadow: 0 16px 44px rgba(16, 33, 47, .16);
}

html { scrollbar-gutter: stable; }
body, .login-page { font-family: var(--font-body); font-synthesis: none; font-size: 15px; line-height: 1.47; background: var(--bg); color: var(--text); overflow-x: visible; }
button, input, select, textarea { font-family: inherit; }
button { touch-action: manipulation; }
:where(a, button, input, select, textarea, summary, [role="button"]):focus-visible { outline: 3px solid #50a8e8; outline-offset: 2px; }
:where(a, button, input, select, textarea, summary, [role="button"]):disabled { cursor: not-allowed; }
.skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; padding: 12px 16px; background: #fff; color: var(--navy); border: 2px solid var(--brand); border-radius: 6px; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

/* Shell and navigation */
.sidebar { width: 236px; padding: 20px 12px 16px; gap: 16px; background: var(--navy); color: #fff; box-shadow: none; border-right: 1px solid var(--navy-strong); }
.brand-lockup { gap: 12px; padding: 4px 6px 12px; border-bottom: 1px solid rgba(255,255,255,.2); min-height: 62px; }
.brand-mark { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 6px; background: #fff; color: var(--navy); box-shadow: none; font-size: 20px; font-weight: 700; }
.brand-copy { min-width: 0; }
.brand-copy strong { font-size: 14px; font-weight: 650; line-height: 1.25; color: #fff; }
.brand-copy small { display: block; font-size: 12px; color: #a8d5ff; }
.side-nav { gap: 2px; }
.nav-item { min-height: 44px; padding: 10px 12px; border-radius: 6px; color: #d6e6f5; font-size: 14px; font-weight: 500; line-height: 20px; }
.nav-icon, .nav-icon svg { width: 18px; height: 18px; flex-basis: 18px; }
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.is-active { background: #fff; color: var(--navy); box-shadow: none; font-weight: 650; }
.sidebar-context { min-height: 44px; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; background: rgba(255,255,255,.08); }
.sidebar-context span { color: #fff; font-size: 13px; }
.sidebar-context.is-actionable::after { border-color: #fff; }
.sidebar-platform { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.2); display: grid; gap: 7px; }
.sidebar-platform span { color: #a8d5ff; font-size: 12px; line-height: 16px; }
.sidebar-platform img { width: 110px; height: auto; max-width: 100%; object-fit: contain; object-position: left center; }
.content-shell { width: min(calc(100% - 236px), 1600px); margin-left: 236px; padding: 0 32px 48px; gap: 0; }
body.sidebar-collapsed .content-shell { width: min(100%, 1600px); }
body[data-page="dashboard"] .content-shell { max-width: 1716px; }
body[data-page="settings"] .content-shell { max-width: 1416px; }
.topbar { position: sticky; top: 0; min-height: 84px; padding: 14px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--bg); backdrop-filter: none; box-shadow: none; gap: 20px; }
.topbar-copy { gap: 1px; min-width: 0; }
.topbar-greeting { margin: 0; background: none; color: var(--text-soft); -webkit-background-clip: initial; background-clip: initial; font: 500 12px/16px var(--font-body); }
.topbar-copy h1 { margin: 0; font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -.02em; }
.topbar-stamp { font-size: 12px; line-height: 16px; color: var(--text-muted); }
.topbar-tools { gap: 8px; }
.icon-btn { width: 44px; height: 44px; flex: 0 0 44px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--navy); box-shadow: none; }
.icon-btn:hover, .icon-btn[aria-expanded="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--navy); transform: none; }
.profile-chip { min-width: 228px; height: 44px; padding: 4px 12px 4px 4px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; box-shadow: none; color: var(--text); }
.profile-chip:hover, .profile-chip[aria-expanded="true"] { border-color: var(--brand); background: #fff; }
.profile-avatar, .sms-sender-avatar { background: var(--brand-soft); color: var(--navy); font-weight: 700; }
.profile-copy strong { font-size: 13px; font-weight: 650; line-height: 18px; }
.profile-copy small { font-size: 12px; line-height: 16px; }
.notification-panel, .profile-menu-panel { width: min(340px, calc(100vw - 32px)); border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.notification-item { border-radius: 6px; background: var(--surface-soft); }
.notification-action:hover { background: var(--brand-soft); border-color: var(--brand); }
.notification-cta, .notification-subhead { color: var(--brand-strong); font-size: 12px; letter-spacing: 0; text-transform: none; }
.profile-menu-email { overflow-wrap: anywhere; }
.page-shell { gap: 20px; padding-top: 24px; }
.page-stack, .page-grid, .activity-list, .queue-list, .tip-list { gap: 20px; }

/* Navigation within a route */
.page-tabs { position: static; gap: 0; padding: 0; border: 0; border-bottom: 1px solid var(--line-strong); border-radius: 0; background: transparent; backdrop-filter: none; box-shadow: none; scrollbar-width: thin; }
.page-tab { min-height: 44px; padding: 10px 16px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; color: var(--text-soft); font-size: 14px; line-height: 20px; font-weight: 600; }
.page-tab:hover { color: var(--navy); background: var(--brand-soft); }
.page-tab.is-active { color: var(--navy); background: transparent; border-bottom-color: var(--brand); box-shadow: none; }

/* Content structure */
.surface-panel, .login-card { padding: 20px 24px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: none; }
.surface-panel-band, .travel-period-intro, .insight-modal-card { background: #fff; }
.panel-head { margin-bottom: 16px; gap: 16px; }
.panel-head h2 { font-size: 18px; line-height: 24px; font-weight: 700; color: var(--text); }
.panel-head h3, .panel-head.compact h3 { font-size: 16px; line-height: 22px; font-weight: 650; }
.panel-head .helper-text { margin-top: 4px; }
.eyebrow, .sidebar-context-label { font-size: 12px; line-height: 16px; letter-spacing: .04em; color: var(--text-muted); }
.helper-text, .empty-state, .summary-card-note, .hero-card-note, .hero-card-meta { font-size: 12px; line-height: 18px; color: var(--text-soft); }
.summary-grid, #summaryCards.summary-grid { min-height: 0; gap: 0; grid-template-columns: repeat(4, minmax(0,1fr)); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.summary-card, .summary-card:nth-child(n), .hero-card, .hero-card:first-child, .hero-card:last-child, .detail-card, .insight-kpi { min-width: 0; border: 0; border-radius: 0; background: #fff; box-shadow: none; }
.summary-card { min-height: 112px; padding: 16px 20px; border-right: 1px solid var(--line); gap: 6px; }
.summary-card:nth-child(4n) { border-right: 0; }
.summary-card:nth-child(n+5) { border-top: 1px solid var(--line); }
.summary-card[class*="tone"] { box-shadow: none; }
.summary-card-button { min-height: 112px; border: 0; background: #fff; }
.summary-card-button:hover, .hero-card-button:hover { background: var(--brand-soft); border-color: transparent; box-shadow: none; transform: none; }
.summary-card strong { font-size: 23px; line-height: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary-card-label { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--text-soft); }
.hero-grid { gap: 12px; }
.hero-card { border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.hero-card-link, .summary-card-link, .link-btn, .table-link:hover, .th-sort-btn.is-active, .password-toggle { color: var(--brand-strong); }
.detail-card, .activity-card, .list-card, .template-card, .contact-profile-summary, .travel-period-card, .travel-period-route-card { border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: none; }
.template-card.is-active { border: 2px solid var(--brand); background: var(--brand-soft); box-shadow: none; }
.template-card-badge { border-radius: 4px; background: var(--surface-muted); color: var(--text-soft); font-size: 12px; }
.travel-period-steps > div, .travel-period-form-section, .travel-period-empty-card { border-color: var(--line); border-radius: 8px; background: var(--surface-soft); }
.travel-period-steps span, .travel-period-empty-icon { background: var(--brand-soft); color: var(--navy); }
.travel-period-date-chip, .travel-period-no-dates { border-radius: 4px; }
.travel-period-date-chip { border-color: var(--line-strong); background: var(--brand-soft); color: var(--navy); }
.travel-period-form-section { padding: 16px; }
.travel-period-route-number, .travel-period-advanced summary, .travel-period-steps small { font-size: 12px; }

/* Controls */
.btn, .btn-sm { min-height: 44px; padding: 10px 16px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; box-shadow: none; color: var(--navy); font-size: 14px; line-height: 20px; font-weight: 600; transform: none; }
.btn:hover, .btn-sm:hover { border-color: var(--brand); background: var(--brand-soft); box-shadow: none; transform: none; }
.btn:active, .icon-btn:active { background: #d8ecf9; }
.btn-primary, :root[data-theme="dark"] .btn-primary { border-color: var(--brand); background: var(--brand); color: #fff; box-shadow: none; }
.btn-primary:hover { border-color: var(--brand-strong); background: var(--brand-strong); color: #fff; }
.btn-secondary, .btn-quiet { border-color: var(--line-strong); background: #fff; }
.btn-danger { border-color: #e6b8bd; background: #fff; color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); background: #fff1f2; color: var(--danger); }
.btn:disabled, .btn-sm:disabled { opacity: .55; transform: none; box-shadow: none; }
.btn-sm { min-height: 36px; padding: 7px 12px; font-size: 13px; line-height: 20px; }
.field { gap: 6px; }
.field > span:first-child, .field-inline > span:first-child { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--text); }
.field input, .field textarea, .field select, .input-inline, .page-size-select { min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--text); font-size: 14px; line-height: 20px; box-shadow: none; }
.field input:focus, .field textarea:focus, .field select:focus, .input-inline:focus, .page-size-select:focus { border: 2px solid var(--brand); padding: 9px 11px; outline: 3px solid #a8d5ff; outline-offset: 1px; box-shadow: none; }
.field input:disabled, .field textarea:disabled, .field select:disabled { background: var(--surface-soft); color: var(--text-soft); }
.field textarea { min-height: 120px; }
.field input::placeholder, .field textarea::placeholder { color: #6b7f8d; opacity: 1; }
.password-toggle { min-height: 36px; padding: 6px 8px; border-radius: 6px; font-size: 13px; font-weight: 600; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }

/* Data and operational state */
.table-wrap { min-height: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; scrollbar-color: var(--line-strong) var(--surface-soft); }
.table-wrap::after { content: "Scroll horizontally to see all columns"; position: sticky; left: 0; display: block; width: max-content; padding: 6px 12px; color: var(--text-muted); background: #fff; font-size: 12px; line-height: 16px; }
.data-table { font-size: 14px; line-height: 20px; }
.data-table th { padding: 12px 14px; background: var(--surface-soft); color: var(--text-soft); font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .03em; }
.data-table td { padding: 14px; border-color: var(--line); }
.data-table tbody tr { min-height: 48px; }
.data-table tbody tr:hover { background: #f0f7fc; }
.data-table .table-link { font-weight: 650; }
.status-pill, .badge, .tag, .chip, .token { border-radius: 4px; }
.mini-bar span, .progress-fill, .pulse-card::before { background: var(--brand); }
.messaging-connection-notice { border-color: var(--line); border-left-color: var(--navy); background: var(--surface-soft); color: var(--text); font-size: 14px; line-height: 20px; }
.messaging-connection-notice.is-ready { border-left-color: var(--success); }
.messaging-connection-notice.is-blocked { border-left-color: var(--danger); background: #fff7f7; color: #8e2432; }
.error-text, .helper-text.is-error { color: var(--danger); }
.helper-text.is-success { color: var(--success); }
.toast-success { background: var(--success); }
.toast-neutral { background: var(--navy); }

/* Overlays and messaging preview */
.modal-backdrop { background: rgba(16,33,47,.56); backdrop-filter: none; }
.modal-card { width: min(640px,100%); max-height: calc(100dvh - 48px); padding: 24px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.modal-card-wide { width: min(880px,100%); }
.modal-head h2 { font-size: 24px; line-height: 30px; }
.feedback-modal-card { width: min(880px,100%); }
.selection-drawer { top: 12px; left: 12px; bottom: 12px; padding: 20px; border-radius: 12px; background: var(--navy); box-shadow: var(--shadow); }
.selection-drawer-item { border-radius: 6px; }
.phone-frame { background: #172a3b; }
.phone-screen, .sms-thread { background: #f7fafc; }
.sms-preview-empty { border-color: var(--line-strong); background: #fff; }

/* Sign in */
.login-page, .login-layout, .login-form-wrap { background: var(--bg); }
.login-layout { grid-template-columns: minmax(0,1fr) minmax(400px, 42%); }
.login-visual { padding: 48px; background: var(--navy); color: #fff; }
.login-visual-copy { max-width: 480px; gap: 16px; }
.login-brand-mark { width: 52px; height: 52px; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; background: rgba(255,255,255,.12); box-shadow: none; font-size: 25px; }
.login-visual-copy h1 { max-width: 12ch; font-size: clamp(36px, 4vw, 54px); line-height: 1.07; letter-spacing: -.03em; }
.login-visual-note { max-width: 52ch; color: #e2edf8; font-size: 15px; line-height: 22px; }
.login-platform { display: grid; gap: 8px; margin-top: 32px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.25); }
.login-platform span { font-size: 12px; line-height: 16px; color: #a8d5ff; }
.login-platform img { width: 132px; height: auto; object-fit: contain; object-position: left center; }
.login-form-wrap { padding: 48px; }
.login-form-stack { max-width: 420px; }
.login-card { max-width: none; width: 100%; padding: 32px; gap: 20px; }
.login-card h2 { margin: 0; font-size: 24px; line-height: 30px; font-weight: 700; }
.login-card .panel-head { margin-bottom: 4px; }
.login-card .btn-primary { width: 100%; }
.login-error { margin: 0; }

@media (max-width: 1199px) {
  .content-shell { padding-right: 24px; padding-left: 24px; }
  .summary-grid, #summaryCards.summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .summary-card:nth-child(n) { border-right: 1px solid var(--line); border-top: 0; }
  .summary-card:nth-child(2n) { border-right: 0; }
  .summary-card:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 980px) {
  body.mobile-shell .sidebar { width: min(288px, calc(100vw - 48px)); padding: 20px 12px 16px; }
  body.mobile-shell .content-shell { width: 100%; max-width: none; margin: 0; padding: 0 20px 36px; }
  body.mobile-shell .topbar { top: 0; min-height: 68px; padding: 8px 0; }
  body.mobile-shell .topbar-copy h1 { font-size: 20px; line-height: 26px; }
  body.mobile-shell .topbar-greeting { display: none; }
  body.mobile-shell .icon-btn, body.mobile-shell .profile-chip { width: 44px; min-width: 44px; height: 44px; border-radius: 6px; }
  body.mobile-shell .page-shell { padding-top: 16px; }
  .page-grid.two-up, .form-grid.two, .form-grid.three, .hero-grid, .campaign-grid { grid-template-columns: 1fr; }
  .login-layout { grid-template-columns: 1fr; }
  .login-visual { min-height: 300px; }
  .login-visual-copy h1 { max-width: none; }
}
@media (max-width: 719px) {
  .login-visual { min-height: 0; padding: 36px 20px 32px; }
  .login-visual-copy { justify-items: start; text-align: left; gap: 12px; }
  .login-visual-copy h1 { font-size: 32px; line-height: 38px; }
  .login-platform { margin-top: 8px; }
  .login-form-wrap { padding: 20px 16px 36px; }
  .login-card { padding: 24px 20px; }
  body.mobile-shell .content-shell { padding: 0 16px 32px; }
  body.mobile-shell .topbar { gap: 8px; }
  body.mobile-shell .topbar-copy h1 { font-size: 18px; line-height: 24px; }
  body.mobile-shell .topbar-stamp { display: none; }
  body.mobile-shell .topbar-tools { gap: 4px; }
  body.mobile-shell .page-shell { gap: 16px; }
  .surface-panel { padding: 16px; }
  .summary-grid, #summaryCards.summary-grid { grid-template-columns: 1fr; }
  .summary-card:nth-child(n) { min-height: 80px; padding: 12px 16px; border-right: 0; border-top: 1px solid var(--line); }
  .summary-card:first-child { border-top: 0; }
  .summary-card strong { font-size: 20px; line-height: 26px; }
  .panel-head { align-items: flex-start; }
  .btn-sm { min-height: 44px; }
  .modal-shell { padding: 12px; }
  .modal-card { max-height: calc(100dvh - 24px); padding: 20px; }
  .selection-drawer { top: 0; left: 0; bottom: 0; width: min(288px, calc(100vw - 48px)); border-radius: 0; }
  body.mobile-shell .notification-panel, body.mobile-shell .profile-menu-panel { top: 60px; right: 12px; width: min(340px, calc(100vw - 24px)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto; animation-duration: .01ms; transition-duration: .01ms; }
}
/* Final shell and dense-data refinements */
.topbar { justify-content: flex-start; }
.topbar-copy { margin-right: auto; }
.sidebar-platform img { width: 138px; }
.login-platform img { width: 168px; }
.table-wrap::after { content: none; }
.trip-date-chip small { font-size: 12px; }
@media (max-width: 719px) {
  .table-wrap:has(> table)::before { content: "Scroll table to see all columns →"; position: sticky; left: 0; z-index: 1; display: block; width: max-content; padding: 8px 12px; background: var(--surface-soft); color: var(--text-soft); font-size: 12px; line-height: 16px; }
}
/* Route width families include the 32px shell gutters. */
.content-shell { width: min(calc(100% - 236px), 1664px); }
body[data-page="dashboard"] .content-shell { max-width: 1544px; }
body[data-page="settings"] .content-shell { max-width: 1244px; }
body.sidebar-collapsed .content-shell { width: min(100%, 1664px); }
@media (max-width: 980px) {
  body.mobile-shell .content-shell { width: 100%; max-width: none; }
}

.table-wrap:has(> .table-wrap) { border: 0; border-radius: 0; overflow: visible; background: transparent; }
.travel-period-extend-current { margin: 0; padding: 12px 16px; border-left: 3px solid var(--brand); background: var(--brand-soft); color: var(--text); font-size: 14px; line-height: 20px; }
#travelPeriodExtendDates { gap: 12px; }
#travelPeriodExtendDates .travel-period-date-row { grid-template-columns: minmax(0, 1fr) auto; }
#travelPeriodExtendDates .btn { align-self: end; }
@media (max-width: 560px) {
  #travelPeriodExtendDates .travel-period-date-row { grid-template-columns: 1fr; }
  #travelPeriodExtendDates .btn { justify-self: start; }
}
@media (max-width: 980px) {
  html { overflow-y: auto; scrollbar-gutter: auto; }
}
