/* Vaurex – design system. Ink + violet, solid surfaces, Red Hat Text/Display/Mono. No framework, no build step.
   Sections: 1 tokens · 2 base · 3 layout · 4 components · 5 motion · 6 utilities */

/* 1 ─ Tokens ─────────────────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: "Red Hat Text";
  src: url("/static/fonts/RedHatText-Variable.woff2") format("woff2");
  font-weight: 300 700; font-style: normal; font-display: swap;
  unicode-range: U+0000-017F, U+0218-021B, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+1E9E, U+2000-206F, U+20AC,
    U+2122, U+2190-2193, U+2212, U+2215, U+2248, U+2260, U+2264-2265, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Red Hat Display";
  src: url("/static/fonts/RedHatDisplay-Variable.woff2") format("woff2");
  font-weight: 300 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-017F, U+0218-021B, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+1E9E, U+2000-206F, U+20AC,
    U+2122, U+2190-2193, U+2212, U+2215, U+2248, U+2260, U+2264-2265, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Red Hat Mono";
  src: url("/static/fonts/RedHatMono-Variable.woff2") format("woff2");
  font-weight: 300 700; font-style: normal; font-display: swap;
  unicode-range: U+0000-017F, U+0218-021B, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+1E9E, U+2000-206F, U+20AC,
    U+2122, U+2190-2193, U+2212, U+2215, U+2248, U+2260, U+2264-2265, U+FEFF, U+FFFD;
}

/* dark is the default theme */
:root {
  color-scheme: dark;
  --font: "Red Hat Text", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Red Hat Display", "Red Hat Text", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Red Hat Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --bg: #0b0d12;
  --sidebar: #0e1016;
  --surface: #12151c;
  --surface-2: #171b23;
  --raised: #1c212b;
  --hover: rgba(255, 255, 255, .035);
  --line: #232835;
  --line-strong: #2f3542;
  --overlay: rgba(4, 5, 8, .72);

  --text-1: #eceef2;
  --text-2: #a3aab8;
  --text-3: #6b7385;

  /* Vaurex violet: white text on --accent 4.9:1, --accent-text on the page 7.6:1 */
  --accent: #7254f5;
  --accent-hover: #6747ec;
  --on-accent: #ffffff;
  --accent-text: #a493ff;
  --accent-soft: rgba(114, 84, 245, .16);
  --accent-line: rgba(114, 84, 245, .45);

  --success: #22c55e; --success-soft: rgba(34, 197, 94, .12);
  --warning: #f5a524; --warning-soft: rgba(245, 165, 36, .13);
  --danger: #ef4444;  --danger-soft: rgba(239, 68, 68, .12);
  --info: #38bdf8;    --info-soft: rgba(56, 189, 248, .12);
  --neutral: #8b93a3; --neutral-soft: rgba(139, 147, 163, .12);
  --gain: #22c55e;
  --loss: #ef4444;

  --r-sm: 6px; --r-md: 8px; --r-lg: 10px; --r-xl: 12px; --r-full: 999px;
  --shadow-1: none;
  --shadow-pop: 0 0 0 1px var(--line-strong), 0 16px 40px -12px rgba(0, 0, 0, .7);

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px;

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --dur-1: 140ms; --dur-2: 200ms; --dur-3: 260ms;

  --sidebar-w: 248px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5f8;
  --sidebar: #eeeef3;
  --surface: #ffffff;
  --surface-2: #f8f8fb;
  --raised: #ffffff;
  --hover: rgba(20, 22, 27, .035);
  --line: #e3e3ea;
  --line-strong: #d0d0da;
  --overlay: rgba(20, 22, 27, .38);

  --text-1: #14161b;
  --text-2: #555b66;
  --text-3: #8a8f98;

  --accent: #5b3fe0;
  --accent-hover: #4f33d6;
  --on-accent: #ffffff;
  --accent-text: #4f33d6;
  --accent-soft: rgba(91, 63, 224, .10);
  --accent-line: rgba(91, 63, 224, .35);

  --success: #15803d; --success-soft: rgba(21, 128, 61, .10);
  --warning: #b45309; --warning-soft: rgba(217, 119, 6, .12);
  --danger: #dc2626;  --danger-soft: rgba(220, 38, 38, .09);
  --info: #0369a1;    --info-soft: rgba(3, 105, 161, .09);
  --neutral: #6b7280; --neutral-soft: rgba(107, 114, 128, .11);
  --gain: #15803d;
  --loss: #dc2626;

  --shadow-1: 0 1px 2px rgba(20, 22, 27, .05);
  --shadow-pop: 0 0 0 1px var(--line), 0 16px 40px -12px rgba(20, 22, 27, .22);
}

/* 2 ─ Base ───────────────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; font-family: var(--font); font-size: 14px; line-height: 1.5;
  color: var(--text-1); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4, h5, p, dl, dd, ul, ol, figure { margin: 0; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -.02em; line-height: 1.25; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent-text); text-decoration: none; transition: color var(--dur-1) var(--ease-out), opacity var(--dur-1); }
@media (hover: hover) and (pointer: fine) { a:hover { color: var(--text-1); } }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
code, kbd { font-family: var(--mono); font-size: .92em; }
/* .mono marks figures and identifiers (logins, tickets, times): the text face with tabular figures, so columns line
   up without the technical look of a monospace font. Real code, keys and logs use var(--mono) directly. */
.mono { font-family: var(--font); }
code { padding: .1em .38em; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); color: var(--text-1); }
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 5px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text-3);
  font-size: 11px; font-family: var(--mono); line-height: 1;
}
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-4) 0; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.num, .mono, .table, .kpi-value, .entity-figure, .entity-stats, .ticker, .dl dd, .status-chip { font-variant-numeric: tabular-nums; }

.icon { width: 18px; height: 18px; flex: none; fill: currentColor; }
.icon-sm { width: 15px; height: 15px; }

/* small labels */
.eyebrow, .kpi-label, .table th, .entity-figure-label, .entity-stats dt, .nav-label, .palette-group, .ticker .th {
  font-size: 12px; font-weight: 500; letter-spacing: .005em; color: var(--text-3);
}
/* Red Hat Display for titles and headline figures: hierarchy by size and weight, no serif or italics */
.page-title, .kpi-value, .entity-figure, .auth-card h1, .modal-head h3, .error-code, .section-title h2, .empty b {
  font-family: var(--display); font-weight: 600; letter-spacing: -.02em;
}

/* 3 ─ Layout ─────────────────────────────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }
html[data-sidebar="collapsed"] { --sidebar-w: 68px; }

.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: var(--s-2);
  padding: 16px 12px; z-index: 30; overflow: hidden; background: var(--sidebar); border-right: 1px solid var(--line);
}

/* brand */
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 16px; color: var(--text-1); white-space: nowrap; }
@media (hover: hover) and (pointer: fine) { .brand:hover { color: var(--text-1); } }
.brand-mark { width: 30px; height: 30px; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-family: var(--display); font-weight: 650; font-size: 20px; line-height: 1; letter-spacing: -.02em; }
.signet { fill: currentColor; stroke: none; }

/* navigation */
/* the menu scrolls between brand and foot when the window is short; the side padding keeps the active marker
   (12px left of the links) inside the scroll box */
.nav {
  position: relative; display: flex; flex-direction: column; gap: 2px; flex: 0 1 auto; min-height: 0;
  margin-inline: -12px; padding-inline: 12px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.nav-label { padding: 14px 10px 6px; white-space: nowrap; }
.nav-link {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 10px;
  border-radius: var(--r-md); color: var(--text-2); font-weight: 500; white-space: nowrap;
  transition: color var(--dur-2) var(--ease-out), background var(--dur-1) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .nav-link:hover { color: var(--text-1); background: var(--hover); } }
.nav-link .icon { width: 19px; height: 19px; color: var(--text-2); transition: color var(--dur-2) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .nav-link:hover .icon { color: var(--text-1); } }
.nav-link.active { color: var(--text-1); background: transparent; }
.nav-link.active .icon { color: var(--accent-text); }
.nav-indicator {
  position: absolute; z-index: 0; left: 12px; right: 12px; top: 0; height: 36px; border-radius: var(--r-md);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); pointer-events: none; opacity: 0;
  transform: translateY(var(--y, 0)); transition: transform var(--dur-3) var(--ease-out), opacity var(--dur-2);
}
.nav-indicator::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-indicator.ready { opacity: 1; }

.sidebar > .brand, .sidebar-foot { flex: none; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: var(--s-3); border-top: 1px solid var(--line); }
.search-trigger {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; width: 100%;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--text-3); white-space: nowrap;
  transition: border-color var(--dur-1) var(--ease-out), color var(--dur-1);
}
@media (hover: hover) and (pointer: fine) { .search-trigger:hover { border-color: var(--line-strong); color: var(--text-2); } }
.search-trigger kbd { margin-left: auto; }
.status-chip {
  display: flex; align-items: center; gap: 9px; min-height: 34px; padding: 6px 10px; border-radius: var(--r-md);
  font-size: 12px; color: var(--text-2); white-space: nowrap; transition: background var(--dur-1);
}
@media (hover: hover) and (pointer: fine) { .status-chip:hover { color: var(--text-1); background: var(--hover); } }
.status-chip b { color: var(--text-1); font-weight: 600; }
.status-chip .chip-dot { height: auto; padding: 0; background: none; }
.status-errors { display: flex; align-items: center; gap: 2px; }
.status-errors .status-chip { flex: 1; min-width: 0; }
.status-errors .status-chip, .status-errors b { color: var(--danger); }
.status-errors .status-chip svg { width: 14px; height: 14px; flex: none; }
html[data-sidebar="collapsed"] .sidebar .status-errors .btn { display: none; }
#nav-status { min-height: 34px; }
.user-btn {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 6px; border: 0; border-radius: var(--r-md);
  background: transparent; text-align: left; white-space: nowrap; transition: background var(--dur-1) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .user-btn:hover { background: var(--hover); } }
