/* GIE.SH visual language (gie-sh-web STYLE.md): warm white canvas, ink opacity levels, serif titles,
   white surfaces only for real groups (tables, side peek), 6% ink borders, pill buttons. */
:root {
  --canvas: #f7f3f0;
  --surface: #ffffff;
  --ink: #1a1a1a;
  --ink-80: rgb(26 26 26 / 0.8);
  --ink-60: rgb(26 26 26 / 0.6);
  --ink-40: rgb(26 26 26 / 0.45);
  --line: rgb(26 26 26 / 0.06);
  --line-strong: rgb(26 26 26 / 0.15);
  --hover: rgb(26 26 26 / 0.03);
  --success: #2fbf71;
  --warning: #f08a00;
  --error: #d62828;
  --serif: "Playfair Display", "Noto Serif SC", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "Fira Code", "Fira Mono", Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
dialog:not([open]) { display: none; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); font: 400 15px/1.7 var(--sans); }
h1, h2, h3 { font-family: var(--serif); text-wrap: balance; margin: 0; }
p { text-wrap: pretty; }
a { color: inherit; }
small { display: block; font-size: 12px; color: var(--ink-40); }
.muted { color: var(--ink-40); }
.mono { font-family: var(--mono); font-size: 13px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---- Shell ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr auto 1fr; grid-template-areas: "brand summary account"; align-items: center; gap: 16px;
  padding: 12px 24px;
  /* Shell-only glass (STYLE 6.5) so scrolled content does not run under the brand. */
  background: rgb(247 243 240 / 0.82); backdrop-filter: blur(16px);
}
.brand { grid-area: brand; justify-self: start; display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 600 20px/1 var(--serif); }
.account {
  grid-area: account; justify-self: end;
  display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 6px;
  border-radius: 999px; background: rgb(255 255 255 / 0.7);
  backdrop-filter: blur(16px); box-shadow: 0 14px 40px rgba(15, 23, 42, 0.09);
  font-size: 14px; color: var(--ink); border: 0; cursor: pointer;
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.account:hover, .account:focus-visible { background: var(--surface); box-shadow: 0 0 0 1px var(--line-strong), 0 14px 40px rgba(15, 23, 42, 0.12); }
.account[hidden] { display: none; }
.account-exit { display: grid; place-items: center; width: 40px; height: 40px; }
.avatar { display: block; flex: none; }
/* Signed-in member's avatar follows the pointer (blobatar/gaze; excursion in viewBox units). */
#account .mo-eyes { --mo-track-travel: 4px; }
#me-avatar { display: block; }
/* Topbar summary (cf. merchant-agent's IncomeSummary): own spending; toggles the profile curtain. */
.summary {
  grid-area: summary; display: flex; align-items: center; gap: 14px; min-width: 0; padding: 5px 12px;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink);
  font: inherit; white-space: nowrap; cursor: pointer;
  transition: background-color 0.2s var(--ease);
}
.summary:hover, .summary[aria-expanded="true"] { background: var(--hover); }
.summary-icon, .summary-chevron { display: flex; flex: none; }
.summary-chevron { color: var(--ink-60); transition: transform 0.3s var(--ease); }
.summary[aria-expanded="true"] .summary-chevron { transform: rotate(180deg); }
.summary-stats { display: flex; align-items: center; gap: 14px; min-width: 0; }
.summary-stats > span { display: grid; gap: 1px; text-align: left; }
.summary-stats small { font-size: 12px; line-height: 1.2; color: var(--ink-60); }
.summary-stats strong { font: 500 13px/1.3 var(--sans); font-variant-numeric: tabular-nums; }
.summary-divider { width: 1px; height: 26px; background: var(--line-strong); flex: none; }
/* Narrow screens stay one row (no wrapping): drop the brand word, icon and chevron, tighten the stats. */
@media (max-width: 640px) {
  .topbar { gap: 8px; }
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .summary { justify-self: center; }
  /* morph-icon sets display: contents inline, so hiding needs !important. */
  .brand span, .summary-icon, .summary-chevron { display: none !important; }
  .summary { gap: 8px; padding: 4px 6px; }
  .summary-stats { gap: 8px; }
  .summary-stats small { font-size: 11px; }
  .summary-stats strong { font-size: 12px; }
}
@media (max-width: 360px) {
  .summary-divider { display: none; }
  .summary { padding: 4px 0; }
  .summary-stats { gap: 10px; }
  .account { gap: 2px; }
}
.person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.stack { display: inline-flex; vertical-align: middle; }
.stack .avatar + .avatar { margin-left: -8px; }

