/* ───────────────────────────────────────────────────────────────────────────
   Osprey Insurance — design system for the sample-insurance test target.
   Brand: deep teal primary + warm amber accent, airy light surface.
   Pure vanilla CSS, no build step, no CDN, system fonts only (offline-safe
   + deterministic for recordings). data-testid / name / id attrs untouched.
─────────────────────────────────────────────────────────────────────────── */
:root {
  /* brand */
  --teal-900: #0b3d39;
  --teal-700: #0f766e;   /* primary */
  --teal-600: #11857b;
  --teal-500: #14b8a6;
  --teal-050: #ecfdf9;
  --amber-500: #f59e0b;  /* accent */
  --amber-050: #fef6e7;

  /* surface + ink */
  --bg: #e9f3f0;
  --bg-grad-a: #def0eb;
  --bg-grad-b: #eef6f4;
  --card: #ffffff;
  --ink: #16252b;
  --mute: #5d6b73;
  --faint: #8b97a0;
  --line: #e3e9ec;
  --line-soft: #eef2f4;

  /* semantic */
  --pri: var(--teal-700);
  --pri-ink: #ffffff;
  --accent: var(--amber-500);
  --ok: #138a5f;
  --ok-bg: #e4f6ee;
  --warn: #b5740a;
  --warn-bg: #fdf2dc;
  --err: #d23b3b;
  --err-bg: #fde7e7;
  --info-bg: #e6f3f1;

  /* depth */
  --sh-sm: 0 1px 2px rgba(16, 40, 44, .05);
  --sh-md: 0 4px 14px rgba(16, 40, 44, .07), 0 1px 3px rgba(16, 40, 44, .05);
  --sh-lg: 0 14px 40px rgba(16, 40, 44, .12);
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1040px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, system-ui, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(880px 520px at 94% -8%, rgba(20,184,166,.22) 0%, transparent 60%),
    radial-gradient(720px 480px at -6% 4%, rgba(245,158,11,.14) 0%, transparent 55%),
    radial-gradient(900px 640px at 50% 116%, rgba(15,118,110,.13) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-grad-a) 0%, var(--bg) 52%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--pri); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: .9em; background: var(--line-soft); padding: 1px 6px; border-radius: 5px; color: var(--teal-900); }

