/* ════════════════════════════════════════════════════════════════
   Digitalo Yield — Terminal Design System
   Ported from the claude.ai/design project "Python app redesign".
   Dark = :root default · Light = [data-theme="light"].
   This is the single design system for the portal. Link it on every
   page. Use the tokens / .t-* classes below instead of literal hex.
   ════════════════════════════════════════════════════════════════ */

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

/* ── Color tokens ───────────────────────────────────────────── */
:root {
  color-scheme: dark;      /* native date/time pickers and their icons follow the theme */
  --t-bg:          #11161e;
  --t-bg-deep:     #0c1118;   /* page void / app background */
  --t-surface:     #161d27;
  --t-surface-2:   #131a23;   /* table heads, footers, inset */
  --t-surface-3:   #1a212c;   /* controls, chips */

  --t-line:        #232c39;
  --t-line-strong: #2a3442;

  --t-text:        #eaf2f0;
  --t-text-2:      #cdd6db;
  --t-text-3:      #9fb0b8;   /* section labels */
  --t-muted:       #7d8ea3;   /* ≥ 4.5:1 on every surface (test_contrast.py) */
  --t-muted-2:     #46556a;

  --t-accent:      #2fd6b8;
  --t-accent-ink:  #06231f;
  --t-accent-2:    #5a8a86;   /* dim accent text (deltas) */
  --t-accent-dim:  rgba(47,214,184,0.42);
  --t-accent-soft: rgba(47,214,184,0.14);

  --t-ok:          #2fd6b8;
  --t-ok-bg:       rgba(47,214,184,0.14);
  --t-warn:        #e0b341;
  --t-warn-bg:     rgba(224,179,65,0.16);
  --t-warn-line:   #3a2f12;
  --t-warn-fill:   #1a160a;
  --t-err:         #ec8273;   /* ≥ 4.5:1 on its chip (test_contrast.py) */
  --t-err-bg:      rgba(236,130,115,0.16);
  --t-err-ink:     #1a0a07;

  --t-vsv:         #b9a3ff;   /* VSV Flow source (prognos); ≥ 4.5:1 on its chip */
  --t-vsv-bg:      rgba(159,130,255,0.16);

  --t-avatar-bg:   #1f3340;
  --t-avatar-ink:  #7da0a8;

  /* Heatmap intensity ramp (low → high) */
  --t-heat-0:      #1a2230;
  --t-heat-1:      #1f3340;
  --t-heat-2:      #21505a;
  --t-heat-3:      #1f8076;
  --t-heat-4:      #2fd6b8;

  --t-shadow-card: 0 14px 44px rgba(10,18,28,0.32);
  --t-shadow-modal:0 30px 80px rgba(0,0,0,0.5);

  /* Type families */
  --t-font-display: 'Space Grotesk', system-ui, sans-serif;
  --t-font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
  /* Body copy (card subtitles, table cells, alerts, hints); 13 px on a phone
     (below). Nothing in this file is under 11 px (tests/test_phone_forms.py). */
  --t-fs-body: 11px;

  /* Spacing scale used by utilities.css (gap-2, mt-4, …) — most pages
     load this file without variables.css, where these were defined. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;

  /* Radii */
  --t-r-sm: 7px;
  --t-r-md: 9px;
  --t-r-lg: 10px;
  --t-r-xl: 12px;
  --t-r-2xl: 14px;
  --t-r-full: 999px;
}

