/* PutScreener — global stylesheet.
   ------------------------------------------------------------------ */

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

:root {
  /* Brand palette (per the PutScreener brand book). */
  --navy:      #0B2540;   /* primary brand */
  --navy-2:    #0E2A4A;   /* gradient companion */
  --navy-deep: #081B30;   /* darkest, for sidebar bottom edge */
  --green:     #15A66E;   /* "Verde Prima" — premium / positive accent */
  --green-2:   #34D399;   /* "Verde Señal" — signal / highlight */
  --red:       #E0533D;   /* error / negative */
  --fog:       #F4F7FA;   /* page background */
  --line:      #E3E8EF;   /* hairline borders */
  --muted:     #5C6B7A;   /* secondary text */
  --tint:      #E6F6EF;   /* success tint background (chips) */

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Spacing scale (4px base) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;

  /* Radii / shadows */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(11,37,64,.06);
  --shadow-md: 0 4px 12px rgba(11,37,64,.08);
  --shadow-lg: 0 12px 40px rgba(11,37,64,.14);

  /* Layout */
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--fog);
  color: var(--navy);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 24px; font-weight: 700; letter-spacing: -.2px; margin: 0 0 4px; }
h2 { font-size: 18px; font-weight: 700; margin: 0 0 8px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
p  { margin: 0 0 12px; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }


/* ── App shell ─────────────────────────────────────────────────── */
/* Desktop: sidebar fija a la izquierda + main area que ocupa el resto.
   Móvil: la sidebar se transforma en un topbar horizontal compacto.   */

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy-2), var(--navy));
  color: #cdd9e5;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  text-decoration: none;
}
.sidebar-brand img { width: 34px; height: 34px; }
.sidebar-brand .wordmark {
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .2px;
}
.sidebar-brand .wordmark span { color: var(--green-2); }

/* Hamburger toggle — invisible on desktop, becomes the primary nav
   trigger at ≤768px. Lives inside the sidebar so its position in
   the topbar (right-aligned via margin-left:auto in the foot row)
   stays consistent with the brand. */
.sidebar-toggle {
  display: none;
  background: rgba(255,255,255,.06);
  color: #fff;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background .12s ease, border-color .12s ease;
}
.sidebar-toggle:hover {
  background: rgba(52,211,153,.16);
  border-color: rgba(52,211,153,.45);
}
.sidebar-toggle svg { display: block; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  color: #aebece;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--r-md);
  text-decoration: none;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,.05);
  color: #fff;
  text-decoration: none;
}
.sidebar-nav a.active {
  background: rgba(52,211,153,.14);
  color: #fff;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px;
  color: #8298ad;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-foot .user-email { color: #cdd9e5; word-break: break-all; }

/* Sidebar form controls.
   ------------------------------------------------------------------
   The <select> and <button> live inside the navy sidebar, so they
   must keep a dark base AND override the browser's native :hover /
   :focus chrome (without explicit backgrounds, browsers paint white
   on hover and the light text disappears against it). Both `appearance:
   none` calls strip the native chrome so we get a consistent look
   across Chrome / Firefox / Safari. */
.sidebar-foot select,
.sidebar-foot button {
  font: inherit;
  font-weight: 500;
  color: #ffffff;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: background .12s ease, border-color .12s ease;
}
.sidebar-foot select:hover,
.sidebar-foot button:hover {
  background: rgba(52,211,153,.16);   /* green-2 tint, on-brand hover */
  border-color: rgba(52,211,153,.45);
  color: #ffffff;
}
.sidebar-foot select:focus,
.sidebar-foot button:focus {
  outline: 0;
  border-color: var(--green-2);
  box-shadow: 0 0 0 3px rgba(52,211,153,.18);
}

/* The <select> arrow is part of the native chrome we just stripped —
   paint a small chevron SVG via background-image instead. */
.sidebar-foot select {
  padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none'><path d='M1 1l5 5 5-5' stroke='%23ffffff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 7px;
}

/* The dropdown <option> list is rendered by the OS / browser and
   barely respects CSS — but Firefox + recent Chromium honor these,
   so set them anyway. Worst case the native styling kicks in (white
   bg, dark text), which is also legible. */
.sidebar-foot select option {
  background: var(--navy);
  color: #ffffff;
}

.main {
  flex: 1;
  padding: 28px 34px;
  overflow: auto;
}

.page-header {
  display: flex;
  align-items: flex-end;
  margin-bottom: 24px;
  gap: 16px;
}
.page-header .lede { color: var(--muted); font-size: 13px; margin: 0; }


/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}


