:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface: #fcfcfb;
  --border: #e3e2dd;
  --grid: #ecebe7;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #7a7974;
  --s1: #2a78d6;   /* value / gain */
  --s2: #eb6834;   /* deposits */
  --s3: #1baf7a;
  --neg: #e34948;  /* loss (diverging red pole) */
  --pos-text: #0f6b2f;
  --neg-text: #b42323;
  --accent: #2a78d6;
  --warn-bg: #fff4d6;
  --warn-text: #6b4a00;
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #8a5cd6; --c5: #c9a227; --c6: #1593a3; --c7: #d1478e; --c8: #8a8984;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --border: #2d2d2a; --grid: #262624;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e86;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --neg: #e66767;
    --pos-text: #5fd38a; --neg-text: #ff8a8a; --accent: #5598e7;
    --warn-bg: #3a2f10; --warn-text: #f5d58a;
    --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #9b74e3; --c5: #d2ad3a; --c6: #22a5b5; --c7: #de5c9d; --c8: #9a9992;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --border: #2d2d2a; --grid: #262624;
  --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e86;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --neg: #e66767;
  --pos-text: #5fd38a; --neg-text: #ff8a8a; --accent: #5598e7;
  --warn-bg: #3a2f10; --warn-text: #f5d58a;
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #9b74e3; --c5: #d2ad3a; --c6: #22a5b5; --c7: #de5c9d; --c8: #9a9992;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", "Noto Sans Hebrew", sans-serif;
  font-variant-numeric: tabular-nums;
}
header {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--surface);
}
header h1 { font-size: 18px; margin: 0; }
.meta { color: var(--muted); font-size: 12px; }
button, select, input {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px;
}
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
main { padding: 20px; max-width: 1400px; margin: 0 auto; display: grid; gap: 20px; }
.banner { background: var(--warn-bg); color: var(--warn-text); padding: 12px 16px; border-radius: 10px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner input { flex: 1; min-width: 220px; }
.hidden { display: none !important; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.kpi .label { color: var(--text-2); font-size: 12px; }
.kpi .value { font-size: 22px; font-weight: 600; margin-top: 4px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; min-width: 0; }
.card h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h2 .spacer { margin-inline-start: auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 20px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } main { padding: 16px; } }
.chart { position: relative; height: 300px; }
.chart.tall { height: 460px; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 4px 10px; }
.seg button.on { background: var(--accent); color: #fff; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: end; white-space: nowrap; }
th { color: var(--text-2); font-weight: 500; cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--surface); }
th.l, td.l { text-align: start; }
tbody tr:hover { background: var(--grid); }
tbody tr.clickable, td.clickable { cursor: pointer; }
.name { font-weight: 500; }
.sub-name { color: var(--muted); font-size: 12px; }
.pos { color: var(--pos-text); }
.neg { color: var(--neg-text); }
.pill { font-size: 11px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--border); color: var(--text-2); }

dialog { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text);
  width: min(900px, calc(100vw - 32px)); max-height: 85vh; padding: 20px; }
dialog::backdrop { background: rgb(0 0 0 / .45); }
.split { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; margin: 6px 0 10px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }

.login { max-width: 360px; margin: 12vh auto; padding: 0 16px; }
.login form { display: grid; gap: 10px; }
.err { color: var(--neg-text); }

/* search, grouping, expandable lots, alerts */
input[type="search"] { min-width: 220px; padding: 5px 10px; }
@media (max-width: 520px) { input[type="search"] { min-width: 0; width: 100%; } }
label.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 400; color: var(--text-2); cursor: pointer; }
label.check input { padding: 0; }
.chev { display: inline-block; width: 18px; color: var(--muted); transition: transform .15s; }
tr.open .chev { transform: rotate(90deg); }
tr.lot td { background: var(--bg); font-size: 12px; }
tr.lot td:first-child { padding-inline-start: 34px; }
tfoot th, tfoot td { font-weight: 600; border-top: 2px solid var(--border); border-bottom: 0; cursor: default; }
.sums { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin: 0 0 10px; }
.sums b { color: var(--text); font-weight: 600; }
.alert-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.alert-form select#alEq { min-width: 200px; }
.alert-form input#alPrice { width: 130px; }
.alert-form input#alNote { flex: 1; min-width: 160px; }
.banner.alert { justify-content: space-between; }
.banner.alert ul { margin: 0; padding-inline-start: 18px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 6px; background: var(--muted); }
.status-dot.on { background: var(--s3); }
.status-dot.fired { background: var(--s2); }
.icon-btn { padding: 2px 8px; font-size: 12px; }

/* top KPI tiles: always one row on wide screens */
#kpis { display: flex; gap: 10px; }
#kpis .kpi { flex: 1 1 0; min-width: 0; padding: 12px 14px; }
#kpis .kpi .value { font-size: clamp(16px, 1.5vw, 22px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#kpis .kpi .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) { #kpis { flex-wrap: wrap; } #kpis .kpi { flex: 1 1 calc(50% - 10px); } }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; margin-bottom: -8px; }
.tabs button { border: 0; border-radius: 8px 8px 0 0; background: transparent; color: var(--text-2);
  padding: 9px 16px; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); background: var(--surface); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; background: var(--surface); }