[data-theme="light"] {
  color-scheme: light;
  --t-bg:          #ffffff;
  --t-bg-deep:     #eef1f4;
  --t-surface:     #ffffff;
  --t-surface-2:   #f4f7fa;
  --t-surface-3:   #f4f7fa;

  --t-line:        #e2e7ec;
  --t-line-strong: #d4dce2;

  --t-text:        #1a2230;
  --t-text-2:      #3d4a59;
  --t-text-3:      #4a5a68;
  --t-muted:       #5c6c78;   /* ≥ 4.5:1 on every surface (test_contrast.py) */
  --t-muted-2:     #aab8c0;

  --t-accent:      #0a7267;   /* white on it, and it on its soft tint, ≥ 4.5:1 (test_contrast.py) */
  --t-accent-ink:  #ffffff;
  --t-accent-2:    #3c8278;
  --t-accent-dim:  rgba(10,114,103,0.42);
  --t-accent-soft: rgba(10,114,103,0.12);

  --t-ok:          #0a7267;
  --t-ok-bg:       #e3f4ef;
  --t-warn:        #8a5f00;   /* ≥ 4.5:1 on its chip and alert */
  --t-warn-bg:     #fbf0d8;
  --t-warn-line:   #ecdcae;
  --t-warn-fill:   #fbf5e6;
  --t-err:         #c0392b;
  --t-err-bg:      #fdeceb;
  --t-err-ink:     #ffffff;

  --t-vsv:         #6d3fc0;
  --t-vsv-bg:      #efe8fb;

  --t-avatar-bg:   #d8e6e9;
  --t-avatar-ink:  #3c6b73;

  --t-heat-0:      #e9eef1;
  --t-heat-1:      #cfeae4;
  --t-heat-2:      #a3dcd1;
  --t-heat-3:      #4fb3a6;
  --t-heat-4:      #0a7267;

  --t-shadow-card: 0 14px 44px rgba(20,35,50,0.16);
  --t-shadow-modal:0 30px 80px rgba(20,35,50,0.28);
}

/* ── Global base (Terminal pages) ───────────────────────────── */
* { box-sizing: border-box; }
body.t-app {
  margin: 0;
  background: var(--t-bg-deep);
  color: var(--t-text);
  font-family: var(--t-font-display);
  -webkit-font-smoothing: antialiased;
}
body.t-app ::placeholder { color: var(--t-muted); }   /* often the field's only label */
body.t-app input:focus, body.t-app textarea:focus, body.t-app select:focus {
  border-color: var(--t-accent);
}
/* Keyboard focus is visible on every control (a mouse or a finger draws
   none); the border alone was too faint, and inputs had no ring at all. */
:focus-visible { outline: 2px solid var(--t-accent); outline-offset: 2px; }
.t-mono { font-family: var(--t-font-mono); }
.t-display { font-family: var(--t-font-display); }

/* ── Desktop top nav (injected by Auth.renderNav) ───────────── */
.t-topnav {
  background: var(--t-bg);
  border-bottom: 1px solid var(--t-line);
  padding: 0 28px;
}
.t-topnav__inner {
  max-width: 1240px; margin: 0 auto;
  display: flex; align-items: center; gap: 24px; height: 62px;
}
.t-brand { display: flex; align-items: center; gap: 10px; }
.t-brand__mark {
  width: 26px; height: 26px; border-radius: var(--t-r-sm);
  background: var(--t-accent); color: var(--t-accent-ink);
  display: flex; align-items: center; justify-content: center;
  font: 700 14px var(--t-font-display);
}
.t-brand__name { font: 600 15px var(--t-font-display); color: var(--t-text); letter-spacing: .01em; }
/* One row at every width: .t-nav__links never wraps; the links that don't
   fit are moved into the "⋯" menu by auth.js fitNav(). */