/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  padding: 11px 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .12s ease;
  text-align: center;
}
.btn-primary {
  background: var(--navy);
  color: #fff;
}
.btn-primary:hover { background: var(--navy-2); color: #fff; text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--green);
}
.btn-block { display: block; width: 100%; }


/* ── Forms ──────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.form label { font-size: 13px; font-weight: 600; color: var(--navy); }
.form input[type="email"],
.form input[type="text"],
.form input[type="number"] {
  font: inherit;
  padding: 11px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--navy);
}
.form input:focus {
  outline: 0;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(21,166,110,.15);
}


/* ── Flash messages ─────────────────────────────────────────────── */
.flashes { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 6px; }
.flash {
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  border: 1px solid transparent;
}
.flash-info    { background: #EFF4FB; color: #234C82; border-color: #DBE6F4; }
.flash-success { background: var(--tint); color: #0c7a52; border-color: #C9EBD9; }
.flash-error   { background: #FCE6E0; color: #B23A26; border-color: #F5C7BD; }


/* ── Auth pages (login / sent / expired) ────────────────────────── */
/* Auth views render WITHOUT the app shell — they get their own
   centered card layout against a soft navy → fog vertical wash. */

.auth-bg {
  min-height: 100vh;
  background:
    linear-gradient(180deg, var(--navy-2) 0%, var(--navy) 280px, var(--fog) 280px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px;
}
.auth-shell {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-weight: 700;
  font-size: 22px;
}
.auth-brand img { width: 44px; height: 44px; }
.auth-brand .wordmark span { color: var(--green-2); }

.auth-card {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
}
.auth-card h1 { font-size: 22px; margin-bottom: 8px; }
.auth-card p  { color: var(--muted); font-size: 14px; }
.auth-card .form { max-width: none; }
.auth-card .form button { margin-top: 8px; }


/* ── Alerts list (#15) ──────────────────────────────────────────── */

.alerts-filters {
  padding: 16px 18px;
  margin-bottom: 16px;
}
.alerts-filters .filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filter-field > span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted);
}
.filter-field input,
.filter-field select {
  font: inherit;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--navy);
  min-width: 0;
}
.filter-field input:focus,
.filter-field select:focus {
  outline: 0;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(21,166,110,.15);
}

.alerts-table-card { padding: 0; overflow: hidden; }

.alerts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.alerts-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  white-space: nowrap;
}
.alerts-table thead th a {
  color: inherit;
  text-decoration: none;
  display: inline-block;
}
.alerts-table thead th a:hover { color: var(--navy); }
.alerts-table thead th.sorted { color: var(--navy); }
.alerts-table thead th .sort-caret {
  display: inline-block;
  margin-left: 4px;
  font-size: 9px;
  color: var(--green);
}

.alerts-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.alerts-table tbody tr:last-child td { border-bottom: 0; }
.alerts-table .tkr { font-weight: 700; color: var(--navy); }
.alerts-table .mono { font-family: var(--font-mono); }

.alert-row { cursor: pointer; transition: background .08s ease; }
.alert-row:hover  { background: var(--fog); }
.alert-row:focus  { outline: 2px solid var(--green-2); outline-offset: -2px; }

.alerts-table.compact thead th,
.alerts-table.compact tbody td { padding: 10px 12px; }