/* ── Header ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 22px;
  padding: 12px 26px;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  box-shadow: var(--sh-sm);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 18px; letter-spacing: -.01em;
  color: var(--teal-900);
}
.brand:hover { text-decoration: none; }
.brand .brand-mark {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--teal-600), var(--teal-900));
  box-shadow: 0 3px 10px rgba(15,118,110,.35), inset 0 1px 0 rgba(255,255,255,.18);
  color: #fff;
}
.brand .brand-mark svg { display: block; }
.brand .brand-name { color: var(--teal-900); }
.brand .brand-name b { color: var(--teal-700); font-weight: 800; }
.demo-tag {
  display: inline-flex; align-items: center; gap: 5px;
  margin-left: -2px; padding: 3px 9px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--warn); background: var(--amber-050);
  border: 1px solid #f4d79a; border-radius: 999px; cursor: default; white-space: nowrap;
}
.demo-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--amber-500); box-shadow: 0 0 0 3px rgba(245,158,11,.18); }

.mainnav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.mainnav a {
  color: var(--mute); font-size: 14px; font-weight: 600;
  padding: 7px 12px; border-radius: 8px; line-height: 1;
}
.mainnav a:hover { color: var(--teal-900); background: var(--teal-050); text-decoration: none; }

.authbox { display: flex; gap: 12px; align-items: center; color: var(--mute); font-size: 14px; }
.authbox [data-testid="current-user"] {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px 5px 7px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  font-weight: 600; color: var(--ink); box-shadow: var(--sh-sm);
}
.authbox [data-testid="current-user"]::before {
  content: ""; width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-700));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
}
.authbox a { font-weight: 600; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.content { max-width: var(--maxw); margin: 28px auto 10px; padding: 0 24px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
  margin-bottom: 18px; box-shadow: var(--sh-md);
}
h1 { font-size: 27px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.02em; color: var(--teal-900); }
h2 { font-size: 18px; margin: 24px 0 10px; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 16px 0 8px; }
.subtitle, .lede { color: var(--mute); margin: 0 0 18px; font-size: 15.5px; max-width: 70ch; }

/* breadcrumbs */
.breadcrumbs { color: var(--faint); font-size: 13px; margin-bottom: 12px; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.breadcrumbs a { color: var(--mute); font-weight: 600; }
.breadcrumbs span { color: var(--faint); }

/* ── Fields ─────────────────────────────────────────────────────────────── */
.field { margin-bottom: 15px; }
.field > label, .field legend { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--ink); }
.field input[type=text], .field input[type=email], .field input[type=number], .field input[type=tel],
.field input[type=url], .field input[type=password], .field input[type=date], .field input[type=search],
.field input[type=datetime-local], .field select, .field textarea,
.filters input, .filters select,
input[type=text], input[type=email], input[type=number], input[type=tel],
input[type=search], input[type=date], input[type=password], select, textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(20,184,166,.18);
}
.field small.help, .help { color: var(--mute); font-size: 12px; }
.req { color: var(--err); }
.radio-group label.radio, .checkbox-group label.check, label.check { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; font-weight: 400; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); }
fieldset.card legend { padding: 0 8px; font-weight: 700; color: var(--teal-900); font-size: 14px; }
.star-row { font-size: 23px; color: var(--amber-500); }
.star input { display: none; }
.driver-row { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; flex-wrap: wrap; }
.driver-row input { width: auto; flex: 1 1 160px; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.switch input { display: none; }
.switch .slider { width: 40px; height: 23px; background: var(--line); border-radius: 22px; position: relative; transition: .2s; flex: none; }
.switch .slider::after { content: ""; position: absolute; width: 19px; height: 19px; background: #fff; border-radius: 50%; top: 2px; left: 2px; transition: .2s; box-shadow: var(--sh-sm); }
.switch input:checked + .slider { background: var(--teal-600); }
.switch input:checked + .slider::after { left: 18px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; line-height: 1;
  transition: transform .08s, box-shadow .15s, background .15s, border-color .15s;
  box-shadow: var(--sh-sm);
}
.btn:hover { text-decoration: none; box-shadow: var(--sh-md); }
.btn:active { transform: translateY(1px); }
.btn-primary, .btn-primary:hover { color: var(--pri-ink); border-color: transparent; }
.btn-primary { background: linear-gradient(135deg, var(--teal-600), var(--teal-700)); box-shadow: 0 4px 12px rgba(15,118,110,.28); }
.btn-primary:hover { background: linear-gradient(135deg, var(--teal-500), var(--teal-600)); box-shadow: 0 6px 18px rgba(15,118,110,.34); }
.btn-secondary { background: #fff; color: var(--teal-900); border-color: var(--line); }
.btn-secondary:hover { background: var(--teal-050); border-color: var(--teal-500); }
.btn-danger { background: var(--err); color: #fff; border-color: var(--err); }
.btn:disabled, .btn.is-disabled { opacity: .45; cursor: not-allowed; pointer-events: none; box-shadow: none; }
.actions, .form-actions, .modal-actions, .status-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 16px 0; }
.filters { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--sh-md); margin-bottom: 16px; }
.filters .field { margin-bottom: 0; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--sh-md); }
.data-table th, .data-table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.data-table th { background: #f7fafa; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--mute); font-weight: 700; }
.data-table th a { color: var(--mute); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--teal-050); }
.data-table .total-row td { background: #f7fafa; }
.meta { color: var(--mute); font-size: 13px; margin: 6px 0 14px; }

/* badges / pills */
.badge, .pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  text-transform: capitalize; letter-spacing: .01em;
  background: var(--line-soft); color: var(--mute); border: 1px solid transparent;
}
.badge::before, .pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active, .badge-success, .badge-approved, .badge-paid, .badge-open { background: var(--ok-bg); color: var(--ok); }
.badge-pending, .badge-warn, .badge-review, .badge-in_review { background: var(--warn-bg); color: var(--warn); }
.badge-cancelled, .badge-error, .badge-rejected, .badge-closed, .badge-expired, .badge-denied { background: var(--err-bg); color: var(--err); }
.badge-info, .badge-draft, .badge-new { background: var(--info-bg); color: var(--teal-700); }

/* ── Alerts / flash ─────────────────────────────────────────────────────── */
.flash, .alert { padding: 12px 16px; border-radius: var(--radius-sm); margin: 14px auto; max-width: var(--maxw); border: 1px solid transparent; font-size: 14px; }
.flash { max-width: var(--maxw); margin: 14px auto 0; }
.flash-info, .alert-info { background: var(--info-bg); color: var(--teal-900); border-color: #cbe6e2; }
.flash-success, .alert-success { background: var(--ok-bg); color: #0c5e41; border-color: #bce6d3; }
.flash-warn, .alert-warn { background: var(--warn-bg); color: #7a4f08; border-color: #f3e0b6; }
.flash-error, .alert-error { background: var(--err-bg); color: #8a2424; border-color: #f3c9c9; }

/* ── Stepper ────────────────────────────────────────────────────────────── */
.stepper { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 24px; flex-wrap: wrap; }
.stepper .step { display: flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--mute); font-size: 13px; font-weight: 600; box-shadow: var(--sh-sm); }
.stepper .step.is-current { background: linear-gradient(135deg, var(--teal-600), var(--teal-700)); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(15,118,110,.3); }
.stepper .step-no { display: inline-grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; background: var(--line-soft); color: var(--mute); font-size: 12px; font-weight: 700; }
.stepper .step.is-current .step-no { background: rgba(255,255,255,.25); color: #fff; }

/* ── Home: KPIs + modules ───────────────────────────────────────────────── */
.kpis, .kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin: 6px 0 8px; }
.kpi, .kpi-tile {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--sh-md);
  transition: transform .15s, box-shadow .15s;
}
.kpi::before, .kpi-tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, var(--teal-500), var(--teal-700)); }
.kpi:nth-child(2)::before { background: linear-gradient(180deg, var(--amber-500), #d97706); }
.kpi:hover, .kpi-tile:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); }
.kpi .n, .kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: var(--teal-900); line-height: 1.1; }
.kpi .l, .kpi-label { color: var(--mute); font-size: 13px; font-weight: 600; margin-top: 2px; }