.t-brand { flex: none; }
.t-nav { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.t-nav__links { display: flex; gap: 4px; flex-wrap: nowrap; overflow: hidden; min-width: 0; }
.t-navlink {
  font: 500 12px var(--t-font-mono); color: var(--t-text-3);
  padding: 0 13px; min-height: 44px; display: inline-flex; align-items: center;
  border-radius: var(--t-r-sm); text-decoration: none; flex: none;
  border: 0; background: transparent; cursor: pointer; white-space: nowrap;
}
.t-navlink:hover { color: var(--t-text); background: var(--t-surface-3); }
.t-navlink--active, .t-navlink--active:hover { color: var(--t-accent); background: var(--t-accent-soft); }
.t-navmore { position: relative; flex: none; }
.t-navmore__btn { min-width: 44px; justify-content: center; padding: 0 10px; }
.t-navmore__menu { left: 0; right: auto; }
.t-menu__item--active { color: var(--t-accent); background: var(--t-accent-soft); }
.t-topnav__right { margin-left: auto; flex: none; display: flex; align-items: center; gap: 14px; }
/* The hidden attribute always wins over an inline display (forms here are
   often style="display:grid"). */
[hidden] { display: none !important; }

/* Shown only when requests find no network (auth.js setOnline). */
.t-offline {
  position: sticky; top: 0; z-index: 1000; padding: 8px 16px; text-align: center;
  font: 500 12px var(--t-font-mono); color: var(--t-err-ink); background: var(--t-err);
}
.t-offline[hidden] { display: none; }
.t-localcopy { padding: 6px 16px; text-align: center; font: 600 12px var(--t-font-mono);
  color: #1a1300; background: #f5c542; }
.t-load-err { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 0;
  font: 400 12px var(--t-font-mono); color: var(--t-err); }
.t-user {
  display: flex; align-items: center; gap: 8px; min-height: 44px;
  padding-left: 14px; border-left: 1px solid var(--t-line);
  background: none; border-top: 0; border-right: 0; border-bottom: 0;
  cursor: pointer; font: 500 12px var(--t-font-mono); color: var(--t-text-2);
}
.t-avatar {
  width: 28px; height: 28px; border-radius: var(--t-r-full);
  background: var(--t-avatar-bg); color: var(--t-avatar-ink);
  display: flex; align-items: center; justify-content: center;
  font: 600 11px var(--t-font-mono);
}
.t-iconbtn {
  width: 32px; height: 32px; flex: none; border-radius: 8px;
  border: 1px solid var(--t-line-strong); background: var(--t-surface-3);
  color: var(--t-text-3); display: inline-flex; align-items: center;
  justify-content: center; cursor: pointer; padding: 0;
}
.t-iconbtn:hover { color: var(--t-accent); border-color: var(--t-accent); }

/* ── Account dropdown (top-nav avatar menu) ─────────────────── */
.t-account { position: relative; }
.t-user__caret { color: var(--t-muted); margin-left: 2px; }
.t-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 220px; z-index: 1100;
  background: var(--t-surface); border: 1px solid var(--t-line-strong);
  border-radius: var(--t-r-xl); box-shadow: var(--t-shadow-modal);
  padding: 6px; overflow: hidden;
}
.t-menu--open { display: block; }
.t-menu__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 10px 12px; border-bottom: 1px solid var(--t-line); margin-bottom: 6px;
}
.t-menu__name { font: 600 12px var(--t-font-mono); color: var(--t-text); }
.t-menu__item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  padding: 10px; min-height: 44px; border-radius: var(--t-r-sm); text-decoration: none;
  font: 500 12px var(--t-font-mono); color: var(--t-text-2);
}
.t-menu__item:hover { background: var(--t-surface-3); color: var(--t-text); }
.t-menu__item--danger { color: var(--t-err); }

/* ── Trailing action clusters (chips + buttons) ─────────────── */
.t-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ── Mobile bottom tab bar (injected by Auth.renderNav) ─────── */
.t-bottomnav { display: none; }

/* ── Page shell ─────────────────────────────────────────────── */
.t-page { max-width: 1240px; margin: 0 auto; padding: 28px; }
.t-page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.t-kicker {
  font: 500 11px var(--t-font-mono); letter-spacing: .14em;
  text-transform: uppercase; color: var(--t-muted);
}
.t-title { font: 700 24px var(--t-font-display); color: var(--t-text); margin-top: 8px; }

