/* Mobile first: the base is a 320-390 px phone; the table layout starts at 768 px. Tap targets >= 44 px. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --ink: #1a1a1a; --muted: #666; --line: #e0e0e0; --soft: #f6f6f6;
  --good: #1a7f37; --bad: #c62828; --grey: #9a9a9a; --amber: #a86400; --amber-bg: #fff4e0;
}
html { -webkit-text-size-adjust: 100%; }
body { font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif; color: var(--ink); background: #fff;
       font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
a { color: inherit; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px;
       padding: 12px 16px; border-bottom: 1px solid var(--line); }
.mark { font-weight: 700; letter-spacing: -0.01em; }
.mark span { font-weight: 400; color: var(--muted); }
.asof { font-size: 13px; color: var(--muted); }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
h1 { font-size: 20px; line-height: 1.25; margin-bottom: 4px; }
h2 { font-size: 16px; margin: 0 0 8px; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.msg { padding: 24px 0; color: var(--muted); }

.badge { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
         padding: 2px 8px; border-radius: 4px; border: 1px solid var(--line); background: var(--soft); color: var(--muted);
         vertical-align: middle; }
.badge.platform { color: var(--amber); background: var(--amber-bg); border-color: #f0d6a8; }
.badge.stale { color: var(--bad); border-color: #f0c4c4; background: #fdf0f0; }
.badge.paused { color: var(--grey); }
.reason { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* Portfolio: cards on a phone */
.head-row { display: none; }
.row { display: block; text-decoration: none; border: 1px solid var(--line); border-radius: 8px; padding: 12px;
       margin-bottom: 10px; min-height: 44px; }
.row:hover, .row:focus-visible { border-color: #999; outline: none; }
.row .who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.row .name { font-weight: 600; margin-right: 4px; }
.row .cells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cell .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cell .val { font-weight: 600; font-variant-numeric: tabular-nums; }
.cell .chg { font-size: 12px; font-variant-numeric: tabular-nums; }
.num { white-space: nowrap; }
.th { margin-left: .2em; }
.cur { font-size: .8em; font-weight: 500; color: var(--muted); }
.row .spark { margin-top: 8px; height: 28px; width: 100%; }
.row .wide { grid-column: 1 / -1; }
.up { color: var(--good); } .down { color: var(--bad); } .flat { color: var(--muted); }
.partial, .partial .val, .partial .chg { color: var(--grey) !important; }
.hint { font-size: 11px; color: var(--grey); }

/* Account page */
.back { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; color: var(--muted);
        text-decoration: none; }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { font: inherit; font-size: 14px; min-height: 44px; min-width: 64px; padding: 0 14px; border: 0;
              background: #fff; color: var(--ink); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.tiles { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 20px; }
.tile { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.tile .val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.block { border-top: 1px solid var(--line); padding: 16px 0; }
.chart { width: 100%; height: 150px; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin: 6px 0 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 4px; vertical-align: -1px; }
.axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
table.m { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.m th, table.m td { text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--soft); }
table.m th:first-child, table.m td:first-child { text-align: left; }
table.m th:not(:first-child), table.m td:not(:first-child) { white-space: nowrap; padding-left: 8px; }
table.m th { font-weight: 500; color: var(--muted); font-size: 12px; }

@media (min-width: 768px) {
  .top { padding: 14px 32px; }
  main { padding: 24px 32px; }
  h1 { font-size: 24px; }
  /* Portfolio as a table: one grid shared by the header row and every account row */
  .head-row, .row { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(3, minmax(120px, 1fr)) 120px;
                    gap: 12px; align-items: center; }
  .head-row { padding: 0 12px 6px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  .row { border-radius: 0; border-width: 0 0 1px; margin: 0; padding: 10px 12px; }
  .row:hover { background: var(--soft); }
  .row .who { margin: 0; }
  .row .cells { display: contents; }
  .row .cell .lbl { display: none; }
  .row .spark { margin: 0; }
  .row .wide { grid-column: 2 / 5; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .blocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
}