/* Outcome chips */
.chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: .3px;
  white-space: nowrap;
}
.chip-lg { font-size: 13px; padding: 7px 14px; }
.c-win     { background: var(--tint); color: #0c7a52; }
.c-loss    { background: #FCE6E0;     color: #B23A26; }
.c-open    { background: #E7EDF4;     color: #22507E; }
.c-neutral { background: #F4F7FA;     color: var(--muted); }
/* "Operada" — distinct from Pending (blue) and Win (green) so the
   user can tell at a glance which alerts are already in flight. */
.c-traded  { background: #FFF6DD;     color: #8A5A00; }
.pos { color: var(--green); font-weight: 600; }
.neg { color: var(--red);   font-weight: 600; }

.paginator {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
  font-size: 13px;
}
.paginator-stats { color: var(--muted); margin-right: auto; }
.paginator-buttons { display: flex; gap: 8px; }
.paginator .btn { padding: 6px 14px; font-size: 13px; }
.paginator-summary {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--muted);
  font-size: 13px;
}

.alerts-empty {
  padding: 64px 18px;
  text-align: center;
  color: var(--muted);
}

/* ── Alert detail (#15) ─────────────────────────────────────────── */

.detail-header { align-items: flex-start; }
.detail-header .tkr  { color: var(--green); }
.detail-outcome      { margin-left: auto; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.kpi .k {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 8px;
}
.kpi .v {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-mono);
}
.kpi .v.green { color: var(--green); }

.detail-card { margin-bottom: 18px; }
.detail-card h2 { margin-bottom: 14px; }

.detail-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  margin: 0;
  font-size: 13px;
}
.detail-grid dt {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .3px;
}
.detail-grid dd {
  margin: 0;
  font-family: var(--font-mono);
  color: var(--navy);
}

/* Confirm-opened form on alert detail (#11). Two-column grid for
   the small numeric inputs (Contracts, Premium) on desktop; stacks
   on mobile via the existing media query. */
.confirm-position-form { max-width: none; }
.confirm-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 8px;
}
.confirm-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  max-width: none;
}
.confirm-field > span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
  color: var(--muted);
  text-transform: uppercase;
}
.confirm-field input[type="number"],
.confirm-field input[type="text"] {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
  color: var(--navy);
  font-family: var(--font-mono);
}
.confirm-field input:focus {
  outline: 0;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(21,166,110,.15);
}

.position-state {
  border-left: 3px solid var(--green);
}

/* Feedback card (#7) — sits on alert detail + as standalone form for
   the email magic-link landing. */
.feedback-card { border-left: 3px solid var(--green-2); }
.feedback-inline-form { max-width: none; }

.feedback-status,
.feedback-reasons {
  border: 0;
  padding: 0;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feedback-status { flex-direction: row; flex-wrap: wrap; gap: 10px; }
.feedback-status legend,
.feedback-reasons legend {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 4px;
  padding: 0;
}

/* Status radios styled as pill toggles. */
.feedback-status-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: border-color .12s, background .12s;
}
.feedback-status-option:hover { border-color: var(--green); }
.feedback-status-option input[type="radio"] { margin: 0; accent-color: var(--green); }
.feedback-status-option:has(input:checked) {
  background: var(--tint);
  border-color: var(--green);
  color: #0c7a52;
}

/* Reasons checkboxes — stacked, low-key. */
.feedback-reason {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 14px;
  color: var(--navy);
  cursor: pointer;
}
.feedback-reason input[type="checkbox"] { accent-color: var(--green); }

/* Free-text note styling, reused from form patterns. */
.feedback-inline-form textarea,
.form textarea {
  font: inherit;
  font-family: var(--font-sans);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
  color: var(--navy);
  width: 100%;
  resize: vertical;
}
.feedback-inline-form textarea:focus,
.form textarea:focus {
  outline: 0;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(21,166,110,.15);
}

/* "Current price" card on the detail page — two-up grid with the
   live spot and the distance to strike. */
.spot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 8px;
}
.spot-grid .k {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 6px;
}
.spot-grid .v {
  font-size: 22px;
  font-weight: 700;
}
.small { font-size: 12px; }

/* ── Metrics dashboard (#16) ───────────────────────────────────── */

/* Two-column row of cards. Collapses to single column on mobile via
   the existing media query. */
.metrics-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}
.metric-card { margin-bottom: 0; }  /* metrics-row already adds margin */
.metric-card h2 { font-size: 15px; margin-bottom: 2px; }
.metric-card .csub { font-size: 12px; margin: 0 0 14px; }

.metrics-kpis .trend {
  font-size: 11px;
  margin-top: 6px;
  letter-spacing: .3px;
}
.metrics-kpis .kpi .v.neg { color: var(--red); }
.metrics-kpis .kpi .v small { font-size: 14px; font-weight: 600; }