/* ── Card ───────────────────────────────────────────────────── */
.t-card {
  background: var(--t-surface); border: 1px solid var(--t-line);
  border-radius: var(--t-r-lg); padding: 22px;
}
.t-card--flush { padding: 0; overflow: hidden; }
.t-card__head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; background: var(--t-surface-2);
  border-bottom: 1px solid var(--t-line);
}
.t-card-title {
  font: 600 13px var(--t-font-mono); color: var(--t-text-3); letter-spacing: .04em;
}
.t-card-sub { font: 400 var(--t-fs-body) var(--t-font-mono); color: var(--t-muted); margin-top: 4px; line-height: 1.6; }

/* ── Stat tiles ─────────────────────────────────────────────── */
.t-stats { display: grid; gap: 12px; }
.t-stat {
  background: var(--t-surface); border: 1px solid var(--t-line);
  border-radius: var(--t-r-md); padding: 14px 15px;
}
.t-stat__label {
  font: 500 11px var(--t-font-mono); letter-spacing: .08em;
  text-transform: uppercase; color: var(--t-muted);
}
.t-stat__value { font: 600 20px var(--t-font-mono); color: var(--t-text); margin-top: 7px; }
.t-stat__value--accent { color: var(--t-accent); }
.t-stat__value--warn { color: var(--t-warn); }
.t-stat__value--err { color: var(--t-err); }
.t-stat__value--lg { font-size: 26px; }
.t-stat__delta { font: 400 var(--t-fs-body) var(--t-font-mono); color: var(--t-accent-2); margin-top: 5px; }
.t-stat__delta--muted { color: var(--t-muted); }

/* ── Mono data table ────────────────────────────────────────── */
.t-table { width: 100%; border-collapse: collapse; }
.t-table th {
  text-align: left; font: 500 11px var(--t-font-mono); color: var(--t-muted);
  letter-spacing: .06em; text-transform: uppercase;
  padding: 11px 14px; background: var(--t-surface-2);
  border-bottom: 1px solid var(--t-line); white-space: nowrap;
}
.t-table td {
  font: 400 var(--t-fs-body) var(--t-font-mono); color: var(--t-text-2);
  padding: 9px 14px; border-top: 1px solid var(--t-line);
}
.t-table tbody tr:hover td { background: var(--t-surface-3); }
.t-table .t-td--ref { color: var(--t-accent); font-weight: 500; }
.t-table .t-td--strong { color: var(--t-text); font-weight: 500; }
.t-table .t-td--num { text-align: right; }
.t-th--num, .t-table th.t-th--num { text-align: right; }   /* over .t-table th */
/* A wide table on a phone: each row becomes a block of label/value pairs.
   <table class="t-table-stack"> with <td data-label="…">; a cell without
   a label (a chip, a button) shows on its own. */
@media (max-width: 560px) {
  .t-table-stack thead { display: none; }
  .t-table-stack, .t-table-stack tbody, .t-table-stack tr { display: block; width: 100%; }
  .t-table-stack tr { padding: 8px 0; border-top: 1px solid var(--t-line); }
  .t-table-stack td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
                      padding: 3px 0 !important; border: 0 !important; text-align: right; overflow-wrap: anywhere; }
  .t-table-stack td[data-label]::before { content: attr(data-label); flex: none; text-align: left;
                      font: 500 11px var(--t-font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--t-muted); }
  .t-table-stack td:not([data-label]) { justify-content: flex-start; flex-wrap: wrap; }
}

/* ── Buttons ────────────────────────────────────────────────── */
.t-btn {
  border: none; border-radius: var(--t-r-sm); padding: 9px 16px; cursor: pointer;
  font: 600 12px var(--t-font-mono); display: inline-flex; align-items: center;
  justify-content: center; gap: 7px; text-decoration: none;
}
.t-btn--lg { padding: 13px; border-radius: var(--t-r-xl); font-size: 14px; }
.t-btn--block { width: 100%; }
.t-btn--accent { background: var(--t-accent); color: var(--t-accent-ink); }
.t-btn--err    { background: var(--t-err);    color: var(--t-err-ink); }
.t-btn--ghost  { background: var(--t-surface-3); color: var(--t-text-3); border: 1px solid var(--t-line-strong); }
.t-btn:disabled { opacity: 0.55; cursor: default; }

