/* GENERATED by tools/build_assets.py from assets/css/*.css. Do not edit: change the sources and rebuild. */

/* --- assets/css/00-README.css --- */
/*
 * Sources of static/components.css. tools/build_assets.py joins assets/css/*.css in file-name order.
 * One file per area, numbered by phase: 10-shell.css, 20-controls.css, and so on.
 * Colours, sizes, radii and motion come from tokens in static/tokens.css, never from literals.
 */

/* --- assets/css/10-shell.css --- */
/* Shell: frame, sidebar, header, section tabs row, phone bar, tab bar, notifications. Macros: templates/ds/shell.html.
   Page-level rules (.view, #main) only; component rules stay in their own files. */

/* ---- frame ----
   The column right of the sidebar is a three-track grid: gutter, content, gutter. Content fills up to
   --content-max and then centres, so both gutters are equal at any width, and they are measured against this
   column (100vw would include the scrollbar). The header and the tabs row sit in the same middle track. */
.app { --side: var(--sidebar-w); display: flex; min-height: 100vh; }
html.sidebar-collapsed .app { --side: var(--sidebar-w-collapsed); }
.app-col {
  --gutter: var(--sp-24);
  flex: 1 1 0; min-width: 0;
  display: grid; grid-template-columns: minmax(var(--gutter), 1fr) min(var(--content-max), calc(100% - 2 * var(--gutter))) minmax(var(--gutter), 1fr);
  align-content: start; row-gap: var(--sp-24); padding-block: var(--sp-24) var(--sp-40);
}
.app-col > * { grid-column: 2; min-width: 0; }
.view { min-width: 0; outline: none; }
#main:focus, .view:focus { outline: none; }

/* ---- sidebar ---- */
.sidebar {
  flex: none; width: var(--side); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: var(--sp-20) var(--sp-12) var(--sp-12); border-right: 1px solid var(--line); background: var(--surface);
  overflow-x: hidden; overflow-y: auto; transition: width var(--d2) var(--ease), padding var(--d2) var(--ease);
}
.brand { display: flex; align-items: center; gap: var(--sp-6); padding: 0 var(--sp-10) var(--sp-10); color: var(--text); text-decoration: none; }
.brand svg { color: var(--accent); }
.brand-name { font-size: var(--fs-16); font-weight: 600; letter-spacing: -0.01em; }
.nav-group { margin: var(--sp-18) 0 var(--sp-6); padding: 0 var(--sp-10); font-size: var(--fs-12); color: var(--text-3); white-space: nowrap; }
.nav-ico { display: inline-flex; flex: none; }
.nav-a {
  position: relative; display: flex; align-items: center; gap: var(--sp-10); width: 100%; height: 36px; padding: 0 var(--sp-10);
  border: 0; border-radius: var(--r); background: transparent; color: var(--text-2); font-size: var(--fs-14); font-weight: 400;
  text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background var(--d1) var(--ease), color var(--d1) var(--ease);
}
.nav-a:hover { background: var(--surface-2); color: var(--text); }
.nav-a.is-cur { background: var(--surface-2); color: var(--accent); font-weight: 500; }
.nav-a.is-soon { color: var(--text-3); }
.nav-tag { margin-left: auto; padding: 0 var(--sp-6); border: 1px solid var(--line); border-radius: var(--r-pill); font-size: var(--fs-12); line-height: 18px; color: var(--text-3); }
.nav-cnt {
  flex: none; min-width: 22px; margin-left: auto; padding: 0 var(--sp-6); border-radius: var(--r-sm); background: var(--surface-2);
  color: var(--text-2); font-size: var(--fs-12); font-weight: 400; line-height: 20px; text-align: center; transition: background var(--d1) var(--ease);
}
.nav-a:hover .nav-cnt { background: var(--line); }
.nav-cnt.is-pend, .nav-a:hover .nav-cnt.is-pend { background: var(--pending-soft); color: var(--pending); }
.nav-a.is-cur .nav-cnt { background: var(--accent-soft); color: var(--accent); }
.sidebar-foot { margin-top: auto; padding-top: var(--sp-12); }

/* Collapsed: icons only. The class is on <html> from theme.js, so the first paint is already narrow. */
html.sidebar-collapsed .sidebar { padding-inline: var(--sp-10); }
html.sidebar-collapsed .brand { justify-content: center; padding-inline: 0; }
html.sidebar-collapsed .brand-name, html.sidebar-collapsed .nav-label, html.sidebar-collapsed .nav-tag { display: none; }
html.sidebar-collapsed .nav-group { height: 1px; margin: var(--sp-12) var(--sp-8); padding: 0; overflow: hidden; background: var(--line); color: transparent; line-height: 0; }
html.sidebar-collapsed .nav-a { justify-content: center; padding: 0; }
html.sidebar-collapsed .nav-cnt {
  position: absolute; top: 5px; right: 6px; min-width: 8px; width: 8px; height: 8px; padding: 0; overflow: hidden;
  border-radius: 50%; background: var(--accent); color: transparent; line-height: 0;
}
html.sidebar-collapsed .nav-cnt.is-pend { background: var(--pending); }
html.sidebar-collapsed .nav-a.is-cur .nav-cnt { background: var(--accent); }
html.sidebar-collapsed .sidebar-foot .nav-a svg { transform: scaleX(-1); }

/* ---- header ---- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-12) var(--sp-24); }
.topbar-act { display: flex; align-items: center; gap: var(--sp-8); }
.me-btn {
  display: inline-flex; align-items: center; gap: var(--sp-4); height: 36px; padding: 0 var(--sp-8) 0 var(--sp-4);
  border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); color: var(--text-2);
  transition: background var(--d1) var(--ease), color var(--d1) var(--ease);
}
.me-btn:hover, .me-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
.me-btn .ava { flex: none; }
.ptabs-row { margin: -4px -2px; }

/* ---- notifications popover ---- */
.pop-notif { max-width: calc(100vw - 16px); }
.pop-h .pop-t { min-width: 0; }
.n-i {
  display: flex; gap: var(--sp-10); width: 100%; padding: var(--sp-10) var(--sp-14); border: 0; border-bottom: 1px solid var(--line);
  background: transparent; color: var(--text); text-align: left; text-decoration: none; transition: background var(--d1) var(--ease);
}
.n-i:hover { background: var(--surface-2); }
.n-dot { flex: none; width: 8px; height: 8px; margin-top: var(--sp-6); border-radius: 50%; background: transparent; }
.n-dot.is-pend { background: var(--pending); }
.n-dot.is-acc { background: var(--accent); }
.n-dot.is-ok { background: var(--win); }
.n-i.is-read .n-dot { background: transparent; border: 1.5px solid var(--line-strong); }
.n-body { flex: 1; min-width: 0; }
.n-t, .n-s { display: block; }
.n-t { font-size: var(--fs-13); font-weight: 500; line-height: 18px; }
.n-i.is-read .n-t { font-weight: 400; color: var(--text-2); }
.n-s { font-size: var(--fs-12); line-height: 16px; color: var(--text-2); }
.n-time { flex: none; font-size: var(--fs-12); line-height: 18px; color: var(--text-3); }
.pop-notif .empty { padding: var(--sp-24) var(--sp-16); }

/* ---- phone chrome (hidden above 767 px) ---- */
.phonebar { display: none; }
.tabbar { display: none; }
.menu-i .nav-tag, .menu-i .cnt { margin-left: auto; }
.menu-i.is-soon { color: var(--text-3); }
.menu-i[aria-current="page"], .menu-i[aria-current="page"] svg { color: var(--accent); }

@media (max-width: 1023px) and (min-width: 768px) {
  .app-col { --gutter: var(--sp-16); }
}

@media (max-width: 767px) {
  .app { display: block; }
  .sidebar, .topbar { display: none; }
  .app-col { display: block; padding: 0; }
  .app-col > * { min-width: 0; }
  .phonebar {
    position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: var(--sp-4); height: 56px;
    padding: 0 var(--sp-6) 0 var(--sp-16); border-bottom: 1px solid var(--line); background: var(--bg);
  }
  .pb-mark { display: flex; flex: none; color: var(--accent); }
  .phonebar .pb-title {
    flex: 1; min-width: 0; margin: 0 0 0 var(--sp-6); overflow: hidden; font-size: var(--fs-16); font-weight: 600;
    letter-spacing: -0.01em; white-space: nowrap; text-overflow: ellipsis;
  }
  .top-btn {
    position: relative; display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0;
    border: 0; background: transparent; color: var(--text-2);
  }
  .top-btn .badge { top: 4px; right: 2px; }
  .tabbar {
    position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: block; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: var(--surface);
  }
  .tabbar-in { display: flex; height: var(--tabbar-h); }
  .tb-item {
    position: relative; display: flex; flex: 1 1 0; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4);
    min-width: 44px; height: var(--tabbar-h); padding: 0; border: 0; background: transparent; color: var(--text-2);
    font-size: var(--fs-12); text-decoration: none;
  }
  .tb-item.is-cur { color: var(--accent); font-weight: 500; }
  .tb-item .tb-dot {
    position: absolute; top: 8px; left: calc(50% + 8px); min-width: 16px; height: 16px; padding: 0 var(--sp-4); border-radius: var(--r);
    background: var(--accent); color: var(--on-accent); font-size: var(--fs-11); font-weight: 600; line-height: 16px; text-align: center;
  }
  .ptabs-row {
    position: sticky; top: 56px; z-index: 39; margin: 0; padding: 0 var(--sp-12); border-bottom: 1px solid var(--line); background: var(--bg);
  }
  .ptabs-row .ptabs { gap: 0; padding: 0; scrollbar-width: none; }
  .ptabs-row .ptabs::-webkit-scrollbar { display: none; }
  .ptabs-row .ptab { margin: var(--sp-4); }
  .ptabs-row .ptab::after { content: ""; position: absolute; inset: -4px; }
  .app-main { padding: var(--sp-16) var(--sp-16) calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }

  /* Notifications as a sheet: the sheet already has the title, so the popover header keeps only its button. */
  .pop.is-in-sheet .pop-h { justify-content: flex-end; border-bottom: 0; }
  .pop.is-in-sheet .pop-h .pop-t { display: none; }
  .pop.is-in-sheet .n-i { padding-block: var(--sp-12); min-height: 44px; }
  .pop.is-in-sheet .pop-foot { height: 48px; }
}