.page { max-width: 1280px; margin: 0 auto; padding: 24px 24px 96px; display: grid; gap: 56px; }
.page > * { min-width: 0; }

/* ---- Buttons ---- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  font: 500 14px/1 var(--sans); color: var(--ink); background: transparent; cursor: pointer; text-decoration: none;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.15s var(--ease);
}
.button:active { transform: scale(0.96); }
.button:disabled { opacity: 0.5; pointer-events: none; }
.button.primary { background: var(--ink); color: var(--canvas); }
.button.primary:hover { background: #333; }
.button.secondary { border-color: rgb(26 26 26 / 0.2); }
.button.secondary:hover, .button.ghost:hover { background: var(--hover); }
.button.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.button.icon { padding: 0; width: 40px; flex: none; }
.button.icon.small { width: 32px; }
.button.danger { color: var(--error); }

/* ---- Icons: <morph-icon> is display: contents; the SVG inherits currentColor. ---- */
.state { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; vertical-align: middle; }
.th-icon { display: inline-flex; align-items: center; color: var(--ink-40); }
.num .th-icon { justify-content: flex-end; }
.ok { color: #1e7a48; }
.warn { color: #9a5900; }
[data-icon="LoaderCircle"] > svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { [data-icon="LoaderCircle"] > svg { animation: none; } }

/* ---- Login ---- */
.login { min-height: calc(100vh - 80px); display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(420px, 100%); display: grid; padding: 40px 32px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px;
}
.login-card > :not(:first-child) { margin-top: 16px; }
#login-message:empty { display: none; }
#code-field, #login-message {
  interpolate-size: allow-keywords; height: auto; min-height: 0;
  transition: height 220ms var(--ease), margin-top 220ms var(--ease), opacity 220ms var(--ease);
}
@starting-style {
  #code-field, #login-message { height: 0; margin-top: 0; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  #code-field, #login-message { transition: none; }
}
.login-brand { display: flex; align-items: center; gap: 16px; }
.login-brand img { flex: none; }
.login-card h1 { font-size: 32px; font-weight: 600; }
.login-actions { display: flex; gap: 8px; }
.login-actions .button.primary { flex: 1; }
.message { margin: 0; min-height: 1.7em; font-size: 14px; color: var(--ink-60); }
.input-icon { position: relative; display: block; color: var(--ink-40); }
.input-icon > svg, .input-icon morph-icon > svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; pointer-events: none; }
.input-icon input { padding-left: 40px; }
/* Rotating hint over the empty identifier field (placeholder=" " keeps :placeholder-shown usable). */
.ticker {
  position: absolute; left: 41px; right: 12px; top: 1px; bottom: 1px; overflow: hidden; pointer-events: none;
  display: flex; align-items: center; font-size: 15px; color: var(--ink-40);
  transition: opacity 0.15s var(--ease);
}
.ticker > span { display: block; white-space: nowrap; }
.input-icon input:not(:placeholder-shown) ~ .ticker { opacity: 0; }