/* ── Form fields ────────────────────────────────────────────── */
.t-field { display: flex; flex-direction: column; }
.t-field__label {
  font: 500 11px var(--t-font-mono); letter-spacing: .1em;
  text-transform: uppercase; color: var(--t-muted); margin-bottom: 6px;
}
.t-field__label--edit { color: var(--t-accent); }
.t-input, .t-textarea, .t-select {
  width: 100%; background: var(--t-bg); border: 1px solid var(--t-line-strong);
  border-radius: var(--t-r-sm); padding: 9px 11px; color: var(--t-text);
  font: 500 12px var(--t-font-mono);
}
.t-input--lg { padding: 14px; border-radius: var(--t-r-lg); font-size: 15px; }
.t-input--edit { border-color: var(--t-accent); }
.t-input--locked { background: var(--t-bg-deep); color: var(--t-muted); }
.t-textarea { resize: vertical; }
.t-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.t-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
/* let grid children shrink so inner overflow:auto scrollers (wide tables)
   contain themselves instead of stretching the card past its edges */
.t-grid-2 > *, .t-grid-3 > * { min-width: 0; }

/* ── Dropzone ───────────────────────────────────────────────── */
.t-dropzone {
  border: 2px dashed var(--t-line-strong); border-radius: var(--t-r-lg);
  padding: 30px 20px; text-align: center; cursor: pointer;
}
.t-dropzone__title { font: 600 12px var(--t-font-mono); color: var(--t-text-2); }
.t-dropzone__hint { font: 400 var(--t-fs-body) var(--t-font-mono); color: var(--t-muted); margin-top: 6px; }
/* Wording that depends on the pointer: "drag & drop" only where there is a mouse */
.t-when-touch { display: none; }
@media (pointer: coarse) {
  .t-when-touch { display: inline; }
  .t-when-fine { display: none; }
}

/* ── Badges / chips ─────────────────────────────────────────── */
.t-chip {
  border-radius: 6px; padding: 3px 10px;
  font: 600 11px var(--t-font-mono); letter-spacing: .04em;
  display: inline-block; white-space: nowrap;
}
.t-chip--warn { background: var(--t-warn-bg); color: var(--t-warn); }
.t-chip--ok   { background: var(--t-ok-bg);   color: var(--t-ok); }
.t-chip--err  { background: var(--t-err-bg);  color: var(--t-err); }
.t-chip--neutral { background: var(--t-avatar-bg); color: var(--t-avatar-ink); }
.t-chip--muted { background: var(--t-surface-3); color: var(--t-muted); }

/* ── Filter pills ───────────────────────────────────────────── */
.t-filter {
  flex: none; background: var(--t-surface-3); color: var(--t-text-3);
  border: 1px solid var(--t-line-strong); border-radius: var(--t-r-full);
  padding: 6px 14px; font: 500 11px var(--t-font-mono); cursor: pointer;
}
.t-filter--active { background: var(--t-accent); color: var(--t-accent-ink); border-color: transparent; }

/* ── Tabs ───────────────────────────────────────────────────── */
.t-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--t-line); flex-wrap: wrap; }
.t-tab {
  font: 500 11px var(--t-font-mono); color: var(--t-muted);
  padding: 9px 13px; min-height: 44px; cursor: pointer; border: 0; background: transparent;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.t-tab:hover { color: var(--t-text-2); }
/* Page tabs (Auth.tabs): one row that scrolls sideways when narrow — the
   cut-off last tab shows there is more, and no second "⋯" competes with the
   nav's. */
.t-tabs--scroll {
  position: relative; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; margin-bottom: 18px;
}
.t-tabs--scroll::-webkit-scrollbar { display: none; }
.t-tabs--scroll .t-tab { flex: none; font-size: 12px; margin-bottom: 0; }
.t-tabs--more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
                      mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
.t-tabs--more-left { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent);
                     mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent); }