.tab-panel { display: grid; gap: 20px; }
.tab-panel:not(.on) { display: none; }
.note { color: var(--muted); font-size: 12px; margin-top: 8px; }

/* broker login (remote browser) */
dialog.bl { width: min(1140px, calc(100vw - 16px)); max-height: 96vh; padding: 12px; }
.bl-screen { width: 100%; height: min(820px, calc(96vh - 130px)); background: #000; border-radius: 8px; overflow: hidden; }
.bl-type { display: flex; gap: 8px; margin-top: 8px; }
.bl-type input { flex: 1; min-width: 0; }

/* holdings: expand button for inline buy history */
.name-cell { display: flex; align-items: center; gap: 6px; }
button.expand { border: 1px solid var(--border); border-radius: 6px; padding: 0; width: 24px; height: 24px; flex: none;
  display: inline-grid; place-items: center; background: var(--surface); }
button.expand .chev { width: auto; font-size: 16px; line-height: 1; color: var(--text-2); }
tr.open button.expand { border-color: var(--accent); }
tr.open button.expand .chev { color: var(--accent); }
tr.lot td:first-child { padding-inline-start: 40px; }
.chev { display: inline-block; transition: transform .15s; }

/* bell buttons, alert dialog, price history */
button.bell { border: 1px solid var(--border); border-radius: 6px; padding: 0; width: 26px; height: 24px; flex: none;
  display: inline-grid; place-items: center; background: var(--surface); color: var(--muted); }
button.bell:hover { color: var(--text); }
button.bell.on { color: var(--s2); border-color: var(--s2); }
.expand-gap { width: 24px; flex: none; }
.bell-gap { width: 26px; flex: none; }
/* today's orders */
.ost { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid currentColor; }
.ost.waiting { color: var(--s2); }
.ost.partial { color: var(--accent); }
.ost.done { color: var(--pos-text); }
.ost.cancelled { color: var(--muted); }
.raw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 16px; font-size: 12px; }
.raw-grid span { color: var(--muted); }
#dBell { width: auto; height: auto; padding: 6px 10px; gap: 6px; display: inline-flex; align-items: center; font-size: 13px; }
dialog.al { width: min(560px, calc(100vw - 16px)); }
.alert-form .quick { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; }
.alert-form .quick button { padding: 2px 8px; font-size: 12px; }
h3.dsub { font-size: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h3.dsub .seg { margin-inline-start: auto; }
form.src { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
form.src input { flex: 1; min-width: 180px; padding: 4px 8px; }
form.src button { padding: 4px 10px; }

/* market status pills in the header */
.markets { display: flex; gap: 8px; flex-wrap: wrap; }
.mkt { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 99px;
  border: 1px solid var(--border); color: var(--text-2); background: var(--bg); white-space: nowrap; }
.mkt b { color: var(--text); font-weight: 600; }
.mkt .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.mkt.open .dot { background: var(--s3); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s3) 25%, transparent); }
.mkt.pre .dot, .mkt.post .dot { background: var(--s2); }
.mkt.open { border-color: color-mix(in srgb, var(--s3) 45%, var(--border)); }