.avatar {
  width: 28px; height: 28px; flex: none; border-radius: 7px; display: grid; place-items: center;
  font-family: var(--font); font-size: 11.5px; font-weight: 600; letter-spacing: 0; color: var(--on-accent); background: var(--accent);
}
.avatar.has-img { background: var(--raised); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.avatar-xs { width: 20px; height: 20px; border-radius: 5px; font-size: 8.5px; }
.avatar-lg { width: 40px; height: 40px; border-radius: 10px; font-size: 15px; }
.avatar-xl { width: 72px; height: 72px; border-radius: 16px; font-size: 24px; }
.avatar-row { display: flex; align-items: center; gap: var(--s-5); flex-wrap: wrap; }
.avatar-row .card-title { margin-bottom: 4px; }
.avatar-actions { gap: 8px; }
.file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); }
.avatar-row label.btn:has(+ .file-hidden:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.user-meta { min-width: 0; line-height: 1.25; }
.user-meta b { display: block; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 11px; color: var(--text-3); }
.sidebar-tools { display: flex; gap: 4px; align-items: center; }
.collapse-btn .icon { transition: transform var(--dur-3) var(--ease-out); }

/* collapsed sidebar */
html[data-sidebar="collapsed"] .sidebar :is(.brand-name, .nav-link span, .search-trigger span,
  .search-trigger kbd, .status-chip .chip-text, .user-meta) { display: none; }
html[data-sidebar="collapsed"] .sidebar :is(.nav-link, .search-trigger, .status-chip) { justify-content: center; padding: 0; }
html[data-sidebar="collapsed"] .sidebar .nav-label { height: 18px; padding: 0; font-size: 0; }
html[data-sidebar="collapsed"] .user-btn { justify-content: center; flex: none; }
html[data-sidebar="collapsed"] .brand { justify-content: center; padding-inline: 0; }
html[data-sidebar="collapsed"] .collapse-btn .icon { transform: rotate(180deg); }
html[data-sidebar="collapsed"] .sidebar-tools { flex-direction: column; }

.topbar { display: none; }
.content-wrap { min-width: 0; }
.content { width: 100%; padding: 32px 40px 72px; }
@media (min-width: 1600px) { .content { padding: 40px 56px 80px; } }

.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-6); }
.page-title { font-size: 30px; line-height: 1.05; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-sub { margin-top: 6px; color: var(--text-2); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.page-sub .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.crumb { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; font-size: 13px; color: var(--text-3); font-weight: 500; }
@media (hover: hover) and (pointer: fine) { .crumb:hover { color: var(--text-1); } }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin: var(--s-8) 0 var(--s-3); }
.section-title h2 { font-size: 18px; display: flex; align-items: center; gap: 8px; }
.section-title h2 .icon { color: var(--text-3); }

/* a development instance (INSTANCE_LABEL): a strip on top of every page, so it is never mistaken for the real one.
   Same amber in dark and light (the light theme's warning colour is too dark for black text).
   Inside the app it sticks under the phone top bar; on the login pages it sits above the card. */
.instance-bar {
  position: sticky; top: 0; z-index: 19; display: flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 32px; padding: 4px var(--s-4); background: #f5a524; color: #1a1000; font-size: 13px; line-height: 1.3; text-align: center;
}
.instance-bar .icon { width: 16px; height: 16px; flex: none; }
.instance-bar b { font-weight: 600; }
.instance-bar.is-auth { position: static; padding-top: calc(4px + env(safe-area-inset-top, 0px)); }
.instance-bar.is-auth + .auth { min-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px)); }

/* phones and small tablets have no side bar: the tab bar leads to the main pages, "Mehr" opens a sheet with the rest */
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; gap: var(--s-2); position: sticky; top: 0; z-index: 20; height: 56px; padding: 0 16px;
    background: var(--sidebar); border-bottom: 1px solid var(--line);
  }
  .topbar .brand { padding: 0; }
  .topbar .brand-mark { width: 28px; height: 28px; }
  .topbar-actions { margin-left: auto; display: flex; gap: 4px; }
  .content { padding: 20px 16px 56px; }
  .page-title { font-size: 26px; }
}

/* 4 ─ Components ─────────────────────────────────────────────────────────────────────────── */
/* card */
.card { position: relative; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--line); min-height: 52px; }
.card-title { font-family: var(--display); font-size: 16px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; display: flex; align-items: center; gap: 10px; }
.card-title > .icon { display: none; }
.card-title .live-label, .card-title .tag, .card-title .pill { font-family: var(--font); }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
/* hover only changes colour – no movement, so the pointer never "falls off" the edge and causes a jitter loop */
a.card, .card.interactive { color: inherit; transition: border-color var(--dur-2) var(--ease-out), background var(--dur-2) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { a.card:hover, .card.interactive:hover { border-color: var(--line-strong); background: var(--surface-2); color: inherit; } }

/* KPI strip */
.kpis {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; overflow: hidden;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-1);
}
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpis.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* dashboard: the state sentence first, then the figures */
.dash-state { display: grid; gap: var(--s-3); }
.state { border: 1px solid var(--line); border-left: 3px solid var(--tone); border-radius: var(--r-xl); background: var(--surface); padding: 14px 18px; }
.state-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.state-head > .icon { color: var(--tone); align-self: center; }
.state-head b { font-family: var(--display); font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.state-sub { color: var(--text-2); }
.state-list { display: grid; margin-top: 8px; }
.state-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.state-list li:first-child { border-top: 0; }
.state-list .dot { width: 8px; height: 8px; border-radius: 2px; flex: none; background: var(--tone); }
.state-text { flex: 1; min-width: 0; text-wrap: pretty; }
.state-list .btn { flex: none; }
@media (max-width: 560px) { .state-list li { flex-wrap: wrap; row-gap: 8px; } .state-text { flex-basis: calc(100% - 18px); } .state-list .btn { margin-left: 18px; } }

/* first steps of a new user */
.setup { margin-bottom: var(--s-4); }
.setup-steps { display: grid; padding: 6px 18px 10px; counter-reset: none; }
.setup-steps li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.setup-steps li:first-child { border-top: 0; }
.setup-num { width: 28px; height: 28px; flex: none; border-radius: 999px; display: grid; place-items: center; font-weight: 600; font-size: 13px; color: var(--accent-text); background: var(--accent-soft); }
.setup-steps li.is-done .setup-num { color: var(--success); background: var(--success-soft); }
.setup-body { flex: 1; min-width: 0; display: grid; gap: 1px; }
.setup-body span { color: var(--text-2); font-size: 13px; }
.setup-steps li.is-done .setup-body b { color: var(--text-2); font-weight: 500; text-decoration: line-through; text-decoration-color: var(--line-strong); }
@media (max-width: 560px) { .setup-steps li { flex-wrap: wrap; row-gap: 8px; } .setup-body { flex-basis: calc(100% - 42px); } .setup-steps .btn { margin-left: 42px; } }
.kpi { padding: 18px 20px 16px; background: var(--surface); min-width: 0; }
.kpi-value { font-size: 34px; line-height: 1; white-space: nowrap; }
.kpi-value small { font-family: var(--font); font-size: 15px; color: var(--text-3); margin-left: 6px; }
/* one line per row: long notes are cut, the full text is in the tooltip */
.table td.cell-clip { max-width: 0; width: 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .table-cards td.cell-clip { max-width: none; white-space: normal; } }
.kpi-label { display: block; margin-top: 8px; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi.tone-danger .kpi-value, .kpi.tone-warning .kpi-value { color: var(--tone); }
@media (max-width: 640px) { .kpi { padding: 14px 14px 12px; } .kpi-value { font-size: 28px; } }

.tone-success { --tone: var(--success); --tone-soft: var(--success-soft); }
.tone-warning { --tone: var(--warning); --tone-soft: var(--warning-soft); }
.tone-danger  { --tone: var(--danger);  --tone-soft: var(--danger-soft); }
.tone-info    { --tone: var(--info);    --tone-soft: var(--info-soft); }
.tone-neutral { --tone: var(--neutral); --tone-soft: var(--neutral-soft); }
.tone-accent  { --tone: var(--accent-text); --tone-soft: var(--accent-soft); }

/* buttons */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text-1); --btn-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: var(--r-md); border: 1px solid var(--btn-bd); background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 500; font-size: 13.5px; white-space: nowrap; user-select: none; text-decoration: none;
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), color var(--dur-1), transform var(--dur-1) var(--ease-out), opacity var(--dur-1);
}
@media (hover: hover) and (pointer: fine) { .btn:hover { --btn-bg: var(--surface-2); color: var(--btn-fg); border-color: var(--text-3); } }
.btn:active { transform: scale(.98); }
.btn .icon { width: 16px; height: 16px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn-primary { --btn-bg: var(--accent); --btn-fg: var(--on-accent); --btn-bd: var(--accent); font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .btn-primary:hover { --btn-bg: var(--accent-hover); --btn-bd: var(--accent-hover); border-color: var(--accent-hover); } }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--text-2); }
@media (hover: hover) and (pointer: fine) { .btn-ghost:hover { --btn-bg: var(--hover); --btn-fg: var(--text-1); border-color: transparent; } }
.btn-success { --btn-bg: var(--success); --btn-fg: #04130a; --btn-bd: var(--success); font-weight: 600; }
.btn-warning { --btn-bg: var(--warning); --btn-fg: #1a1000; --btn-bd: var(--warning); font-weight: 600; }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: var(--danger); font-weight: 600; }
[data-theme="light"] .btn-success { --btn-fg: #fff; }
[data-theme="light"] .btn-warning { --btn-fg: #fff; }
@media (hover: hover) and (pointer: fine) { :is(.btn-success, .btn-warning, .btn-danger):hover { --btn-bg: var(--btn-bd); border-color: var(--btn-bd); filter: brightness(1.08); } }
.btn-soft-danger { --btn-fg: var(--danger); --btn-bg: transparent; --btn-bd: var(--line-strong); }
@media (hover: hover) and (pointer: fine) { .btn-soft-danger:hover { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); border-color: var(--danger); } }
.btn-soft { --btn-fg: var(--text-1); --btn-bg: var(--surface-2); --btn-bd: var(--line-strong); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-sm); gap: 6px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14.5px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; flex-wrap: wrap; gap: var(--s-2); }
.htmx-request.btn, .btn.htmx-request { opacity: .65; pointer-events: none; }

.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* status pill & tags */
.pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; white-space: nowrap; vertical-align: middle;
  color: var(--text-2);
}
.pill .dot { width: 7px; height: 7px; border-radius: 1.5px; background: var(--tone, var(--neutral)); flex: none; }
.pill.live .dot { animation: square-pulse 2.6s ease-in-out infinite; }
@keyframes square-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes ping { 0% { transform: scale(.6); opacity: .8; } 80%, 100% { transform: scale(1.8); opacity: 0; } }
.page-title .pill { font-family: var(--font); font-size: 13px; letter-spacing: 0; margin-top: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 5px;
  font-size: 11.5px; font-weight: 500; color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--line); white-space: nowrap; vertical-align: middle;
}
.tag-accent { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-soft); }
.tag-xs { height: 16px; padding: 0 4px; font-size: 10px; border-radius: 4px; vertical-align: 1px; }
.tag .icon { width: 12px; height: 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }

/* forms */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s-4); }
.form-grid > * { grid-column: span 12; }
.col-3 { grid-column: span 3 !important; } .col-4 { grid-column: span 4 !important; } .col-5 { grid-column: span 5 !important; }
.col-6 { grid-column: span 6 !important; } .col-7 { grid-column: span 7 !important; } .col-8 { grid-column: span 8 !important; }
@media (max-width: 720px) { .form-grid > [class*="col-"] { grid-column: span 12 !important; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 500; color: var(--text-1); display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.label .opt { font-size: 12px; font-weight: 400; color: var(--text-3); }
.help { font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.help code { font-size: 11.5px; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--line-strong);
  background: var(--bg); color: var(--text-1); outline: none;
  transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
[data-theme="light"] :is(.input, .select, .textarea) { background: var(--surface); }
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
@media (hover: hover) and (pointer: fine) { .input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); } }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.is-invalid, .input.is-invalid:focus { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.field-error { font-size: 12.5px; color: var(--danger); margin-top: 4px; }
.field-error[hidden] { display: none; }
.input:disabled, .select:disabled { opacity: .55; cursor: not-allowed; }
.select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8f98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.input-sm, .select-sm { height: 32px; font-size: 13px; border-radius: var(--r-sm); padding-left: 10px; }
.select-sm { padding-right: 30px; background-position: right 8px center; }
.input-lg { height: 44px; font-size: 15px; }
.input.mono, .textarea.mono { font-size: 13px; }
.input-otp { height: 54px; font-size: 24px; letter-spacing: .5em; text-align: center; font-family: var(--mono); padding-left: .5em; }
input[type="date"].input { padding-right: 8px; }

.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; user-select: none; }
.switch input {
  appearance: none; flex: none; width: 36px; height: 20px; margin: 0; border-radius: 99px; position: relative; cursor: pointer;
  background: var(--raised); box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: background var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
[data-theme="light"] .switch input { background: var(--line); }
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-2);
  transition: transform var(--dur-2) var(--ease-out), background var(--dur-2);
}
[data-theme="light"] .switch input::after { background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked { background: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.switch input:checked::after { transform: translateX(16px); background: var(--on-accent); }
.switch-text { display: flex; flex-direction: column; gap: 2px; }
.switch-text b { font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.check input {
  appearance: none; width: 17px; height: 17px; margin: 0; flex: none; border-radius: 5px; cursor: pointer; position: relative;
  border: 1px solid var(--line-strong); background: var(--bg); transition: background var(--dur-1), border-color var(--dur-1);
}
[data-theme="light"] .check input { background: var(--surface); }
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after { content: ""; position: absolute; left: 5px; top: 1.5px; width: 5px; height: 9px; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.check input[type="radio"] { border-radius: 50%; }
.check input[type="radio"]:checked::after { left: 4px; top: 4px; width: 7px; height: 7px; border: 0; border-radius: 50%; background: var(--on-accent); transform: none; }

.radio-cards { display: grid; gap: 8px; }
.radio-card {
  display: flex; gap: 12px; padding: 13px 14px; border-radius: var(--r-lg); border: 1px solid var(--line-strong); cursor: pointer;
  background: var(--surface); transition: border-color var(--dur-1) var(--ease-out), background var(--dur-1);
}
@media (hover: hover) and (pointer: fine) { .radio-card:hover { border-color: var(--text-3); } }
.radio-card:has(input:checked) { border-color: var(--accent-text); background: var(--accent-soft); }
.radio-card.danger:has(input:checked) { border-color: var(--danger); background: var(--danger-soft); }
.radio-card.danger input:checked { background: var(--danger); border-color: var(--danger); }
.radio-card.danger input[type="radio"]:checked::after { background: #fff; }
.radio-card input { margin-top: 2px; }
.radio-card b { display: block; font-weight: 600; margin-bottom: 2px; }
.radio-card span { color: var(--text-2); font-size: 13px; }

.callout {
  display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r-lg); font-size: 13px; line-height: 1.5;
  color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); border-left: 2px solid var(--tone, var(--accent-text));
}
.callout > .icon { color: var(--tone, var(--accent-text)); margin-top: 1px; width: 16px; height: 16px; }
.callout b { color: var(--text-1); font-weight: 600; }
.callout > .signet { color: var(--accent-text); width: 18px; height: 18px; flex: none; margin-top: 1px; }
.callout.notice { align-items: flex-start; }
.callout .notice-close { margin-left: auto; margin-top: -4px; flex: none; }
/* a callout that is a link: the whole box reacts, the text keeps its colours */
a.callout-link { align-items: center; color: var(--text-2); transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out); }
a.callout-link > .icon { margin-top: 0; }
.callout-text { flex: 1; min-width: 0; text-wrap: pretty; }
.callout-more { flex: none; display: inline-flex; align-items: center; gap: 4px; color: var(--accent-text); font-weight: 500; white-space: nowrap; }
.callout-more .icon { transition: transform var(--dur-2) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { a.callout-link:hover { color: var(--text-2); background: var(--surface); border-color: var(--line-strong); } }
@media (hover: hover) and (pointer: fine) { a.callout-link:hover .callout-more .icon { transform: translateX(2px); } }
@media (max-width: 560px) {
  a.callout-link { flex-wrap: wrap; align-items: flex-start; row-gap: 6px; }
  a.callout-link > .icon { margin-top: 1px; }
  a.callout-link .callout-text { flex-basis: calc(100% - 28px); }
  a.callout-link .callout-more { margin-left: 28px; }
}
@media (prefers-reduced-motion: reduce) { a.callout-link, .callout-more .icon { transition: none; } }
.notify-table .group-row td { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); background: var(--surface-2); padding-top: 10px; }
.notify-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 0; }
.form-actions { display: flex; gap: var(--s-2); align-items: center; margin-top: var(--s-6); flex-wrap: wrap; }
/* rare actions that delete data, kept apart below the settings */
.danger-zone { margin-top: var(--s-8); }

/* segmented control */
.segmented { position: relative; display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-md); background: var(--bg); border: 1px solid var(--line); }
[data-theme="light"] .segmented { background: var(--surface-2); }
.segmented > a, .segmented > button {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border: 0;
  border-radius: 6px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: color var(--dur-2) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .segmented > a:hover, .segmented > button:hover { color: var(--text-1); } }
.segmented > .active { color: var(--text-1); }
.segmented-thumb {
  position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 0; border-radius: 6px; background: var(--raised);
  box-shadow: inset 0 0 0 1px var(--line-strong); transform: translateX(var(--x, 0)); width: var(--w, 0);
  transition: transform var(--dur-3) var(--ease-out), width var(--dur-3) var(--ease-out);
}
.segmented:not([data-ready]) > .active { background: var(--raised); }
.segmented-sm > a, .segmented-sm > button { height: 24px; padding: 0 9px; font-size: 12px; }
.segmented .icon { width: 15px; height: 15px; }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { height: 40px; padding: 0 14px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table td { height: 44px; padding: 8px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-1) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .table tbody tr:hover { background: var(--hover); } }
.table th:first-child, .table td:first-child { padding-left: 18px; }
.table th:last-child, .table td:last-child { padding-right: 18px; }
.table .num { text-align: right; white-space: nowrap; }
.table th.num { font-family: var(--font); font-size: 12px; }
.table .nowrap, .table td.strong, .table td:first-child { white-space: nowrap; }
.table .sub { display: block; font-size: 12px; color: var(--text-3); margin-top: 1px; }
.table a.strong { font-weight: 600; color: var(--text-1); }
@media (hover: hover) and (pointer: fine) { .table a.strong:hover { color: var(--accent-text); } }
.table-sm td { height: 40px; padding-top: 6px; padding-bottom: 6px; font-size: 13px; }
.table tr.is-error td:first-child, .table tr.is-skip td:first-child, .table tr.is-pending td:first-child, .table tr.is-limit td:first-child { position: relative; }
.table tr.is-error td:first-child::before, .table tr.is-skip td:first-child::before, .table tr.is-pending td:first-child::before, .table tr.is-limit td:first-child::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 2px 2px 0;
}
.table tr.is-error td:first-child::before { background: var(--danger); }
.table tr.is-skip td:first-child::before, .table tr.is-limit td:first-child::before { background: var(--warning); }
.table tr.is-pending { color: var(--text-2); }
.table tr.is-pending td:first-child::before { background: var(--info); }
.table .inline-form { display: flex; gap: 6px; align-items: center; }
.table .inline-form .input { width: 92px; height: 30px; font-size: 12.5px; padding: 0 8px; border-radius: var(--r-sm); }
.action-cell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.action-ico { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; background: var(--tone-soft, var(--surface-2)); color: var(--tone, var(--text-2)); flex: none; }
.action-ico .icon { width: 13px; height: 13px; }
.side { display: inline-flex; align-items: center; height: 19px; padding: 0 6px; border-radius: 4px; font-size: 11.5px; font-weight: 600; }
.side-buy { color: var(--gain); background: var(--success-soft); }
.side-sell { color: var(--loss); background: var(--danger-soft); }

/* definition list */
.dl { display: grid; grid-template-columns: auto 1fr; }
.dl dt, .dl dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
.dl dt { color: var(--text-2); font-size: 13px; padding-right: var(--s-4); }
.dl dd { text-align: right; font-weight: 500; }
.dl dt:last-of-type, .dl dd:last-of-type { border-bottom: 0; }