.chart { display: block; }
.chart-legend { margin-top: 6px; }

.empty-state {
  padding: 28px 0;
  text-align: center;
}

/* Donut + legend layout (one row on desktop, stack on mobile). */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 22px;
}
.donut-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
  flex: 1;
}
.donut-legend li {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
}
.donut-legend li:last-child { border-bottom: 0; }
.donut-legend .sw {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: block;
}
.donut-legend .lg-label { color: var(--navy); }
.donut-legend .lg-val { color: var(--muted); }

/* Bar list — used for "Win rate by DTE" and "Win rate by source". */
.bar-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.bar-list li {
  display: grid;
  grid-template-columns: 80px 1fr 44px auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.bar-list li:last-child { border-bottom: 0; }
.bar-label { font-size: 13px; font-weight: 600; color: var(--navy); }
.bar-track {
  height: 8px;
  background: var(--fog);
  border-radius: 8px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-2));
  border-radius: 8px;
  transition: width .2s ease;
}
.bar-value { font-size: 13px; text-align: right; }
.bar-context { white-space: nowrap; }

/* ── Settings: /settings/capital (#9) ──────────────────────────── */

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.settings-card { margin-bottom: 0; }
.settings-card h2 { font-size: 15px; margin-bottom: 2px; }
.settings-card .csub { font-size: 12px; margin: 0 0 14px; }

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  max-width: 320px;
}
.settings-field .field-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
  color: var(--muted);
  text-transform: uppercase;
}

.amount-input {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
  overflow: hidden;
}
.amount-input:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(21,166,110,.15);
}
.amount-input .amount-prefix {
  background: var(--fog);
  padding: 11px 14px;
  font-family: var(--font-mono);
  color: var(--muted);
  border-right: 1px solid var(--line);
}
.amount-input input {
  border: 0;
  outline: 0;
  padding: 11px 12px;
  flex: 1;
  font: inherit;
  font-family: var(--font-mono);
  color: var(--navy);
  background: transparent;
}

.settings-note {
  background: var(--fog);
  border-left: 3px solid var(--green-2);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  line-height: 1.55;
  margin-top: 10px;
}

/* Slider + numeric input synced via inline onchange handlers in the
   template. The CSS just makes both feel like one control. */
.pct-control {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 520px;
}
.pct-control input[type="range"] {
  flex: 1;
  /* Vendor-prefixed track + thumb for cross-browser look. */
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: linear-gradient(90deg, var(--green) 0%, var(--green-2) 100%);
  border-radius: 4px;
  outline: none;
}
.pct-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--navy);
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(11,37,64,.25);
  cursor: pointer;
}
.pct-control input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--navy);
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(11,37,64,.25);
  cursor: pointer;
}
.pct-number-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
}
.pct-number-wrap:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(21,166,110,.15);
}
.pct-number-wrap input {
  width: 70px;
  border: 0;
  outline: 0;
  padding: 9px 4px 9px 12px;
  font: inherit;
  font-family: var(--font-mono);
  text-align: right;
  background: transparent;
  color: var(--navy);
}
.pct-number-wrap .pct-suffix {
  color: var(--muted);
  font-family: var(--font-mono);
  padding-right: 10px;
}

.pct-readout-line {
  margin-top: 10px;
  margin-bottom: 16px;
}
.pct-readout {
  font-size: 18px;
  color: var(--green);
  font-weight: 700;
}

/* Profile reference table — informational, not interactive. */
.profile-table {
  width: 100%;
  max-width: 400px;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 12px;
}
.profile-table thead th {
  text-align: left;
  padding: 8px 12px;
  background: var(--fog);
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.profile-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}
.profile-table tbody tr:last-child td { border-bottom: 0; }

.settings-explainer p {
  margin-bottom: 8px;
  color: var(--navy);
}
.settings-explainer p:last-child { margin-bottom: 0; }

.settings-actions {
  display: flex;
  justify-content: flex-end;
}