.t-tabs--more-left.t-tabs--more-right {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); }
.t-tab--active { color: var(--t-text); border-bottom-color: var(--t-accent); }

/* ── Calendar / heatmap (Puls) ──────────────────────────────── */
.t-cal { display: flex; flex-direction: column; gap: 4px; }
.t-cal__dow { display: grid; grid-template-columns: 24px repeat(7,1fr); gap: 4px; margin-bottom: 5px; }
.t-cal__dow span { font: 500 11px var(--t-font-mono); color: var(--t-muted); text-align: center; }
.t-cal__week { display: grid; grid-template-columns: 24px repeat(7,1fr); gap: 4px; align-items: center; }
.t-cal__iso { font: 500 11px var(--t-font-mono); color: var(--t-muted-2); text-align: right; padding-right: 2px; }
.t-cal__cell {
  aspect-ratio: 1; border-radius: 3px; display: flex; align-items: center;
  justify-content: center; font: 500 11px var(--t-font-mono); cursor: pointer;
  color: var(--t-text-2);
}
.t-heat-0 { background: var(--t-heat-0); }
.t-heat-1 { background: var(--t-heat-1); }
.t-heat-2 { background: var(--t-heat-2); color: var(--t-text); }
.t-heat-3 { background: var(--t-heat-3); color: var(--t-bg-deep); }
.t-heat-4 { background: var(--t-heat-4); color: var(--t-accent-ink); }
.t-cal__cell--sel { outline: 2px solid var(--t-accent); outline-offset: 1px; }

/* ── Alerts ─────────────────────────────────────────────────── */
.t-alert {
  border-radius: var(--t-r-lg); padding: 12px 14px;
  font: 400 var(--t-fs-body) var(--t-font-mono); line-height: 1.6;
}
.t-alert--ok { background: var(--t-ok-bg); color: var(--t-ok); border: 1px solid var(--t-warn-line); }
.t-alert--ok { background: var(--t-accent-soft); color: var(--t-accent); border: 1px solid var(--t-accent-dim); }
.t-alert--err { background: var(--t-err-bg); color: var(--t-err); border: 1px solid var(--t-err); }
.t-alert--warn {
  background: var(--t-warn-fill); color: var(--t-warn);
  border: 1px solid var(--t-warn-line);
}

/* ── Reusable "better on desktop" notice (HANDOFF §4) ────────── */
.ds-desktop-notice {
  background: var(--t-surface); border: 1px solid var(--t-line-strong);
  border-radius: var(--t-r-2xl); padding: 18px;
}
.ds-desktop-notice__row { display: flex; align-items: flex-start; gap: 12px; }
.ds-desktop-notice__icon {
  flex: none; width: 38px; height: 38px; border-radius: var(--t-r-lg);
  background: var(--t-warn-fill); border: 1px solid var(--t-warn-line);
  display: flex; align-items: center; justify-content: center;
}
.ds-desktop-notice__title { font: 600 13px var(--t-font-display); color: var(--t-text); }
.ds-desktop-notice__body { font: 400 var(--t-fs-body) var(--t-font-mono); color: var(--t-text-2); margin-top: 4px; line-height: 1.55; }
.ds-desktop-link {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--t-accent); color: var(--t-accent-ink);
  border: none; border-radius: 11px; padding: 13px; margin-top: 14px;
  font: 600 13px var(--t-font-mono); text-decoration: none; cursor: pointer; width: 100%;
}
.ds-desktop-link:active { filter: brightness(0.95); }
.ds-desktop-notice__hint { text-align: center; font: 400 11px var(--t-font-mono); color: var(--t-muted); margin-top: 9px; }