/* empty state */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 44px 20px; color: var(--text-2); }
.empty-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 8px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); }
.empty-icon .icon { width: 20px; height: 20px; }
.empty b { color: var(--text-1); font-size: 17px; }
.empty p { max-width: 420px; font-size: 13.5px; }
.empty .btn { margin-top: 12px; }
.empty-sm { padding: 28px 16px; }
.empty-sm .empty-icon { width: 36px; height: 36px; }
.empty-sm .empty-icon .icon { width: 17px; height: 17px; }

/* entity cards (accounts, sessions) */
.entity-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: var(--s-3); }
.entity { display: flex; flex-direction: column; padding: 16px; gap: 14px; min-width: 0; }
.entity-head { display: flex; align-items: flex-start; gap: 12px; }
.entity-avatar {
  width: 36px; height: 36px; flex: none; border-radius: 9px; display: grid; place-items: center;
  font-weight: 600; font-size: 12.5px; color: var(--text-1); background: var(--raised); border: 1px solid var(--line-strong);
}
.entity-avatar .icon { width: 17px; height: 17px; }
.entity-avatar.tone-success, .entity-avatar.tone-warning, .entity-avatar.tone-danger, .entity-avatar.tone-info { color: var(--tone); background: var(--tone-soft); border-color: transparent; }
.entity-title { min-width: 0; flex: 1; }
.entity-title b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-title > span { display: block; font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.entity-figure { font-size: 26px; line-height: 1; white-space: nowrap; }
.is-stale .entity-figure, .is-stale .num { opacity: .55; }
.entity-figure small { font-family: var(--font); font-size: 12px; font-weight: 500; color: var(--text-3); margin-left: 5px; }
.entity-figure-label { margin-bottom: 4px; }
.entity-stats { display: flex; border-top: 1px solid var(--line); margin: 0 -16px -16px; }
.entity-stats > div { flex: 1; padding: 10px 14px; min-width: 0; }
.entity-stats > div:first-child { padding-left: 16px; }
.entity-stats > div + div { border-left: 1px solid var(--line); }
.entity-stats dt { font-size: 11.5px; }
.entity-stats dd { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.entity-error { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--danger); background: var(--danger-soft); padding: 8px 10px; border-radius: var(--r-md); }
.entity-error .icon { width: 15px; height: 15px; margin-top: 1px; }
.entity-error span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.entity-error-full span { display: block; -webkit-line-clamp: none; }
.entity-phase { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.entity-phase .spinner { width: 12px; height: 12px; color: var(--accent-text); }

/* start-up steps of a terminal */
.start-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.start-steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-3); }
.start-steps .step-mark { width: 18px; height: 18px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-strong); }
.start-steps .step-mark .icon { width: 11px; height: 11px; }
.start-steps .step-done { color: var(--text-2); }
.start-steps .step-done .step-mark { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.start-steps .step-current { color: var(--text-1); font-weight: 500; }
.start-steps .step-current .step-mark { border-color: var(--accent); color: var(--accent-text); }
.start-steps .step-current .spinner { width: 10px; height: 10px; border-width: 1.5px; }
.start-steps .step-label { display: flex; flex-wrap: wrap; gap: 4px 8px; padding-top: 1px; }
.step-time { color: var(--text-3); font-weight: 400; font-size: 12px; }
.step-hint { display: block; color: var(--text-3); font-weight: 400; font-size: 12px; margin-top: 2px; }

/* health page */
.health-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--s-4); }
.health-check.tone-danger { border-color: var(--danger); }
.health-check.tone-warning { border-color: var(--warning); }
.log-view { max-height: 65vh; }
.log-line { display: block; }
.log-warning { color: var(--warning); }
.log-error { color: var(--danger); }
/* link form: symbol check result and the fields it filled */
.input.is-suggested, .textarea.is-suggested { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.symbol-check-table td .sub { display: block; color: var(--text-3); font-size: 12px; font-family: var(--font); }
.symbol-check-table { max-width: 640px; }
/* restart drawer: progress of the run, one row per terminal, the log of the current one */
.restart-summary { display: grid; gap: 8px; }
.restart-meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.restart-meter > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width var(--dur-2) var(--ease-out); }
.restart-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.restart-step { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.restart-step:last-child { border-bottom: 0; }
.restart-step-text { display: flex; flex-direction: column; min-width: 0; }
.restart-step-text .sub { color: var(--text-3); font-size: 13px; }
.restart-log { max-height: 40vh; font-size: 12px; }
@media (prefers-reduced-motion: reduce) { .restart-meter > span { transition: none; } }

/* MT5 journal on the account page */
:is(.journal-card, .rule-more) > summary { cursor: pointer; list-style: none; flex-wrap: nowrap; }
/* the note beside the title moves below it on narrow cards instead of squeezing the title */
:is(.journal-card, .rule-more) > summary .card-title { flex-wrap: wrap; column-gap: 10px; row-gap: 2px; min-width: 0; }
:is(.journal-card, .rule-more) > summary::-webkit-details-marker { display: none; }
:is(.journal-card, .rule-more) > summary .chevron { margin-left: auto; transition: transform .15s ease; color: var(--text-3); }
:is(.journal-card, .rule-more)[open] > summary .chevron { transform: rotate(90deg); }
.journal { margin: 0; max-height: 360px; overflow: auto; font-family: var(--mono); font-size: 11.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; }
.journal .j-time { color: var(--text-3); }
.journal .j-src { color: var(--accent-text); }
@media (prefers-reduced-motion: reduce) { :is(.journal-card, .rule-more) > summary .chevron { transition: none; } }
.entity-note { font-size: 12.5px; color: var(--warning); display: flex; gap: 6px; align-items: flex-start; }
.entity-note .icon { width: 14px; height: 14px; margin-top: 2px; }
.entity-actions { display: flex; align-items: center; gap: 4px; margin: auto -16px -16px; padding: 8px 10px; border-top: 1px solid var(--line); }
.flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.flow > .icon { color: var(--text-3); width: 15px; height: 15px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 4px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; font-weight: 500; white-space: nowrap; max-width: 100%; color: var(--text-1); }
@media (hover: hover) and (pointer: fine) { a.chip:hover { border-color: var(--line-strong); color: var(--text-1); } }
.ap-suggest { display: grid; gap: var(--s-2); }
#ap-suggest:not(:has(*)) { display: none; }
.ap-suggest .alert-inline { margin-bottom: 0; }
.ap-options, .ap-names { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.ap-option { padding: 0 10px; font-family: var(--mono); font-size: 12px; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .chip.ap-option:hover { border-color: var(--line-strong); } }
.chip.ap-option.selected { border-color: var(--accent); color: var(--accent-text); }
.chip.ap-option .ap-ms { margin-left: 8px; font-family: var(--font); font-size: 11px; color: var(--text-3); }
.chip.ap-option.selected .ap-ms { color: var(--accent-text); }
.chip.ap-option.ap-down { opacity: .55; }
.chip .mini-avatar { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; font-size: 9.5px; font-weight: 600; color: var(--text-2); background: var(--raised); }
.chip .mini-avatar.master { color: var(--on-accent); background: var(--accent); }
.chip .mini-avatar .icon { width: 11px; height: 11px; }
.chip.muted { color: var(--text-3); }
.chip .dot { width: 6px; height: 6px; border-radius: 1.5px; background: var(--tone, var(--neutral)); }

/* list view of the same entity markup: fixed columns so every row lines up; notes get their own row */
.entity-grid[data-view="list"] { grid-template-columns: 1fr; gap: var(--s-2); }
.entity-grid[data-view="list"] .entity {
  display: grid; grid-template-columns: minmax(260px, 1.25fr) minmax(300px, 1.4fr) minmax(300px, 1.5fr);
  align-items: center; column-gap: 28px; row-gap: 10px; padding: 12px 16px;
}
.entity-grid[data-view="list"] .entity-head { grid-column: 1; align-items: center; min-width: 0; }
.entity-grid[data-view="list"] .entity-main { grid-column: 2; align-items: center; min-width: 0; }
.entity-grid[data-view="list"] .entity-stats { grid-column: 3; grid-row: 1; margin: 0; border: 0; }
.entity-grid[data-view="list"] .flow { grid-column: 2 / -1; grid-row: 1; }
.entity-grid[data-view="list"] :is(.entity-error, .entity-note) { grid-column: 1 / -1; }
.entity-grid[data-view="list"] .entity-figure { font-size: 24px; }
.entity-grid[data-view="list"] .entity-figure-label { display: none; }
.entity-grid[data-view="list"] .entity-stats > div { padding: 0 16px; }
.entity-grid[data-view="list"] .entity-main :is(.spark, .spark-empty) { flex: none; width: 48%; max-width: none; height: 30px; }
.entity-grid[data-view="list"] .entity-avatar { width: 32px; height: 32px; }
@media (max-width: 1100px) {
  .entity-grid[data-view="list"] .entity { grid-template-columns: 1fr; }
  .entity-grid[data-view="list"] :is(.entity-head, .entity-main, .entity-stats, .flow) { grid-column: 1; grid-row: auto; }
  .entity-grid[data-view="list"] .entity-stats { margin: 0 -16px -12px; border-top: 1px solid var(--line); }
  .entity-grid[data-view="list"] .entity-stats > div { padding: 8px 16px; }
}

/* sparkline */
.spark { width: 128px; height: 38px; overflow: visible; flex: none; color: var(--text-3); }
.entity-main .spark, .entity-main .spark-empty { flex: 1 1 128px; min-width: 96px; max-width: 320px; width: auto; }
.spark.up { color: var(--gain); }
.spark.down { color: var(--loss); }
.spark polyline { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spark polygon { fill: currentColor; opacity: .07; stroke: none; }
.spark-empty { width: 128px; height: 38px; min-height: 38px; display: flex; align-items: flex-end; justify-content: flex-end; padding-bottom: 2px; font-size: 11px; line-height: 1; color: var(--text-3);
  background: linear-gradient(90deg, var(--line-strong) 50%, transparent 50%) left 9px / 6px 1px repeat-x; }

/* grids */
.grid { display: grid; gap: var(--s-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-side-main { grid-template-columns: 360px minmax(0, 1fr); }
.grid-7-5 { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.grid-5-7 { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.grid-dash { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
@media (min-width: 1800px) { .grid-dash { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
@media (max-width: 1180px) { .grid-side-main, .grid-7-5, .grid-5-7, .grid-3, .grid-dash { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s-2); }
.row { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); flex-wrap: wrap; }

/* toolbar (filters) */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px 14px; }
.toolbar .field { min-width: 150px; flex: 1; }
.toolbar .field .label { font-size: 12px; font-weight: 500; color: var(--text-3); }
.toolbar .check { height: 32px; font-size: 13px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-4); color: var(--text-3); font-size: 12.5px; }

/* popover menu */
.menu {
  margin: 0; padding: 6px; min-width: 220px; border-radius: var(--r-xl); border: 0; color: var(--text-1);
  background: var(--raised); box-shadow: var(--shadow-pop); position: fixed; inset: auto;
}
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-1); font-size: 13.5px; text-align: left; font-weight: 500; }
@media (hover: hover) and (pointer: fine) { .menu-item:hover { background: var(--hover); color: var(--text-1); } }
.menu-item .icon { width: 16px; height: 16px; color: var(--text-3); }
.menu-item.danger, .menu-item.danger .icon { color: var(--danger); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-head { padding: 8px 10px 6px; font-size: 12px; line-height: 1.45; color: var(--text-3); max-width: 280px; overflow-wrap: anywhere; }
.theme-switch { display: flex; gap: 2px; padding: 3px; margin: 4px; border-radius: var(--r-md); background: var(--bg); border: 1px solid var(--line); }
.theme-switch button { flex: 1; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--text-3); display: grid; place-items: center; transition: background var(--dur-2), color var(--dur-2); }
.theme-switch button .icon { width: 15px; height: 15px; }
@media (hover: hover) and (pointer: fine) { .theme-switch button:hover { color: var(--text-1); } }
.theme-switch button[aria-pressed="true"] { background: var(--surface-2); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* dialogs */
dialog.modal {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 0; border-radius: 14px;
  color: var(--text-1); background: var(--raised); box-shadow: var(--shadow-pop); overflow: auto;
}
dialog.modal::backdrop { background: var(--overlay); }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 20px 0; }
.modal-icon { width: 36px; height: 36px; flex: none; border-radius: 9px; display: grid; place-items: center; color: var(--tone, var(--accent-text)); background: var(--tone-soft, var(--accent-soft)); }
.modal-icon .icon { width: 18px; height: 18px; }
.modal-head h3 { font-size: 19px; line-height: 1.15; }
.modal-head p { color: var(--text-2); margin-top: 4px; font-size: 13.5px; }
.modal-body { padding: 16px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--s-2); padding: 0 20px 20px; }
.modal-close { margin-left: auto; margin-top: -4px; margin-right: -6px; }

/* command palette */
dialog.palette { width: min(620px, calc(100vw - 24px)); margin-top: 12vh; margin-bottom: auto; }
.palette-search { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.palette-search .icon { color: var(--text-3); }
.palette-search input { flex: 1; height: 54px; border: 0; outline: none; background: transparent; font-size: 15px; }
.palette-search input::placeholder { color: var(--text-3); }
.palette-list { max-height: min(420px, 56dvh); overflow-y: auto; padding: 6px; scroll-padding: 6px; }
.palette-group { padding: 10px 10px 4px; }
.palette-item { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 10px; border-radius: var(--r-md); cursor: pointer; color: var(--text-1); }
.palette-item .icon { color: var(--text-3); width: 16px; height: 16px; }
.palette-item .p-sub { margin-left: auto; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48%; }
.palette-item[aria-selected="true"] { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }
.palette-item[aria-selected="true"] .icon { color: var(--accent-text); }
.palette-item mark { background: none; color: var(--accent-text); font-weight: 600; }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }
.palette-foot span { display: inline-flex; align-items: center; gap: 6px; }
.palette-empty { padding: 32px; text-align: center; color: var(--text-3); }

/* toasts */
.toast-stack { position: fixed; z-index: 1000; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 12px 12px 12px 14px; border-radius: var(--r-lg);
  background: var(--raised); box-shadow: var(--shadow-pop); font-size: 13.5px; border-left: 2px solid var(--tone, var(--accent));
  animation: toast-in var(--dur-3) var(--ease-out) both;
}
.toast.toast-update { animation: fade var(--dur-2) var(--ease-out) both; }
.toast.leaving { animation: toast-out var(--dur-2) var(--ease-in) both; }
.toast-icon { flex: none; display: grid; place-items: center; color: var(--tone, var(--accent-text)); padding-top: 1px; }
.toast-icon .icon { width: 17px; height: 17px; }
.toast-body { flex: 1; min-width: 0; word-break: break-word; }
.toast-body b { display: block; font-weight: 600; margin-bottom: 1px; }
.toast-body a { font-weight: 600; }
.toast-close { margin: -4px -4px 0 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }
@media (max-width: 640px) { .toast-stack { right: 16px; left: 16px; bottom: 16px; width: auto; } }

/* navigation progress line (shown only for slow navigations) */
.progress { position: fixed; z-index: 2000; top: 0; left: 0; height: 2px; width: 100%; pointer-events: none; background: var(--accent); transform-origin: left; transform: scaleX(0); opacity: 0; }
.progress.run { opacity: 1; animation: progress-run 8s cubic-bezier(.1, .7, .2, 1) forwards; }
.progress.done { opacity: 0; transform: scaleX(1); transition: transform var(--dur-2) var(--ease-out), opacity 260ms 140ms; }
@keyframes progress-run { from { transform: scaleX(0); } 30% { transform: scaleX(.55); } to { transform: scaleX(.92); } }

/* live */
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 1.5px; background: var(--success); animation: square-pulse 2.6s ease-in-out infinite; }
.live-label { display: inline-flex; align-items: center; gap: 7px; margin-left: 4px; font-size: 12px; font-weight: 500; color: var(--success); }

/* skeleton (only for the slow live positions) */
.skeleton { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface-2), var(--raised), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton-rows { display: flex; flex-direction: column; gap: 14px; padding: 20px 18px; }
.skeleton-rows .skeleton { height: 12px; }
.skeleton-rows .skeleton:nth-child(2) { width: 82%; }
.skeleton-rows .skeleton:nth-child(3) { width: 64%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* auth pages */
.auth { position: relative; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; overflow: hidden; }
.auth-motif { position: absolute; left: 50%; top: 50%; width: min(1200px, 160vw); transform: translate(-50%, -50%); color: var(--line); pointer-events: none; }
.auth-motif path { fill: none; stroke: currentColor; stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.auth-inner { position: relative; width: min(400px, 100%); }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 22px; color: var(--text-1); }
.auth-brand .brand-mark { width: 34px; height: 34px; border-radius: 9px; }
.auth-brand .brand-mark svg { width: 22px; height: 22px; }
.auth-brand .brand-name { font-size: 27px; }
.auth-card { padding: 28px 28px 24px; }
.auth-card h1 { font-size: 28px; line-height: 1.05; }
.auth-card .auth-sub { color: var(--text-2); font-size: 13.5px; margin: 4px 0 22px; }
.alert-inline { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); font-size: 13px; color: var(--tone, var(--danger)); background: var(--tone-soft, var(--danger-soft)); margin-bottom: 16px; }
.alert-inline .icon { width: 16px; height: 16px; margin-top: 1px; }
.alert-inline ul { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.error-code { font-size: 80px; line-height: 1; color: var(--accent-text); }

/* misc */
.qr { padding: 12px; border-radius: var(--r-lg); background: #fff; width: max-content; max-width: 100%; border: 1px solid var(--line); }
.qr svg { max-width: 100%; height: auto; shape-rendering: crispEdges; }
/* groups of four are visual only (inline spans + <wbr>), so copying yields the exact key */
.secret span { margin-right: .6em; }
.secret { font-family: var(--mono); font-size: 13.5px; letter-spacing: .04em; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); user-select: all; }
.ticker { display: grid; grid-template-columns: 1fr auto auto; }
.ticker > div { padding: 10px 18px; border-bottom: 1px solid var(--line); }
.ticker > div:nth-child(3n+2), .ticker > div:nth-child(3n) { text-align: right; }
.ticker .th { background: var(--surface-2); padding-top: 9px; padding-bottom: 9px; }
.ticker > div:nth-last-child(-n+3) { border-bottom: 0; }
.side-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; border-radius: var(--r-md); background: var(--bg); border: 1px solid var(--line); }
.side-toggle label { position: relative; }
.side-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.side-toggle span { display: grid; place-items: center; height: 30px; border-radius: 6px; font-weight: 600; font-size: 13px; color: var(--text-2); cursor: pointer; transition: background var(--dur-2), color var(--dur-2); }
.side-toggle .buy input:checked + span { background: var(--success); color: #fff; }
.side-toggle .sell input:checked + span { background: var(--danger); color: #fff; }
.side-toggle input:focus-visible + span { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.chart-box { position: relative; height: 340px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-3); }
.legend i { display: inline-block; width: 14px; height: 2px; border-radius: 2px; margin-right: 6px; vertical-align: middle; background: var(--accent-text); }
.legend i.dashed { background: repeating-linear-gradient(90deg, var(--text-3) 0 4px, transparent 4px 7px); }
.legend i.flow { width: 9px; height: 8px; border-radius: 0; background: var(--info); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.json { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); word-break: break-all; max-width: 520px; }
.role-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--text-3); margin-top: var(--s-4); }
.role-legend b { color: var(--text-2); }

/* 5 ─ Motion ─────────────────────────────────────────────────────────────────────────────── */
@keyframes fade { from { opacity: 0; } }

/* page navigation: only #main is swapped – one fade out, one fade in */
.content { transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out); }
.content.htmx-swapping { opacity: 0; transform: translateY(-4px); transition-duration: var(--dur-1); transition-timing-function: var(--ease-in); }
.content.htmx-added { opacity: 0; transform: translateY(6px); }

/* slow partials (live positions) fade in once */
.swap-in { animation: fade var(--dur-3) var(--ease-out) both; }

/* live updates */
@keyframes row-flash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }
@keyframes row-flash-error { 0% { background: rgba(239, 68, 68, .2); } 100% { background: transparent; } }
@keyframes row-in { from { opacity: 0; transform: translateY(-4px); } }
.table tr.is-new { animation: row-in 320ms var(--ease-out) both, row-flash 1.8s var(--ease-out) both; }
.table tr.is-new.is-error { animation: row-in 320ms var(--ease-out) both, row-flash-error 1.8s var(--ease-out) both; }
@keyframes bump { 40% { color: var(--accent-text); } }
.bump { animation: bump 700ms var(--ease-out); }

/* dialogs + popovers open/close (allow-discrete keeps them rendered while fading out) */
dialog.modal, .menu {
  opacity: 0; transform: translateY(6px) scale(.985);
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out), overlay var(--dur-2) allow-discrete, display var(--dur-2) allow-discrete;
}
dialog.modal[open], .menu:popover-open { opacity: 1; transform: none; }
@starting-style { dialog.modal[open], .menu:popover-open { opacity: 0; transform: translateY(6px) scale(.985); } }
dialog.modal::backdrop { opacity: 0; transition: opacity var(--dur-2) var(--ease-out), overlay var(--dur-2) allow-discrete, display var(--dur-2) allow-discrete; }
dialog.modal[open]::backdrop { opacity: 1; }
@starting-style { dialog.modal[open]::backdrop { opacity: 0; } }