input, select, textarea {
  font: 400 15px/1.5 var(--sans); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 12px; min-height: 40px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
input:disabled, select:disabled, textarea:disabled { border-color: transparent; background: transparent; color: var(--ink); opacity: 1; padding-left: 0; }
select:disabled { appearance: none; }
textarea { resize: vertical; line-height: 1.7; }
/* ---- Slide-to-confirm switch (merchant-agent availability switch) ----
   Small switch = display (on/green = open, off = closed). Large switch: drag the thumb across and release. */
.mini-switch { display: inline-block; flex: none; width: 28px; height: 16px; padding: 2px; border-radius: 20px; border: 1px solid var(--line-strong); background: rgb(26 26 26 / 0.06); vertical-align: middle; }
.mini-switch i { display: block; width: 10px; height: 10px; border-radius: 50%; background: var(--ink-40); transition: transform 150ms; }
.mini-switch.is-on { background: var(--success); border-color: var(--success); }
.mini-switch.is-on i { background: var(--surface); transform: translateX(12px); }
.settle-trigger { display: inline-flex; align-items: center; gap: 9px; padding: 8px 12px; margin-left: -12px; border: 0; border-radius: 999px; background: none; font: 500 13px/1 var(--sans); color: var(--ink-40); cursor: pointer; }
.settle-trigger:hover { background: var(--hover); }
.settle-trigger.is-on { color: #1e7a48; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

.big-switch { display: grid; gap: 20px; width: min(320px, calc(100vw - 48px)); }
.switch-title { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 0; font-size: 18px; font-weight: 500; color: var(--ink-60); transition: color 180ms; }
.switch-title.is-on { color: #1e7a48; }
.switch-track {
  position: relative; height: 88px; border: 1px solid var(--line-strong); border-radius: 999px; touch-action: none; user-select: none;
  background: color-mix(in srgb, var(--success) var(--fill, 0%), rgb(26 26 26 / 0.06));
  box-shadow: inset 0 2px 8px rgb(26 26 26 / 0.08);
}
.switch-thumb {
  position: absolute; top: 11px; left: calc(12px + (100% - 24px - 64px) * var(--pos, 0) / 100); width: 64px; height: 64px;
  border: 1px solid rgb(255 255 255 / 0.5); border-radius: 50%; background: #8c8c8c; box-shadow: 0 4px 16px rgb(26 26 26 / 0.16); cursor: grab;
}
.switch-thumb:active { cursor: grabbing; }
.switch-thumb:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.big-switch:not([data-dragging]) .switch-thumb { transition: left 200ms ease-out; }
.big-switch:not([data-dragging]) .switch-track { transition: background-color 200ms ease-out; }
.switch-hint { margin: 0; text-align: center; font-size: 13px; color: var(--ink-60); }
.big-switch:not(.is-leaving, .no-grow) :is(.switch-title, .switch-hint) { animation: switch-label-in 180ms 140ms both; }

/* Bill close: grows in place at the bottom of the side peek. */
.peek-actions.settle { position: relative; justify-content: flex-start; align-items: flex-start; }
.settle-switch { margin: 8px auto; transform-origin: center; animation: settle-grow 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.settle-switch.no-grow { animation: none; }
.settle-switch.is-preparing { visibility: hidden; }
.settle.is-expanded > .settle-trigger { position: absolute; top: 16px; left: 0; visibility: hidden; }
.settle-switch.is-leaving { pointer-events: none; }
.settle-switch.is-leaving :is(.switch-title, .switch-hint) { opacity: 0; }
.settle.is-collapsing { overflow: clip; }
@keyframes settle-grow { from { transform: translate(var(--from-x), var(--from-y)) scale(var(--from-sx), var(--from-sy)); } }

/* Sign-out: full screen. */
.switch-dialog {
  position: fixed; inset: 50% auto auto 50%; margin: 0; padding: 0; border: 0; overflow: visible; background: none; color: var(--ink);
  transform: translate(-50%, -50%); animation: switch-expand 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.switch-dialog::backdrop { background: rgb(247 243 240 / 0.55); backdrop-filter: blur(14px); animation: switch-blur-in 240ms ease-out both; }
.switch-dialog.is-leaving { animation: switch-collapse 200ms cubic-bezier(0.4, 0, 0.8, 0.2) both; pointer-events: none; }
.switch-dialog.is-leaving::backdrop { animation: switch-blur-out 200ms ease-in both; }
.switch-dialog.is-leaving :is(.switch-title, .switch-hint) { opacity: 0; }
@keyframes switch-expand { from { transform: translate(calc(-50% + var(--from-x)), calc(-50% + var(--from-y))) scale(var(--from-sx), var(--from-sy)); } }
@keyframes switch-collapse { to { transform: translate(calc(-50% + var(--from-x)), calc(-50% + var(--from-y))) scale(var(--from-sx), var(--from-sy)); } }
@keyframes switch-blur-in { from { opacity: 0; backdrop-filter: blur(0); } }
@keyframes switch-blur-out { to { opacity: 0; backdrop-filter: blur(0); } }
@keyframes switch-label-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .switch-dialog, .switch-dialog::backdrop, .settle-switch { animation-duration: 1ms; } }

/* ---- Tables ---- */
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.table-wrap { overflow-x: auto; position: relative; } /* relative: contains the absolutely positioned hidden caption */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
thead th { font-size: 12px; font-weight: 500; color: var(--ink-40); white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
tbody th { font-weight: 500; }
.num { text-align: right; white-space: nowrap; }
.person small { display: block; }
.amounts { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.amount { font-weight: 500; white-space: nowrap; }

.ledger-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; margin-bottom: 12px; }
.filters { flex: 1 1 240px; min-width: 0; }
.views { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: rgb(26 26 26 / 0.04); }
.views button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; min-width: 44px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent;
  font: 500 13px/1 var(--sans); color: var(--ink-60); cursor: pointer;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease), transform 0.15s var(--ease);
}
.views button:active { transform: scale(0.96); }
.views button:hover { background: var(--hover); color: var(--ink); }
.views button[aria-pressed="true"] { background: var(--ink); color: var(--canvas); }
.count {
  min-width: 18px; padding: 2px 5px; border-radius: 999px; background: var(--warning); color: var(--ink);
  font-size: 11px; line-height: 14px; font-variant-numeric: tabular-nums;
}
.count.done { background: rgb(26 26 26 / 0.08); color: inherit; }
.ledger tbody tr[data-id] { cursor: pointer; transition: background-color 0.15s var(--ease); }
.ledger tbody tr[data-id]:hover { background: var(--hover); }
.ledger tbody tr[data-id]:focus-visible { outline-offset: -2px; }
.time-group > td { padding: 20px 16px 8px; background: var(--canvas); border-bottom: 1px solid var(--line-strong); }
.time-group h3 { width: fit-content; position: sticky; left: 16px; font-size: 16px; font-weight: 600; color: var(--ink-60); }
.title-cell { font-weight: 500; min-width: 200px; }
.empty { text-align: center; padding: 48px 16px; color: var(--ink-40); }
.witness-cell { display: inline-flex; align-items: center; gap: 8px; }
/* Dashed circle = waiting for *my* witness; clicking it witnesses on the spot (the circle then disappears). */
.quick-witness {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; margin: -4px 0;
  border: 0; border-radius: 50%; background: none; color: #9a5900; cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.quick-witness:hover { background: var(--ink); color: var(--canvas); }
.quick-witness:active { transform: scale(0.92); }
/* Closed (settled) bills stay on record: struck through and faded. */
.ledger tr.closed > td:not(.close-cell) { text-decoration: line-through; opacity: 0.45; }
/* Archived (Telegram-style): one folded row atop the witness view. */
.archive-fold { cursor: pointer; }
.archive-fold:hover, .ledger tr.folded { background: rgb(26 26 26 / 0.02); }

/* ---- Side peek (Notion-style) ---- */
.peek {
  position: fixed; inset: 0 0 0 auto; margin: 0; width: min(560px, 100vw); height: 100vh; max-height: none; max-width: none;
  padding: 0; border: 0; border-left: 1px solid var(--line); background: var(--surface); color: var(--ink);
  box-shadow: 0 20px 70px rgba(15, 23, 42, 0.08);
}
.peek[open] { animation: peek-in 0.42s var(--ease); }
.peek::backdrop { background: rgb(26 26 26 / 0.12); }
@keyframes peek-in { from { transform: translateX(32px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .peek[open] { animation: none; } }
.peek-body { display: grid; gap: 12px; padding: 16px 32px 48px; }
.peek-bar {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 12px;
  margin: -16px -32px 0; padding: 12px 32px; background: var(--surface);
}
.peek-bar #close-peek { margin-left: auto; }
.status-chip { font-size: 13px; color: #1e7a48; }
.status-chip.muted { color: var(--ink-40); }
.note { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.save-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-40); }
.save-status.error { color: var(--error); }
.peek-title { font: 600 30px/1.3 var(--serif); border-color: transparent; padding: 4px 0; margin-top: 8px; }
.props { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 4px 16px; margin: 8px 0; align-items: center; }
.props dt { display: flex; color: var(--ink-40); cursor: help; }
.props dd { margin: 0; min-height: 40px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.props .row { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.props .row input { flex: 1; min-width: 0; }
/* Currency dropdown: button beside the amount, popover list anchored under it (CSS anchor positioning). */
.currency-button {
  anchor-name: --currency; flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px 0 12px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink);
  font: 500 14px/1 var(--mono); cursor: pointer;
}
.currency-button:hover { background: var(--hover); }
.currency-button morph-icon svg { color: var(--ink-40); }
.currency-menu {
  position-anchor: --currency; inset: auto; top: anchor(bottom); right: anchor(right); margin: 4px 0 0;
  min-width: 200px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  box-shadow: 0 12px 32px rgb(26 26 26 / 0.12);
}
.currency-menu label { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.currency-menu label:hover, .currency-menu label:has(:focus-visible) { background: var(--hover); }
.currency-menu label:has(:checked) { background: rgb(26 26 26 / 0.06); }
.currency-menu .code { font: 500 14px/1 var(--mono); }
.currency-menu .muted { margin-left: auto; font-size: 13px; }
.currency-menu input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.flag { width: 18px; height: 12px; border-radius: 2px; flex: none; box-shadow: 0 0 0 1px var(--line); }
.peek h3 { display: flex; color: var(--ink-40); margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.hint { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: #9a5900; }
.witnesses, .files { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.witnesses li, .files li { display: flex; align-items: center; gap: 10px; min-height: 32px; }
.witnesses li .name { color: var(--ink); }
.witnesses li > :last-child { margin-left: auto; }
.files li a { min-width: 0; overflow-wrap: anywhere; }
.upload { justify-self: start; }
.peek-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.peek-actions .row { display: flex; flex-wrap: wrap; gap: 8px; }
/* ---- Profile: drops over the ledger like a curtain, then replaces it in the page flow ---- */
.profile { background: var(--canvas); }
.profile.curtain {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; overflow: hidden;
  box-shadow: 0 24px 60px rgb(26 26 26 / 0.12);
}
.profile-body { display: grid; gap: 20px; max-width: 920px; margin: 0 auto; padding: 24px 32px 96px; }
.profile-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile-head { gap: 10px; }
.profile-head h2 { font-size: 26px; line-height: 1.3; }
.profile-head small { color: var(--ink-60); }
/* Same currency dropdown as the bill peek, as a pill, with its own anchor. */
.profile-currency { flex: none; }
.profile-currency .currency-button { anchor-name: --profile-currency; border-radius: 999px; padding: 0 12px 0 14px; }
.profile-currency .currency-menu { position-anchor: --profile-currency; }
.profile-counts { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--ink-60); font-size: 12px; }
.profile-counts > span { display: inline-flex; align-items: center; gap: 6px; }
.profile-counts > :last-child { margin-left: auto; }
.profile-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; min-width: 0; }
.total-label { display: flex; align-items: center; gap: 10px; color: var(--ink-60); font-size: 13px; }
.chart-unit { font: 500 11px var(--mono); color: var(--ink-60); }
.profile-total { font: 500 clamp(30px, 6vw, 48px)/1.35 var(--sans); letter-spacing: -0.045em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; margin: 8px 0 16px; }
.profile-rate-note { margin: -10px 0 16px; font-size: 11px; color: var(--ink-60); }
.settlement-layout { display: grid; grid-template-columns: 148px 1fr; gap: 28px; align-items: center; }
.settlement-ring { width: 100%; max-width: 160px; height: auto; }
.ring-track, .ring-value { fill: none; stroke-width: 10; }
.ring-track { stroke: #d8d7d1; }
.ring-value { stroke: var(--ink); }
.ring-number { fill: var(--ink); font: 600 25px var(--sans); letter-spacing: -1px; }
.ring-label { fill: var(--ink-60); font: 12px var(--sans); }
.settlement-amounts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; min-width: 0; }
.settlement-amounts dt { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--ink-60); font-size: 12px; }
.settlement-amounts dt span { margin-left: auto; font: 11px var(--mono); }
.settlement-amounts dd { margin: 6px 0 0; font: 500 24px/1.4 var(--sans); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.legend-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: none; }
.legend-dot.dark { background: var(--ink); }
.legend-dot.light { background: #d8d7d1; border: 1px solid var(--ink-40); }
.chart-foot { font-size: 11px; color: var(--ink-60); margin: 12px 0 0; }
.profile-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; min-width: 0; }
.chart-wide { grid-column: 1 / -1; }
.chart { margin: 0; }
.chart figcaption, #profile .profile-card h3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; font: 600 14px var(--sans); color: var(--ink); margin: 0; padding: 0; border: 0; }
.chart figcaption > span:first-child { display: flex; align-items: center; gap: 8px; }
.chart-readout { min-height: 19px; margin: 8px 0 12px; color: var(--ink-60); font: 11px/1.7 var(--mono); }
.monthly-plot { width: 100%; height: 320px; }
.month-presets { display: flex; gap: 4px; margin: 16px 0 12px; flex-wrap: wrap; }
.month-presets .button { min-height: 34px; padding: 4px 12px; font-size: 12px; }
.month-controls { display: flex; align-items: center; gap: 8px; }
.month-controls label { display: grid; gap: 4px; min-width: 0; flex: 1; font-size: 11px; color: var(--ink-60); }
.month-controls input { width: 100%; min-width: 0; min-height: 38px; padding: 4px 6px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: 12px var(--sans); }
.spending-mix, .subscriptions { grid-column: 1 / -1; }
#profile :is(.spending-mix, .subscriptions) h3 { justify-content: start; }
.mix-periods { margin-left: auto; display: flex; gap: 2px; }
.mix-periods .button { min-height: 30px; padding: 2px 10px; font-size: 12px; font-weight: 400; }
.mix-periods .button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.mix-amounts { display: flex; justify-content: space-between; gap: 16px; margin: 24px 0 12px; }
.mix-amounts > :last-child { text-align: right; }
.mix-amounts dt { display: flex; align-items: center; gap: 7px; color: var(--ink-60); font-size: 12px; }
.mix-amounts > :last-child dt { flex-direction: row-reverse; }
.mix-amounts dt span { font: 11px var(--mono); }
.mix-amounts dd { margin: 4px 0 0; font: 500 20px/1.4 var(--sans); font-variant-numeric: tabular-nums; }
.mix-bar { width: 100%; height: 8px; border-radius: 4px; display: block; }
.mix-track { fill: #d8d7d1; }
.mix-value { fill: var(--ink); }
.sub-list { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 14px; }
.sub-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-list strong { font-weight: 500; font-variant-numeric: tabular-nums; }
.sub-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 2px 10px; font-size: 13px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.sub-list small { grid-column: 1 / -1; display: flex; align-items: center; gap: 5px; color: var(--ink-60); font-size: 11px; font-variant-numeric: tabular-nums; }
.sub-list li.idle { color: var(--ink-60); }
.sub-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.subscriptions h3 strong { margin-left: auto; white-space: nowrap; font: 500 19px var(--sans); font-variant-numeric: tabular-nums; }
.subscriptions h3 small { display: inline; font-size: 12px; font-weight: 400; color: var(--ink-60); }
.profile-method { color: var(--ink-60); font-size: 12px; }
.profile-method summary { cursor: pointer; padding: 6px 0; }
.profile-method p { margin: 8px 0; }
.rates-error { display: block; color: var(--error); }
.profile-unavailable p { font-size: 13px; color: var(--ink-60); }
.profile-unavailable > morph-icon { margin-bottom: 16px; }
@media (max-width: 700px) {
  .settlement-amounts { grid-template-columns: 1fr; gap: 14px; }
  .settlement-amounts dd { font-size: 22px; margin-top: 2px; }
}
@media (max-width: 540px) {
  .profile-body { padding: 12px 16px 64px; gap: 16px; }
  .profile-head h2 { font-size: 23px; }
  .profile-heading { gap: 6px; }
  .profile-counts { gap: 6px 12px; font-size: 11px; }
  .profile-counts > :last-child { margin-left: 0; }
  .profile-card { padding: 20px 16px; border-radius: 16px; }
  .profile-total { margin: 6px 0 10px; font-size: clamp(28px, 8vw, 38px); }
  .settlement-layout { grid-template-columns: 124px minmax(0, 1fr); gap: 20px; }
  .settlement-amounts dd { font-size: 20px; }
  .profile-charts { grid-template-columns: minmax(0, 1fr); }
  .chart-wide { grid-column: auto; }
}
@media (max-width: 360px) {
  .profile-head .avatar { width: 32px; height: 32px; }
  .profile-head h2 { font-size: 20px; }
  .settlement-layout { grid-template-columns: 96px minmax(0, 1fr); gap: 12px; }
  .settlement-amounts dd { font-size: 18px; }
}

@media (max-width: 640px) {
  .topbar { padding: 10px 16px; }
  .page { padding: 8px 16px 64px; gap: 40px; }
  th, td { padding: 10px 12px; }
  .peek-body { padding: 12px 20px 40px; }
  .peek-bar { margin: -12px -20px 0; padding: 10px 20px; }
  .props { gap: 4px 12px; }
}