.modules, .module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.module-card {
  position: relative; display: block;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; color: var(--ink); box-shadow: var(--sh-md);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.module-card strong { font-size: 16px; color: var(--teal-900); }
.module-card small { color: var(--mute); }
.module-card::after { content: "→"; position: absolute; top: 16px; right: 18px; color: var(--faint); font-weight: 700; transition: transform .15s, color .15s; }
.module-card:hover { transform: translateY(-3px); border-color: var(--teal-500); box-shadow: var(--sh-lg); text-decoration: none; }
.module-card:hover::after { transform: translateX(3px); color: var(--teal-600); }

/* premium hero (quote pricing) */
.premium-hero {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--teal-700), var(--teal-900));
  color: #fff; border-radius: var(--radius); padding: 26px 28px;
  box-shadow: var(--sh-lg); margin: 8px 0 22px;
}
.premium-hero .amount { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.premium-hero .amount::before { content: "$"; font-size: 26px; font-weight: 600; opacity: .8; margin-right: 2px; }
.premium-hero .ccy { font-size: 16px; font-weight: 700; opacity: .85; }
.premium-hero .compute { margin-left: auto; font-size: 13px; opacity: .75; }

/* rating factors */
.factors { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 10px; margin: 8px 0; }
.factor { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; box-shadow: var(--sh-sm); }
.factor dt { font-size: 12px; color: var(--mute); text-transform: capitalize; }
.factor dd { margin: 2px 0 0; font-weight: 700; color: var(--teal-900); }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabbtns, .tab-bar, .tablist { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabbtns .btn, .tab { box-shadow: none; }
.tabbtns .btn.active, .tab.active { background: var(--teal-050); color: var(--teal-700); border-color: var(--teal-500); }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; background: rgba(11,61,57,.45); display: grid; place-items: center; z-index: 50; backdrop-filter: blur(3px); }
.modal[hidden] { display: none; }
.modal .modal-box, .modal-card, .modal-panel { background: #fff; border-radius: var(--radius); padding: 24px; max-width: 480px; width: 90%; box-shadow: var(--sh-lg); }

/* ── Toasts ─────────────────────────────────────────────────────────────── */
.toast-root { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { padding: 11px 18px; border-radius: var(--radius-sm); color: #fff; box-shadow: var(--sh-lg); font-weight: 600; font-size: 14px; }
.toast-info { background: var(--teal-700); } .toast-success { background: var(--ok); } .toast-warn { background: var(--warn); } .toast-error { background: var(--err); }

/* autocomplete / lists */
ul.ac-list, ul.results, ul.ac-results { list-style: none; padding: 0; margin: 4px 0; border: 1px solid var(--line); border-radius: var(--radius-sm); max-height: 200px; overflow: auto; background: #fff; box-shadow: var(--sh-md); }
ul.ac-list li, ul.results li, ul.ac-results li { padding: 8px 12px; cursor: pointer; }
ul.ac-list li:hover, ul.results li:hover, ul.ac-results li:hover { background: var(--teal-050); }

/* pagination */
.pagination { display: flex; gap: 12px; align-items: center; margin: 16px 0; }
.pagination span { color: var(--mute); font-size: 13px; font-weight: 600; }

/* misc helpers used across pages */
.muted { color: var(--mute); }
.creds-hint summary { cursor: pointer; font-weight: 600; color: var(--teal-700); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.kv dt { color: var(--mute); font-size: 13px; }
.kv dd { margin: 0; font-weight: 600; }
.danger-zone { border: 1px solid #f3c9c9; background: #fef9f9; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.footer { max-width: var(--maxw); margin: 36px auto 28px; padding: 18px 24px 0; color: var(--mute); font-size: 13px; display: flex; gap: 18px; align-items: center; border-top: 1px solid var(--line); }
.footer [data-testid="footer-status"] { color: var(--ok); font-weight: 700; }
.footer a { color: var(--mute); font-weight: 600; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } .topbar { gap: 12px; padding: 10px 16px; } .content { padding: 0 16px; } }