/* --- assets/css/20-controls.css --- */
/* Controls: buttons, chips, segmented control, tabs, search, disclosure. Macros: templates/ds/controls.html. */

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-6);
  height: 32px; padding: 0 var(--sp-14);
  border: 1px solid transparent; border-radius: var(--r); background: transparent; color: var(--text);
  font-size: var(--fs-13); font-weight: 500; line-height: 1; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background var(--d1) var(--ease), color var(--d1) var(--ease), filter var(--d1) var(--ease), transform var(--d1) var(--ease), border-color var(--d1) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger { background: var(--loss); color: var(--on-loss); }
.btn-danger:hover { filter: brightness(1.08); }
.btn-danger-ghost { color: var(--loss); }
.btn-danger-ghost:hover { background: var(--loss-soft); }
.btn-sm { height: 28px; padding: 0 var(--sp-10); font-size: var(--fs-12); }
.btn-lg { height: 40px; padding: 0 var(--sp-18); font-size: var(--fs-14); }
.btn-block { width: 100%; }

/* Busy: the label stays in the DOM (assistive technology reads it, aria-busy says why it is inert). */
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 16px; height: 16px;
  border: 2px solid var(--on-accent); border-right-color: transparent; border-radius: 50%;
  animation: ds-spin .7s linear infinite;
}
.btn-secondary.is-busy::after, .btn-ghost.is-busy::after { border-color: var(--accent); border-right-color: transparent; }
.btn-danger-ghost.is-busy::after { border-color: var(--loss); border-right-color: transparent; }
.btn-danger.is-busy::after { border-color: var(--on-loss); border-right-color: transparent; }
@keyframes ds-spin { to { transform: rotate(360deg); } }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--text-2);
  text-decoration: none; cursor: pointer;
  transition: background var(--d1) var(--ease), color var(--d1) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.hb { width: 36px; height: 36px; }
.icon-btn.is-ghost { border-color: transparent; background: transparent; }
.icon-btn.is-ghost:hover { background: var(--surface-2); }
.icon-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
.icon-btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- filter chips ---- */
.fchips { display: flex; flex-wrap: wrap; gap: var(--sp-8); }
.fchip {
  position: relative; display: inline-flex; align-items: center; gap: var(--sp-8); height: 32px; padding: 0 var(--sp-6) 0 var(--sp-12);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--surface); color: var(--text-2);
  font-size: var(--fs-13); font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background var(--d1) var(--ease), color var(--d1) var(--ease), border-color var(--d1) var(--ease);
}
.fchip:not(:has(.cnt)) { padding-right: var(--sp-12); }
.fchip .cnt { background: var(--surface-2); }
.fchip:hover { border-color: var(--text-3); color: var(--text); }
.fchip.is-on, .fchip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.fchip.is-on:hover, .fchip[aria-pressed="true"]:hover { color: var(--on-accent); }
.fchip.is-on .cnt, .fchip[aria-pressed="true"] .cnt { background: transparent; color: inherit; }
.fchip.is-on .cnt::before, .fchip[aria-pressed="true"] .cnt::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: currentColor; opacity: .14; }

/* ---- segmented control: native radios, the visible segment is the span after the input ---- */
.seg {
  display: inline-flex; gap: var(--sp-2); min-width: 0; margin: 0; padding: var(--sp-2);
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface-2);
}
.seg-b { position: relative; display: inline-flex; cursor: pointer; }
/* The input covers its segment (and is the hit area); it is invisible, the span is what people see. */
.seg-in { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg-in:focus-visible { outline: none; }
.seg-t {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-6); height: 30px; padding: 0 var(--sp-12);
  border: 1px solid transparent; border-radius: var(--r-sm); color: var(--text-2);
  font-size: var(--fs-13); font-weight: 500; white-space: nowrap;
  transition: background var(--d1) var(--ease), color var(--d1) var(--ease), border-color var(--d1) var(--ease);
}
.seg-b:hover .seg-t { color: var(--text); }
.seg-in:checked + .seg-t { border-color: var(--line); background: var(--surface); color: var(--text); }
.seg-in:focus-visible + .seg-t { outline: 2px solid var(--focus); outline-offset: 2px; }
.seg-block { display: flex; width: 100%; }
.seg-block .seg-b { flex: 1; }
.seg-block .seg-t { width: 100%; }
.seg-scroll { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg-scroll .seg-b { flex: none; }
.seg-scroll::-webkit-scrollbar { display: none; }

/* ---- tabs: section tabs (links) and tab list (buttons) ---- */
.ptabs { display: flex; gap: var(--sp-8); overflow-x: auto; scrollbar-width: thin; padding: var(--sp-4) var(--sp-2); }
.tablist { display: flex; gap: var(--sp-8); overflow-x: auto; scrollbar-width: thin; padding: var(--sp-2); }
.ptab {
  position: relative; display: inline-flex; flex: none; align-items: center; gap: var(--sp-6); height: 36px; padding: 0 var(--sp-14);
  border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-2);
  font-size: var(--fs-14); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background var(--d1) var(--ease), color var(--d1) var(--ease), border-color var(--d1) var(--ease);
}
.ptab:hover { border-color: var(--text-3); color: var(--text); }
.ptab .live-ico { color: var(--live); }
.ptab.is-cur, .ptab[aria-selected="true"] { border-color: var(--text); background: var(--text); color: var(--bg); font-weight: 500; }
.ptab.is-cur .live-ico, .ptab[aria-selected="true"] .live-ico { color: inherit; }
.ptab.is-cur .cnt, .ptab[aria-selected="true"] .cnt { background: transparent; color: inherit; }
.ptab.is-cur .cnt::before, .ptab[aria-selected="true"] .cnt::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: currentColor; opacity: .14; }
.tabpanel:focus-visible { outline-offset: 2px; }

/* ---- search ---- */
.search {
  display: flex; align-items: center; gap: var(--sp-8); width: 340px; max-width: 100%; height: 36px; padding: 0 var(--sp-8) 0 var(--sp-10);
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--text-3);
  transition: border-color var(--d1) var(--ease);
}
.search:focus-within { border-color: var(--accent); }
.search:has(.search-in:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.search-in { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--text); font-size: var(--fs-14); }
.search-in:focus-visible { outline: none; }
.search-in::placeholder { color: var(--text-3); opacity: 1; }
.search-in::-webkit-search-cancel-button { display: none; }
.search-sm { width: 260px; height: 32px; }
.search-clear {
  display: grid; place-items: center; flex: none; width: 24px; height: 24px; padding: 0;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-2);
}
.search-clear:hover { background: var(--surface-2); color: var(--text); }
.keychip {
  flex: none; padding: 0 var(--sp-6); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2);
  font-size: var(--fs-12); line-height: 20px; color: var(--text-2); white-space: nowrap;
}
.search-btn { cursor: pointer; font: inherit; text-align: left; }
.search-btn:hover { border-color: var(--text-3); }
.search-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.search-btn .sb-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1023px) and (min-width: 768px) {
  .search { width: 260px; }
}
@media (max-width: 767px) {
  .search { width: 100%; }
}

/* ---- disclosure, tree rows and the collapsible region ---- */
.disclosure {
  display: inline-flex; align-items: center; gap: var(--sp-8); min-height: 36px; padding: 0 var(--sp-10) 0 var(--sp-4);
  border: 0; border-radius: var(--r); background: transparent; color: var(--text);
  font-size: var(--fs-15); font-weight: 600; text-align: left;
}
.disclosure:hover { background: var(--surface-2); }
.tree-row {
  display: flex; align-items: center; gap: var(--sp-8); width: 100%; height: 36px; padding: 0 var(--sp-10);
  border: 0; border-radius: var(--r); background: transparent; color: var(--text);
  font-size: var(--fs-14); font-weight: 500; text-align: left; cursor: pointer;
  transition: background var(--d1) var(--ease);
}
.tree-row:hover, .tree-child:hover { background: var(--surface-2); }
.tree-name { flex: 1; min-width: 0; }
.tree-row .cnt, .tree-child .cnt, .disclosure .cnt { background: var(--surface-2); }
.tree-row:hover .cnt, .tree-child:hover .cnt, .disclosure:hover .cnt { background: var(--line); }
.tree-chev { display: inline-flex; flex: none; color: var(--text-3); transition: transform var(--d2) var(--ease); }
[aria-expanded="true"] > .tree-chev { transform: rotate(90deg); }
.tree-child {
  display: flex; align-items: center; gap: var(--sp-8); height: 34px; padding: 0 var(--sp-10) 0 var(--sp-32);
  border: 0; border-radius: var(--r); background: transparent; color: var(--text-2);
  font-size: var(--fs-14); text-align: left; text-decoration: none; cursor: pointer;
  transition: background var(--d1) var(--ease);
}
.tree-child > span:first-child { flex: 1; min-width: 0; }
.tree-child.is-on { color: var(--accent); font-weight: 500; background: var(--accent-soft); }
.coll { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--d2) var(--ease); }
.coll.is-open { grid-template-rows: 1fr; }
.coll-in { min-height: 0; overflow: hidden; visibility: hidden; transition: visibility 0s linear var(--d2); }
.coll.is-open > .coll-in { visibility: visible; transition-delay: 0s; }

/* ---- vertical tabs: settings navigation as links; below 768 px a select (a GET form) takes over ---- */
.vtabs-list { position: sticky; top: var(--sp-16); display: flex; flex-direction: column; gap: var(--sp-2); }
.vtab {
  display: flex; align-items: center; gap: var(--sp-10); height: 40px; padding: 0 var(--sp-12);
  border-radius: var(--r); color: var(--text-2); font-size: var(--fs-14); font-weight: 500; text-decoration: none;
  transition: background var(--d1) var(--ease), color var(--d1) var(--ease);
}
.vtab:hover { background: var(--surface-2); color: var(--text); }
.vtab.is-cur, .vtab[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.vtab-t { flex: 1; min-width: 0; }
.vtab .cnt { background: var(--surface-2); }
.vtab:hover .cnt { background: var(--line); }
.vtab.is-cur .cnt, .vtab[aria-current="page"] .cnt { background: transparent; color: inherit; }
.vtab.is-cur .cnt::before, .vtab[aria-current="page"] .cnt::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: currentColor; opacity: .14; }
.vtabs-sel { display: flex; align-items: center; gap: var(--sp-8); }
.vtabs-sel .select-wrap { display: flex; flex: 1; }

/* --- assets/css/30-data.css --- */
/* Labels and data cells: pills, tags, counters, avatars, odds, closing price, live score, KPI, stat line.
   Macros: templates/ds/data.html. */