/* ── Modal primitives (recon detail modal) ──────────────────── */
.t-modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(6,10,16,0.66);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
[data-theme="light"] .t-modal-overlay { background: rgba(20,35,50,0.45); }
.t-modal {
  width: 760px; max-width: 100%; max-height: 90vh;
  display: flex; flex-direction: column;
  background: var(--t-bg); border: 1px solid var(--t-line-strong);
  border-radius: var(--t-r-2xl); box-shadow: var(--t-shadow-modal); overflow: hidden;
}
.t-modal__head, .t-modal__foot { flex: none; display: flex; align-items: center; padding: 18px 22px; }
.t-modal__head { justify-content: space-between; border-bottom: 1px solid var(--t-line); }
.t-modal__foot { gap: 10px; justify-content: flex-end; border-top: 1px solid var(--t-line); background: var(--t-surface-2); }
.t-modal__body { flex: 1; overflow: auto; padding: 22px; }
.t-modal__close {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--t-line-strong); background: var(--t-surface-3);
  color: var(--t-text-2); display: flex; align-items: center; justify-content: center;
  font-size: 17px; cursor: pointer;
}

/* hide scrollbars on horizontal scroll panes that match the design */
.t-scroll::-webkit-scrollbar { display: none; }
.t-scroll { scrollbar-width: none; max-width: 100%; }
.t-hscroll { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; }

/* ── Spinner ────────────────────────────────────────────────── */
.t-spinner {
  display: inline-block; width: 13px; height: 13px; margin-right: 7px;
  border: 2px solid var(--t-accent-dim); border-top-color: var(--t-accent);
  border-radius: 50%; animation: t-spin .7s linear infinite; vertical-align: -2px;
}
@keyframes t-spin { to { transform: rotate(360deg); } }

/* ── Loading placeholders: blurred bars with a heartbeat pulse ──
   [data-skeleton] areas get rows of .t-skel__bar (auth.js skeleton());
   inside an aria-busy="true" region the real value fields pulse the same
   way until the data has arrived. */
.t-skel { display: grid; gap: 14px; padding: 16px 18px; }
.t-skel__row { display: flex; gap: 16px; align-items: center; }
.t-skel__bar {
  display: inline-block; height: 12px; border-radius: 6px; background: var(--t-line-strong);
  filter: blur(1.5px); animation: t-heartbeat 1.8s ease-in-out infinite;
}
.t-skel__row:nth-child(2) .t-skel__bar { animation-delay: .12s; }
.t-skel__row:nth-child(3) .t-skel__bar { animation-delay: .24s; }
.t-skel__row:nth-child(4) .t-skel__bar { animation-delay: .36s; }
.t-skel__row:nth-child(n+5) .t-skel__bar { animation-delay: .48s; }
[aria-busy="true"] .t-stat__value,
[aria-busy="true"] .t-stat__delta,
[aria-busy="true"] .t-busy-blur {
  color: transparent !important; background: var(--t-line-strong); border-radius: 6px;
  filter: blur(3px); animation: t-heartbeat 1.8s ease-in-out infinite;
}
@keyframes t-heartbeat {   /* lub-dub, rest */
  0%, 100% { opacity: .35; }
  12% { opacity: .9; }
  24% { opacity: .5; }
  36% { opacity: .85; }
  60% { opacity: .35; }
}
@media (prefers-reduced-motion: reduce) {
  .t-skel__bar, [aria-busy="true"] .t-stat__value, [aria-busy="true"] .t-stat__delta,
  [aria-busy="true"] .t-busy-blur { animation: none; opacity: .5; }
}

/* ════════════════════════════════════════════════════════════
   Responsive — phones and tablets (≤ 1024 px, or a touch screen up to
   1400 px, i.e. every tablet in either orientation): hide the top nav, show
   the bottom tab bar + "Mer" sheet. Phones also get the mobile page header.
   This media query is the only place that picks bottom vs top nav.
   ════════════════════════════════════════════════════════════ */
