:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1d2330;
  --muted: #6b7280;
  --line: #e5e7eb;
  --up: #0f7b3f;
  --down: #c62828;
  --accent: #2456c7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1;
}
.title { display: flex; align-items: center; gap: 12px; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 12px; }
h2 small, h3 { color: var(--muted); font-weight: 500; }
h2 small { font-size: 13px; margin-left: 6px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 6px; }

.badge { padding: 3px 10px; border-radius: 4px; font-weight: 700; font-size: 12px; letter-spacing: .06em; }
.badge.live { background: #fde2e2; color: #a01919; border: 1px solid #e57373; }

.status { font-size: 13px; color: var(--muted); }
.status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #9ca3af; }
.status .dot.ok { background: #16a34a; }
.status .dot.bad { background: #dc2626; }

.banner { background: #fff4d6; border-bottom: 1px solid #f0c44c; padding: 12px 28px; }
.hidden { display: none !important; }

main { max-width: 1280px; margin: 0 auto; padding: 20px 28px; }
section { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; margin-bottom: 20px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.section-head h2 { margin: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; }
.card .label { font-size: 12px; color: var(--muted); }
.card .value { font-size: 22px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
th:first-child, td:first-child { text-align: left; }
td.name { text-align: left; color: var(--muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
td.sym { font-weight: 600; }
tr:last-child td { border-bottom: none; }
.empty { color: var(--muted); text-align: left; padding: 10px; }

.up { color: var(--up); }
.down { color: var(--down); }
.tag { font-size: 10px; font-weight: 600; color: #8a5a00; background: #fff4d6; border-radius: 3px; padding: 1px 4px; margin-left: 4px; vertical-align: middle; }

form { display: flex; gap: 6px; }
input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 5px; font: inherit; text-transform: uppercase; width: 170px; }
button { padding: 7px 14px; border: none; border-radius: 5px; background: var(--accent); color: white; font: inherit; cursor: pointer; }
button:disabled { opacity: .6; cursor: default; }
button.remove { background: none; color: var(--muted); padding: 2px 8px; font-size: 16px; }
/* Secondary (light) and danger (red) buttons on every page, not only Bot Customization */
button.secondary, a.button.secondary { background: #eef2fb; color: var(--accent); }
button.danger, a.button.danger { background: #c62828; color: #fff; }
button.remove:hover { color: var(--down); }
.msg { font-size: 13px; min-height: 18px; margin: 4px 0; color: var(--down); }
.msg.ok { color: inherit; }  /* a success ("Saved: ...") reads as normal text; errors stay red */

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 10px 0 30px; }

nav:not(.navtabs) { font-size: 13px; color: var(--muted); margin-left: 8px; }
nav a { color: var(--accent); text-decoration: none; }

/* Explanation popups (static/tips.js) */
.tip {
  position: fixed; z-index: 20; max-width: 260px; padding: 7px 10px; border-radius: 6px;
  background: #1d2330; color: #fff; font-size: 12.5px; line-height: 1.4; pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
[data-tip], th { cursor: help; }
button[data-tip], a[data-tip], summary[data-tip] { cursor: pointer; }

/* Keep wide content (tables) scrolling inside its box instead of widening the page */
main, section, .cards, .card, .table-wrap { min-width: 0; }
.table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }

/* Phones */
@media (max-width: 700px) {
  body { font-size: 14px; }
  header { flex-wrap: wrap; gap: 6px; padding: 10px 14px; }
  .title { flex-wrap: wrap; gap: 8px; }
  h1 { font-size: 18px; }
  nav:not(.navtabs) { margin-left: 0; width: 100%; }
  .status { width: 100%; }
  .banner { padding: 10px 14px; }
  main { padding: 12px 10px; }
  section { padding: 14px 12px; margin-bottom: 12px; border-radius: 6px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card { padding: 9px 10px; }
  .card .value { font-size: 17px; overflow-wrap: anywhere; }
  .section-head { flex-wrap: wrap; gap: 8px; }
  .section-head form { width: 100%; }
  .section-head input { flex: 1; width: auto; min-width: 0; }
  th, td { padding: 7px 8px; }
  td.name { max-width: 130px; }
  footer { padding: 10px 14px 24px; }
}

/* Settings page */
.choices { border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; }
.choices legend { font-size: 13px; color: var(--muted); padding: 0 4px; }
.choices label { display: block; padding: 7px 0; cursor: pointer; }
.choices input { width: auto; margin-right: 8px; }
.hint { color: var(--muted); font-size: 13px; }

/* Dark theme (Settings page, or "Automatic" with the device in dark mode) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111418;
  --card: #1a1d23;
  --text: #e6e8eb;
  --muted: #9aa1ab;
  --line: #2c313a;
  --up: #3fbf74;
  --down: #f06a6a;
  --accent: #6b9bf2;
}
:root[data-theme="dark"] input, :root[data-theme="dark"] select { background: #14171c; color: var(--text); border-color: var(--line); }
:root[data-theme="dark"] button { background: #3d6fd6; }
:root[data-theme="dark"] button.secondary, :root[data-theme="dark"] a.button.secondary { background: #223152; color: #9dbcf7; }
:root[data-theme="dark"] button.danger, :root[data-theme="dark"] a.button.danger { background: #b52a2a; }
:root[data-theme="dark"] .badge.live { background: #3d1717; color: #ff8a8a; border-color: #7a2a2a; }
:root[data-theme="dark"] .banner { background: #2f2810; border-color: #6b5518; }
:root[data-theme="dark"] .tag { background: #3a2f12; color: #f3c75b; }
:root[data-theme="dark"] .tip { background: #e6e8eb; color: #111418; }
:root[data-theme="dark"] button.remove { background: none; }


/* ---------- Top bar (shared by all pages) ---------- */
header.topbar {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 18px;  /* the right side shrinks (status ellipsis), never over the tabs */
  padding: 0 24px; height: 58px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); }
.brand .logo { display: block; width: 34px; height: 34px; flex: none; }
/* Bold geometric wordmark, " Auto" in the accent colour */
.brand-name { font-family: "Segoe UI", Inter, Arial, sans-serif; font-size: 19px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.brand-name .sfx { color: #2563eb; }
:root[data-theme="dark"] .brand-name .sfx { color: #6b9bf2; }
/* Phones (up to 480 px): the logo without the name, so the Wealthsimple panel and the buttons fit side by side */
@media (max-width: 480px) { header.topbar .brand-name { display: none; } }
.navtabs { display: flex; gap: 4px; height: 100%; align-items: stretch; }
.navtab {
  display: flex; align-items: center; gap: 7px; padding: 0 14px; text-decoration: none;
  color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap; /* "Bot Customization" on one line at tablet widths */
}
.navtab svg { width: 17px; height: 17px; fill: currentColor; }
.navtab:hover { color: var(--text); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.navtab.on { color: var(--accent); border-bottom-color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 10px; justify-self: end; min-width: 0; max-width: 100%; }
.topbar-right > :not(.status) { flex-shrink: 0; }  /* only the status text gives way (ellipsis) when the bar is tight */
.topbar-right .status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The bots' Wealthsimple account in the top bar (every page): dot, name, account, value, clock; a link to its settings */
.broker-dock { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.broker-dock .dot { width: 8px; height: 8px; background: #9ca3af; margin-right: 6px; }
.broker-dock .dot.ok { background: #16a34a; }
.broker-dock .dot.bad { background: #f59e0b; }
.dock-state { display: inline-flex; align-items: center; font-size: 13px; color: var(--muted); white-space: nowrap; }
.dock-account { margin-left: 6px; color: var(--text); }
.dock-value { margin-left: 8px; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.dock-time { margin-left: 6px; font-variant-numeric: tabular-nums; }
/* The market mood's reading (30-11-2026): calm green, nervous amber, danger red */
@media (max-width: 700px) {
  .broker-dock { gap: 6px; }
  .dock-state { font-size: 12px; }
}

@media (max-width: 700px) {
  header.topbar { grid-template-columns: auto 1fr; height: auto; padding: 8px 12px 0; gap: 6px 10px; }
  /* Two rows at most: the Wealthsimple panel, then everything else (status, pill, server button); the status
     text gives way (…) rather than taking a third row */
  .topbar-right { justify-self: stretch; flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }
  .topbar-right .broker-dock { flex: 1 0 100%; justify-content: flex-end; order: -1; min-width: 0; flex-wrap: wrap; }
  /* A narrow phone: the account text gives way (…), the clock stays whole. Where even a few letters of it have no
     room (320 px, or a time zone with a long name such as GMT+5:30) the clock goes under the account text: nothing
     is drawn over anything else */
  .broker-dock .dock-state { flex: 1 1 0; min-width: min-content; flex-wrap: wrap; justify-content: flex-end; }
  .broker-dock .dock-account { flex: 1 1 28px; max-width: max-content; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .broker-dock .dot, .dock-value, .dock-time { flex: none; }
  .topbar-right .status { flex: 1 1 0; min-width: 0; text-align: right; font-size: 12px; }
  .navtabs { grid-column: 1 / -1; order: 3; height: 44px; border-top: 1px solid var(--line);
             margin: 0 -12px; width: calc(100% + 24px); display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; }
  .navtab { justify-content: center; padding: 0 2px; font-size: 13px; }
}

.al-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.al-form input { text-transform: none; width: 220px; }
.al-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
#al-status { margin-top: 6px; }

/* Swipe-between-pages hint (static/swipe.js) */
.swipe-hint {
  position: fixed; top: 50%; z-index: 30; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 28px; line-height: 1; opacity: .9;
}
.swipe-hint.next { right: 12px; }
.swipe-hint.prev { left: 12px; }

/* Our swipe handles page changes; stop the browser's own back/forward swipe from competing. */
html, body { overscroll-behavior-x: none; }

/* Unread count on the Alerts tab */
.navtab { position: relative; }
.badge-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--down); color: #fff;
  font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1;
}
.badge-count[hidden] { display: none; }

/* Alerts page */
.checks { display: grid; gap: 8px; }
.check { display: flex; gap: 8px; align-items: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: none; color: var(--muted); border: 1px solid var(--line); border-radius: 16px; padding: 5px 12px; }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
/* The dark theme's blue button background must not fill the unselected chips. */
:root[data-theme="dark"] .chip { background: none; }
:root[data-theme="dark"] .chip.on { background: #3d6fd6; border-color: #3d6fd6; }
.feed { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 12px; }  /* a long word never widens an alert past the screen */
.alert { position: relative; border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 6px; padding: 10px 40px 10px 12px; }
.alert.action { border-left-color: #d64545; }
.alert.safety { border-left-color: #e08a1e; }
.alert.summary { border-left-color: var(--accent); }
.alert.new { box-shadow: 0 0 0 1px var(--accent) inset; }
.alert-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.alert-time { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.alert-msg { margin-top: 6px; color: var(--muted); font-size: 13px; line-height: 1.5; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.alert-x { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; padding: 0; border-radius: 50%;
  background: none; color: var(--muted); border: 1px solid transparent; font-size: 15px; line-height: 1; }
.alert-x:hover { border-color: var(--line); color: var(--fg, inherit); }
:root[data-theme="dark"] .alert-x { background: none; }
.alert-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.clear-all { background: none; color: var(--muted); border: 1px solid var(--line); border-radius: 16px; padding: 5px 12px; }
:root[data-theme="dark"] .clear-all { background: none; }
.clear-all:disabled { opacity: .45; }
@media (max-width: 700px) {
  .navtab { padding: 0 2px; font-size: 12px; gap: 4px; }
  .navtab svg { width: 15px; height: 15px; }
  .badge-count { position: absolute; top: 4px; right: 6px; }
  .alert-time { margin-left: 0; width: 100%; }
}

/* Settings: time zone */
.tz-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tz-row select { max-width: 100%; }

/* Dashboard overview: wallets, stats, graphs */
.overview h4 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 0 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; flex: none; }
.wallets { display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 10px; scroll-snap-type: x proximity; }
button.wallet { flex: 0 0 auto; min-width: 190px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  text-align: left; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; scroll-snap-align: start; }
button.wallet:hover { border-color: var(--muted); }
button.wallet.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.w-name { font-size: 13px; color: var(--muted); display: flex; align-items: center; white-space: nowrap; }
.w-value { font-size: 18px; font-weight: 600; }
.w-sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.wallet-panel { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-head h3 { margin: 0; text-transform: none; letter-spacing: 0; font-size: 16px; color: var(--text); font-weight: 600; display: flex; align-items: center; }
.ranges { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.ranges button { background: none; color: var(--muted); border-radius: 0; padding: 5px 12px; }
.ranges button + button { border-left: 1px solid var(--line); }
.ranges button.on { background: var(--accent); color: #fff; }
.ov-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
:is(.ov-stats, .metrics, .table-wrap, .chart, .checks, .feed) + :is(.hint, p) { margin-top: 10px; }  /* text after a bordered box: never touching it */
.ov-stat { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.ov-stat .label { font-size: 12px; color: var(--muted); }
.ov-stat .value { font-size: 20px; font-weight: 600; margin-top: 2px; }
.ov-stat:first-child .value { font-size: 24px; }
.ov-stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.mix { margin-top: 12px; }
.mix-bar { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; display: flex; }
.mix-bar span { display: block; height: 100%; border-right: 2px solid var(--card); }
.mix-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.mix-legend .key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.mix-legend .key.cash { background: var(--line); }
details.fold { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 0 20px; margin-bottom: 12px; }
details.fold > summary { font-size: 15px; font-weight: 600; padding: 14px 0; list-style-position: inside; }
details.fold > summary small { color: var(--muted); font-weight: 500; margin-left: 6px; }
details.fold[open] { padding-bottom: 16px; }
:root[data-theme="dark"] button.wallet { background: var(--card); }
:root[data-theme="dark"] .ranges button { background: none; }
:root[data-theme="dark"] .ranges button.on { background: #3d6fd6; }
@media (max-width: 700px) {
  button.wallet { min-width: 160px; padding: 8px 12px; }
  .w-value { font-size: 16px; }
  .ov-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ov-stat:first-child { grid-column: 1 / -1; }
  .ov-stat .value { font-size: 17px; }
  .panel-head .ranges { width: 100%; }
  .ranges button { flex: 1; }
  details.fold { padding: 0 12px; }
}

/* Phone notifications (Alerts page) */
.phone-setup { max-width: 640px; }
.phone-setup .steps { padding-left: 20px; line-height: 1.6; }
.phone-setup code, .phone-setup .code { font-family: ui-monospace, Consolas, monospace; }
.phone-setup .code { font-size: 1.15em; letter-spacing: 2px; padding: 1px 6px; border-radius: 4px; background: rgba(127, 127, 127, .15); }
.tg-form { display: flex; gap: 8px; flex-wrap: wrap; }
.tg-form input { flex: 1 1 260px; min-width: 0; padding: 8px 10px; }
.phone-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.kinds { border: 1px solid rgba(127, 127, 127, .3); border-radius: 8px; padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.kinds label { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; cursor: pointer; }
.phone-sub { margin: 18px 0 8px; font-size: 1rem; }
#tg-msg.bad { color: #c0392b; }

/* Settings tabs: General | Real money | AI */
.set-tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.set-tabs button { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 8px 6px; background: transparent; color: var(--text);
  border: none; border-radius: 7px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-tabs button:hover { background: rgba(127, 127, 127, .12); }
.set-tabs button.on { background: var(--accent); color: #fff; }
.set-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.set-intro { margin: 0 0 12px; }
.cap-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cap-label { display: block; margin: 10px 0 4px; font-size: 13px; font-weight: 600; }
.cap-row input[type=range] { flex: 1 1 220px; min-width: 0; }
.cap-row input[type=number] { width: 110px; }
.cap-row label { min-width: 120px; font-weight: 600; }
details.fold h4.sub { margin: 14px 0 4px; font-size: 14px; color: var(--text); text-transform: none; letter-spacing: 0; }
/* Real-money pop-up (Start trading, Add money): inside the page, not the browser's prompt */
.money-dialog { width: min(420px, calc(100vw - 32px)); padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--text); }
.money-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.money-dialog h3 { margin: 0 0 12px; font-size: 17px; }
.money-dialog label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; margin-top: 10px; }
.money-dialog input { font-size: 16px; padding: 8px 10px; }  /* 16px: phones don't zoom in */
.money-dialog .hint { margin: 4px 0 0; }
.money-dialog .msg { min-height: 1.2em; margin: 8px 0 0; }
.money-dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.money-dialog form, .money-dialog .md-step { display: block; width: 100%; }
.money-dialog label input { width: 100%; box-sizing: border-box; }
.money-dialog .md-summary { font-size: 16px; line-height: 1.5; margin: 4px 0 0; }
.money-dialog [hidden] { display: none !important; }
/* A bot's answer to Decide now / Forced buy (nav.js, every page) */
@media (min-width: 601px) { .money-dialog.answer { width: min(600px, calc(100vw - 32px)); } }
.money-dialog.answer:focus { outline: none; }  /* the pop-up holds the focus when it opens (nav.js): no ring around it */
.answer-log { max-height: 45vh; overflow: auto; font-size: 14px; line-height: 1.45; border: 1px solid var(--line); border-radius: 6px; margin-top: 8px; }
.answer-log div { padding: 6px 10px; border-bottom: 1px solid var(--line); }
.answer-log div:last-child { border-bottom: none; }
.answer-log .time { color: var(--muted); margin-right: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 600px) {
  .money-dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; border-bottom: none;
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); }
  .money-dialog h3 { font-size: 19px; }
  .money-dialog input { font-size: 18px; padding: 12px; min-height: 48px; }
  .money-dialog .actions { flex-direction: column-reverse; gap: 10px; }
  .money-dialog .actions button { width: 100%; min-height: 48px; font-size: 16px; }
}
/* Settings > Real money: status at a glance (label | state | action per row) */
.rm-card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px 20px; margin-bottom: 12px; }
.rm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rm-head h2 { margin: 0; font-size: 17px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text); }
.rm-card > .hint { margin: 4px 0 12px; }
.rm-rows { border-top: 1px solid var(--line); }
.rm-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; align-items: center; gap: 4px 16px;
  padding: 12px 0; border-bottom: 1px solid var(--line); }
.rm-row:last-child { border-bottom: none; }
.rm-label { font-weight: 600; }
.rm-state { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; min-width: 0; }
.rm-note { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.rm-act { display: flex; gap: 8px; justify-content: flex-end; }
.rm-act .button, .rm-act button { min-width: 96px; text-align: center; }
.rm-extra { grid-column: 2 / -1; }
.rm-extra:empty, .rm-extra:not(:has(:not([hidden]))) { display: none; }
.rm-extra .al-form { margin-top: 4px; }
.rm-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--line); color: var(--muted); }
.rm-pill.ok { color: var(--up); border-color: currentColor; background: color-mix(in srgb, var(--up) 12%, transparent); }
.rm-pill.warn { color: #b26a00; border-color: currentColor; background: color-mix(in srgb, #f0a020 14%, transparent); }
:root[data-theme="dark"] .rm-pill.warn { color: #f0b44c; }
.rm-pill.off { color: var(--muted); }
@media (max-width: 700px) {
  .rm-card { padding: 14px 12px; }
  .rm-row { grid-template-columns: minmax(0, 1fr) auto; }
  .rm-label { grid-column: 1; }
  .rm-act { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .rm-state { grid-column: 1; }
  .rm-extra { grid-column: 1 / -1; }
  .rm-act .button, .rm-act button { min-width: 0; }
}
.golive { padding-left: 20px; line-height: 1.6; margin: 8px 0; }
.golive > li { margin: 10px 0; }
.golive .al-form { margin-top: 6px; }
.golive .override { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--down, #c62828); border-radius: 4px; }
.locks { padding-left: 4px; list-style: none; line-height: 1.8; margin: 8px 0; }
.locks .lock-row { display: grid; grid-template-columns: 1.6em minmax(8em, 11em) 5.5em 1fr; gap: 4px 10px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--line, rgba(127,127,127,.2)); line-height: 1.4; }
.locks .lock-row:last-child { border-bottom: 0; }
.lock-name { font-weight: 600; }
.lock-state { font-size: 12px; font-weight: 700; text-align: center; padding: 1px 8px; border-radius: 10px; }
.lock-state.open { background: #e3f4e8; color: #0f7b3f; }
.lock-state.closed { background: #eceff3; color: #5b6472; }
:root[data-theme="dark"] .lock-state.open { background: #15331f; color: #5fd68e; }
:root[data-theme="dark"] .lock-state.closed { background: #2a2f38; color: #a9b1bd; }
.lock-detail small { color: var(--muted); }
@media (max-width: 600px) {
  .locks .lock-row { grid-template-columns: 1.6em 1fr auto; }
  .lock-detail { grid-column: 2 / -1; }
}
.alert-head .tag { font-size: 11px; font-weight: 700; letter-spacing: .5px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.alert-head .tag.live { color: var(--text); border-color: #1f9d55; }

/* Login page */
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 16px; }
.login-box { width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.login-box .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.login-box form { display: flex; flex-direction: column; gap: 12px; }
.login-box label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.login-box input { padding: 10px; font-size: 16px; text-transform: none; }
.login-box button { padding: 10px; font-size: 16px; }
/* Settings > Security */
.qr { background: #fff; display: inline-block; padding: 8px; border-radius: 8px; }
.qr svg { display: block; width: 200px; height: 200px; }
.kinds label { justify-content: flex-start; width: auto; }
.kinds input[type=checkbox] { width: auto; margin: 0; flex: none; }
a.button { display: inline-block; padding: 7px 14px; border-radius: 5px; background: var(--accent); color: #fff; text-decoration: none; }

/* The hidden attribute must win over display rules (e.g. the login page's code field) */
[hidden] { display: none !important; }

.w-name .tag.live, .tag.live { color: var(--text); border-color: #1f9d55; }
/* The dark theme's blue button background must not fill the unselected settings tabs. */
:root[data-theme="dark"] .set-tabs button { background: transparent; }
:root[data-theme="dark"] .set-tabs button:hover { background: rgba(127, 127, 127, .15); }
:root[data-theme="dark"] .set-tabs button.on { background: #3d6fd6; }
.set-tabs { max-width: 640px; }  /* phones: the full row; wide screens: a compact bar */

@media (max-width: 600px) {
  .set-tabs button { white-space: normal; line-height: 1.15; font-size: 14px; }
}
#phone-history.scroll5 { overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }

/* AI Lab */
.ai-form { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; max-width: 720px; }
.ai-form textarea { width: 100%; padding: 8px 10px; font: inherit; text-transform: none; border-radius: 6px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.ai-form button { align-self: flex-start; }
.qa { border-top: 1px solid var(--line); padding: 8px 0; }
.qa > summary { cursor: pointer; }
.qa .answer { padding: 8px 0 0 14px; line-height: 1.5; }
.revision { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
.revision h4 { margin: 0 0 4px; }
.audit-bar { height: 8px; border-radius: 4px; background: rgba(127, 127, 127, .2); overflow: hidden; margin: 6px 0; max-width: 420px; }
.audit-bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.ai-table td { vertical-align: top; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.family { margin: 14px 0 22px; }
.family h3 { margin: 0 0 6px; font-size: 1.05rem; }
.revision.retired { opacity: .75; border-style: dashed; }
/* Server health tiles: coloured edge when a number is high */
.srv-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.ov-stat.srv { border-left: 4px solid transparent; }
.ov-stat.srv.ok { border-left-color: #2fa84f; }
.ov-stat.srv.warn { border-left-color: #e0a030; }
.ov-stat.srv.bad { border-left-color: #c0392b; }
.ai-focus { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.ai-focus select { flex: 1 1 auto; max-width: 420px; padding: 8px 10px; font-size: 15px; }

/* Phones: six tabs - icon above a short label, one row */
@media (max-width: 520px) {
  .navtabs { height: 54px; }
  .navtab { flex-direction: column; gap: 3px; font-size: 11px; padding: 6px 0 4px; }
  .navtab svg { width: 19px; height: 19px; }
  .navtab span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .navtab .nav-long { display: none; }
}
/* The smallest phones (under 360 px, e.g. 320): slightly smaller labels, or "Dashboard" is cut to "Dashboa…" */
@media (max-width: 359px) { .navtab { font-size: 10px; } }
@media (min-width: 521px) { .navtab .nav-short { display: none; } }
/* Tablets (701-1040 px): logo without the name, short labels, tighter tabs - so the top bar fits in one row */
@media (min-width: 701px) and (max-width: 1040px) {
  header.topbar { gap: 12px; padding: 0 14px; }
  .brand-name { display: none; }
  .navtabs { gap: 0; }
  .navtab { padding: 0 9px; gap: 5px; }
  .navtab .nav-long { display: none; }
  .navtab .nav-short { display: inline; }
}
@media (min-width: 701px) and (max-width: 820px) {
  .navtab svg { display: none; }
}
/* Up to 1400 px the top bar has two rows (logo + Wealthsimple panel, then the tabs), so the panel - always
   every part - never runs off screen or over the tabs */
@media (min-width: 701px) and (max-width: 1400px) {
  header.topbar { grid-template-columns: auto 1fr; height: auto; padding: 8px 24px 0; gap: 6px 18px; }
  .navtabs { grid-column: 1 / -1; order: 3; height: 46px; border-top: 1px solid var(--line); margin: 0 -24px; padding: 0 12px; }
  .navtab svg { display: inline; }
}
/* AI Lab: buttons never sit on the text below them; reviews as a list (fits phones) */
.viz-root .actions { margin: 6px 0 10px; }
.rv-list { display: flex; flex-direction: column; }
.rv-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.rv-item .rv-name { font-weight: 600; }
.rv-item .rv-verdict { text-align: right; white-space: nowrap; }
.rv-item .rv-sum, .rv-item .actions { grid-column: 1 / -1; margin: 0; }
.rv-item .rv-sum { color: var(--muted); font-size: 14px; }
.rv-item .actions { justify-content: flex-start; }
.full-review { margin: 6px 0 4px; }
.full-review > summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 4px 0; }
.full-review[open] { padding-bottom: 4px; }

/* Server health: info (i) button (header, far right) and its pop-up */
.srv-eye { display: inline-grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; padding: 0; border: none; border-radius: 50%;
  background: transparent !important; color: var(--muted); }
.srv-eye:hover { color: var(--accent); }
.srv-eye svg { width: 24px; height: 24px; fill: currentColor; }
.srv-dialog { width: min(920px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 16px 18px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--card); color: var(--text); }
.srv-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.srv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.srv-head h3 { margin: 0; }
.srv-close { width: 36px; height: 36px; padding: 0; }
@media (max-width: 600px) {
  .srv-dialog { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0; border-radius: 0; padding: 12px; }
  .srv-stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {  /* phones: the (i) button on the first row with the badges, the status line below */
  .topbar-right .srv-eye { order: 0; width: 32px; height: 32px; }
  .topbar-right .status { order: 1; }
}
.srv-hist-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.srv-hist-head h4 { margin: 0; }
:root[data-theme="dark"] a.button { background: #3d6fd6; color: #fff; }  /* same as dark buttons: readable */
/* Server pop-up: scrolls inside itself; on phones it fits the visible screen (the address bar
   isn't counted in 100dvh, so the bottom - the graph - can be reached) */
.srv-dialog { overflow-y: auto; overscroll-behavior: contain; }
.srv-dialog .srv-body { padding-bottom: 24px; }
.srv-dialog table { width: 100%; font-size: 14px; }
.srv-dialog td, .srv-dialog th { padding: 6px 6px; white-space: nowrap; }
@media (max-width: 600px) {
  .srv-dialog { height: 100dvh; max-height: 100dvh; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .srv-dialog table { font-size: 13px; }
  .srv-dialog td, .srv-dialog th { padding: 6px 4px; }
}
.srv-timers { margin-top: 10px; }
/* While a pop-up is open the page behind doesn't scroll (no scroll leaking past the pop-up's end) */
html.modal-open, html.modal-open body { overflow: hidden; overscroll-behavior: none; }
@media (max-width: 600px) {
  /* Visible height only (the address bar isn't counted); 100vh first for browsers without dvh */
  .srv-dialog { height: 100vh; max-height: 100vh; height: 100dvh; max-height: 100dvh; -webkit-overflow-scrolling: touch; }
}

/* A value meant to be copied (e.g. the two-step setup key): one tap selects all of it. */
.copyable { -webkit-user-select: all; user-select: all; cursor: text; word-break: break-all; }

.mode-tag { display: inline-block; font-size: 11px; margin-left: 5px; vertical-align: middle; opacity: .85; }
.mode-tag.paused { opacity: .55; }
.rl-bot > summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer; list-style: none; font-weight: 600; font-size: 15px; }
.rl-bot > summary::-webkit-details-marker { display: none; }
.rl-bot > summary .caret { color: var(--muted); font-size: 12px; transition: transform .15s; }
.rl-bot[open] > summary .caret { transform: rotate(90deg); }
.rl-bot > summary .rl-line { font-weight: 400; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rl-bot > summary a { margin-left: auto; font-weight: 400; }
.rl-bot[open] > summary { margin-bottom: 8px; }

/* Server pop-up: the note under the history graph sits below its date labels */
.srv-hist-note { margin-top: 22px; }

.rl-bot { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }

.rl-wait { color: var(--muted); }

/* Settings > AI: Claude's monthly budget */
.bg-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 6px 0 8px; max-width: 420px; }
.bg-bar span { display: block; height: 100%; background: var(--up, #0f7b3f); }
.bg-bar span.high { background: #d99a00; }
.bg-bar span.full { background: var(--down, #c62828); }
.bg-kinds { list-style: none; padding: 0; margin: 0 0 8px; max-width: 420px; font-size: 13px; }
.bg-kinds li { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px dashed var(--line); }
.sched-row { max-width: 420px; margin: 6px 0; }
.sched-row input[type=range] { width: 100%; }
.sched-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* Server health pop-up: everything on one screen, no scrolling. Computers: compact tiles in 4 columns, then the
   parts table and the history graph side by side; phones: tiles in 2 columns, then the table, then the graph.
   The graph's height is worked out from the space left (server.js). */
.srv-dialog { width: min(1180px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 12px 16px; }
.srv-dialog .srv-body { padding-bottom: 0; }
.srv-head h3 small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; text-transform: none; letter-spacing: 0; }
.srv-dialog .srv-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.srv-dialog .ov-stat.srv { padding: 6px 10px; }
.srv-dialog .ov-stat.srv .label { font-size: 11px; }
.srv-dialog .ov-stat.srv .value { font-size: 17px; margin-top: 0; }
.srv-dialog .ov-stat.srv .sub { font-size: 11px; margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srv-dialog h4 { margin: 10px 0 4px; }
.srv-dialog td, .srv-dialog th { padding: 3px 6px; font-size: 13px; }
.srv-dialog .srv-timers { margin: 6px 0 0; font-size: 12px; }
.srv-dialog .srv-hist-head { margin-top: 10px; }
.srv-dialog .srv-hist-head h4 { margin: 0; }
.srv-dialog .srv-hist-note { margin: 4px 0 0; font-size: 12px; }
.srv-dialog .srv-chart { margin-top: 4px; }
@media (min-width: 900px) {
  .srv-lower { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 18px; align-items: start; }
}
@media (max-width: 600px) {
  .srv-dialog { padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
  .srv-dialog .srv-stats { grid-template-columns: 1fr 1fr; gap: 6px; }
  .srv-dialog .ov-stat.srv:first-child { grid-column: auto; }  /* 8 tiles = 4 even rows */
  .srv-dialog .ov-stat.srv:first-child .value { font-size: 15px; }
  .srv-dialog .ov-stat.srv .value { font-size: 15px; }
  .srv-dialog td, .srv-dialog th { padding: 2px 4px; font-size: 12px; }
  .srv-dialog td.left { white-space: normal; }
  .srv-head h3 small { display: none; }
}

.check-row { display: flex; gap: 0.5rem; align-items: center; margin: 0.4rem 0; cursor: pointer; }
.check-row[hidden] { display: none; }  /* a box shown only when it matters (e.g. Claude check's second box) */
/* Phones: Settings' four tabs as a 2 x 2 grid, so "Live trading account" stays on one line */
@media (max-width: 520px) {
  .set-tabs { display: grid; grid-template-columns: 1fr 1fr; }
  .set-tabs button { white-space: nowrap; min-height: 40px; }
}

/* Bots page > Compare backtests (12-11-2026) */
.cmp-controls { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 4px 0 10px; }
.cmp-controls label { display: inline-flex; gap: 6px; align-items: center; }
.cmp-presets { display: inline-flex; gap: 6px; }
.cmp-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-variant-numeric: tabular-nums; }
.cmp-table th, .cmp-table td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); }
/* On a phone each line is a small card: its name, then label: value rows, its note below (12-11-2026, the owner's
   request: the six-column table ran out of the box) */
@media (max-width: 640px) {
  .cmp-table thead { display: none; }
  .cmp-table, .cmp-table tbody, .cmp-table tr, .cmp-table td { display: block; width: 100%; }
  .cmp-table tr { border-bottom: 1px solid var(--line); padding: 6px 0; }
  .cmp-table td { border: 0; padding: 2px 4px; display: flex; justify-content: space-between; gap: 12px;
                  overflow-wrap: anywhere; }
  .cmp-table td[data-label]::before { content: attr(data-label); color: var(--muted); }
  .cmp-table td.cmp-name { font-weight: 600; }
  .cmp-table td.hint { display: block; font-size: 12px; }
  .cmp-table td.hint:empty { display: none; }
  .cmp-controls label { flex: 1 1 140px; }
  .cmp-controls input[type="date"] { min-width: 0; width: 100%; }
}

/* View-only login (static/nav.js, 13-11-2026) */
.view-only-badge { position: fixed; left: 10px; bottom: 10px; z-index: 50; padding: 4px 10px; border-radius: 999px;
                   background: var(--card, #1f2937); border: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.view-only-note { position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%); z-index: 60; max-width: 90vw;
                  padding: 8px 14px; border-radius: 8px; background: var(--card, #1f2937); border: 1px solid var(--line);
                  box-shadow: 0 4px 16px rgba(0, 0, 0, .3); font-size: 14px; }
.view-only-note[hidden] { display: none; }

/* A family or friend's page (static/me.html, 13-11-2026) */
.me-box { max-width: 520px; }
.me-box h3 { margin: 14px 0 6px; }
.me-form { display: grid; gap: 8px; margin-top: 8px; }
.fam-acct { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.fam-acct .cap-row { margin: 6px 0 0; flex-wrap: wrap; }
.me-box h4 { margin: 14px 0 4px; }
.me-log { margin-top: 12px; max-height: 50vh; overflow: auto; border-top: 1px solid var(--line); padding-top: 8px; }

/* Dashboard > Market mood (30-11-2026): how far each crash sign is toward its alarm level */
.mood-bar { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: var(--line); vertical-align: middle; overflow: hidden; }
.mood-bar > span { display: block; height: 100%; background: var(--down); border-radius: 3px; }
.mood-table td.num, .mood-table th.num { text-align: right; }

/* Dashboard > Cash allocation by bot (03-12-2026): each bot's cash claim on the account, first come first served; the
   pie charts beside it on a wide screen */
#rl-owners { margin: 6px 0 14px; }
#rl-owners h3 { margin: 10px 0 8px; }
.owners-wrap { display: flex; gap: 16px; align-items: flex-start; }
.owners-main { flex: 1 1 auto; min-width: 0; overflow-x: auto; }
table.owners { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
table.owners th { font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.owners td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
table.owners .num { text-align: right; }
table.owners .q { width: 24px; color: var(--muted); }
table.owners td.bot .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }
table.owners tfoot td { font-weight: 600; border-bottom: none; padding-top: 6px; padding-bottom: 6px; }
table.owners tfoot tr:first-child td { border-top: 2px solid var(--line); }
table.owners .muted, table.owners tfoot .muted { color: var(--muted); font-weight: 400; }
table.owners sup { color: var(--muted); margin-left: 1px; }
.owners-note { margin-top: 6px; font-size: 12px; }

/* Dashboard > Account: pie charts beside the tiles on a computer screen (03-12-2026), never making the section taller:
   hidden when the screen is too narrow for them to sit beside the tiles */
/* seven distinct hues (checked for colour blindness, 03-12-2026: the greys for cash and set aside looked alike) */
:root { --pie-1: #2a78d6; --pie-2: #eb6834; --pie-3: #1baf7a; --pie-4: #eda100; --pie-5: #e87ba4;
  --pie-cash: #008300; --pie-hold: #6250d6; --pie-other: #8f8e88; }
:root[data-theme="dark"] { --pie-1: #3987e5; --pie-2: #d95926; --pie-3: #199e70; --pie-4: #c98500; --pie-5: #d55181;
  --pie-cash: #008300; --pie-hold: #9085e9; --pie-other: #8a8983; }
.acct-row { margin-top: 12px; }
.acct-row > .acct-tiles { margin-top: 0; }
.acct-pies { display: flex; flex-direction: column; gap: 10px; flex: 0 0 auto; margin-top: 38px; }
.acct-pie { display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; }
.acct-pie .pie { width: 104px; height: 104px; flex: 0 0 104px; }
.acct-pie .pie circle { stroke-linecap: butt; }
.acct-pie .pie circle:hover { stroke-width: 13; }
.pie-legend { display: grid; grid-template-columns: auto auto auto; column-gap: 10px; row-gap: 3px; font-size: 12px; line-height: 16px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pie-legend b { grid-column: 1 / -1; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.pie-legend > span { display: contents; }
.pie-legend .pl { color: var(--text); }
.pie-legend .pl::before { content: none; }
.pie-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.pie-legend .pv { text-align: right; color: var(--text); }
.pie-legend em { font-style: normal; color: var(--muted); text-align: right; }
@media (max-width: 1000px) { .acct-pies { display: none; } }

/* Dashboard > Fear level: the figure with its small history chart beside it (03-12-2026) */
.mood-row { display: flex; gap: 14px; align-items: stretch; flex-wrap: wrap; }
.mood-row > .ov-stats { flex: 0 1 300px; margin-top: 12px; }
.mood-hist { flex: 1 1 360px; min-width: 0; margin-top: 12px; }
.mood-ranges { width: max-content; margin-bottom: 4px; }
.mood-ranges button { padding: 3px 10px; font-size: 12px; }