/* settings */
form.settings { display: grid; gap: 10px; max-width: 640px; }
form.settings label:not(.check) { display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
form.settings input:not([type=checkbox]) { width: 100%; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
ol.steps { margin: 0 0 14px; padding-inline-start: 20px; color: var(--text-2); font-size: 13px; display: grid; gap: 4px; }
.idlist { margin-top: 14px; }
.idlist h3 { font-size: 13px; margin: 0 0 6px; color: var(--text-2); font-weight: 600; }
.idrow { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; flex-wrap: wrap; }
.idrow .grow { flex: 1; min-width: 160px; }
pre.preview { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; white-space: pre-wrap; font: 13px/1.5 system-ui, sans-serif; margin-top: 10px; }

/* daily grid: day % heat map */
table.grid td { text-align: center; font-size: 12px; padding: 6px 8px; }
table.grid th[data-day] { cursor: pointer; }
table.grid td[data-day] { cursor: pointer; }
table.grid td[data-day]:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
table.grid td.c.on { box-shadow: inset 0 0 0 1px var(--accent); }
table.grid td.l.clickable:hover { color: var(--accent); }
table.grid th.on { color: var(--accent); }
table.grid td.c { border-radius: 4px; border: 2px solid var(--surface); }

/* sortable headers */
thead th { cursor: pointer; }
thead th:hover { color: var(--text); }
.sort-ind { color: var(--accent); }

/* header actions; short labels on phones */
header .actions { display: flex; gap: 8px; align-items: center; }
header #asof { flex: none; }
#asof { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 4px 8px; font-size: 13.5px; color: var(--text-2); }
.conn { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font-weight: 650; font-size: 13.5px; border: 1px solid currentColor; line-height: 1.2; white-space: nowrap; }
.conn .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }
.conn.live { color: #16a34a; background: color-mix(in srgb, #16a34a 12%, transparent); }
.conn.live .dot { animation: connPulse 1.8s ease-out infinite; }
.conn.stale { color: #d97706; background: color-mix(in srgb, #d97706 12%, transparent); }
.conn.off { color: #dc2626; background: color-mix(in srgb, #dc2626 12%, transparent); }
@keyframes connPulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, #16a34a 60%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .conn.live .dot { animation: none; } }   /* shrinks/wraps so the buttons stay on the first line */
header .actions form { margin: 0; }
.sm { display: none; }
#tabs { position: relative; }

/* estimated (rebuilt) values: dashed swatch to match the dashed line */
.legend i.dash { background: repeating-linear-gradient(90deg, var(--s1) 0 5px, transparent 5px 8px); }

/* settings sub-tabs */
.subtabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; justify-self: start; }
.subtabs button { padding: 7px 14px; white-space: nowrap; }
.subpanel { display: none; gap: 20px; }
.subpanel.on { display: grid; }

/* US pre-market / after-hours price under the regular one */
.ext { font-size: 11px; color: var(--muted); white-space: nowrap; margin-top: 1px; }

/* Daily tab: today so far (not saved yet) */
.pill.live { border-style: dashed; }
td.c.live { outline: 1.5px dashed var(--muted); outline-offset: -3px; }

/* notifications bell + panel */
button.bell { position: relative; }
.bell .badge { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px; background: var(--neg); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px;
  text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.inbox { position: fixed; z-index: 20; top: 56px; inset-inline-end: 12px; width: min(420px, calc(100vw - 24px));
  max-height: min(70vh, 640px); display: flex; flex-direction: column; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgb(0 0 0 / .18); }
.inbox.hidden { display: none; }
.inbox-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.inbox-head .meta { margin-inline-end: auto; }
.inbox-head button { padding: 3px 9px; font-size: 12px; }
.inbox ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.inbox li { padding: 10px 12px; border-bottom: 1px solid var(--grid); display: grid; gap: 2px; }
.inbox li:last-child { border-bottom: 0; }
.inbox li.unread { background: color-mix(in srgb, var(--accent) 8%, transparent);
  box-shadow: inset 3px 0 0 var(--accent); }
.inbox li .t { font-weight: 600; }
.inbox li .b { color: var(--text-2); font-size: 13px; white-space: pre-line; overflow-wrap: anywhere; }
.inbox li .when { color: var(--muted); font-size: 11px; }
.inbox .empty { color: var(--muted); text-align: center; padding: 24px 12px; }

/* ---------- phones ---------- */
@media (max-width: 600px) {
  body { font-size: 14px; }
  .lg, .desk-only { display: none !important; }
  .sm { display: inline; }
  /* header: name + buttons on one line, market pills on the next, status line under them */
  header { padding: 10px 12px; gap: 6px 8px; }
  header h1 { font-size: 17px; order: 0; }
  header .actions { order: 1; gap: 6px; }
  .markets { order: 2; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 6px; }
  .mkt { padding: 3px 8px; font-size: 11px; }
  #asof { order: 3; flex: 1 1 100%; justify-content: flex-start; font-size: 12.5px; }
  .conn { font-size: 12.5px; }
  .inbox { top: 48px; inset-inline-end: 6px; width: calc(100vw - 12px); max-height: 75vh; }

  main { padding: 10px; gap: 12px; }
  .card { padding: 12px; border-radius: 10px; }
  .card h2 { font-size: 14px; margin-bottom: 10px; }
  .card h2 > .meta { font-size: 11px; }
  .banner { padding: 10px 12px; font-size: 13px; }
  .tab-panel, .subpanel { gap: 12px; }
  .subtabs { display: flex; flex-wrap: wrap; gap: 6px; border: 0; overflow: visible; }
  .subtabs button { border: 1px solid var(--border); border-radius: 99px; padding: 5px 12px; font-size: 13px; }

  /* iOS zooms into inputs under 16px */
  input, select, textarea { font-size: 16px; }
  input[type="search"] { min-width: 0; width: 100%; }

  /* tabs stay at the top while scrolling */
  .tabs { position: sticky; top: 0; z-index: 5; background: var(--bg); margin: 0 -10px -4px; padding: 0 6px; }
  .tabs button { padding: 10px 12px; }

  /* top tiles: 3 per row, compact */
  #kpis { flex-wrap: wrap; gap: 6px; }
  #kpis .kpi { flex: 1 1 calc(33.3% - 6px); padding: 8px 9px; border-radius: 10px; }
  #kpis .kpi .label, #kpis .kpi .sub { font-size: 10.5px; }
  #kpis .kpi .value { font-size: 15px; margin-top: 2px; }
  #kpis .kpi .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* other tile rows: 2 per row (daily: 3) */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  #dailyKpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi { padding: 10px; }
  .kpi .value { font-size: 17px; overflow-wrap: anywhere; }
  .kpi .label, .kpi .sub { font-size: 11px; }

  /* tables: scroll sideways with the first column pinned */
  .table-wrap { margin: 0 -12px; padding: 0 12px; }
  table { font-size: 12.5px; }
  th, td { padding: 7px 8px; }
  .table-wrap tr > :first-child { position: sticky; inset-inline-start: 0; z-index: 1; background: var(--surface);
    box-shadow: inset -1px 0 0 var(--border); }
  .table-wrap thead tr > :first-child { z-index: 2; }
  .table-wrap tbody tr:hover > :first-child { background: var(--grid); }
  .table-wrap tr.lot > :first-child { background: var(--bg); }
  .name-cell .name, .name-cell .sub-name { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
  button.expand, button.bell { width: 30px; height: 30px; }
  .expand-gap, .bell-gap { width: 30px; }
  table.grid td { padding: 6px 5px; }

  .chart { height: 240px; }
  .chart.tall { height: 380px; }
  .grid2 { grid-template-columns: 1fr; gap: 12px; }

  /* dialogs: almost full screen */
  dialog { width: calc(100vw - 12px); max-width: none; max-height: 92vh; padding: 14px; border-radius: 12px; }
  dialog h2 { font-size: 15px; }
  dialog h2 button { padding: 5px 10px; font-size: 13px; }
  .alert-form select#alEq, .alert-form input#alNote { flex: 1 1 100%; min-width: 0; }
  .alert-form input#alPrice, .alert-form input#alDlgPrice { flex: 1; width: auto; min-width: 0; }
  form.src input { min-width: 0; }
  #watchEq { width: auto !important; flex: 1; min-width: 0; }
  #watchForm { flex: 1 1 100%; flex-wrap: nowrap; }
  .sums { gap: 6px 14px; font-size: 12px; }
}

/* touch screens: no "stuck" hover highlight after a tap */
@media (hover: none) {
  button:hover { border-color: var(--border); }
  button.primary:hover { border-color: var(--accent); }
  .tabs button:not(.on):hover { background: transparent; color: var(--text-2); }
  tbody tr:hover { background: transparent; }
  .table-wrap tbody tr:hover > :first-child { background: var(--surface); }
}

/* price source pill in the header */
.mkt.src.ok .dot { background: var(--s3); }
.mkt.src.backup { border-color: color-mix(in srgb, var(--s2) 55%, var(--border)); }
.mkt.src.backup .dot { background: var(--s2); }
.mkt.src.off .dot { background: var(--muted); }

/* watchlist notes */
input.note-in { width: 100%; min-width: 160px; padding: 3px 8px; border-color: transparent; background: transparent; }
input.note-in:hover, input.note-in:focus { border-color: var(--border); background: var(--surface); }
input.note-in:focus { border-color: var(--accent); outline: none; }
input.note-in.saved { border-color: var(--s3); }
label.dnote { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
label.dnote input { flex: 1; min-width: 0; }
@media (max-width: 600px) { input.note-in { min-width: 130px; } }

/* security type tag (Share / ETF / Index fund / ...) */
.type { display: inline-block; font-size: 11px; line-height: 1.5; padding: 0 7px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--border); color: var(--text-2); }
.type.t-etf, .type.t-ifund { border-color: color-mix(in srgb, var(--accent) 55%, transparent); color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent); }
.type.t-mm { border-style: dashed; }

/* ---------------- family savings ---------------- */
.sav-kpis { margin-bottom: 16px; }
.sav-controls { margin-bottom: 8px; }
.sav-controls label { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-2); }
.sav-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.sav-filters .grp { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-inline-end: 10px; }
.sav-filters .grp > span { font-size: 12px; color: var(--muted); margin-inline-end: 2px; }
.chip { border: 1px solid var(--border); border-radius: 99px; padding: 2px 10px; font-size: 12px; background: transparent; color: var(--text-2); }
.chip.on { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: var(--accent); color: var(--text); }
.legend button.lg-item { border: 0; background: none; padding: 0; color: inherit; font: inherit; }
.legend button.lg-item.off { opacity: .4; text-decoration: line-through; }
/* accounts table: sticky header + first column, quiet account rows, clear group rows */
.sav-wrap { max-height: 75vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
table.sav-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
table.sav-table td, table.sav-table th { white-space: nowrap; padding: 6px 12px; border-bottom: 1px solid var(--grid); }
table.sav-table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 2px solid var(--border);
  font-size: 12px; color: var(--text-2); font-weight: 600; vertical-align: bottom; }
table.sav-table tr > :first-child { position: sticky; inset-inline-start: 0; z-index: 1; background: var(--surface);
  text-align: start; min-width: 220px; max-width: 340px; overflow: hidden; text-overflow: ellipsis; border-inline-end: 1px solid var(--border); }
table.sav-table thead tr > :first-child { z-index: 3; }
table.sav-table td.num, table.sav-table th.num { text-align: end; }
table.sav-table td.chg, table.sav-table th.chg { border-inline-end: 1px solid var(--border); background: color-mix(in srgb, var(--grid) 35%, var(--surface)); line-height: 1.25; }
table.sav-table td.chg .meta { font-size: 11px; }
table.sav-table tr.g1 td { font-weight: 650; background: color-mix(in srgb, var(--accent) 7%, var(--surface)); cursor: pointer; font-size: 13.5px; }
table.sav-table tr.g1 td.chg { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
table.sav-table tr.g2 td { font-weight: 600; cursor: pointer; }
table.sav-table tr.g2 td:first-child { padding-inline-start: 26px; }
table.sav-table .chev { display: inline-block; width: 12px; color: var(--muted); }
table.sav-table tr.acc td { color: var(--text-2); }
table.sav-table tr.acc td:first-child { padding-inline-start: 30px; cursor: pointer; color: var(--text); }
table.sav-table tr.acc.lvl2 td:first-child { padding-inline-start: 44px; }
table.sav-table tr.acc td:first-child:hover .nm { text-decoration: underline; }
table.sav-table tr.acc.closed td { color: var(--muted); }
table.sav-table tr.total td { font-weight: 700; border-top: 2px solid var(--border); background: var(--bg); }
table.sav-table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
table.sav-table td.cell { cursor: pointer; }
table.sav-table td.cell:hover { outline: 1px solid var(--accent); outline-offset: -1px; }
.nm { display: inline-flex; gap: 5px; align-items: baseline; }
.nm .sep { font-style: normal; color: var(--muted); }
.nm .muted { color: var(--muted); font-style: italic; font-size: 12px; }
.sav-table .stale, .sav-key .stale { color: var(--muted); opacity: .75; }
.sav-table .est, .sav-key .est { color: var(--accent); font-style: italic; background-image: repeating-linear-gradient(90deg, var(--accent) 0 4px, transparent 4px 7px);
  background-size: 100% 1px; background-repeat: no-repeat; background-position: 0 calc(100% - 3px); }
table.sav-table td.auto::after { content: " ⚡"; font-size: 10px; }
.sav-estnote { grid-column: 1 / -1; margin: 0; }
@media (max-width: 600px) {
  table.sav-table tr > :first-child { min-width: 150px; max-width: 170px; }
  table.sav-table td, table.sav-table th { padding: 5px 8px; }
}
/* Add data: a tab per person; red when amounts are typed in it */
.sav-tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--border); margin: 4px 0 12px; scrollbar-width: none; }
.sav-tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 6px 6px 0 0; background: transparent; padding: 8px 14px;
  color: var(--text-2); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; font-weight: 500; }
.sav-tabs button.on { color: var(--text); border-bottom-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); font-weight: 650; }
.sav-tabs button.filled { color: var(--neg-text); }
.sav-tabs button.filled.on { border-bottom-color: var(--neg); background: color-mix(in srgb, var(--neg) 10%, transparent); }
.sav-tabs .cnt { background: var(--neg); color: #fff; border-radius: 99px; font-size: 11px; min-width: 18px; padding: 0 5px; line-height: 18px; text-align: center; }
.sav-tabs button[data-addperson] { color: var(--muted); }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 99px; border: 1px solid var(--border); color: var(--muted); margin-inline-start: 6px; }
.dlg-head { display: flex; gap: 8px; align-items: center; margin: 0 0 12px; font-size: 15px; }
.dlg-head .spacer { margin-inline-start: auto; }
dialog.sav-dlg { width: min(760px, calc(100vw - 16px)); }
.sav-date { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; margin-bottom: 12px; }
.sav-people { margin-bottom: 12px; }
.sav-type { border-top: 1px solid var(--border); padding: 8px 0; }
.sav-type > .head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.sav-type > .head button { margin-inline-start: auto; width: 28px; padding: 2px 0; }
.sav-line { display: grid; grid-template-columns: minmax(90px, 1.2fr) minmax(120px, 1.4fr) minmax(110px, 1fr) 58px 140px 28px; gap: 6px;
  align-items: center; padding: 3px 0; }
