/* =============================================================
   Shipping Quotes Dashboard — Halogen Systems brand theme.
   Matches halogensystems.com: Deep Navy (#1A2E44) + Clean Cyan
   (#00A8E8) on Soft Slate (#EDF2F4), Manrope headings / Inter body,
   white cards with soft shadows and rounded corners.
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap');

* { box-sizing: border-box; }

:root {
  /* ---- Brand palette (from halogen-web tailwind config) ---- */
  --navy:            #1A2E44;   /* primary text, headers */
  --navy-deep:       #132236;   /* gradient/darker navy */
  --navy-darker:     #0D1B2A;   /* hero gradient top */
  --cyan:            #00A8E8;   /* CTAs, accents, links */
  --cyan-dark:       #0090C8;   /* hover */
  --cyan-darker:     #006B93;   /* pressed / dark-on-light text */
  --cyan-light:      #66D4FF;   /* underline, light accents */
  --cyan-tint:       #E4F5FC;   /* faint cyan fill */
  --steel:           #8D99AE;   /* captions, secondary text */
  --slate:           #EDF2F4;   /* page background */
  --slate-low:       #E5EBED;   /* hover / subtle fills */
  --slate-mid:       #DDE4E7;
  --line:            #C8CDD5;   /* borders, dividers */
  --line-soft:       #E2E8EC;
  --white:           #ffffff;

  /* Soft card shadows — same depth language as the brand site. */
  --shadow-sm: 0 1px 2px rgba(26, 46, 68, 0.06);
  --shadow:    0 1px 3px rgba(26, 46, 68, 0.08), 0 1px 2px rgba(26, 46, 68, 0.04);
  --shadow-md: 0 4px 12px rgba(26, 46, 68, 0.10);
  --shadow-lg: 0 12px 32px rgba(26, 46, 68, 0.16);
  --ring-cyan: 0 0 0 3px rgba(0, 168, 232, 0.20);

  --radius:    12px;
  --radius-sm: 8px;

  /* ---- Compatibility aliases ----
     The markup/JS still references --brand-* and --term-* tokens.
     Map them onto the brand palette so every existing rule reskins
     without touching class names. */
  --brand-blue:        var(--cyan);
  --brand-blue-dark:   var(--cyan-dark);
  --brand-blue-light:  var(--cyan-light);
  --brand-blue-tint:   var(--cyan-tint);
  --brand-blue-ring:   rgba(0, 168, 232, 0.20);

  --logo-blue:       var(--cyan);
  --logo-blue-dark:  var(--navy);
  --logo-blue-light: var(--cyan-light);

  --term-bg:       var(--slate);
  --term-surface:  var(--white);
  --term-fg:       var(--navy);
  --term-dim:      var(--steel);
  --term-line:     var(--line);
  --term-hover:    var(--slate-low);
  --term-accent:   var(--cyan);
  --term-select:   rgba(0, 168, 232, 0.08);

  --ok:        #1B8F5A;
  --ok-light:  #86efac;
  --warn:      #B45309;
  --warn-tint: #FEF3C7;
  --err:       #BA1A1A;
  --err-light: #f87171;
}

html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
  background: var(--slate);
  color: var(--navy);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--cyan-darker); }

h1, h2, h3, .wordmark, .goal-card-head h2 {
  font-family: 'Manrope', 'Inter', system-ui, sans-serif;
}

/* ---------- Header ---------- */
header {
  display: flex; flex-direction: column; align-items: stretch;
  padding: 14px 24px 0; gap: 10px;
  background: rgba(237, 242, 244, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; z-index: 10;
}
.header-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  min-height: 64px;
}
.header-left, .header-right { display: flex; align-items: center; }
.header-right {
  flex-direction: column; justify-content: center;
  align-items: flex-end; gap: 6px;
  width: fit-content; margin-left: auto;
}
.header-status {
  font-size: 12px; color: var(--steel);
  font-variant-numeric: tabular-nums;
  line-height: 1.2; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.header-status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--steel); display: inline-block; flex: none;
}
.header-status.error { color: var(--err); }
.header-status.error::before { background: var(--err); }
.header-status.ok { color: var(--ok); }
.header-status.ok::before { background: var(--ok); }

.header-center { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.brand-logo { display: inline-flex; align-items: center; gap: 10px; color: var(--navy); line-height: 1; }
/* Halogen Systems hexagon mark. */
.brand-logo-img {
  height: 168px;
  width: auto;
  display: block;
}
/* Legacy ASCII / text marks are no longer rendered. */
.brand-logo .ascii-hex,
.brand-logo .wordmark { display: none; }
header h1 {
  margin: 0;
  font-size: 12px; font-weight: 600;
  color: var(--steel);
  letter-spacing: 0.14em; text-transform: uppercase;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--line-soft);
  margin: 2px -24px 0; padding: 0 24px;
}
.tab {
  background: transparent;
  color: var(--steel);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px; margin-bottom: -1px;
  font-size: 13px; font-family: inherit;
  letter-spacing: 0.02em;
  cursor: pointer; font-weight: 600;
}
.tab:hover:not(:disabled) { color: var(--navy); }
.tab.active {
  color: var(--cyan-darker);
  border-bottom-color: var(--cyan);
}