/* Settings index — card grid of sub-sections. */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.settings-tile {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 18px 20px;
  transition: border-color .12s ease, transform .08s ease;
}
.settings-tile:hover {
  border-color: var(--green);
  text-decoration: none;
  transform: translateY(-1px);
}
.settings-tile h2 { font-size: 15px; margin-bottom: 6px; }
.settings-tile p  { font-size: 13px; margin: 0; }
.settings-tile-disabled { opacity: 0.6; cursor: default; }
.settings-tile-disabled:hover { border-color: var(--line); transform: none; }

/* Push notifications status card (#6). Each state surfaces a
   distinct visual cue so the user knows where they stand at a glance. */
.push-state { padding: 10px 14px; border-radius: var(--r-md); border: 1px solid var(--line); }
.push-state-detecting   { background: #FBFCFD; }
.push-state-enabled     { background: var(--tint);  color: #0C7A52; border-color: #C9EBD9; }
.push-state-disabled    { background: #EFF4FB;      color: #234C82; border-color: #DBE6F4; }
.push-state-denied      { background: #FCE6E0;      color: #B23A26; border-color: #F5C7BD; }
.push-state-unsupported { background: var(--fog);   color: var(--muted); }
.push-state p { margin: 0; }

/* ── Mobile: collapse sidebar into a topbar ─────────────────────── */
@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    /* Replace vertical gradient with the navy header tone alone. */
    background: var(--navy);
  }
  .sidebar-brand { margin-bottom: 0; }
  .sidebar-brand img { width: 28px; height: 28px; }
  .sidebar-brand .wordmark { font-size: 15px; }

  /* Hamburger visible only on mobile; sits to the left of the
     language+logout cluster. */
  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
  }

  /* Nav links hidden at rest; pop as a dropdown drawer when
     <body> has the .nav-open class (toggled by the hamburger). */
  .sidebar-nav { display: none; }
  body.nav-open .sidebar-nav {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 52px;            /* below the topbar (≈ 52px tall) */
    left: 0; right: 0;
    background: var(--navy);
    padding: 12px 16px 16px;
    gap: 2px;
    z-index: 100;
    box-shadow: 0 12px 24px rgba(0,0,0,.35);
    border-top: 1px solid rgba(255,255,255,.08);
  }
  body.nav-open .sidebar-nav a {
    padding: 13px 14px;   /* fatter tap target on mobile */
    font-size: 15px;
  }
  /* Backdrop — a real <div> in the markup so it can capture
     tap-to-close. Hidden at rest; shown only when nav-open. */
  .nav-backdrop {
    display: none;
  }
  body.nav-open .nav-backdrop {
    display: block;
    position: fixed;
    inset: 52px 0 0 0;       /* below the topbar */
    background: rgba(11,37,64,.40);
    backdrop-filter: blur(2px);
    z-index: 99;
  }
  body.nav-open { overflow: hidden; }

  .sidebar-foot {
    margin-top: 0;
    margin-left: 0;        /* hamburger already pushed us right */
    padding-top: 0;
    border-top: 0;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  .sidebar-foot .user-email { display: none; }
  .sidebar-foot select,
  .sidebar-foot button { padding: 4px 8px; font-size: 12px; }

  .main { padding: 18px 16px; }

  /* Tables: let them scroll horizontally rather than crush columns. */
  .alerts-table-card { overflow-x: auto; }
  .alerts-table { min-width: 720px; }

  /* KPI grid: stack tighter on mobile. */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi .v { font-size: 18px; }

  /* Detail grid: stack dt/dd vertically so long values don't overflow. */
  .detail-grid { grid-template-columns: 1fr; gap: 2px 0; }
  .detail-grid dt { margin-top: 10px; }

  /* Metrics: stack everything single-column. */
  .metrics-row { grid-template-columns: 1fr; }
  .donut-wrap { flex-direction: column; align-items: flex-start; }
  .bar-list li {
    grid-template-columns: 60px 1fr 44px;
  }
  .bar-context { display: none; }   /* hide the "(2/3 resolved · 5 total)" hint */

  /* Capital settings: stack the slider + number on small screens. */
  .pct-control { flex-direction: column; align-items: stretch; gap: 12px; }
  .pct-number-wrap { align-self: flex-start; }

  /* Confirm-opened form: stack the contracts + premium pair. */
  .confirm-row { grid-template-columns: 1fr; }
}