/* Tablets and phones are touched: every control is at least 44 px tall, and
   a field is 16 px — iOS zooms the page in on a focused field under that. */
@media (max-width: 1024px), (pointer: coarse) {
  .t-btn, .t-input, .t-select, .t-filter { min-height: 44px; }
  .t-input, .t-select, .t-textarea { font-size: 16px; }
}
@media (max-width: 1024px), (pointer: coarse) and (max-width: 1400px) {
  .t-topnav { display: none; }
  .t-page { padding-bottom: 80px; }

  .t-bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    background: var(--t-bg); border-top: 1px solid var(--t-line);
    padding: 10px 6px max(10px, env(safe-area-inset-bottom));
  }
  .t-bottomnav__item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px;
    text-decoration: none; border: 0; background: none; cursor: pointer;
  }
  .t-bottomnav__item span { font: 500 11px var(--t-font-mono); color: var(--t-muted); }
  .t-bottomnav__item svg { stroke: var(--t-muted); }
  .t-bottomnav__item--active span { color: var(--t-accent); }
  .t-bottomnav__item--active svg { stroke: var(--t-accent); }
}
@media (max-width: 760px) {
  :root { --t-fs-body: 13px; }      /* read in a cab, in daylight or at night */
  .t-page { padding: 16px 16px 80px; }
  .t-title { font-size: 27px; }

  /* dense desktop grids collapse to single column on phones */
  .t-grid-2, .t-grid-3 { grid-template-columns: 1fr; }
}

/* "Mer" sheet for overflow nav items on mobile */
.t-sheet {
  display: none; position: fixed; inset: 0; z-index: 950;
  background: rgba(6,10,16,0.6); align-items: flex-end;
}
.t-sheet--open { display: flex; }
.t-sheet__panel {
  width: 100%; background: var(--t-bg); border-top: 1px solid var(--t-line);
  border-radius: var(--t-r-2xl) var(--t-r-2xl) 0 0; padding: 10px 14px 28px;
}
.t-sheet__item {
  display: block; padding: 15px 8px; border-top: 1px solid var(--t-line);
  font: 500 14px var(--t-font-mono); color: var(--t-text); text-decoration: none;
}

/* ── Segmented control: "Utseende: Nytt | Klassiskt" (auth.js uiSegment) ──
   In the account menu and the "Mer" sheet of the new UI, and in the
   Utseende card of Inställningar → Mitt konto in both UIs. */
.t-seg { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.t-seg__label { font: 500 11px var(--t-font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--t-muted); }
.t-seg__group { display: inline-flex; border: 1px solid var(--t-line-strong); border-radius: var(--t-r-sm); overflow: hidden; }
.t-seg__group button {
  background: var(--t-surface-3); border: 0; color: var(--t-text-3); padding: 0 12px; min-height: 36px;
  font: 500 12px var(--t-font-mono); cursor: pointer;
}
.t-seg__group button + button { border-left: 1px solid var(--t-line-strong); }
.t-seg__group button[aria-pressed="true"] { background: var(--t-accent); color: var(--t-accent-ink); }
@media (max-width: 1024px), (pointer: coarse) { .t-seg__group button { min-height: 44px; } }

/* ── "Prova nya Yield" (auth.js renderUiPrompt): shown once per device in
   the classic UI, under the top nav (above the content on a phone). ── */
.t-uiprompt { background: var(--t-surface); border-bottom: 1px solid var(--t-line); }
.t-uiprompt__inner {
  max-width: 1240px; margin: 0 auto; padding: 12px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.t-uiprompt__text { margin: 0; flex: 1 1 320px; font: 400 13px var(--t-font-mono); color: var(--t-text-2); line-height: 1.5; }
.t-uiprompt__actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .t-uiprompt__inner { padding: 12px 16px; }
  .t-uiprompt__actions { width: 100%; }
  .t-uiprompt__actions .t-btn { flex: 1; }
}