/* drawer: details slide in from the right (a bottom sheet on phones, see below) */
@media (min-width: 641px) {
  dialog.drawer {
    margin: 0 0 0 auto; width: min(640px, 100vw); height: 100dvh; max-height: 100dvh;
    border-radius: 16px 0 0 16px; transform: translateX(32px);
  }
  dialog.drawer[open] { transform: none; }
  @starting-style { dialog.drawer[open] { opacity: 0; transform: translateX(32px); } }
}
.drawer-head { position: sticky; top: 0; z-index: 1; background: var(--raised); padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.drawer-loading { padding: 24px 20px; display: grid; gap: 12px; }
.drawer-loading span { height: 14px; border-radius: 6px; background: var(--surface-2); }
.drawer-loading span:first-child { width: 45%; height: 22px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text-1); overflow-wrap: anywhere; }
.kv-wide { grid-template-columns: minmax(120px, max-content) 1fr; }
.kv-table td { overflow-wrap: anywhere; }
/* master actions: summary, timeline, one card per target account, comparison */
.group-summary, .group-sum { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); }
.group-summary .dot, .group-sum .dot { width: 8px; height: 8px; border-radius: 2px; flex: none; background: var(--tone, var(--neutral)); }
.group-summary { padding: 8px 12px; border-radius: var(--r-md); background: var(--tone-soft, var(--surface-2)); color: var(--text-1); }
.tl-total { font-size: 14px; }
.tl-total b { font-size: 20px; color: var(--text-1); margin-right: 4px; }
.tl-account { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.tl-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.tl-stack { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.tl-stack .seg { min-width: 4px; flex-basis: 0; }
.tl-stack .seg-rest { flex-basis: 0; }
.seg-detect { background: var(--info); }
.seg-prep { background: var(--text-3); }
.seg-prep.tone-warning, .seg-prep.tone-danger { background: var(--tone); }
.seg-exec { background: var(--accent); }
.tl-parts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-2); }
.tl-parts i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.tl-moments summary { cursor: pointer; font-size: 13px; color: var(--text-2); }
.tl-moments ol { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 12.5px; }
.tl-moments li { display: grid; grid-template-columns: auto 64px 1fr; gap: 10px; }
.cmp-list { display: grid; gap: 8px; }
.cmp-card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 14px; display: grid; gap: 8px; }
.cmp-card.is-master { background: var(--surface-2); }
.cmp-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.cmp-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; }
.cmp-grid dt { font-size: 11.5px; color: var(--text-3); }
.cmp-grid dd { margin: 2px 0 0; font-size: 13px; white-space: nowrap; }
.cmp-split { margin: 0; font-size: 12px; color: var(--text-2); }
.cmp-prices { display: flex; flex-wrap: wrap; gap: 4px 24px; margin: 0; font-size: 13px; }
.cmp-prices > div { display: flex; gap: 8px; align-items: baseline; }
.cmp-prices dt { font-size: 11.5px; color: var(--text-3); }
.cmp-prices dd { margin: 0; }
@media (max-width: 480px) { .cmp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.copy-card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; display: grid; gap: 10px; }
.copy-card.is-error { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.copy-card.is-skip { border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); }
.copy-card-head { display: flex; align-items: center; gap: 8px; }
.compare-table tr.is-master td, .table tr.is-master td { background: var(--surface-2); }
.card-foot-help { padding: 10px 20px 14px; margin: 0; }
@media (max-width: 640px) {
  .tl-moments li { grid-template-columns: 1fr auto; }
  .tl-moments li > span:first-child { grid-column: 1 / -1; }
}
/* trades of a session: tabs above the table, more on demand below */
.card-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.segmented .count { margin-left: 6px; padding: 0 6px; border-radius: 99px; font-size: 11px; font-weight: 600; line-height: 16px; background: var(--accent); color: var(--on-accent); }
.card-more { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 18px; border-top: 1px solid var(--line); }
.trade-table .side, .trade-table .tag { margin-right: 6px; }
.trade-table .group-sum { min-width: 132px; align-items: baseline; }  /* long summaries wrap, short ones never */
@media (max-width: 640px) { .trade-table .sub { display: inline; margin-left: 6px; } }
.trade-table .live-dot { margin-left: 6px; vertical-align: 1px; }
/* trade drawer: result per account, the course of the trade, folded sections */
.trade-state { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; }
.result-list { display: grid; gap: 8px; }
.result-row { display: grid; gap: 6px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); }
.result-row.is-master { background: var(--surface-2); }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.result-name { min-width: 0; overflow-wrap: anywhere; }
.result-figures { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; font-size: 13px; }
.result-money { font-size: 17px; font-weight: 600; }
.result-note { margin: 0; font-size: 12.5px; }
.steps { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.step + .step { border-top: 1px solid var(--line); }
.step > summary, .fold > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.step > summary::-webkit-details-marker, .fold > summary::-webkit-details-marker { display: none; }
.step > summary { padding: 10px 12px; }
.step.is-focus > summary { background: var(--surface-2); }
.step-title { display: grid; gap: 2px; flex: 1; min-width: 0; font-size: 13.5px; }
.step-title .group-sum { font-size: 12.5px; }
.step-time { flex: none; white-space: nowrap; }
.step-body { padding: 4px 12px 14px; }
.step .chevron, .fold .chevron { flex: none; width: 16px; height: 16px; color: var(--text-3); transition: transform var(--dur-2) var(--ease-out); }
.step[open] > summary .chevron, .fold[open] > summary .chevron { transform: rotate(90deg); }
.fold { border: 1px solid var(--line); border-radius: var(--r-lg); }
.fold > summary { padding: 12px 14px; font-size: 13.5px; }
.fold > summary .soft { flex: 1; min-width: 0; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fold-body { padding: 2px 14px 14px; }
@media (max-width: 640px) {
  .step > summary { flex-wrap: wrap; }
  .step-time { order: 3; flex-basis: 100%; padding-left: 34px; }
  .card-toolbar, .card-more { padding-inline: 16px; }
  .card-toolbar .segmented { width: 100%; }
  .card-toolbar .segmented > a { flex: 1; justify-content: center; }
}
.row-link { cursor: pointer; }
.row-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .row-link:hover td { background: var(--hover); } }
/* the details column takes only the space left and cuts its single line */
.audit-details { width: 100%; max-width: 0; }
.audit-table .row { flex-wrap: nowrap; }
.audit-summary { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
  .pill.live .dot, .live-dot { animation: none; }
}

/* 6 ─ Utilities ──────────────────────────────────────────────────────────────────────────── */
.muted { color: var(--text-3); }
.soft { color: var(--text-2); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.num { white-space: nowrap; }
.gain { color: var(--gain) !important; }
.loss { color: var(--loss) !important; }
.warn-text { color: var(--warning); }
.ok-text { color: var(--success); }
.danger-text { color: var(--danger); }
.success-text { color: var(--success); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); }
.w-auto { width: auto; }
.ml-auto { margin-left: auto; }
@media (max-width: 640px) { .hide-sm { display: none !important; } }

/* legal pages and consent */
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-top: 18px; font-size: 13px; }
.legal-links a { color: var(--text-3); }
.auth.auth-wide { place-items: start center; }
.auth.auth-wide .auth-inner { width: min(820px, 100%); padding-block: 24px; }
.legal-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.legal-tabs a { padding: 6px 12px; border-radius: var(--r-full); border: 1px solid var(--line); color: var(--text-2); font-size: 13px; }
.legal-tabs a.active { border-color: var(--accent); color: var(--accent-text); }
.prose { font-size: 15px; line-height: 1.65; color: var(--text-1); max-width: 70ch; display: grid; gap: 12px; }
.prose h2 { font-family: var(--display); font-weight: 600; font-size: 22px; letter-spacing: -.015em; margin-top: 18px; }
.prose h3 { font-size: 17px; margin-top: 12px; }
.prose h4 { font-size: 15px; margin-top: 8px; }
.prose ul, .prose ol { padding-left: 20px; display: grid; gap: 6px; }
.prose ul { list-style: disc; } .prose ol { list-style: decimal; }
.prose blockquote { margin: 0; padding: 12px 16px; border-left: 3px solid var(--warning); background: var(--surface-2); border-radius: var(--r-md); }
.prose a { text-decoration: underline; text-underline-offset: 2px; }
.prose .table-wrap { border: 1px solid var(--line); border-radius: var(--r-md); }
mark.placeholder { background: color-mix(in srgb, var(--warning) 22%, transparent); color: var(--text-1); padding: 0 3px; border-radius: 3px; }
.legal-operator { margin-top: 24px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); font-size: 14px; color: var(--text-2); display: grid; gap: 6px; }
.legal-operator b { color: var(--text-1); }
.risk-notice { border-left-color: var(--danger) !important; --tone: var(--danger); }
.risk-notice ul { padding-left: 18px; list-style: disc; display: grid; gap: 4px; margin-top: 6px; }