/* ---- badges, counters, tags, pills ---- */
.badge {
  position: absolute; top: -8px; right: -8px; min-width: 20px; height: 20px; padding: 0 var(--sp-4);
  border: 2px solid var(--bg); border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent);
  font-size: var(--fs-12); font-weight: 600; line-height: 16px; text-align: center;
}
.cnt {
  position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-width: 20px; height: 20px; padding: 0 var(--sp-6); border-radius: var(--r-sm); background: var(--surface); color: var(--text-2);
  font-size: var(--fs-12); font-weight: 500; line-height: 1;
  transition: background var(--d2) var(--ease), color var(--d2) var(--ease);
}
.cnt-soft { background: var(--surface-2); }
.cnt-pend { background: var(--pending-soft); color: var(--pending); }
.tag {
  display: inline-flex; align-items: center; padding: 0 var(--sp-6); border: 1px solid var(--line); border-radius: var(--r-pill);
  font-size: var(--fs-12); line-height: 18px; color: var(--text-3); white-space: nowrap;
}

.pill {
  display: inline-flex; align-items: center; gap: var(--sp-4); height: 22px; padding: 0 var(--sp-8);
  border: 1px solid transparent; border-radius: var(--r-pill);
  font-size: var(--fs-12); font-weight: 500; line-height: 1; white-space: nowrap;
}
.st-win { background: var(--win-soft); color: var(--win); }
.st-loss { background: var(--loss-soft); color: var(--loss); }
.st-void { background: var(--void-soft); color: var(--void); }
.st-pend { background: var(--pending-soft); color: var(--pending); }
.st-pre { background: var(--surface-2); color: var(--text-2); }
.st-live { background: var(--accent-soft); color: var(--accent); }
.st-stuck { background: var(--pending-soft); color: var(--pending); border-color: var(--pending); }
.st-accent { background: var(--accent-soft); color: var(--accent); }
.st-mute { background: var(--surface-2); color: var(--text-2); }
.live-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---- avatar ---- */
.ava {
  display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: var(--fs-13); font-weight: 600;
}
.ava-sm { width: 24px; height: 24px; font-size: var(--fs-12); }
.ava-lg { width: 40px; height: 40px; font-size: var(--fs-16); }
.ava-xl { width: 56px; height: 56px; font-size: var(--fs-22); }
.ava.t2 { background: var(--win-soft); color: var(--win); }
.ava.t3 { background: var(--pending-soft); color: var(--pending); }
.ava.t4 { background: var(--void-soft); color: var(--void); }

/* ---- odds pill ---- */
.odds {
  display: inline-flex; align-items: center; justify-content: space-between; gap: var(--sp-12); min-width: 132px; height: 32px; padding: 0 var(--sp-10);
  border: 0; border-radius: var(--r); background: var(--surface-2); color: var(--text);
  font-size: var(--fs-13); line-height: 1; white-space: nowrap;
}
.odds.is-sel { background: var(--accent-soft); }
.odds-pick { color: var(--text-2); }
.odds-price { font-weight: 600; color: var(--text); }
.odds.is-sel .odds-price { color: var(--accent); }
.odds-sm { min-width: 0; height: 26px; gap: var(--sp-8); padding: 0 var(--sp-8); font-size: var(--fs-12); }
/* In a table column every pill fills its cell, so the cell is as wide as the widest pill and the prices share
   the right edge. */
td .odds { display: flex; width: 100%; min-width: max-content; max-width: 176px; }

/* ---- closing price: a grid of fixed slots ---- */
.close {
  --close-slot: 5.5ch;
  display: inline-grid; grid-template-columns: var(--close-slot) 12px var(--close-slot) auto; align-items: center; column-gap: var(--sp-6);
  font-size: var(--fs-13); white-space: nowrap;
}
.close-old { color: var(--text-3); }
.close-new { font-weight: 500; }
.close-now { font-size: var(--fs-12); color: var(--text-3); }
.close-mark { display: inline-flex; justify-content: center; width: 12px; }
.close-mark.is-down { color: var(--win); }
.close-mark.is-up { color: var(--loss); }
.close-mark.is-up svg { transform: rotate(180deg); }

/* ---- live score, result cell ---- */
.live-score { display: inline-flex; align-items: center; gap: var(--sp-6); white-space: nowrap; }
.live-wave { display: inline-flex; flex: none; color: var(--live); }
.sboxes { display: inline-flex; gap: var(--sp-2); }
.sbox { position: relative; display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid var(--line); border-radius: var(--r-xs); font-size: var(--fs-12); font-weight: 500; line-height: 1; }
.live-t { font-size: var(--fs-12); color: var(--text-2); }
.pre-t { font-size: var(--fs-12); line-height: 16px; color: var(--text-2); white-space: nowrap; }

/* ---- live-update flash: ds.js adds .is-flash for --d2; the fade is the transition back ---- */
[data-ds-flash] { position: relative; }
[data-ds-flash]::after {
  content: ""; position: absolute; inset: -2px -4px; border-radius: var(--r-xs); background: var(--accent); opacity: 0; pointer-events: none;
  transition: opacity var(--d-chart) var(--ease);
}
[data-ds-flash].is-flash::after { opacity: .24; transition: none; }

/* ---- profit, win-loss bar ---- */
.profit { white-space: nowrap; }
.wl { display: block; flex: none; width: 160px; height: 6px; }
.wl-win { fill: var(--win); }
.wl-loss { fill: var(--loss); }
.wl-void { fill: var(--void); }
.wl-pend { fill: var(--pending); }
.wl-none { fill: var(--line); }
.wl-full { width: 100%; }

/* ---- KPI hero, KPI tile ---- */
.kpi-v { font-size: var(--fs-64); font-weight: 600; letter-spacing: -0.02em; line-height: 1; white-space: nowrap; color: var(--text); }
.kpi-l { margin-top: var(--sp-8); font-size: var(--fs-14); color: var(--text-2); }
.kpi-md .kpi-v { font-size: var(--fs-28); line-height: 1.15; letter-spacing: -0.01em; }
.kpi-sm .kpi-v { font-size: var(--fs-22); line-height: 1.2; letter-spacing: -0.01em; }
.kpi-md .kpi-l, .kpi-sm .kpi-l { margin-top: var(--sp-2); font-size: var(--fs-13); }
.kpi-v.c-win { color: var(--win); }
.kpi-v.c-loss { color: var(--loss); }

.kpi-tiles { display: grid; gap: var(--sp-12); }
.kpi-tiles-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi-tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-tiles-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-tiles-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi-tile {
  display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; padding: var(--sp-14) var(--sp-16);
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--text); text-decoration: none;
  transition: background var(--d1) var(--ease), border-color var(--d1) var(--ease);
}
.kpi-tile.is-link:hover { border-color: var(--text-3); background: var(--surface-2); }
.kpi-tile-v { font-size: var(--fs-22); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; white-space: nowrap; }
.kpi-tile-v.c-win { color: var(--win); }
.kpi-tile-v.c-loss { color: var(--loss); }
.kpi-tile-v.c-pend { color: var(--pending); }
.kpi-tile-l { font-size: var(--fs-13); color: var(--text-2); }
.kpi-tile-d { font-size: var(--fs-12); color: var(--text-2); }
.kpi-tile-spark { display: block; margin-top: var(--sp-6); }
.kpi-tile-spark svg { display: block; width: 100%; height: 32px; }

/* ---- stat line, hero row ---- */
.hero-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-16) var(--sp-44); }
.hero-row .stat-line { padding-bottom: var(--sp-2); }
.stat-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-10) var(--sp-28); font-size: var(--fs-14); }
.stat { display: inline-flex; align-items: center; gap: var(--sp-6); white-space: nowrap; }
.stat-line .sl-k { color: var(--text-2); }
.stat-line .sl-v { font-weight: 500; }

/* ---- callout, key-value list, divider ---- */
.callout { display: flex; gap: var(--sp-10); padding: var(--sp-10) var(--sp-12); border-radius: var(--r); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-13); line-height: 18px; }
.callout.is-warn { background: var(--pending-soft); color: var(--pending); }
.callout.is-bad { background: var(--loss-soft); color: var(--loss); }
.callout.is-ok { background: var(--win-soft); color: var(--win); }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: var(--sp-8) var(--sp-12); margin: 0; font-size: var(--fs-13); }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; }
.divider { height: 1px; margin: var(--sp-12) 0; border: 0; background: var(--line); }
.date-line { margin-top: var(--sp-2); font-size: var(--fs-14); color: var(--text-2); }

@media (max-width: 1199px) {
  .kpi-tiles-5, .kpi-tiles-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .kpi-tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .kpi-v { font-size: var(--fs-44); line-height: 1.05; }
  .kpi-l { margin-top: var(--sp-4); }
  .kpi-tiles-3, .kpi-tiles-4, .kpi-tiles-5, .kpi-tiles-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-tile { min-height: 64px; justify-content: center; }
  .hero-row { gap: var(--sp-12) var(--sp-24); }
}
@media (max-width: 767px) {
  .kv { grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); }
  .kv dd { margin-bottom: var(--sp-8); }
}

/* ---- form strip: the last results as squares ---- */
.fstrip { display: inline-flex; gap: var(--sp-4); vertical-align: middle; }
.fstrip-b {
  display: grid; place-items: center; width: 20px; height: 20px; border-radius: var(--r-xs);
  font-size: var(--fs-11); font-style: normal; font-weight: 600; line-height: 1;
}
.fstrip-w { background: var(--win-soft); color: var(--win); }
.fstrip-l { background: var(--loss-soft); color: var(--loss); }
.fstrip-n { background: var(--surface-2); color: var(--text-3); }

/* ---- probability bar: names and shares above one SVG; segment widths are attributes ---- */
.pbar { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 160px; }
.pbar-1 { --pbar-c: var(--c1); }
.pbar-2 { --pbar-c: var(--c2); }
.pbar-3 { --pbar-c: var(--c3); }
.pbar-accent { --pbar-c: var(--accent); }
.pbar-mute { --pbar-c: var(--text-3); }
.pbar-txt { display: flex; justify-content: space-between; gap: var(--sp-12); font-size: var(--fs-13); white-space: nowrap; }
.pbar-k { display: inline-flex; align-items: center; gap: var(--sp-6); }
.pbar-k::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--pbar-c); }
.pbar-n { color: var(--text-2); }
.pbar-k b { font-weight: 600; }
.pbar-svg { display: block; width: 100%; height: 6px; border-radius: var(--r-pill); overflow: hidden; background: var(--line); }
.pbar-seg { fill: var(--pbar-c); }

/* --- assets/css/40-panels.css --- */
/* Panels, the card row and panel grid, lists, week cards, the live card, section cards. Macros: templates/ds/panels.html.
   Lists sit in a bare panel: their rows carry the side padding. */

