:root {
  color-scheme: light;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --border: rgba(0, 0, 0, .07);
  --teal: #1d1d1f;
  --paper: #f5f5f7;
  --up: #d93025;
  --down: #0b8043;
  --shadow: 0 2px 12px rgba(0, 0, 0, .035), 0 0 0 1px rgba(0, 0, 0, .035);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
.apple-nav-wrap {
  position: sticky; top: 12px; z-index: 50;
  display: flex; justify-content: center; pointer-events: none;
  margin-bottom: 16px;
}
.apple-nav {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px; border-radius: 999px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, .06), 0 0 0 1px rgba(0, 0, 0, .05);
}
.apple-nav a {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 34px; padding: 0 16px; border-radius: 999px;
  font-size: .86rem; font-weight: 600; color: var(--muted);
  text-decoration: none; transition: all .18s ease; white-space: nowrap;
}
.apple-nav a:hover { color: var(--ink); background: rgba(0, 0, 0, .04); }
.apple-nav a.active { background: var(--ink); color: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .14); }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.35rem, 4vw, 1.85rem); letter-spacing: .025em; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; overflow-wrap: anywhere; }
small, .muted { color: var(--muted); font-size: .86rem; }
button, input, select { font: inherit; color: inherit; }
button, input, select { min-height: 42px; border: 1px solid var(--border); border-radius: .55rem; padding: .4rem .65rem; background: white; }
button { cursor: pointer; font-weight: 600; }
button:not(:disabled):hover { background: #f0f0f5; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 2px solid #0071e3; outline-offset: 2px; }
.primary { background: var(--teal); color: white; border-color: var(--teal); }
.primary:not(:disabled):hover { background: #333336; }
.dashboard { width: min(100%, 70rem); margin: auto; padding: 1.7rem clamp(.85rem, 4vw, 2rem) 3rem; }
.page-header, .holdings-header, .overview-total, .heading-group, .actions, .product-head { display: flex; gap: .6rem; align-items: center; }
.page-header, .holdings-header, .overview-total, .product-head { justify-content: space-between; }
.page-header { margin-bottom: 1rem; min-height: 3.5rem; }
.status { color: var(--muted); font-size: .85rem; }
.status[data-tone="error"], .form-message { color: #93372a; }
.actions { flex-wrap: wrap; }
/* The first reading is today's change. Balances share a quieter panel. */
.overview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); gap: .8rem; margin-bottom: 1rem; }
.today-card, .balance-card { min-width: 0; padding: 1.15rem 1.35rem; border-radius: 18px; background: white; box-shadow: var(--shadow); }
.today-card p, .today-card small { color: var(--muted); }
.today-card small { display: block; margin-top: .35rem; }
.today-card strong { display: block; font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.2; margin-top: .3rem; letter-spacing: -0.03em; }
.balance-card { border: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; align-items: center; }
.balance-card > div { min-width: 0; }
.balance-card > div + div { border-left: 1px solid var(--border); padding-left: .8rem; }
.balance-card p { color: var(--muted); font-size: .86rem; }
.balance-card strong { display: block; font-size: clamp(1.05rem, 3.2vw, 1.65rem); line-height: 1.3; margin: .3rem 0; }
strong, .number { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.up { color: var(--up); }
.down { color: var(--down); }
.panel { background: white; border: 0; border-radius: 20px; box-shadow: var(--shadow); margin-bottom: .95rem; }
.chart-panel summary { display: flex; gap: .6rem; align-items: baseline; padding: .8rem 1.05rem; cursor: pointer; font-weight: 700; list-style: none; }
.chart-panel summary::-webkit-details-marker { display: none; }
.chart-panel summary::before { content: "▸"; color: var(--teal); }
.chart-panel[open] summary::before { content: "▾"; }
.chart-panel summary small { margin-left: auto; font-weight: 400; overflow-wrap: anywhere; }
.chart-frame { height: 215px; margin: .15rem 1rem 1rem; }
.holdings { padding: .9rem 1rem; }
.heading-group span { font-size: .86rem; color: var(--muted); }
.filters { display: grid; grid-template-columns: 1fr auto auto auto; gap: .45rem; margin: .6rem 0; }
.filters input, .filters select { min-width: 0; max-width: 100%; }
.products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.product { padding: .7rem .8rem; border: 1px solid var(--border); border-radius: .65rem; min-width: 0; }
.product-head { align-items: flex-start; }
.product-actions { display: flex; gap: .35rem; flex-shrink: 0; }
.product-head button { font-size: .82rem; min-height: 36px; padding: .2rem .5rem; }
.product-meta { font-size: .83rem; color: var(--muted); overflow-wrap: anywhere; margin: .2rem 0 .5rem; }
.product-values { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .22rem; border-top: 1px solid var(--border); padding-top: .35rem; }
.product-values b, .product-values small { display: block; }
.product-values b { font-size: .92rem; }
.pending { color: #885717; }
.empty-message { grid-column: 1 / -1; padding: .85rem; color: var(--muted); }
dialog { max-height: calc(100vh - 1.5rem); max-height: calc(100dvh - 1.5rem); max-width: min(31rem, 100% - 1.5rem); width: 100%; margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: .9rem; color: var(--ink); }
dialog::backdrop { background: #152838a6; }
.dialog-form { display: flex; flex-direction: column; max-height: calc(100vh - 1.5rem); max-height: calc(100dvh - 1.5rem); }
.dialog-header, .dialog-footer { padding: .7rem .95rem; background: #f5f5f7; flex: 0 0 auto; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.dialog-header button { min-width: 42px; }
.dialog-body { padding: .75rem .95rem; overflow: auto; overscroll-behavior: contain; min-height: 0; }
.dialog-footer { border-top: 1px solid var(--border); }
.dialog-footer button { width: 100%; }
.dialog-body label { display: grid; gap: .2rem; font-size: .88rem; font-weight: 600; margin-bottom: .45rem; }
.dialog-body input, .dialog-body select { width: 100%; min-width: 0; font-size: 16px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .25rem .55rem; }
.form-grid .wide { grid-column: 1 / -1; }
.estimate { align-self: end; margin-bottom: .45rem; font-size: .8rem; }
.form-message:empty { display: none; }
.catalog-results { list-style: none; padding: 0; margin: .3rem 0 .55rem; max-height: 10rem; overflow: auto; border: 1px solid var(--border); border-radius: .55rem; }
.catalog-results button { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; text-align: left; width: 100%; display: block; font-size: .88rem; }
.catalog-results small { display: block; }
@media (max-width: 620px) {
  .dashboard { padding-top: 1rem; padding-bottom: 5.5rem; }
  .apple-nav-wrap {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0;
    margin: 0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    background: rgba(245, 245, 247, .85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--border);
  }
  .apple-nav { width: 100%; justify-content: space-between; box-shadow: none; background: transparent; padding: 0; }
  .apple-nav a { flex: 1; padding: 0 8px; height: 38px; font-size: .82rem; }
  .page-header { flex-wrap: wrap; }
  .actions { width: 100%; }
  .actions button { flex: 1; font-size: .84rem; white-space: nowrap; }
  .overview { grid-template-columns: 1fr; gap: .55rem; }
  .today-card, .balance-card { padding: .7rem .9rem; }
  .products { grid-template-columns: minmax(0, 1fr); }
  .holdings { padding: .65rem .7rem; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters input { grid-column: 1 / -1; }
}
.chart-mode { display: flex; align-items: center; gap: .55rem; margin: 0 1rem .55rem; color: var(--muted); }
.daily-rows { list-style: none; padding: 0 1rem; margin: .4rem 0 .8rem; }
.daily-rows:empty { display: none; }
.daily-rows li { display: flex; justify-content: space-between; padding: .3rem 0; border-top: 1px solid var(--border); }
.chart-period, #chartDates { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.chart-period { margin: 0 1rem .65rem; color: var(--muted); }
#chartDateError { color: var(--up); }

.chart-note { margin: 0 1rem .45rem; color: var(--muted); font-size: .85rem; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.chart-controls { display: flex; flex-wrap: wrap; align-items: start; gap: .5rem; margin: 0 1rem .65rem; }
.chart-controls .chart-mode, .chart-controls .chart-period { margin: 0; }
.chart-controls select { background: #f5f5f7; font-weight: 600; }
.chart-panel summary { font-size: 1.12rem; padding: .95rem 1rem; }
.chart-frame { height: clamp(215px, 30vw, 310px); }
.chart-controls .chart-period { display: contents; }
#chartDates { flex-basis: 100%; }
@media (max-width: 360px) {
  .product-values { grid-template-columns: 1fr 1fr; gap: .35rem; }
  .product-values b { font-size: .83rem; }
}
@media (max-width: 620px) {
  .product-values { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem .5rem; }
  .rec-grid { grid-template-columns: 1fr; }
  .watch-form { grid-template-columns: 1fr; }
}
.rec-body { padding: 0 1rem 1rem; }
.rec-toolbar { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; margin-bottom: .75rem; }
.rec-tab {
  min-height: 30px; padding: .22rem .72rem; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  font-size: .8rem; font-weight: 600; cursor: pointer;
}
.rec-tab.active { background: #1d1d1f; color: #fff; border-color: #1d1d1f; }
.rec-toolbar-hint { font-size: .76rem; color: var(--muted); margin-left: auto; }
.rec-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: .75rem; }
.rec-block { border: 1px solid var(--border); border-radius: .7rem; padding: .7rem .85rem; background: #fafcf9; min-width: 0; }
.rec-block h3 { font-size: .95rem; margin-bottom: .45rem; }
.rec-list { list-style: none; padding: 0; margin: 0; }
.rec-list li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .42rem 0; border-top: 1px solid var(--border); font-size: .88rem; }
.rec-list li:first-child { border-top: 0; }
.rec-item-main { min-width: 0; }
.rec-item-name { font-weight: 600; display: block; overflow-wrap: anywhere; }
.rec-item-sub { font-size: .78rem; color: var(--muted); display: block; }
.rec-item-right { display: flex; align-items: center; gap: .45rem; flex-shrink: 0; white-space: nowrap; }
.rec-rates { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; line-height: 1.25; }
.rec-rate-row { font-size: .76rem; color: var(--muted); display: inline-flex; align-items: baseline; gap: 4px; }
.rec-rate-row b { font-size: .84rem; font-weight: 600; }
.rec-rate-row.primary b { font-size: .94rem; font-weight: 700; }
.rec-rate-muted { color: var(--muted); font-size: .74rem; }
.rec-mini-btn { min-height: 30px; padding: .15rem .45rem; font-size: .78rem; }
.nav7-detail {
  margin-top: .6rem; padding-top: .5rem; border-top: 1px dashed var(--border);
}
.nav7-detail summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between;
  align-items: center; gap: .5rem; font-size: .78rem; color: var(--muted); user-select: none;
}
.nav7-detail summary::-webkit-details-marker { display: none; }
.nav7-detail summary:hover { color: var(--ink); }
.nav7-sum-left { font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.nav7-sum-left::after { content: "▾"; font-size: .82rem; transition: transform .15s; }
.nav7-detail[open] .nav7-sum-left::after { transform: rotate(180deg); }
.nav7-sum-right { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.nav7-table {
  width: 100%; border-collapse: collapse; margin-top: .5rem; font-size: .76rem;
  font-variant-numeric: tabular-nums;
}
.nav7-table th, .nav7-table td {
  padding: 4px 6px; border-bottom: 1px solid var(--border); text-align: right;
}
.nav7-table th { color: var(--muted); font-weight: 600; }
.nav7-table th:first-child, .nav7-table td:first-child { text-align: left; }
.nav7-table tr:last-child td { border-bottom: 0; }
.nav7-foot {
  margin: .4rem 0 0; font-size: .73rem; color: var(--muted); line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
.watch-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .45rem; }
.watch-header h3 { margin: 0; }
.watch-form { display: grid; grid-template-columns: 1.5fr 1fr auto; gap: .45rem; margin-bottom: .45rem; }
.rec-note { margin: .6rem 0 0; }
.nt-body { padding: 0 1rem 1rem; }
.nt-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; margin-bottom: .65rem; }
.nt-kpis > div { border: 1px solid var(--border); border-radius: .65rem; padding: .55rem .75rem; background: #fafcf9; min-width: 0; }
.nt-kpis strong { display: block; font-size: clamp(1.05rem, 2.6vw, 1.35rem); margin-top: .15rem; }
.nt-chart-frame { margin: .25rem 0 .75rem; height: 195px; }
.nt-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .45rem; margin-bottom: .75rem; }
.nt-group-card { border: 1px solid var(--border); border-radius: .6rem; padding: .5rem .65rem; background: white; min-width: 0; }
.nt-group-card .nt-group-name { font-weight: 700; font-size: .88rem; display: block; }
.nt-group-card .nt-group-val { font-size: .95rem; font-weight: 700; display: block; margin-top: .15rem; }
.nt-group-card small { font-size: .76rem; display: block; }
.nt-badge { display: inline-block; padding: .05rem .38rem; border-radius: .35rem; background: #eaf3f2; color: var(--teal); font-size: .74rem; font-weight: 600; margin-left: .35rem; }
.btn-link { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; border: 1px solid var(--border); border-radius: .55rem; padding: .4rem .75rem; background: white; color: var(--teal); font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn-link:hover { background: #eaf3f2; }
.nt-balance-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.nt-section { padding: .95rem 1rem 1rem; }
.nt-seg { display: flex; gap: .45rem; flex-wrap: wrap; }
.nt-seg select { background: #f5f8f4; font-weight: 600; }
.nt-inline-note { margin: .4rem 0 .6rem; }
.nt-main-chart { margin: 0; height: clamp(240px, 34vw, 340px); }
.nt-groups-page { margin: .65rem 0 0; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); }
.nt-group-btn { text-align: left; font-weight: 400; min-height: auto; padding: .6rem .75rem; }
.nt-group-btn.active { border-color: var(--teal); background: #eaf3f2; }
.nt-table-wrap { overflow-x: auto; margin-top: .6rem; }
.nt-matrix { width: 100%; border-collapse: collapse; font-size: .85rem; }
.nt-matrix th, .nt-matrix td { padding: .42rem .55rem; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.nt-matrix th:first-child, .nt-matrix td:first-child { text-align: left; font-weight: 600; color: var(--muted); }
.nt-matrix td.nt-hot { font-weight: 700; background: #fafcf9; }
.nt-etf-cards { display: grid; gap: .5rem; }
.nt-etf-card { border: 1px solid var(--border); border-radius: .65rem; background: white; }
.nt-etf-summary { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .7rem .85rem; cursor: pointer; list-style: none; }
.nt-etf-summary::-webkit-details-marker { display: none; }
.nt-etf-left { min-width: 0; }
.nt-etf-title { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
.nt-etf-metrics { display: grid; grid-template-columns: repeat(3, minmax(76px, 1fr)); gap: .45rem; flex-shrink: 0; text-align: right; }
.nt-etf-metrics small, .nt-etf-metrics b { display: block; }
.nt-holders { border-top: 1px solid var(--border); padding: .6rem .85rem .75rem; background: #fafcf9; border-radius: 0 0 .65rem .65rem; }
.nt-holder-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.nt-holder-list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; font-size: .84rem; padding: .22rem .35rem; border-radius: .35rem; }
.nt-holder-list li.is-nt { background: #eaf3f2; font-weight: 600; }
.nt-holder-name { min-width: 0; overflow-wrap: anywhere; }
.nt-radar-banner { margin: .6rem 0 .75rem; padding: .75rem .9rem; border-radius: .7rem; border: 1px solid var(--border); background: #f5f8f4; }
.nt-radar-banner strong { display: block; font-size: 1rem; margin-bottom: .2rem; color: var(--teal); }
.nt-radar-banner p { font-size: .86rem; color: var(--muted); }
.nt-radar-banner[data-regime="support"] { background: #edf7f3; border-color: #b5dccd; }
.nt-radar-banner[data-regime="momentum"] { background: #fdf3f2; border-color: #ebc2be; }
.nt-radar-banner[data-regime="momentum"] strong { color: var(--up); }
.nt-radar-banner[data-regime="outflow"] { background: #f2f7f5; border-color: #bcd7cc; }
.nt-radar-banner[data-regime="outflow"] strong { color: var(--down); }
.nt-radar-grid { margin-bottom: 0; }
.nt-score-pill { display: inline-block; padding: .08rem .42rem; border-radius: .35rem; background: #163f35; color: #fff; font-size: .74rem; font-weight: 700; }
.nt-subhead { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin: .75rem 0 .4rem; flex-wrap: wrap; }
.nt-subhead h3 { font-size: .95rem; }
.nt-val-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.nt-val-card { border: 1px solid var(--border); border-radius: .65rem; padding: .55rem .7rem; background: #fafcf9; min-width: 0; }
.nt-val-head { display: flex; justify-content: space-between; align-items: center; gap: .3rem; margin-bottom: .25rem; }
.nt-val-head strong { font-size: .92rem; }
.nt-zone { font-size: .72rem; font-weight: 700; padding: .05rem .38rem; border-radius: .35rem; }
.nt-zone.low { background: #dff4ea; color: var(--down); }
.nt-zone.mid { background: #edf1f4; color: var(--muted); }
.nt-zone.high { background: #fce6e5; color: var(--up); }
.nt-val-nums { font-size: .82rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.nt-rot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .45rem; margin-bottom: .8rem; }
.nt-rot-card { border: 1px solid var(--border); border-radius: .6rem; padding: .5rem .65rem; background: white; min-width: 0; }
.nt-rot-card.lead { border-color: var(--teal); background: #f2faf7; }
.nt-rot-card small { display: block; font-size: .76rem; }
@media (max-width: 720px) {
  .nt-val-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .nt-kpis, .nt-balance-3 { grid-template-columns: 1fr; }
  .nt-balance-3 > div + div { border-left: 0; border-top: 1px solid var(--border); padding-left: 0; padding-top: .6rem; }
  .nt-etf-summary { flex-direction: column; align-items: stretch; }
  .nt-etf-metrics { text-align: left; }
}