/* 7 ─ Touch and phone ────────────────────────────────────────────────────────────────────── */
/* No double-tap zoom delay on controls; controls are not text to select or long-press. */
button, a, summary, label, [role="button"], .tab { touch-action: manipulation; }
:is(button, .btn, .tab, .chip, .nav-link, .more-link, .menu-item, .segmented > *, .user-btn) {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
/* Pull-to-refresh is ours (see .ptr); inner scrollers keep their bounce without moving the page. */
html { overscroll-behavior-y: none; }
/* Overlays keep their scroll. Wide tables only keep the sideways swipe (no back gesture, no side bar):
   "contain" on both axes would also swallow the vertical wheel, although a table never scrolls vertically. */
dialog.modal, .palette-list { overscroll-behavior: contain; }
.table-wrap { overscroll-behavior-x: contain; }
.tabbar, .ptr, .sheet-handle { display: none; }

@media (pointer: coarse) {
  /* iOS zooms into anything smaller than 16px */
  input:not([type="checkbox"]):not([type="radio"]), select, textarea, .input, .select, .textarea,
  .input.mono, .textarea.mono { font-size: 16px; }
  .input, .select, .input-sm, .select-sm { min-height: 44px; }
  /* tap targets of at least 44px */
  .btn, .btn-sm { min-height: 44px; }
  .btn-sm { padding: 0 14px; font-size: 13.5px; }
  .btn-icon, .btn-icon.btn-sm { min-width: 44px; }
  .nav-link, .menu-item, .search-trigger, .palette-item { min-height: 44px; }
  .nav-indicator { height: 44px; }
  .check, .switch { min-height: 44px; align-items: center; }
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; }
  .switch input { width: 44px; height: 26px; }  /* a switch keeps its shape, only larger */
  .switch input::after { width: 20px; height: 20px; }
  .switch input:checked::after { transform: translateX(18px); }
  .segmented > * { min-height: 44px; min-width: 44px; }
  .chip.ap-option { height: 40px; padding: 0 14px; }
  .notify-table input[type="checkbox"] { width: 24px; height: 24px; }
  .cell-check { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; cursor: pointer; }
  .crumb { min-height: 44px; margin: -12px 0 -4px; padding-right: 12px; }
  .palette-foot, .palette-search kbd { display: none; }  /* keyboard hints help nobody without a keyboard */
  .theme-switch button { height: 40px; }
  /* press feedback on touch, right when the finger lands */
  .btn, .tab, .nav-link, .menu-item, a.card { transition: transform 120ms var(--ease-out), background var(--dur-1); }
  .btn:active, .menu-item:active { transform: scale(.97); }
  a.card:active, .tab:active { transform: scale(.985); }
}