/* ---- panel ---- */
.panel {
  display: flex; flex-direction: column; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--text);
}
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-12); min-height: 52px; padding: var(--sp-12) var(--sp-16); }
.panel .panel-h h2 { flex: 1; min-width: 0; margin: 0; font-size: var(--fs-15); font-weight: 600; line-height: 20px; }
.panel-act { display: flex; flex: none; align-items: center; gap: var(--sp-8); }
.panel-b { flex: 1 1 auto; min-width: 0; padding: 0 var(--sp-16) var(--sp-16); }
.panel-note { padding: 0 var(--sp-16) var(--sp-14); font-size: var(--fs-12); line-height: 16px; color: var(--text-3); }
.panel-f { padding: var(--sp-12) var(--sp-16); border-top: 1px solid var(--line); font-size: var(--fs-13); }

/* ---- card row and panel grid: one set of columns, so card edges meet panel edges ---- */
.card-row, .panel-grid { display: grid; gap: var(--sp-16); }
.card-row-2, .panel-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-row-3, .panel-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Rows stretch, so panels side by side end on one line; in a stack the last panel takes the slack. */
.panel-col { display: flex; flex-direction: column; gap: var(--sp-16); min-width: 0; }
.panel-col > .panel:last-child { flex: 1 1 auto; }
.panel-col.span-2 { grid-column: span 2; }

/* At 1199 px and below a three-column grid is one column; the stacks dissolve and `po-N` sets the order. */
@media (max-width: 1199px) {
  .card-row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-row .card-wide { grid-column: 1 / -1; }
  .panel-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .panel-grid-3 .panel-col { display: contents; }
  .panel-grid-3 .panel-col.span-2 { grid-column: auto; }
  .panel-grid-3 .po-1 { order: 1; } .panel-grid-3 .po-2 { order: 2; } .panel-grid-3 .po-3 { order: 3; } .panel-grid-3 .po-4 { order: 4; }
  .panel-grid-3 .po-5 { order: 5; } .panel-grid-3 .po-6 { order: 6; } .panel-grid-3 .po-7 { order: 7; } .panel-grid-3 .po-8 { order: 8; }
}
@media (max-width: 1023px) {
  .panel-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .panel-grid-2 .panel-col { display: contents; }
  .panel-grid-2 .po-1 { order: 1; } .panel-grid-2 .po-2 { order: 2; } .panel-grid-2 .po-3 { order: 3; } .panel-grid-2 .po-4 { order: 4; }
  .panel-grid-2 .po-5 { order: 5; } .panel-grid-2 .po-6 { order: 6; } .panel-grid-2 .po-7 { order: 7; } .panel-grid-2 .po-8 { order: 8; }
}
@media (max-width: 767px) {
  .card-row-2, .card-row-3 { grid-template-columns: minmax(0, 1fr); }
  .panel-h { min-height: 48px; padding: var(--sp-10) var(--sp-12); }
  .panel-b { padding: 0 var(--sp-12) var(--sp-12); }
  .panel-note { padding: 0 var(--sp-12) var(--sp-12); }
  .panel-f { padding: var(--sp-10) var(--sp-12); }
}

/* ---- stretched link: the link covers its host, controls inside sit above it ---- */
.stretch-host { position: relative; }
.stretch-link { position: static; display: block; padding: 0; border: 0; background: transparent; color: inherit; text-decoration: none; cursor: pointer; }
.stretch-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.stretch-link:focus-visible { outline: none; }
.stretch-link:focus-visible::after { outline: 2px solid var(--focus); outline-offset: 2px; }
.stretch-host a:not(.stretch-link), .stretch-host button:not(.stretch-link) { position: relative; z-index: 2; }

/* ---- attention and stuck-bet lists ---- */
.att { margin: 0; padding: 0; list-style: none; }
.att-i { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8) var(--sp-12); padding: var(--sp-12) var(--sp-16); border-top: 1px solid var(--line); }
.att-i:first-child { border-top: 0; }
.att-b { flex: 1 1 180px; min-width: 0; }
.att-t { display: flex; align-items: center; gap: var(--sp-8); min-width: 0; }
.att-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-14); font-weight: 500; }
.att-s { margin-top: var(--sp-2); font-size: var(--fs-13); line-height: 18px; color: var(--text-2); }
.att-a { display: flex; flex: none; align-items: center; gap: var(--sp-8); margin-left: auto; }
.att-more .att-n { color: var(--text-2); font-weight: 400; }
.att-h { margin: 0; padding: var(--sp-4) var(--sp-16) var(--sp-8); font-size: var(--fs-13); font-weight: 600; color: var(--text-2); }
.att-note { margin: 0; padding: var(--sp-8) var(--sp-16) var(--sp-12); font-size: var(--fs-12); line-height: 16px; color: var(--text-3); }
@media (max-width: 767px) {
  .att-i { padding: var(--sp-12); }
  .att-b { flex-basis: 100%; }
  .att-a { flex-basis: 100%; margin-left: 0; }
  .att-more .att-a { flex-basis: auto; margin-left: auto; }
  .att-h, .att-note { padding-right: var(--sp-12); padding-left: var(--sp-12); }
}

/* ---- timeline ---- */
.tl { margin: 0; padding: var(--sp-4) var(--sp-16) var(--sp-8); list-style: none; }
.tl-i { position: relative; padding: 0 0 var(--sp-14) var(--sp-20); }
.tl-i::before { content: ""; position: absolute; top: 14px; bottom: 0; left: 4px; width: 1px; background: var(--line); }
.tl-i:last-child { padding-bottom: 0; }
.tl-i:last-child::before { display: none; }
.tl-i::after { content: ""; position: absolute; top: 4px; left: 0; width: 9px; height: 9px; border: 2px solid var(--line-strong); border-radius: 50%; background: var(--surface); }
.tl-i.is-live::after { border-color: var(--live); background: var(--live); animation: ds-pulse 1.6s ease-in-out infinite; }
.tl-meta { display: flex; gap: var(--sp-8); font-size: var(--fs-12); line-height: 16px; color: var(--text-3); }
.tl-t { margin-top: var(--sp-2); font-size: var(--fs-14); font-weight: 500; }
.tl-s { margin-top: var(--sp-2); font-size: var(--fs-13); color: var(--text-2); }

/* ---- activity feed ---- */
.feed { margin: 0; padding: 0; list-style: none; }
.feed-i { display: flex; align-items: flex-start; gap: var(--sp-10); padding: var(--sp-10) var(--sp-16); border-top: 1px solid var(--line); }
.feed-i:first-child { border-top: 0; }
.feed-t { flex: 1; min-width: 0; font-size: var(--fs-13); line-height: 18px; color: var(--text-2); }
.feed-t b { font-weight: 600; color: var(--text); }
.feed-time { flex: none; font-size: var(--fs-12); line-height: 18px; color: var(--text-3); white-space: nowrap; }
@media (max-width: 767px) {
  .feed-i { padding-right: var(--sp-12); padding-left: var(--sp-12); }
}

/* ---- health list ---- */
.health-g { margin: 0; padding: var(--sp-8) var(--sp-16) var(--sp-4); font-size: var(--fs-12); font-weight: 600; color: var(--text-3); }
.health-g:not(:first-child) { margin-top: var(--sp-8); border-top: 1px solid var(--line); padding-top: var(--sp-12); }
.health-l { margin: 0; padding: 0; list-style: none; }
.health-i { display: flex; align-items: center; gap: var(--sp-12); padding: var(--sp-8) var(--sp-16); }
.health-b { flex: 1; min-width: 0; }
.health-t { font-size: var(--fs-14); font-weight: 500; }
.health-s { font-size: var(--fs-12); line-height: 16px; color: var(--text-2); }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--void); }
.dot.is-ok { background: var(--win); }
.dot.is-lag { background: var(--pending); }
.dot.is-down { background: var(--loss); }
@media (max-width: 767px) {
  .health-g, .health-i { padding-right: var(--sp-12); padding-left: var(--sp-12); }
}

/* ---- week cards: a strip of cells divided by hairlines (each card's shadow ring; the later card paints over the earlier
   one's ring); the last cell of a row takes the rest ---- */
.week-grid { display: grid; }
.week-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.week-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.week-card {
  display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; padding: var(--sp-14) var(--sp-16);
  background: var(--surface); color: var(--text); text-decoration: none;
  box-shadow: 0 0 0 1px var(--line);
  transition: background var(--d1) var(--ease);
}
.week-card:hover { background: var(--surface-2); }
.week-card-h { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-13); color: var(--text-2); }
.week-card-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-12); }
.week-card-v { font-size: var(--fs-22); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; white-space: nowrap; }
.week-card-spark { flex: 0 1 96px; min-width: 0; }
.week-card-spark svg { display: block; width: 100%; height: 28px; }
.week-card-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-12); font-size: var(--fs-12); color: var(--text-3); }
@media (min-width: 1024px) {
  .week-grid-3 > :last-child:nth-child(3n+1), .week-grid-4 > :last-child:nth-child(4n+2) { grid-column: span 3; }
  .week-grid-3 > :last-child:nth-child(3n+2), .week-grid-4 > :last-child:nth-child(4n+3) { grid-column: span 2; }
  .week-grid-4 > :last-child:nth-child(4n+1) { grid-column: span 4; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .week-grid-3, .week-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week-grid > :last-child:nth-child(2n+1) { grid-column: span 2; }
}
@media (max-width: 767px) {
  .week-grid-3, .week-grid-4 { grid-template-columns: minmax(0, 1fr); }
  .week-card { padding: var(--sp-12); }
}

/* ---- live card ---- */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--sp-12); }
.live-card {
  display: flex; flex-direction: column; gap: var(--sp-12); min-width: 0; padding: var(--sp-14) var(--sp-16);
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--text);
  transition: border-color var(--d1) var(--ease);
}
.live-card:hover { border-color: var(--text-3); }
.live-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-8); min-width: 0; }
.live-head-l { display: flex; align-items: center; gap: var(--sp-8); min-width: 0; font-size: var(--fs-12); color: var(--text-2); }
.live-since { flex: none; font-size: var(--fs-12); color: var(--text-2); white-space: nowrap; }
.live-board { display: flex; flex-direction: column; gap: var(--sp-6); }
.live-board-r { display: flex; align-items: center; gap: var(--sp-6); }
.live-board-n { display: flex; flex: 1; align-items: center; gap: var(--sp-8); min-width: 0; }
.live-name { min-width: 0; font-size: var(--fs-14); color: var(--text-2); }
.live-name.is-lead { font-weight: 600; color: var(--text); }
.live-bh { flex: none; width: 28px; font-size: var(--fs-11); text-align: center; color: var(--text-3); }
.live-box {
  display: grid; place-items: center; flex: none; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: var(--fs-13); line-height: 1; color: var(--text-2);
}
.live-box.is-lead { border-color: var(--text-3); font-weight: 600; color: var(--text); }
.live-box.is-cur { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.live-bets { display: flex; flex-direction: column; gap: var(--sp-8); padding-top: var(--sp-12); border-top: 1px solid var(--line); }
.live-bet { display: flex; flex-direction: column; gap: var(--sp-6); min-width: 0; }
.live-bet.is-btn {
  width: 100%; padding: var(--sp-8) var(--sp-10); border: 1px solid var(--line); border-radius: var(--r);
  background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: background var(--d1) var(--ease);
}
.live-bet.is-btn:hover { background: var(--surface-2); }
.live-bet-main { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); }
.live-model { font-size: var(--fs-12); color: var(--text-2); }
.live-close { font-size: var(--fs-12); }
.live-trend { display: flex; align-items: center; gap: var(--sp-8); }
.live-tr { font-size: var(--fs-12); font-weight: 500; color: var(--text-2); }
.live-tr.is-plus { color: var(--win); }
.live-tr.is-minus { color: var(--loss); }
.live-note { font-size: var(--fs-12); color: var(--text-3); }
@media (max-width: 767px) {
  .live-grid { grid-template-columns: minmax(0, 1fr); }
  .live-card { padding: var(--sp-12); }
}