.sav-line input, .sav-line select { min-width: 0; width: 100%; }
.sav-line .last { font-size: 12px; color: var(--muted); }
.sav-line.new { background: color-mix(in srgb, var(--accent) 7%, transparent); border-radius: 8px; padding: 4px; }
.sav-line input.own-date { border-color: var(--s2); }
.sav-line .x { padding: 2px 0; }
.sav-foot { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 6px; }
.sav-foot .spacer { margin-inline-start: auto; }
.sav-acc-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-bottom: 10px; }
.sav-acc-form label { display: grid; gap: 4px; font-size: 12px; color: var(--text-2); min-width: 0; }
.sav-acc-form input, .sav-acc-form select { width: 100%; min-width: 0; }
.sav-acc-form .wide { grid-column: 1 / -1; }
.sav-ops { margin-bottom: 10px; }
.sav-op { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 12px; display: grid; gap: 8px; }
.sav-op .row label { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
@media (max-width: 600px) {
  .sav-line { grid-template-columns: 1fr 1fr; }
  .sav-line .last { grid-column: 1 / -1; order: 5; }
}

/* header switch: Broker | Savings (icon + text) */
.mode { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.mode button { border: 0; border-radius: 7px; padding: 4px 11px; display: inline-flex; gap: 6px; align-items: center;
  background: transparent; color: var(--text-2); font-weight: 500; }
.mode button svg { width: 16px; height: 16px; flex: none; }
.mode button.on { background: var(--surface); color: var(--text); font-weight: 650; box-shadow: 0 1px 3px rgb(0 0 0 / .14); }
.mode button.on svg { color: var(--accent); }
.mode button:not(.on):hover { color: var(--text); }

/* Finance section: the broker parts of the page step aside (and the broker section hides Finance's tabs) */
body:not([data-mode="finance"]) #finTabs { display: none !important; }
body[data-mode="finance"] :is(#kpis, #tabs, #markets, #asof, #brokerLoginBtn, #refreshBtn, #sessionBanner, #errBanner, #alertBanner) { display: none !important; }
.card.flat { border: 0; padding: 8px 0; background: transparent; }
@media (max-width: 600px) {
  .mode button { padding: 4px 8px; font-size: 13px; gap: 4px; }
  .mode button svg { width: 15px; height: 15px; }
}
.kpi .kpi-last { font-size: 13px; color: var(--text-2); font-weight: 600; margin: 2px 0 3px; }
.kpi .kpi-last .meta { font-weight: 400; }
.kpi .label .seg.mini { display: flex; width: fit-content; margin-top: 4px; }
.seg.mini button { padding: 1px 6px; font-size: 11px; }
#watchGrid td.c { cursor: pointer; }
.kpi .label .avg-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; }
.kpi .label .avg-ctl .seg.mini { margin-top: 0; }
.check.mini { font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: 0; gap: 4px; }
.check.mini input { width: 13px; height: 13px; margin: 0; }
.inbox li { position: relative; padding-inline-end: 34px; }
.inbox li .del { position: absolute; top: 6px; inset-inline-end: 6px; border: 0; background: none; color: var(--muted);
  font-size: 13px; line-height: 1; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.inbox li .del:hover, .inbox li .del:focus-visible { color: var(--neg); background: var(--grid); }

/* header row: larger text throughout */
header h1 { font-size: 21px; }
header .mode button { font-size: 15px; padding: 5px 12px; }
header .mode button svg { width: 18px; height: 18px; }
.mkt { font-size: 14px; padding: 5px 12px; }
.mkt .dot { width: 9px; height: 9px; }
#asof, .conn { font-size: 15px; }
@media (max-width: 600px) {
  header h1 { font-size: 19px; }
  header .mode button { font-size: 14px; padding: 4px 10px; }
  .mkt { font-size: 12.5px; padding: 4px 9px; }
  #asof, .conn { font-size: 13.5px; }
}

/* header: countdown ring to the next refresh */
.tick { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; color: var(--text-2); cursor: default; }
.tick svg { width: 18px; height: 18px; transform: rotate(-90deg); flex: none; }
.tick circle { fill: none; stroke-width: 2.6; }
.tick .trk { stroke: var(--border); }
.tick .arc { stroke: var(--accent); stroke-dasharray: 100; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.tick.due svg { animation: tickSpin 1s linear infinite; }
.tick.due .arc { stroke-dashoffset: 75 !important; transition: none; }
.tick span { min-width: 2.6ch; }
@keyframes tickSpin { to { transform: rotate(270deg); } }
@media (prefers-reduced-motion: reduce) { .tick .arc { transition: none; } .tick.due svg { animation: none; } }

/* header on one line: name · switch · market pills · icon buttons · status + countdown · log out */
header .actions { margin-inline-start: auto; gap: 6px; }
header form.logout { margin: 0; }
header button.hbtn { width: 38px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px !important; border-radius: 9px; flex: none; }
header button.hbtn svg { width: 20px; height: 20px; }
header form.logout .hbtn:hover { color: var(--neg-text); border-color: var(--neg-text); }
#refreshBtn.busy svg { animation: tickSpin 0.9s linear infinite; }
@media (max-width: 600px) {
  /* line 1: name, switch, log out · line 2: icons, status + countdown · line 3: market pills */
  header h1, header .mode { order: 0; }
  header form.logout { order: 1; margin-inline-start: auto; }
  header .actions { order: 2; margin-inline-start: 0; }
  header #asof { order: 3; flex: 1 1 auto; justify-content: flex-end; }
  .markets { order: 4; }
  header button.hbtn { width: 34px; height: 34px; font-size: 16px !important; }
  header button.hbtn svg { width: 18px; height: 18px; }
}
@media (min-width: 601px) and (max-width: 1599px) {
  /* not enough room for one line: market pills go to a second line under the rest */
  .markets { order: 5; flex: 1 1 100%; }
}

/* returns tree: All › years › months */
#retMonthly tr.rt-l0 td { font-weight: 600; }
#retMonthly tr.rt-l1 td { background: color-mix(in srgb, var(--accent) 4%, transparent); }

/* watchlist: search-as-you-type list under the add box */
.suggest-wrap { position: relative; display: inline-block; }
.suggest { position: absolute; z-index: 30; top: calc(100% + 4px); inset-inline-start: 0; width: min(420px, calc(100vw - 32px));
  max-height: 320px; overflow-y: auto; margin: 0; padding: 4px 0; list-style: none; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgb(0 0 0 / 0.14); font-size: 13px; font-weight: 400; }
.suggest li { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; cursor: pointer; }
.suggest li.active, .suggest li:hover { background: var(--grid); }
.suggest li .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest li.note { cursor: default; color: var(--muted); }
.suggest li.note:hover { background: none; }

/* ETF tab */
.etf-sectors { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; align-items: center; }
.etf-sectors .chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; }
.etf-sectors .chip i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.etf-sectors .chip.off { opacity: .45; }
.etf-sectors .chip.off i { background: var(--muted) !important; }
#etfTable tr.mine td { background: color-mix(in srgb, var(--s2) 10%, transparent); }
#etfTable td:last-child { color: var(--s2); }
.etf-zoom { gap: 4px; font-size: 13px; color: var(--text-2); }
.etf-zoom input { width: 58px; padding: 4px 6px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 640px) { #etfSearch { min-width: 0; width: 100%; } }
.help-btn { width: 22px; height: 22px; padding: 0; border-radius: 50%; font-size: 12px; font-weight: 700; line-height: 1;
  color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; }
.help-btn:hover { color: var(--accent); border-color: var(--accent); }
.etf-conc { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; }
@media (max-width: 900px) { .etf-conc { grid-template-columns: 1fr; } }
.help-dlg { width: min(760px, calc(100vw - 32px)); display: flex; flex-direction: column; overflow: hidden; }
.help-dlg:not([open]) { display: none; }
.help-body { font-size: 14px; line-height: 1.55; overflow-y: auto; min-height: 0; flex: 1; position: relative; }
.help-body section { padding: 4px 0 10px; border-bottom: 1px solid var(--border); scroll-margin-top: 8px; }
.help-body section:last-child { border-bottom: 0; }
.help-body h3 { font-size: 15px; margin: 10px 0 6px; }
.help-body p, .help-body ul { margin: 6px 0; color: var(--text-2); }
.help-body b { color: var(--text); }
.help-body .formula { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; color: var(--text); }
.help-body a { color: var(--accent); }
.prov-pick { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.prov-pick select, .prov-pick input { min-width: 0; width: 100%; }
.sav-type > .head button.addline { width: auto; white-space: nowrap; font-size: 12px; font-weight: 500; padding: 3px 10px; }
.sav-type > button.addline.under { margin-top: 4px; font-size: 12px; padding: 3px 10px; }
button:disabled { opacity: .45; cursor: not-allowed; }
.sav-addprov { gap: 8px; }
.sav-addprov select { max-width: 220px; }

/* ---------------- Finance: bank, cards, analysis ---------------- */
#finTabs .fin-up-tab { margin-inline-start: auto; color: var(--accent); font-weight: 600; white-space: nowrap; }
.cat-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-inline-end: 7px; vertical-align: 0; flex: none; }
.fin-legend .cat-dot { margin-inline-end: 6px; }
.fin-monthnav { display: inline-flex; align-items: center; gap: 2px; }
.fin-monthnav button { padding: 4px 10px; font-size: 15px; line-height: 1; }
.fin-monthnav select { min-width: 150px; }
.fin-grid .card { min-width: 0; }
.fin-grid table tr.on td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
tr.fin-sub th { font-size: 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; padding-top: 14px; }
.fin-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; border: 1px solid var(--border); border-radius: 99px; font-size: 13px; }
.fin-chip button { border: 0; background: transparent; padding: 0 6px; font-size: 15px; line-height: 1; }
.fin-tx td { vertical-align: top; }
.fin-tx .name { max-width: 460px; }
.fin-cat { display: inline-flex; align-items: center; }
.fin-cat select { border: 1px solid transparent; background: transparent; padding: 2px 4px; max-width: 190px; color: var(--text); }
.fin-cat select:hover, .fin-cat select:focus { border-color: var(--border); background: var(--surface); }
tr.fin-excl td { opacity: .45; text-decoration: line-through; }
tr.fin-excl td:last-child { opacity: 1; text-decoration: none; }
td.nowrap, .nowrap { white-space: nowrap; }
.fin-empty p { color: var(--text-2); margin: 0 0 12px; }
.fin-toast { position: fixed; inset-inline-start: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; transition: .2s; z-index: 50; max-width: calc(100vw - 32px); }
.fin-toast.on { opacity: 1; transform: translate(-50%, 0); }
.fin-toast.err { background: var(--neg); color: #fff; }
dialog.fin-up-dlg { width: min(760px, calc(100vw - 16px)); }
.fin-drop { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 16px; border: 2px dashed var(--border); border-radius: 12px; }
.fin-drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.fin-up-list { display: grid; gap: 8px; margin-top: 12px; }
.fin-up-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; font-size: 13px; }
.fin-up-item .pill { margin-inline-start: 4px; }
.fin-up-item.err { border-color: var(--neg); color: var(--neg-text); }
.fin-up-item.done { border-color: var(--s3); }
.fin-insights { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.fin-insights li { padding: 8px 12px; border-radius: 8px; border-inline-start: 4px solid var(--s1); background: var(--bg); font-size: 14px;
  display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: start; }
.fin-ins-ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--s1); color: #fff; margin-top: 1px; }
.fin-insights li.warn .fin-ins-ic { background: #eab308; }
.fin-insights li.good .fin-ins-ic { background: var(--s3); }
.fin-insights li.tip { border-color: #8b5cf6; }
.fin-insights li.tip .fin-ins-ic { background: none; font-size: 15px; }
.fin-ins-title { font-weight: 600; margin-bottom: 2px; }
.fin-ins-act { display: flex; gap: 4px; align-items: center; white-space: nowrap; }
.fin-ins-act .icon-btn { opacity: .5; }
.fin-insights li:hover .fin-ins-act .icon-btn { opacity: 1; }
button.link { background: none; border: 0; padding: 2px 4px; color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; }
button.link:hover { text-decoration: underline; }
.fin-locked { margin-top: 10px; font-size: 13px; }
.fin-locked summary { cursor: pointer; color: var(--muted); }
.fin-locked ul { margin: 6px 0 0; padding-inline-start: 18px; display: grid; gap: 3px; }
.fin-insights li.good { border-color: var(--s3); }
.fin-insights li.warn { border-color: #eab308; }
.fin-heatmap td.fin-heat { font-size: 12px; text-align: center; min-width: 44px; }
.fin-heatmap th { text-align: center; }
.fin-budgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 24px; }
.fin-budget .row { font-size: 14px; }
.fin-budget .spacer { margin-inline-start: auto; }
.fin-bar { height: 8px; border-radius: 4px; background: var(--grid); overflow: hidden; margin-top: 6px; }
.fin-bar i { display: block; height: 100%; border-radius: 4px; }
.fin-list { margin: 0; padding-inline-start: 18px; display: grid; gap: 6px; font-size: 14px; }
.pill.fin-up { border-color: var(--neg); color: var(--neg-text); }
.fin-set input:not([type=color]) { width: 100%; min-width: 110px; }
.fin-set input[type=color] { width: 36px; height: 28px; padding: 0 2px; }
@media (max-width: 700px) {
  .fin-monthnav select { min-width: 0; }
  .fin-tx .name { max-width: 220px; }
}
#finBank [dir=auto], #finCards [dir=auto], #finAnalysis [dir=auto], #finSettings td[dir=auto], #finTxDlg [dir=auto] { text-align: left; }
table.fin-wrap td { white-space: normal; }
table.fin-wrap td:last-child { white-space: nowrap; }
.fin-tx td { white-space: normal; }
.fin-tx td.nowrap { white-space: nowrap; }
.fin-heatmap td.fin-heat:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.fin-lg { cursor: pointer; user-select: none; }
.fin-lg.off { opacity: .4; text-decoration: line-through; }
.fin-merch { cursor: pointer; }
.fin-merch:hover { color: var(--accent); text-decoration: underline; }
.fin-back { margin-inline-end: 4px; }
.fin-unsum { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 10px; font-size: 13px; }
.fin-unchip i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 5px; vertical-align: -1px; }

/* Settings: sections that fold (› opens) */
details.set-sec > summary { cursor: pointer; list-style: none; }
details.set-sec > summary::-webkit-details-marker { display: none; }
details.set-sec > summary h2 { margin: 0; }
details.set-sec > summary h2::before { content: "›"; display: inline-block; width: 14px; color: var(--muted); font-size: 20px; line-height: 1;
  transition: transform .15s; transform-origin: 40% 55%; }
details.set-sec[open] > summary h2::before { transform: rotate(90deg); }
details.set-sec[open] > summary { margin-bottom: 12px; }
details.set-sec:not([open]) { padding-top: 14px; padding-bottom: 14px; }
.set-group { margin: 18px 4px 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.set-group:first-child { margin-top: 4px; }
details.set-sec { margin: 0 0 10px; }

/* family server (finance + savings only) */
body:not([data-profile="family"]) .fam-only, body:not([data-role="admin"]) .admin-only { display: none !important; }
body[data-profile="family"] #modeSwitch { display: none !important; }
.acc-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.acc-form input:not([type=checkbox]) { min-width: 160px; }
.acc-key { font: 600 15px/1.6 ui-monospace, monospace; word-break: break-all; user-select: all; }