@media (max-width: 960px) {
  /* nothing below 12px on small screens */
  .tag, .user-meta span, kbd, .entity-figure-label, .table th, .entity-stats dt, .json, .spark-empty,
  .notify-table .group-row td, .entity-title .mono { font-size: 12px; }
  .help { font-size: 13px; }
  .page-title { font-size: 26px; }

  /* notch, Dynamic Island and home indicator */
  .topbar {
    height: calc(56px + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px);
    padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px));
  }
  .instance-bar:not(.is-auth) { top: calc(56px + env(safe-area-inset-top, 0px)); }
  .content {
    padding: 20px max(16px, env(safe-area-inset-right, 0px)) calc(88px + env(safe-area-inset-bottom, 0px))
      max(16px, env(safe-area-inset-left, 0px));
  }

  /* bottom tab bar: Dashboard, Konten, Sessions, Historie, Mehr */
  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; z-index: 22; left: 0; right: 0; bottom: 0;
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    background: color-mix(in srgb, var(--sidebar) 92%, transparent); border-top: 1px solid var(--line);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; padding: 6px 2px 4px;
    border: 0; background: none; color: var(--text-3); font: inherit; font-size: 12px; font-weight: 500; text-decoration: none;
  }
  .tab .icon { width: 22px; height: 22px; }
  .tab.active { color: var(--accent-text); }
  .toast-stack { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }

  /* sticky main action in forms */
  form .form-actions {
    position: sticky; bottom: calc(56px + env(safe-area-inset-bottom, 0px)); z-index: 5; margin-inline: -16px; padding: 12px 16px;
    background: color-mix(in srgb, var(--bg) 88%, transparent); border-top: 1px solid var(--line);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }
  .form-actions .btn-primary { flex: 1; }

  /* pull to refresh */
  .ptr {
    display: grid; place-items: center; position: fixed; z-index: 21; left: 50%; top: calc(64px + env(safe-area-inset-top, 0px));
    width: 36px; height: 36px; margin-left: -18px; border-radius: 50%; background: var(--raised); box-shadow: var(--shadow-pop);
    color: var(--accent-text); opacity: 0; transform: translateY(var(--pull, -48px)); pointer-events: none;
  }
  .ptr .spinner { animation-play-state: paused; }
  .ptr.armed .spinner, .ptr.loading .spinner { animation-play-state: running; }

  /* card heads keep title and action in one line; a long title wraps in itself */
  .card-header { padding-inline: 16px; }
  .card-header .card-title { flex: 1 1 0; min-width: 0; flex-wrap: wrap; row-gap: 2px; }
  .card-header > .small { flex-basis: 100%; }
  /* profile picture: the text keeps a readable width, the buttons move below */
  .avatar-row { gap: var(--s-4); }
  .avatar-row .grow { flex: 1 1 200px; }
  /* notification choices: three narrow columns of boxes, the name of the event wraps */
  .notify-table th, .notify-table td { padding-inline: 2px; }
  .notify-table th:first-child, .notify-table td:first-child { padding-left: 16px; white-space: normal; }
  .notify-table th:last-child, .notify-table td:last-child { padding-right: 8px; }

  /* entity action rows wrap instead of pushing the page sideways */
  .entity-actions { flex-wrap: wrap; row-gap: 2px; }
}

.table .c-break { display: none; }
.dt-y, .dt-s { display: inline; }

/* dialogs become bottom sheets on phones: anchored at the bottom, swipe down to close */
dialog.modal.sheet {
  width: min(100%, 560px); max-width: none; margin: auto auto 0; max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px));
  border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px);
}
dialog.modal.sheet[open] { transform: translateY(var(--drag, 0px)); }
@starting-style { dialog.modal.sheet[open] { transform: translateY(40%); opacity: 1; } }
/* the grab handle: a wide touch area around a small bar */
dialog.modal.sheet .sheet-handle { display: grid; place-items: center; height: 24px; touch-action: none; }
dialog.modal.sheet .sheet-handle::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); }

/* "Mehr": the pages outside the tab bar, the theme, the legal texts and the sign-out */
dialog.more-sheet { padding-inline: 12px; }
dialog.more-sheet:focus-visible { outline: none; }
.more-user { display: flex; align-items: center; gap: 12px; padding: 4px 6px 12px; }
.more-user .user-meta { flex: 1; }
.more-user .user-meta b { font-size: 15px; }
.more-user .user-meta span { font-size: 12.5px; }
.more-user .theme-switch { margin: 0; flex: none; }
.more-user .theme-switch button { width: 40px; }
.more-status:empty { display: none; }
.more-status { padding: 4px 0 8px; border-top: 1px solid var(--line); }
.more-nav { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); }
.more-nav .nav-label { padding: 14px 10px 4px; font-size: 12px; }
.more-link {
  display: flex; align-items: center; gap: 14px; min-height: 48px; padding: 0 10px; border-radius: var(--r-md);
  color: var(--text-1); font-size: 15px; font-weight: 500;
}
.more-link .icon { width: 20px; height: 20px; color: var(--text-2); }
.more-link.active { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.more-link.active .icon { color: var(--accent-text); }
.more-link:active { background: var(--hover); }
.more-foot { display: grid; gap: 12px; padding: 12px 0 16px; border-top: 1px solid var(--line); }
.more-legal { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; font-size: 13px; }
.more-legal a { color: var(--text-3); padding: 6px 0; }

@media (max-width: 640px) {
  dialog.modal:not(.palette) {
    width: 100%; max-width: none; margin: auto 0 0; max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px));
    border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  dialog.modal:not(.palette)[open] { transform: translateY(var(--drag, 0px)); }
  @starting-style { dialog.modal:not(.palette)[open] { transform: translateY(40%); opacity: 1; } }
  dialog.modal:not(.palette) .sheet-handle { display: grid; place-items: center; height: 24px; touch-action: none; }
  dialog.modal:not(.palette) .sheet-handle::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); }
  .modal-foot { flex-direction: column-reverse; align-items: stretch; }
  .modal-foot .btn { width: 100%; }
  .menu:popover-open { position: fixed; inset: auto 0 0 0; width: 100%; margin: 0; border-radius: 18px 18px 0 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }

  /* tables as cards: main facts at a glance, the rest on tap */
  .table-cards, .table-cards tbody { display: block; }
  .table-cards thead { display: none; }
  .table-cards tr {
    display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; row-gap: 4px; padding: 12px 16px;
    border-bottom: 1px solid var(--line);
  }
  .table-cards td { display: block; height: auto; padding: 0; border: 0; white-space: normal; text-align: left; }
  .table-cards td:first-child { padding-left: 0; }
  .table-cards td:last-child { padding-right: 0; }
  /* first line: the title takes the room that is left and wraps in itself, the fact on the right keeps its place */
  .table-cards .c-main { flex: 1 1 0; order: 1; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
  .table-cards .c-main .action-cell { white-space: normal; align-items: flex-start; }
  .table-cards .c-aside { flex: 0 1 auto; order: 2; min-width: 0; max-width: 55%; margin-left: auto; text-align: right; overflow-wrap: anywhere; }
  .table-cards .c-meta.is-empty { display: none; }
  /* dates without year and seconds: the details show the full time */
  .table-cards .dt-y, .table-cards .dt-s { display: none; }
  /* figures as a grid of two columns, the name of each above its value */
  .cards-grid tr { column-gap: 12px; row-gap: 8px; }
  .cards-grid .c-meta { flex: 0 0 calc(50% - 6px); min-width: 0; color: var(--text-1); text-align: left; }
  .cards-grid .c-meta.c-wide { flex-basis: 100%; overflow-wrap: anywhere; }
  .cards-grid .c-meta.c-last { order: 5; }
  .cards-grid .c-meta .sub { display: inline; margin-left: 6px; }
  /* the comparison row is tinted as a whole card, not cell by cell */
  .table-cards tr.is-master { background: var(--surface-2); }
  .table-cards tr.is-master td { background: none; }
  .cards-grid .c-meta[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 1px; font-family: var(--font); font-size: 12px; color: var(--text-3);
  }
  .table-cards .c-break { display: block; order: 3; flex-basis: 100%; height: 0; }
  .table-cards .c-meta { order: 4; color: var(--text-2); }
  .table-cards .c-actions { order: 6; flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; }
  .table-cards .c-more { order: 5; display: none; flex-basis: 100%; }
  .table-cards tr.open .c-more { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
  .table-cards .c-more[data-label]::before, .table-cards .c-meta[data-label]::before {
    content: attr(data-label); color: var(--text-3); font-weight: 400;
  }
  .table-cards .c-meta[data-label]::before { content: attr(data-label) " "; }
  .table-cards tr[data-expand] { cursor: pointer; }
  /* the status marker moves from the first cell to the card edge */
  .table-cards tr.is-error, .table-cards tr.is-skip, .table-cards tr.is-pending { box-shadow: inset 3px 0 0 var(--tone-bar, transparent); }
  .table-cards tr.is-error { --tone-bar: var(--danger); }
  .table-cards tr.is-skip { --tone-bar: var(--warning); }
  .table-cards tr.is-pending { --tone-bar: var(--info, var(--accent)); }
  .table-cards tr td:first-child::before { display: none; }
  .table-cards tr[data-expand] .c-aside::after {
    content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 8px; border: solid var(--text-3);
    border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); transition: transform var(--dur-2) var(--ease-out);
  }
  .table-cards tr.open .c-aside::after { transform: translateY(1px) rotate(-135deg); }
  .table-cards .c-hide-sm { display: none; }
  .card-body.flush .table-wrap:has(.table-cards) { overflow: visible; }
}