/* ---- section cards ---- */
.sec-card {
  display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; padding: var(--sp-16);
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--text); text-decoration: none;
  transition: border-color var(--d1) var(--ease);
}
a.sec-card:hover { border-color: var(--text-3); }
.sec-card-h { display: flex; align-items: center; gap: var(--sp-8); }
.sec-card-ico { display: inline-flex; flex: none; color: var(--text-2); }
.sec-card-name { flex: 1; min-width: 0; font-size: var(--fs-14); font-weight: 600; }
.sec-card-go { display: inline-flex; flex: none; color: var(--text-3); }
.sec-card-v { margin-top: var(--sp-8); font-size: var(--fs-28); font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; white-space: nowrap; }
.sec-card-l { font-size: var(--fs-13); color: var(--text-2); }
.sec-card-m { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-12); margin-top: var(--sp-4); font-size: var(--fs-12); color: var(--text-2); }
.sec-card-spark { display: block; margin-top: var(--sp-8); }
.sec-card-spark svg { display: block; width: 100%; height: 40px; }
.sec-card-cap { display: flex; justify-content: space-between; gap: var(--sp-8); margin-top: var(--sp-4); font-size: var(--fs-12); color: var(--text-2); }
.sec-card.is-soon { border-style: dashed; background: transparent; }
.soon-l { margin: var(--sp-4) 0 0; padding: 0; list-style: none; }
.soon-i { display: flex; align-items: center; gap: var(--sp-10); padding: var(--sp-8) 0; color: var(--text); text-decoration: none; }
.soon-i:hover .soon-n { text-decoration: underline; }
.soon-b { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.soon-n { font-size: var(--fs-14); font-weight: 500; }
.soon-t { font-size: var(--fs-12); color: var(--text-3); }

/* --- assets/css/50-feedback.css --- */
/* Feedback: empty state, skeleton, toasts, tooltip, and the busy and error states of reloaded panels. */

/* ---- empty state ---- */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--sp-6); padding: var(--sp-40) var(--sp-20); text-align: center; }
.empty .em-ico { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: var(--sp-6); border-radius: 50%; background: var(--surface-2); color: var(--text-3); }
.empty .em-t { font-size: var(--fs-15); font-weight: 600; }
.empty .em-s { max-width: 360px; font-size: var(--fs-13); color: var(--text-2); }
.empty .btn { margin-top: var(--sp-10); }

/* ---- skeleton: the shimmer comes from .anim-shimmer in base.css ---- */
.sk { border-radius: var(--r-sm); }
.sk-page { display: flex; flex-direction: column; gap: var(--sp-16); }
.sk-rows { gap: var(--sp-12); }
.sk-t { height: 56px; width: 220px; }
.sk-l { height: 14px; }
.sk-row { height: 40px; }
.sk-b { height: 120px; border-radius: var(--r-lg); }
.sk-w-40 { width: 40%; }
.sk-w-60 { width: 60%; }
.sk-w-80 { width: 80%; }

/* ---- toasts ---- */
.toasts { position: fixed; z-index: 300; right: 20px; bottom: 20px; display: flex; flex-direction: column; align-items: flex-end; gap: var(--sp-8); width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: var(--sp-10); width: 100%; padding: var(--sp-10) var(--sp-8) var(--sp-10) var(--sp-14); border-radius: var(--r); background: var(--inv-bg); color: var(--inv-fg); box-shadow: var(--shadow); font-size: var(--fs-13); line-height: 18px; pointer-events: auto; animation: ds-fb-toast-in var(--d3) var(--ease); }
.toast.is-leaving { animation: ds-fb-toast-out var(--d2) var(--ease) forwards; }
@keyframes ds-fb-toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes ds-fb-toast-out { to { opacity: 0; transform: translateY(8px); } }
.toast-t { flex: 1; min-width: 0; }
.toast-a { flex: none; height: 32px; padding: 0 var(--sp-10); border: 0; border-radius: var(--r-sm); background: transparent; color: var(--inv-accent); font-weight: 600; font-size: var(--fs-13); }
.toast-a:hover { background: var(--hover-on-inv); }
.toast-x { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--inv-fg); opacity: .7; }
.toast-x:hover { opacity: 1; background: var(--hover-on-inv); }
.toast .t-ico { flex: none; display: grid; place-items: center; }
.toast .t-ok { color: var(--win-on-inv); }
.toast .t-warn { color: var(--pending-on-inv); }
.toast :focus-visible { outline-color: var(--inv-accent); }

/* ---- tooltip ---- */
.tip { position: fixed; z-index: 400; max-width: 240px; padding: var(--sp-6) var(--sp-10); border-radius: var(--r-sm); background: var(--inv-bg); color: var(--inv-fg); font-size: var(--fs-12); line-height: 16px; pointer-events: none; animation: ds-fb-fade-in var(--d1) var(--ease); }
@keyframes ds-fb-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---- panels that htmx reloads ---- */
[data-ds-panel] { position: relative; }
[data-ds-panel].is-loading > :not(.panel-h) { visibility: hidden; pointer-events: none; }
[data-ds-panel].is-loading::after {
  content: ""; position: absolute; top: 56px; left: 16px; right: 16px; bottom: 16px; border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  -webkit-mask-image: repeating-linear-gradient(to bottom, currentColor 0, currentColor 14px, transparent 14px, transparent 28px);
  mask-image: repeating-linear-gradient(to bottom, currentColor 0, currentColor 14px, transparent 14px, transparent 28px);
  animation: ds-shimmer 1.2s linear infinite;
  pointer-events: none;
}
[data-ds-panel].is-error > :not(.panel-h):not(.panel-err) { display: none; }

@media (max-width: 767px) {
  .toasts { right: 12px; left: 12px; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); width: auto; align-items: stretch; }
  .toast-a, .toast-x { min-height: 44px; min-width: 44px; }
}

/* --- assets/css/60-overlays.css --- */
/* Overlays. Drawers, dialogs, sheets and the palette are native <dialog> elements opened with showModal(),
   so the scrim is ::backdrop. Entry is a keyframe animation; exit is a discrete transition of display and
   overlay, which keeps the closing dialog on screen for its duration (browsers without it just cut). */

dialog.drawer, dialog.dialog, dialog.sheet, dialog.palette {
  padding: 0; border: 1px solid var(--line); background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  overflow: hidden; flex-direction: column; font: inherit;
  transition: display var(--d2) allow-discrete, overlay var(--d2) allow-discrete, opacity var(--d2) var(--ease), transform var(--d2) var(--ease);
}
dialog.drawer[open], dialog.dialog[open], dialog.sheet[open], dialog.palette[open] { display: flex; }
dialog.drawer:not([open]), dialog.dialog:not([open]), dialog.sheet:not([open]), dialog.palette:not([open]) { opacity: 0; pointer-events: none; }
dialog.drawer::backdrop, dialog.dialog::backdrop, dialog.sheet::backdrop, dialog.palette::backdrop { background: var(--scrim); animation: ds-ov-fade-in var(--d2) var(--ease); }
@keyframes ds-ov-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---- layer parts ---- */
.layer-h { display: flex; flex: none; align-items: flex-start; justify-content: space-between; gap: var(--sp-12); padding: var(--sp-16) var(--sp-12) var(--sp-12) var(--sp-20); border-bottom: 1px solid var(--line); }
.layer-hd { min-width: 0; }
.layer-h h2 { font-size: var(--fs-18); font-weight: 600; line-height: 1.3; }
.layer-sub { margin-top: var(--sp-2); font-size: var(--fs-13); color: var(--text-2); }
.layer-b { flex: 1; min-height: 0; overflow-y: auto; padding: var(--sp-16) var(--sp-20); }
.layer-f { display: flex; flex: none; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--sp-8); padding: var(--sp-12) var(--sp-20); border-top: 1px solid var(--line); background: var(--surface); }
.layer-f .grow-left { margin-right: auto; }