/* ---------- Header actions ---------- */
.header-actions { display: inline-flex; align-items: center; gap: 8px; }
.btn-tight {
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  letter-spacing: 0.01em;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn-tight:hover { background: var(--slate-low); border-color: var(--steel); }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  color: var(--steel);
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.theme-toggle:hover { color: var(--cyan-dark); border-color: var(--steel); }
.theme-toggle .theme-icon { width: 16px; height: 16px; }
.theme-toggle .theme-icon-sun  { display: none; }
.theme-toggle .theme-icon-moon { display: inline-block; }
html[data-theme="dark"] .theme-toggle .theme-icon-sun  { display: inline-block; }
html[data-theme="dark"] .theme-toggle .theme-icon-moon { display: none; }

/* ---------- Main ---------- */
main {
  padding: 22px 24px 40px;
  flex: 1 1 auto;
  display: flex; flex-direction: column; gap: 18px;
  max-width: 1200px; width: 100%; margin: 0 auto;
}
.tab-panel { display: flex; flex-direction: column; gap: 18px; }
.tab-panel[hidden] { display: none; }

/* ---------- Buttons ---------- */
button {
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--line);
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit;
  letter-spacing: 0.01em;
  cursor: pointer; font-weight: 600; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
button:hover:not(:disabled) { background: var(--slate-low); border-color: var(--steel); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

button.btn-primary {
  background: var(--cyan);
  color: #fff;
  border-color: var(--cyan);
  box-shadow: 0 2px 6px rgba(0, 168, 232, 0.25);
}
button.btn-primary:hover:not(:disabled) {
  background: var(--cyan-dark);
  border-color: var(--cyan-dark);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 168, 232, 0.32);
}

/* ---------- Controls bar ---------- */
.controls-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.ctrl { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.ctrl-label {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--steel); font-weight: 700;
}
.ctrl input[type="date"],
.ctrl input[type="text"],
.ctrl input[type="number"],
.ctrl select {
  font: inherit; font-size: 13px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  background: var(--white); color: var(--navy);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ctrl input:focus, .ctrl select:focus {
  outline: none; border-color: var(--cyan);
  box-shadow: var(--ring-cyan);
}
.muted { color: var(--steel); font-size: 12px; }
.center { text-align: center; }

/* ---------- Banner ---------- */
.banner {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
}
.banner-error {
  border-color: rgba(186, 26, 26, 0.35);
  color: var(--err);
  background: rgba(186, 26, 26, 0.06);
}

/* ---------- Cards (quote / ship / parcels / rates / settings) ---------- */
.goal-card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 10px;
}
.goal-card-head h2 {
  margin: 0;
  font-size: 14px; font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--navy);
}
.goal-card-range {
  font-size: 12px; color: var(--steel);
  font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; gap: 8px;
}

/* ---------- Tables (generic) ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
thead th {
  background: var(--slate-low);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--steel);
  border-bottom: 1px solid var(--line);
}
tbody tr:hover { background: var(--slate-low); }
tbody tr:last-child td { border-bottom: none; }
.right { text-align: right; }
th.right { text-align: right; }

/* ---------- Settings ---------- */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 18px;
}
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }
.settings-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.settings-card h2 {
  margin: 0 0 4px;
  font-size: 14px; font-weight: 700;
  color: var(--navy);
}

/* ---------- Status pills ---------- */
.pill {
  display: inline-block;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.pill.ok    { color: var(--ok);    background: rgba(27, 143, 90, 0.08); }
.pill.warn  { color: var(--warn);  background: rgba(180, 83, 9, 0.08); }
.pill.err   { color: var(--err);   background: rgba(186, 26, 26, 0.08); }
.pill.muted { color: var(--steel); background: var(--slate-low); }

/* ---------- Report modal (base; app specifics in extras.css) ---------- */
.modal-overlay, .report-modal {
  position: fixed; inset: 0;
  background: rgba(13, 27, 42, 0.5);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-overlay[hidden], .report-modal[hidden] { display: none; }
.modal-card {
  background: var(--white);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: min(820px, 100%);
  max-height: 90vh;
  display: flex; flex-direction: column;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-head h2 {
  margin: 0; font-size: 14px; font-weight: 700; color: var(--navy);
}
.modal-close {
  background: transparent; border: none;
  font-size: 20px; line-height: 1; padding: 0 8px;
  color: var(--steel); cursor: pointer;
}
.modal-close:hover { color: var(--navy); }

/* ---------- Dark mode (deep-navy, matches the brand hero gradient) ---------- */
html[data-theme="dark"] {
  --navy:        #E6ECF2;   /* light text on dark */
  --term-fg:     #E6ECF2;
  --term-bg:     #0D1B2A;
  --term-surface:#16263A;
  --term-dim:    #8D99AE;
  --term-line:   #2A3D54;
  --term-hover:  #1E3149;
  --slate:       #0D1B2A;
  --slate-low:   #1E3149;
  --line:        #2A3D54;
  --line-soft:   #223144;
  --white:       #16263A;
}
html[data-theme="dark"] body { background: var(--term-bg); color: var(--term-fg); }
html[data-theme="dark"] header {
  background: rgba(13, 27, 42, 0.85);
  border-bottom-color: var(--line-soft);
}
html[data-theme="dark"] .brand-logo .wordmark { color: var(--term-fg); }
html[data-theme="dark"] thead th { background: var(--slate-low); color: var(--steel); }
html[data-theme="dark"] .banner-error { background: rgba(248, 113, 113, 0.08); }