/* filters and actions that move into a sheet on phones */
.action-list { display: grid; gap: 6px; }
.action-list .btn { width: 100%; justify-content: flex-start; min-height: 48px; font-size: 15px; }
.sheet-only { display: none; }
@media (max-width: 640px) {
  .sheet-only { display: revert; }
  .btn.sheet-only { display: inline-flex; }  /* keeps icon and text in one line */
  .inline-only { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  dialog.modal, .ptr { transition: none !important; }
}

/* daily loss limit of a participation: today's result against the limit */
.day-limit { display: grid; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.day-limit-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.day-limit-bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.day-limit-bar > span { display: block; height: 100%; background: var(--warning); border-radius: inherit; }
.day-limit.is-reached { color: var(--danger); }
.day-limit.is-reached .day-limit-bar > span { background: var(--danger); }

/* statistics: tabs, figures, calendar, hours */
.stats-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.stats-tabs::-webkit-scrollbar { display: none; }
.stats-tabs > a { flex: none; padding: 10px 14px; font-size: 13.5px; font-weight: 500; color: var(--text-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.stats-tabs > a.active { color: var(--text-1); border-bottom-color: var(--accent-text); }
@media (hover: hover) and (pointer: fine) { .stats-tabs > a:hover { color: var(--text-1); } }
/* all five tabs in one row on phones where they fit */
@media (max-width: 640px) { .stats-tabs { gap: 0; } .stats-tabs > a { flex: 1 0 auto; padding: 10px 7px; text-align: center; } }
.chart-box-sm { height: 260px; }
.figures-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: var(--s-4); }
.figures-main { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.figures-main > div { display: grid; gap: 4px; min-width: 0; }
.figures-main .figure { font-size: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 480px) { .figures-main { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.figures-kv { grid-template-columns: minmax(0, 1fr) auto; }
.figures-kv dd { text-align: right; }
.cal-head { gap: 6px; flex-wrap: wrap; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { font-size: 11.5px; color: var(--text-3); text-align: center; padding-bottom: 2px; }
.cal-day { --s: 0; display: grid; align-content: start; gap: 2px; min-height: 64px; padding: 6px; border-radius: 8px;
  border: 1px solid var(--line); color: var(--text-2); font-size: 12px; min-width: 0; overflow: hidden; }
.cal-day.is-empty { border-color: transparent; }
.cal-day.is-pos { background: color-mix(in srgb, var(--success) calc(var(--s) * 45%), transparent); color: var(--text-1); }
.cal-day.is-neg { background: color-mix(in srgb, var(--danger) calc(var(--s) * 45%), transparent); color: var(--text-1); }
a.cal-day:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }
@media (hover: hover) and (pointer: fine) { a.cal-day:hover { border-color: var(--text-3); } }
.cal-n { font-weight: 600; }
.cal-day.is-today .cal-n { color: var(--accent-text); }
.cal-pnl { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-t { font-size: 11px; color: var(--text-3); }
@media (max-width: 560px) { .cal { gap: 2px; } .cal-day { min-height: 46px; padding: 3px; font-size: 11px; } .cal-t { display: none; }
  .cal-pnl { font-size: 10.5px; } }
.heat { display: grid; gap: 2px; }
.heat-row { display: grid; grid-template-columns: 28px repeat(24, minmax(0, 1fr)); gap: 2px; align-items: center; }
.heat-hours span { font-size: 10.5px; color: var(--text-3); text-align: left; }
.heat-wd { font-size: 11.5px; color: var(--text-3); }
.heat-cell { --s: 0; height: 22px; border-radius: 3px; background: var(--surface-2); }
.heat-cell.is-pos { background: color-mix(in srgb, var(--success) calc(var(--s) * 100%), var(--surface-2)); }
.heat-cell.is-neg { background: color-mix(in srgb, var(--danger) calc(var(--s) * 100%), var(--surface-2)); }
.heat-cell.is-count { background: color-mix(in srgb, var(--accent-text) calc(var(--s) * 100%), var(--surface-2)); }
@media (max-width: 560px) { .heat-row { grid-template-columns: 22px repeat(24, minmax(0, 1fr)); gap: 1px; }
  .heat-cell { height: 16px; border-radius: 2px; } }

/* Web Push devices in the profile */
.push-box { border-top: 1px solid var(--line); }
.push-devices { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.push-devices li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13.5px; }

/* account form: the access point field only when entered by hand */
.ap-field:has(#f-ap-manual:not(:checked)) .ap-manual,
.ap-field:has(#f-ap-manual:checked) .ap-auto-text { display: none; }

/* link card: symbol settings Vaurex proposes */
.symbol-proposal { display: grid; gap: 8px; padding: 12px; border-radius: var(--r-md); background: var(--accent-soft, var(--surface-2)); border: 1px solid var(--line); }
.symbol-proposal-head { display: flex; align-items: center; gap: 8px; }
.symbol-proposal-head .icon { width: 16px; height: 16px; color: var(--accent, var(--text-1)); }
.symbol-pairs { list-style: none; display: grid; gap: 4px; font-size: 13px; }
.symbol-pairs li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Vaurex Engine: "In Entwicklung" and the scaffolds of the admin preview */
.engine-soon { display: flex; gap: 22px; padding: 28px; align-items: flex-start; max-width: 860px; }
.engine-soon-mark { width: 56px; height: 56px; flex: none; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); border: 1px solid var(--accent-line); }
.engine-soon-mark .icon { width: 28px; height: 28px; }
.engine-soon-body { display: grid; gap: 12px; justify-items: start; }
.engine-soon-body h2 { font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: -.015em; color: var(--text-1); }
.engine-soon-body p { color: var(--text-2); line-height: 1.6; max-width: 62ch; text-wrap: pretty; }
.engine-points { list-style: none; display: grid; gap: 8px; }
.engine-points li { display: flex; gap: 8px; align-items: flex-start; color: var(--text-1); font-size: 14px; }
.engine-points .icon { color: var(--accent-text); margin-top: 3px; flex: none; }
.engine-placeholder { opacity: .7; }
.nav-soon { margin-left: auto; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-text); background: var(--accent-soft); border-radius: 999px; padding: 1px 7px; }
@media (max-width: 640px) { .engine-soon { flex-direction: column; padding: 20px; } }

/* rules of a target account: one calm column of questions */
.rule-form { display: grid; gap: var(--s-4); max-width: 820px; }
.rule-step .card-title, .rule-more .card-title { font-size: 16px; }
.rule-more:not([open]) > summary { border-bottom: 0; }
:is(.journal-card, .rule-more) .card-title .small { font-family: var(--font); font-weight: 400; letter-spacing: 0; }
.rule-presets { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rule-presets .chip { padding: 0 10px; cursor: pointer; transition: border-color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .rule-presets .chip:hover { border-color: var(--text-3); } }
.rule-presets .chip.selected { border-color: var(--accent-text); color: var(--accent-text); background: var(--accent-soft); }
.rule-modes { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.rule-modes .radio-card span span { display: block; color: var(--text-2); font-size: 13px; text-wrap: pretty; }
.rule-example { align-self: end; margin: 0 0 10px; color: var(--text-2); text-wrap: pretty; }
.rule-form [data-show-for][hidden] { display: none; }
@media (max-width: 640px) { .rule-example { grid-column: span 12 !important; margin: 0; } }

/* a target account's rules as sentences */
.rule-summary { display: grid; gap: 2px; min-width: 0; }
.rule-summary b { font-weight: 600; }
.rule-summary span { color: var(--text-2); font-size: 13px; text-wrap: pretty; }
.btn .count { margin-left: 2px; padding: 0 6px; border-radius: 99px; font-size: 11px; font-weight: 600; line-height: 16px; background: var(--accent); color: var(--on-accent); }
@media (max-width: 640px) { .section-title { flex-wrap: wrap; row-gap: 8px; } .section-title > .row { width: 100%; } .section-title > .row > .btn { flex: 1; justify-content: center; } }

/* profile: tabs and notification levels */
.profile-tabs { margin-bottom: var(--s-2); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.notify-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.notify-levels .help { grid-column: 1 / -1; }
@media (max-width: 640px) { .notify-levels { grid-template-columns: minmax(0, 1fr); } }
.notify-details { border-top: 1px solid var(--line); }
.notify-details > summary { display: flex; align-items: center; cursor: pointer; list-style: none; font-weight: 500; }
.notify-details > summary::-webkit-details-marker { display: none; }
.notify-details > summary .chevron { margin-left: auto; color: var(--text-3); transition: transform .15s ease; }
.notify-details[open] > summary .chevron { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .notify-details > summary .chevron { transition: none; } }