/* ---- drawer: a side panel, a bottom sheet at 767 px and below ---- */
dialog.drawer { inset: 0 0 0 auto; margin: 0; width: min(480px, 100vw); max-width: 100vw; height: 100%; max-height: none; border-width: 0 0 0 1px; border-radius: 0; animation: ds-ov-drawer-in var(--d3) var(--ease); }
dialog.drawer.is-wide { width: min(640px, 100vw); }
dialog.drawer:not([open]) { transform: translateX(32px); }
dialog.drawer .sheet-grab { display: none; }
@keyframes ds-ov-drawer-in { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- sheet: full width, anchored to the bottom edge ---- */
dialog.sheet { inset: auto 0 0 0; margin: 0 auto; width: min(100%, 560px); max-width: 100%; height: auto; max-height: 90vh; border-width: 1px 1px 0; border-radius: var(--r-lg) var(--r-lg) 0 0; animation: ds-ov-sheet-in var(--d3) var(--ease); }
dialog.sheet:not([open]) { transform: translateY(40px); }
@keyframes ds-ov-sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-grab { flex: none; width: 36px; height: 4px; margin: var(--sp-8) auto 0; border-radius: var(--r-xs); background: var(--line); }
dialog.sheet .layer-b { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
dialog.sheet .layer-f { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.sheet-list { padding: var(--sp-4) var(--sp-8) var(--sp-8); }
.sheet-list .menu-i { width: 100%; height: 48px; margin: 0; font-size: var(--fs-15); }

/* ---- dialog: centred ---- */
dialog.dialog { inset: 0; margin: auto; width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 48px); height: fit-content; border-radius: var(--r-lg); animation: ds-ov-dialog-in var(--d2) var(--ease); }
dialog.dialog:not([open]) { transform: translateY(8px) scale(.98); }
@keyframes ds-ov-dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
dialog.dialog .layer-b { padding-top: var(--sp-14); }
.dialog-msg { color: var(--text-2); }

/* ---- popover and menu ---- */
.pop { position: fixed; z-index: 150; overflow: hidden; min-width: 160px; max-width: calc(100vw - 16px); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); animation: ds-ov-pop-in var(--d2) var(--ease); transform-origin: top right; }
.pop.is-leaving { animation: ds-ov-pop-out var(--d1) var(--ease) forwards; }
@keyframes ds-ov-pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes ds-ov-pop-out { to { opacity: 0; transform: translateY(-4px); } }
.pop[role="menu"] { padding: var(--sp-6) 0; }
.pop.is-in-sheet { position: static; min-width: 0; max-width: none; border: 0; border-radius: 0; box-shadow: none; animation: none; }
.pop-h { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-12); height: 44px; padding: 0 var(--sp-6) 0 var(--sp-14); border-bottom: 1px solid var(--line); font-size: var(--fs-14); font-weight: 600; }
.pop-scroll { max-height: min(420px, 60vh); overflow-y: auto; }
.pop-foot { display: flex; align-items: center; justify-content: center; height: 40px; color: var(--accent); font-size: var(--fs-13); font-weight: 500; text-decoration: none; transition: background var(--d1) var(--ease); }
.pop-foot:hover { background: var(--accent-soft); }
.pop-sep { height: 1px; margin: var(--sp-6) 0; background: var(--line); }
.menu-i { display: flex; align-items: center; gap: var(--sp-10); width: calc(100% - 12px); height: 36px; margin: 0 var(--sp-6); padding: 0 var(--sp-8); border: 0; border-radius: var(--r); background: transparent; color: var(--text); font-size: var(--fs-14); text-align: left; text-decoration: none; cursor: pointer; transition: background var(--d1) var(--ease); }
.menu-i:hover { background: var(--surface-2); }
.menu-i:focus-visible { background: var(--surface-2); outline-offset: -2px; }
.menu-i svg { color: var(--text-2); }
.menu-i.is-danger, .menu-i.is-danger svg { color: var(--loss); }
.menu-i[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.menu-i .menu-chk { margin-left: auto; color: var(--accent); }

/* ---- command palette ---- */
dialog.palette { inset: 0 0 auto 0; margin: 12vh auto 0; width: min(640px, calc(100vw - 24px)); height: auto; max-height: 72vh; border-radius: var(--r-lg); animation: ds-ov-palette-in var(--d2) var(--ease); }
dialog.palette:not([open]) { transform: translateY(-8px); }
@keyframes ds-ov-palette-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.pal-in { display: flex; flex: none; align-items: center; gap: var(--sp-10); height: 56px; padding: 0 var(--sp-16); border-bottom: 1px solid var(--line); color: var(--text-3); }
.pal-in input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; color: var(--text); font-size: var(--fs-16); }
.pal-in input::placeholder { color: var(--text-3); opacity: 1; }
.pal-list { flex: 1; min-height: 0; overflow-y: auto; padding: var(--sp-6) var(--sp-8) var(--sp-8); }
.pal-g { padding: var(--sp-10) var(--sp-10) var(--sp-4); font-size: var(--fs-12); color: var(--text-3); }
.pal-i { display: flex; align-items: center; gap: var(--sp-12); width: 100%; min-height: 44px; padding: var(--sp-6) var(--sp-10); border: 0; border-radius: var(--r); background: transparent; color: var(--text); text-align: left; text-decoration: none; cursor: pointer; }
.pal-i[aria-selected="true"] { background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--focus); }
.pal-ico { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: var(--r); background: var(--surface-2); color: var(--text-2); }
.pal-i[aria-selected="true"] .pal-ico { background: var(--accent-soft); color: var(--accent); }
.pal-tx { display: flex; flex-direction: column; min-width: 0; }
.pal-t { font-size: var(--fs-14); line-height: 20px; }
.pal-s { font-size: var(--fs-12); line-height: 16px; color: var(--text-2); }
.pal-i mark { background: transparent; color: var(--accent); font-weight: 600; }
.pal-end { margin-left: auto; font-size: var(--fs-12); color: var(--text-3); white-space: nowrap; }
.pal-empty { padding: var(--sp-28) var(--sp-16); text-align: center; color: var(--text-2); }
.pal-foot { display: flex; flex: none; align-items: center; gap: var(--sp-16); padding: var(--sp-8) var(--sp-16); border-top: 1px solid var(--line); font-size: var(--fs-12); color: var(--text-3); }
.pal-foot span { display: inline-flex; align-items: center; gap: var(--sp-6); }
.palette .keychip { flex: none; padding: 0 var(--sp-6); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); font-size: var(--fs-12); line-height: 20px; color: var(--text-2); white-space: nowrap; }

@media (max-width: 767px) {
  dialog.drawer, dialog.drawer.is-wide { inset: auto 0 0 0; width: 100%; max-width: 100%; height: auto; max-height: 92vh; border-width: 1px 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; animation-name: ds-ov-sheet-in; }
  dialog.drawer:not([open]) { transform: translateY(40px); }
  dialog.drawer .sheet-grab { display: block; }
  dialog.palette { margin-top: var(--sp-8); max-height: calc(100vh - 16px); }
  .pal-foot { display: none; }
  .menu-i { height: 44px; }
  .layer-x { width: 44px; height: 44px; }
}

/* --- assets/css/70-charts.css --- */
/*
 * Charts. The SVG comes from istrena_ds.charts; geometry is in its attributes and this file only paints it.
 * The chart box is the plot: gutters for the axis labels are margins (ch-l-N, ch-r-N) and the svg overflows into them.
 */
.ch {
  --ch-l: var(--sp-12);
  --ch-r: var(--sp-16);
  display: block;
  width: calc(100% - var(--ch-l) - var(--ch-r));
  max-width: none;
  margin-left: var(--ch-l);
  margin-right: var(--ch-r);
  overflow: visible;
  touch-action: pan-y;
}
.ch-l-4 { --ch-l: var(--sp-4); } .ch-r-4 { --ch-r: var(--sp-4); }
.ch-l-12 { --ch-l: var(--sp-12); } .ch-r-12 { --ch-r: var(--sp-12); }
.ch-l-16 { --ch-l: var(--sp-16); } .ch-r-16 { --ch-r: var(--sp-16); }
.ch-l-32 { --ch-l: var(--sp-32); } .ch-r-32 { --ch-r: var(--sp-32); }
.ch-l-44 { --ch-l: var(--sp-44); } .ch-r-44 { --ch-r: var(--sp-44); }
.ch-l-56 { --ch-l: calc(var(--sp-44) + var(--sp-12)); } .ch-r-56 { --ch-r: calc(var(--sp-44) + var(--sp-12)); }
.ch-l-68 { --ch-l: calc(var(--sp-44) + var(--sp-24)); } .ch-r-68 { --ch-r: calc(var(--sp-44) + var(--sp-24)); }
.ch-l-80 { --ch-l: calc(var(--sp-40) + var(--sp-40)); } .ch-r-80 { --ch-r: calc(var(--sp-40) + var(--sp-40)); }

/* series colours: --ch-c is read by lines, dots, bars and swatches */
.ch-s1 { --ch-c: var(--c1); } .ch-s2 { --ch-c: var(--c2); } .ch-s3 { --ch-c: var(--c3); }
.ch-s4 { --ch-c: var(--c4); } .ch-s5 { --ch-c: var(--c5); }
.ch-s-accent { --ch-c: var(--accent); } .ch-s-win { --ch-c: var(--win); } .ch-s-loss { --ch-c: var(--loss); }
.ch-s-pend { --ch-c: var(--pending); } .ch-s-void { --ch-c: var(--void); }

.ch text { font-size: var(--fs-12); }
.ch-ax { fill: var(--text-3); }
.ch-val { fill: var(--text-2); }
.ch-mark-l { fill: var(--text-2); }
.ch-endlab { fill: var(--text); font-weight: 600; }
.ch-lbl.is-sel { fill: var(--text); font-weight: 600; }
.ch-ln { overflow: visible; }
.ch-slot { overflow: visible; }

.ch-grid line { stroke: var(--line); stroke-width: 1; }
.ch-zero { stroke: var(--line); stroke-width: 1; stroke-dasharray: 4 4; }
.ch-base { stroke: var(--line); stroke-width: 1; }
.ch-ideal { stroke: var(--text-3); }
.ch-mark { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.ch-cross { stroke: var(--text-3); stroke-width: 1; }
.ch [hidden] { display: none; }
.ch-hit { fill: transparent; }
.ch-hit-s { fill: transparent; }

.ch-line {
  fill: none; stroke: var(--ch-c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.ch-line.is-dashed { stroke-dasharray: 5 4; }
.ch-area { fill: var(--ch-c); fill-opacity: .1; stroke: none; }
.ch-end { fill: var(--ch-c); }
.ch-link { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-opacity: .5; vector-effect: non-scaling-stroke; }
.ch-err { stroke: var(--text-3); stroke-width: 1.2; }

/* line draw: a clip reveal, since dash animations are ignored with non-scaling strokes */
@keyframes ch-reveal {
  from { clip-path: inset(-4px 100% -4px 0); }
  to { clip-path: inset(-4px -4px -4px 0); }
}
@keyframes ch-appear { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .ch-reveal { animation: ch-reveal var(--d-chart) var(--ease) both; }
  .ch-end, .ch-endlab { animation: ch-appear var(--d2) var(--ease) calc(var(--d-chart) - var(--d2)) both; }
}

/* data points: invisible until the readout activates them */
.ch-pt { fill: transparent; stroke: transparent; outline: none; }
.ch-pt:focus { outline: none; }
circle.ch-pt.is-on { fill: var(--ch-c); stroke: var(--surface); stroke-width: 2px; }
circle.ch-pt:focus-visible { fill: var(--ch-c); stroke: var(--focus); stroke-width: 3px; }
.ch-dot { fill: var(--accent); stroke: var(--accent); stroke-width: 2px; }
.ch-dot.is-thin { fill: var(--surface); }
.ch-dot.is-on, .ch-dot:focus-visible { stroke: var(--text); stroke-width: 3px; }
.ch-dot.is-on { fill: var(--accent); }
.ch-dot.is-thin.is-on { fill: var(--surface); }
a.ch-pt { cursor: pointer; }
.ch-pt:focus-visible .ch-hit-s { stroke: var(--focus); stroke-width: 2px; }

/* bars: the slot svg centres the bar and caps its width */
.ch-bar {
  x: 50%; width: min(62%, 32px); transform-box: fill-box; transform: translateX(-50%);
  transition: opacity var(--d1) var(--ease);
}
.ch-stack .ch-bar { width: min(60%, 44px); }
.ch-hist .ch-bar { width: 80%; }
.ch-pos { fill: var(--win); }
.ch-neg { fill: var(--loss); }
.ch-void { fill: var(--void); }
.ch-seg { fill: var(--ch-c); stroke: var(--surface); stroke-width: 1px; }
.ch-sel { fill: var(--accent-soft); }
.ch-bars:has(.ch-pt.is-on) .ch-pt:not(.is-on) .ch-bar,
.ch-stack:has(.ch-pt.is-on) .ch-pt:not(.is-on) .ch-bar { opacity: .55; }

.ch-off { display: none; }
@media (max-width: 767px) {
  .ch-t2 { display: none; }
}

/* sparkline */
.ch-spark { display: block; flex: none; overflow: visible; }
.ch-spark.is-fluid { flex: 1 1 0; min-width: 0; width: calc(100% - var(--sp-8)); margin: 0 var(--sp-4); }
.ch-spark-line {
  fill: none; stroke: var(--ch-c); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.ch-spark-dot { fill: var(--ch-c); }

/* the shared readout: one element, positioned by 70-charts.js */
.chart-tip {
  position: fixed; left: 0; top: 0; z-index: 350; min-width: 110px; max-width: 280px;
  padding: var(--sp-8) var(--sp-10); border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow); color: var(--text);
  font-size: var(--fs-12); line-height: 16px; pointer-events: none;
  animation: ch-appear var(--d1) var(--ease);
}
.chart-tip .ct-t { margin-bottom: var(--sp-2); color: var(--text-3); }
.chart-tip .ct-r { display: flex; align-items: center; gap: var(--sp-6); }
.chart-tip .ct-r b { margin-left: auto; padding-left: var(--sp-10); font-weight: 600; white-space: nowrap; }
.ch-sw { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: var(--r-xs); background: var(--ch-c, var(--accent)); }
.chart-tip .ch-sw { width: 8px; height: 8px; }

/* legend */
.ch-legend { display: flex; flex-wrap: wrap; gap: var(--sp-8); }
.ch-lg {
  display: inline-flex; align-items: center; gap: var(--sp-8); min-height: 36px; padding: 0 var(--sp-12);
  border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); color: var(--text);
  font-size: var(--fs-13);
}
.ch-lg b { font-weight: 600; }
.ch-lg[aria-pressed="false"] { color: var(--text-2); background: var(--surface-2); }
.ch-lg[aria-pressed="false"] .ch-sw { opacity: .35; }
.ch-lg:hover:not(:disabled) { border-color: var(--text-3); }
.ch-lg:disabled, .ch-lg.is-static { cursor: default; color: var(--text); }
.ch-lg.is-static, .ch-lg:disabled { border-color: transparent; background: transparent; padding: 0 var(--sp-4); min-height: 24px; }
.ch-lg:disabled { opacity: 1; }
@media (max-width: 767px) {
  .ch-lg:not(:disabled) { min-height: 44px; }
}

/* progress bar and horizontal bars */
.progress { display: block; width: 100%; height: 6px; overflow: hidden; }
.progress-track { fill: var(--surface-2); }
.progress-fill { fill: var(--accent); }
.progress.is-win .progress-fill { fill: var(--win); }
.progress.is-loss .progress-fill { fill: var(--loss); }
.progress.is-pend .progress-fill { fill: var(--pending); }
.progress.is-mute .progress-fill { fill: var(--text-3); }

.hbars { display: grid; grid-template-columns: fit-content(40%) minmax(0, 1fr) max-content; column-gap: var(--sp-12); }
.hb-row {
  display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; align-items: center; min-height: 30px;
}
.hb-l, .hb-v { font-size: var(--fs-13); }
.hb-v { min-width: 56px; text-align: right; font-weight: 500; }

/* ROI bar */
.roi { display: inline-flex; align-items: center; gap: var(--sp-10); }
.roi-v { min-width: 64px; text-align: right; font-weight: 500; }
.roi-bar { flex: none; width: 96px; height: 8px; overflow: visible; }
.roi-track { fill: var(--surface-2); }
.roi-fill.is-pos { fill: var(--win); }
.roi-fill.is-neg { fill: var(--loss); }
.roi-zero { stroke: var(--text-3); stroke-width: 1; }
@media (max-width: 767px) {
  .roi-bar { width: 72px; }
}

/* calibration table */
.ch-tbl { width: 100%; margin-top: var(--sp-12); border-collapse: collapse; font-size: var(--fs-13); }
.ch-tbl th { padding: var(--sp-6) var(--sp-4); border-bottom: 1px solid var(--line); font-size: var(--fs-12); font-weight: 400; text-align: left; color: var(--text-3); }
.ch-tbl td { padding: var(--sp-6) var(--sp-4); border-bottom: 1px solid var(--line); }
.ch-tbl .r { text-align: right; }
.ch-tbl tr:last-child td { border-bottom: 0; }

/* --- assets/css/80-table.css --- */
/* Data table, phone cards and pager. Macros: templates/ds/table.html. Behaviour: assets/js/50-table.js. */

.dt-root { min-width: 0; }
.dt-wrap { overflow-x: auto; }
.dt-wrap.is-sticky { overflow: auto; max-height: var(--dt-max, 560px); }
.dt { width: 100%; border-collapse: collapse; }
.dt th {
  height: 36px; padding: 0 var(--sp-8); border-bottom: 1px solid var(--line); background: var(--surface); color: var(--text-3);
  font-size: var(--fs-12); font-weight: 500; text-align: left; white-space: nowrap;
}
.dt.is-sticky th { position: sticky; top: 0; z-index: 2; }
.dt td { height: 44px; padding: 0 var(--sp-8); border-bottom: 1px solid var(--line); font-size: var(--fs-13); white-space: nowrap; }
.dt.is-dense td { height: 36px; }
.dt th:first-child, .dt td:first-child { padding-left: var(--sp-16); }
.dt th:last-child, .dt td:last-child { padding-right: var(--sp-16); }
.dt th.r, .dt td.r { text-align: right; }
.dt td.mute { color: var(--text-2); }
.dt td.wrap-cell { white-space: normal; }
.dt tbody tr:last-child td { border-bottom: 0; }
.dt tr.is-click { cursor: pointer; }
.dt tr.is-click:hover td, .dt tr.is-click:focus-within td { background: var(--surface-2); }
.dt tr.is-sel td { background: var(--accent-soft); }
.dt .dt-selc { width: 44px; padding-right: var(--sp-2); }
.dt .dt-selc .check { min-height: 20px; }

/* The link or drawer button in the main cell of a clickable row: it looks like the cell's text. */
.dt-link {
  display: inline-flex; align-items: center; gap: var(--sp-8); max-width: 100%; padding: 0; border: 0; background: transparent;
  color: inherit; font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.dt-link:hover { color: var(--accent); }

/* Sortable header: a link; the chevron shows on hover and for the current sort. */
.th-b { display: inline-flex; align-items: center; gap: var(--sp-4); padding: 0; color: inherit; text-decoration: none; cursor: pointer; }
.th-b:hover { color: var(--text); }
.th-b .sort-ico { opacity: 0; transition: opacity var(--d1) var(--ease), transform var(--d2) var(--ease); }
.th-b:hover .sort-ico { opacity: .6; }
th[aria-sort="ascending"] .sort-ico, th[aria-sort="descending"] .sort-ico { opacity: 1; color: var(--accent); }
th[aria-sort="ascending"] .sort-ico { transform: rotate(180deg); }
th.r .th-b { flex-direction: row-reverse; }

.dt-empty { padding: var(--sp-16); }

/* Phone sort: a plain GET form, shown at 767 px and below next to the cards. */
.dt-sort { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); padding: var(--sp-8) var(--sp-12); border-bottom: 1px solid var(--line); }
.dt-sort .select-wrap { flex: 1 1 140px; }

/* Phone cards: .dt-card holds an optional checkbox and the body (a link, a drawer button or plain). */
.dt-cards { display: none; margin: 0; padding: 0; list-style: none; }
.dt-card { display: flex; align-items: flex-start; gap: var(--sp-4); padding: var(--sp-10) var(--sp-14); border-bottom: 1px solid var(--line); }
.dt-cards .dt-card:last-child { border-bottom: 0; }
.dt-card.is-sel { background: var(--accent-soft); }
.dt-card-b { display: flex; flex: 1; flex-direction: column; gap: var(--sp-4); min-width: 0; color: inherit; text-decoration: none; }
.dt-card.is-click { cursor: pointer; }
.dt-card.is-click:active { background: var(--surface-2); }
.dt-csel { display: grid; flex: none; place-items: center; width: 44px; height: 44px; margin: -8px 0 -8px -14px; }
.dt-csel input { width: 22px; height: 22px; }
.dc-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-8); min-height: 22px; }
.dc-title { overflow: hidden; font-size: var(--fs-14); line-height: 20px; white-space: nowrap; text-overflow: ellipsis; }
.dc-bot { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-6) var(--sp-10); min-height: 32px; }
.dc-bot .dc-end { margin-left: auto; font-weight: 600; }
.dc-meta { display: flex; justify-content: space-between; gap: var(--sp-12); font-size: var(--fs-12); line-height: 16px; color: var(--text-2); }
.dc-meta b { font-weight: 400; color: var(--text-3); }
.dt td > .crumb { margin-left: var(--sp-8); }
.crumb { display: inline-flex; align-items: center; gap: var(--sp-4); font-size: var(--fs-12); line-height: 16px; color: var(--text-3); white-space: nowrap; }

/* ---- pager ---- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-8) var(--sp-12); padding: var(--sp-8) var(--sp-16); border-top: 1px solid var(--line); font-size: var(--fs-13); color: var(--text-2); }
.pg-btns { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--sp-4); }
.pg-size { display: flex; align-items: center; gap: var(--sp-8); margin-right: var(--sp-8); }
.pg-cnt { padding: 0 var(--sp-6); white-space: nowrap; }

@media (max-width: 767px) {
  .dt-root.has-cards .dt-wrap { display: none; }
  .dt-root.has-cards .dt-cards { display: block; }
  .th-b { min-height: 44px; }
  .pager { padding: var(--sp-8) var(--sp-12); }
  .pager .icon-btn { width: 44px; height: 44px; }
  .pg-btns { width: 100%; justify-content: space-between; }
  .pg-size { flex: 1 0 100%; margin-right: 0; }
  .pg-size .select-wrap { min-width: 0; flex: 1; }
}

/* --- assets/css/82-forms.css --- */
/* Forms: field, input, select, textarea, switch, checkbox, radio cards, multi-select, checkbox matrix.
   Macros: templates/ds/forms.html. Behaviour: assets/js/60-forms.js. */

/* ---- field ---- */
.field { display: flex; flex-direction: column; gap: var(--sp-6); min-width: 0; margin: 0; padding: 0; border: 0; }
.field-l { padding: 0; font-size: var(--fs-13); font-weight: 500; color: var(--text); }
.field-h { font-size: var(--fs-12); line-height: 16px; color: var(--text-3); }
.field-e { display: none; align-items: center; gap: var(--sp-6); font-size: var(--fs-12); line-height: 16px; color: var(--loss); }
.field.has-error .field-e { display: flex; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--loss); }

/* ---- input, select, textarea ---- */
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 var(--sp-12); border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-14);
  transition: border-color var(--d1) var(--ease), box-shadow var(--d1) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.input[readonly] { background: var(--surface-2); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: .5; cursor: not-allowed; }
.textarea { height: auto; min-height: 72px; padding: var(--sp-8) var(--sp-12); line-height: 1.5; resize: vertical; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input { padding-right: var(--sp-40); }
.input-act {
  position: absolute; top: var(--sp-2); right: var(--sp-2); bottom: var(--sp-2); display: grid; place-items: center; width: 32px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-2); cursor: pointer;
}
.input-act:hover { background: var(--surface-2); color: var(--text); }
.select-wrap { position: relative; display: inline-flex; align-items: center; min-width: 0; }
.field .select-wrap { display: flex; }
.select { appearance: none; -webkit-appearance: none; padding-right: var(--sp-32); cursor: pointer; }
.select-wrap > svg { position: absolute; right: var(--sp-10); pointer-events: none; color: var(--text-3); }
.select-sm .select { height: 32px; font-size: var(--fs-13); }

/* ---- switch: a native checkbox, so it submits without script ---- */
.switch {
  appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 36px; height: 20px; margin: 0; padding: 0;
  border: 0; border-radius: var(--r-pill); background: var(--line-strong); cursor: pointer; transition: background var(--d2) var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface);
  transition: transform var(--d2) var(--ease);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); background: var(--on-accent); }
.switch::before { content: ""; position: absolute; inset: -12px -4px; }
.switch:disabled { opacity: .5; cursor: not-allowed; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-12); min-height: 40px; }
.switch-row .sr-t { display: block; font-size: var(--fs-14); cursor: pointer; }
.switch-row .sr-s { font-size: var(--fs-12); color: var(--text-3); }
.sw-label { display: inline-flex; align-items: center; gap: var(--sp-8); min-height: 28px; font-size: var(--fs-14); cursor: pointer; }

/* ---- checkbox ---- */
.check { display: inline-flex; align-items: center; gap: var(--sp-8); min-height: 28px; font-size: var(--fs-14); cursor: pointer; }
.check input {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 18px; height: 18px; margin: 0;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-xs); background: var(--surface); cursor: pointer;
  transition: background var(--d1) var(--ease), border-color var(--d1) var(--ease);
}
.check input:hover { border-color: var(--text-3); }
.check input:checked, .check input:indeterminate { border-color: var(--accent); background: var(--accent); }
.check input:checked::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.check input:indeterminate::after { content: ""; position: absolute; left: 3px; top: 6px; width: 8px; height: 2px; background: var(--on-accent); }
.check input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.check input:disabled { opacity: .5; cursor: not-allowed; }

/* ---- radio cards ---- */
.radio-cards { display: flex; flex-direction: column; gap: var(--sp-8); }
.radio-card {
  display: flex; align-items: center; gap: var(--sp-10); padding: var(--sp-10) var(--sp-12); border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); cursor: pointer; transition: border-color var(--d1) var(--ease), background var(--d1) var(--ease);
}
.radio-card:hover { border-color: var(--text-3); }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.radio-card input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.radio-card .rc-t { display: block; font-weight: 500; }
.radio-card .rc-s { display: block; font-size: var(--fs-12); color: var(--text-2); }

/* ---- multi-select: a <details> without script, a popover with it ---- */
.msel { display: inline-block; }
.msel-t { list-style: none; cursor: pointer; }
.msel-t::-webkit-details-marker { display: none; }
.msel-d > .pop { position: static; max-width: none; margin-top: var(--sp-6); box-shadow: none; animation: none; }
.msel-b { display: flex; flex-direction: column; gap: var(--sp-12); padding: var(--sp-12) var(--sp-14) var(--sp-14); }
.msel-g { min-width: 0; margin: 0; padding: 0; border: 0; }
.msel-g legend { padding: 0 0 var(--sp-4); font-size: var(--fs-12); color: var(--text-3); }
.msel-pop .check { display: flex; width: 100%; min-height: 36px; }
.msel-pop .pop-h { height: auto; min-height: 44px; }

/* ---- checkbox matrix ---- */
.matrix { display: flex; flex-direction: column; gap: var(--sp-8); }
.matrix-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-4) var(--sp-12); font-size: var(--fs-13); color: var(--text-2); }
.matrix-n b { font-weight: 600; color: var(--text); }
.matrix-w { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); }
.matrix-t { width: 100%; border-collapse: collapse; font-size: var(--fs-13); }
.matrix-t th, .matrix-t td { padding: var(--sp-6) var(--sp-8); border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.matrix-t thead th { height: 40px; background: var(--surface-2); font-size: var(--fs-12); font-weight: 500; color: var(--text-2); }
.matrix-t tbody tr:last-child th, .matrix-t tbody tr:last-child td { border-bottom: 0; }
.matrix-t tbody th { font-weight: 400; white-space: nowrap; }
.matrix-t thead .check { min-height: 32px; font-size: var(--fs-12); font-weight: 500; white-space: nowrap; }
.matrix-sub { margin-left: var(--sp-8); color: var(--text-3); }

@media (max-width: 767px) {
  .input, .select { height: 44px; }
  .select-sm .select { height: 44px; }
  .input-act { width: 44px; }
  .input-act::before { content: ""; position: absolute; inset: 0 -2px; }
  .switch-row { min-height: 48px; }
  .check, .sw-label { min-height: 44px; }
  .matrix-t thead th + th, .matrix-t td { text-align: center; }
  .matrix-t thead .check { flex-direction: column; justify-content: center; gap: var(--sp-2); min-height: 44px; text-align: center; white-space: normal; overflow-wrap: anywhere; }
  .matrix-t th, .matrix-t td { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .matrix-sub { display: none; }
}

/* --- assets/css/84-bars.css --- */
/* Bulk selection bar and the unsaved-changes save bar. Macros: templates/ds/table.html (bulk_bar), forms.html (save_bar). */

/* ---- bulk bar: lives in a panel header and replaces its calm look while rows are checked ---- */
.bulkbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-8) var(--sp-12); width: 100%; }
.bulkbar[hidden] { display: none; }
.bulk-n { font-size: var(--fs-14); font-weight: 600; }
.bulk-act { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); }
.panel-h:has(.bulkbar:not([hidden])) { background: var(--accent-soft); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.panel-act:has(.bulkbar:not([hidden])) { flex: 1 1 auto; }

/* ---- save bar ---- */
.savebar {
  position: sticky; bottom: var(--sp-16); z-index: 30; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--sp-10) var(--sp-16); padding: var(--sp-10) var(--sp-12) var(--sp-10) var(--sp-16);
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow);
}
.savebar[hidden] { display: none; }
.savebar-t { font-size: var(--fs-14); font-weight: 500; }

@media (max-width: 767px) {
  .bulkbar .btn { min-height: 44px; }
  .panel-h:has(.bulkbar:not([hidden])) { flex-wrap: wrap; }
  .panel-act:has(.bulkbar:not([hidden])) { flex: 1 1 100%; }
  .savebar { bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); }
  .savebar .row { width: 100%; }
  .savebar .btn { flex: 1; min-height: 44px; }
}

/* --- assets/css/90-touch.css --- */
/*
 * Touch targets (task 5.10, design D7). At 767 px and below every interactive control has a hit area of at least
 * 44 by 44 px and keeps its look. Three techniques:
 *  - stacked rows (tree rows, matrix cells) get a real 44 px size;
 *  - small controls get a transparent ::before that grows the hit area around them;
 *  - rows of small controls get a 14 px gap, so neighbouring hit areas never overlap.
 * tests/test_touch_browser.py probes every control on the reference page with elementsFromPoint.
 */
@media (max-width: 767px) {
  /* ---- hit-area pseudo-element: 44 px centred on the control, nothing when the control is larger ---- */
  .btn, .icon-btn, .fchip, .ptab, .seg-b, .search-clear, .ch-lg {
    position: relative;
  }
  .btn::before, .icon-btn::before, .fchip::before, .ptab::before, .seg-b::before, .search-clear::before,
  .ch-lg::before, .input-act::before {
    content: ""; position: absolute; inset: min(0px, calc((100% - 44px) / 2));
  }

  /* ---- containers that clip or pack their controls ---- */
  .ptabs, .tablist { padding-block: var(--sp-4); }
  .search, .search-sm { height: 44px; }
  /* The input is a replaced element with no pseudo-element: it grows over the 1 px border of its box instead. */
  .search-in { height: calc(100% + var(--sp-2)); margin-block: calc(var(--sp-2) / -2); }
  .fchips { gap: var(--sp-14); }
  .row:has(> :is(.btn, .icon-btn, .fchip, .ptab, .seg)), .row-between:has(> :is(.btn, .icon-btn)) { gap: var(--sp-14); }

  /* ---- stacked rows and cells: a real size ---- */
  .tree-row, .tree-child, .disclosure { height: auto; min-height: 44px; }
  .matrix-t td .check, .matrix-t thead .check { justify-content: center; min-width: 44px; }
  /* The scroll container clips the ::before, so the strip itself must be tall enough for a 44 px hit area. */
  .seg-scroll { padding-block: var(--sp-8); }
}
