/* ============================================================
   Hub design system – components
   buttons · inputs · segmented · chips/tags · cards · widgets ·
   list rows · stat tiles · empty · sheets/modals · toasts · login
   ============================================================ */

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text); font-weight: 600; font-size: 14px; border: 0; transition: background var(--dur) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur); white-space: nowrap; }
.btn:hover { background: var(--border-strong); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); color: var(--primary-text); box-shadow: var(--shadow-md); }
.btn.primary:hover { background: var(--primary); filter: brightness(1.15); }
.btn.accent { background: var(--accent); color: var(--accent-text); box-shadow: 0 8px 18px -10px var(--accent); }
.btn.accent:hover { filter: brightness(1.06); background: var(--accent); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn.soft:hover { background: var(--accent-soft-2); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn.icon { width: 38px; padding: 0; } .btn.icon.sm { width: 32px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); }
.iconbtn { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--text-3); flex: none; transition: background var(--dur), color var(--dur); }
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.iconbtn:disabled { opacity: .3; } .iconbtn .i { width: 17px; height: 17px; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label { font-size: 12px; font-weight: 700; color: var(--text-2); letter-spacing: .02em; text-transform: uppercase; }
.input, select.input, textarea.input { width: 100%; height: 42px; padding: 0 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid transparent; outline: none; transition: border-color var(--dur), background var(--dur), box-shadow var(--dur); color: var(--text); appearance: none; -webkit-appearance: none; }
.input::placeholder { color: var(--text-3); }
.input:focus { border-color: var(--accent); background: var(--surface-solid); box-shadow: var(--focus-ring); }
textarea.input { height: auto; min-height: 120px; padding: 11px 14px; resize: vertical; line-height: 1.5; font-family: var(--font); }
textarea.input.short { min-height: 72px; }
select.input { padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }
.input.money { font-variant-numeric: tabular-nums; text-align: right; font-weight: 700; font-size: 17px; }
.input.big { height: 52px; font-size: 17px; font-weight: 600; border-radius: 16px; }
input[type="color"] { width: 38px; height: 38px; padding: 0; border: 0; border-radius: 12px; background: none; cursor: pointer; flex: none; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch, input[type="color"]::-moz-color-swatch { border: 1px solid var(--border-strong); border-radius: 12px; }
input[type="checkbox"].switch { appearance: none; -webkit-appearance: none; width: 42px; height: 26px; border-radius: 13px; background: var(--surface-3); position: relative; cursor: pointer; transition: background var(--dur); flex: none; margin: 0; }
input[type="checkbox"].switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-solid); box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease); }
input[type="checkbox"].switch:checked { background: var(--accent); }
input[type="checkbox"].switch:checked::after { transform: translateX(16px); }
.row { display: flex; gap: 10px; align-items: center; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .row .grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 480px) { .grid3 { grid-template-columns: 1fr 1fr; } }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r-pill); padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { padding: 6px 12px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; color: var(--text-2); transition: background var(--dur), color var(--dur); white-space: nowrap; flex: none; }
.seg button.active { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button.p2.active { color: var(--info); } .seg button.p3.active { color: var(--warn); } .seg button.p4.active { color: var(--danger); }
.seg.block { display: flex; } .seg.block button { flex: 1; }
.seg button.neg.active { color: var(--danger); } .seg button.pos.active { color: var(--ok); }

/* underline tabs */
.tabs-u { display: flex; gap: 18px; padding: 0 2px; margin: 2px 0 14px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs-u button { padding: 8px 2px 10px; font-weight: 700; font-size: 14px; color: var(--text-3); position: relative; white-space: nowrap; }
.tabs-u button.active { color: var(--text); }
.tabs-u button.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2.5px; border-radius: 2px; background: var(--accent); }

/* ---------- Chips / tags / pills ---------- */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 10px; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: var(--r-pill); flex: none; background: var(--surface-2); color: var(--text-2); font-size: 13.5px; font-weight: 600; transition: all var(--dur) var(--ease); }
.chip:hover { background: var(--surface-3); color: var(--text); }
.chip.active { background: var(--primary); color: var(--primary-text); }
.chip.sm { height: 28px; font-size: 12.5px; padding: 0 10px; }
.chip .dot { width: 8px; height: 8px; box-shadow: none; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); line-height: 1.3; white-space: nowrap; letter-spacing: .01em; }
.tag.proj, .tag.cat { background: color-mix(in srgb, var(--p) 16%, transparent); color: color-mix(in srgb, var(--p) 70%, var(--text)); }
.tag.proj { text-transform: uppercase; font-size: 10.5px; letter-spacing: .06em; }
.tag.cat .i { width: 12px; height: 12px; stroke-width: 2.2; }
.tag.ok { background: var(--ok-soft); color: var(--ok); } .tag.warn { background: var(--warn-soft); color: var(--warn); } .tag.danger { background: var(--danger-soft); color: var(--danger); } .tag.accent { background: var(--accent-soft); color: var(--accent-ink); } .tag.info { background: var(--info-soft); color: var(--info); }
.tag .i { width: 12px; height: 12px; stroke-width: 2.2; }
.pill-app { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; padding: 3px 8px; border-radius: 99px; background: color-mix(in srgb, var(--a) 16%, transparent); color: var(--a-ink, var(--a)); }
.pill-app .i { width: 11px; height: 11px; stroke-width: 2.4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag.proj, :root:not([data-theme="light"]) .tag.cat { color: color-mix(in srgb, var(--p) 60%, #fff); } }

/* ---------- Cards & widget shell ---------- */
.card-box { border-radius: var(--r-lg); padding: 18px; margin-bottom: 16px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border), var(--shadow-sm); }
.card-box h2 { font-size: 15px; margin: 0 0 12px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.card-box h2 .spacer { flex: 1; }
.card-box > .hint:first-of-type { margin: -6px 0 10px; }
.widget {
  position: relative; border-radius: var(--r-lg); padding: 16px 18px; min-width: 0; display: flex; flex-direction: column; gap: 10px;
  background: var(--glass-sheen), var(--glass-strong); -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--saturate)); backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  box-shadow: inset 0 0 0 1px var(--glass-edge), inset 0 1.5px 0 var(--glass-hi), inset 0 -1px 0 var(--glass-lo), var(--glass-shadow);
  --a: var(--accent); --a-ink: var(--accent-ink); animation: rise var(--dur-slow) var(--ease) both;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .widget { background: var(--surface-solid); } }
.widget[data-app="tasks"] { --a: var(--app-tasks); --a-ink: var(--app-tasks-ink); }
.widget[data-app="finance"] { --a: var(--app-finance); --a-ink: var(--app-finance-ink); }
.widget[data-app="home"] { --a: var(--app-home); --a-ink: var(--app-home-ink); }
.widget[data-app="inventory"] { --a: var(--app-inventory); --a-ink: var(--app-inventory-ink); }
.widget::before { content: ""; position: absolute; left: 18px; right: 18px; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--a); opacity: .9; }
.widget-h { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.widget-h h3 { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: var(--track-caps); color: var(--text-2); margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.widget-h .more { color: var(--text-3); font-size: 12.5px; font-weight: 700; }
.widget-h .more:hover { color: var(--a-ink); }
.widget.locked { justify-content: center; align-items: center; text-align: center; min-height: 150px; color: var(--text-2); gap: 6px; }
.widget.locked .lock { width: 40px; height: 40px; border-radius: 13px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); margin-bottom: 4px; }
.widget.locked strong { color: var(--text); }

/* stat tiles */
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat .v { font-size: var(--fs-xl); font-weight: 800; letter-spacing: var(--track-tight); line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v.hero { font-size: var(--fs-2xl); }
.stat .l { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.stat .d { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.stat .d.pos, .pos { color: var(--ok); } .stat .d.neg, .neg { color: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat-tile { padding: 14px 16px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border), var(--shadow-sm); }

/* list rows (generic) */
.list { display: flex; flex-direction: column; gap: 8px; }
.list.tight { gap: 2px; }
.lrow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; cursor: pointer; transition: background var(--dur); min-width: 0; }
.lrow:hover { background: var(--surface-2); }
.lrow .tile { width: 36px; height: 36px; }
.lrow .tx { flex: 1; min-width: 0; }
.lrow .t { font-weight: 600; font-size: 14px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow .s { font-size: 12px; color: var(--text-3); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 6px; align-items: center; }
.lrow .money { font-weight: 700; font-size: 14.5px; white-space: nowrap; }
.lrow .money.pos { color: var(--ok); }
.tile { width: 36px; height: 36px; border-radius: 11px; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 14px; letter-spacing: -0.02em; background: var(--tile-bg); color: var(--tile-fg); position: relative; }
.tile .i { width: 18px; height: 18px; stroke-width: 2.2; }
.tile.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 12px; } .tile.sm .i { width: 15px; height: 15px; }
.section { margin: 10px 0 24px; }
.section-h { display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px 4px; }
.section-h h2 { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: var(--track-caps); color: var(--text-2); margin: 0; }
.section-h h2.over { color: var(--danger); }
.section-h .n { font-size: 12px; color: var(--text-3); font-weight: 600; }
.section-h .date, .section-h .right { margin-left: auto; font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.srow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.srow:first-of-type { border-top: 0; }
.srow .name { flex: 1; min-width: 140px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.srow .name small { color: var(--text-3); font-weight: 500; margin-left: 6px; }
.srow .name small.block { display: block; margin: 2px 0 0; white-space: normal; }
.srow .input { height: 36px; }
.srow .input.auto { width: auto; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; width: 100%; }
.progress > i { display: block; height: 100%; border-radius: 3px; background: var(--p, var(--accent)); transition: width var(--dur-slow) var(--ease); }
.progress.over > i { background: var(--danger); }
.progress.warn > i { background: var(--warn); }

/* ---------- Empty state ---------- */
.empty { padding: 28px 16px; text-align: center; color: var(--text-3); font-size: 14px; background: var(--surface-2); border-radius: var(--r); border: 1.5px dashed var(--border-strong); }
.empty.big { padding: 56px 16px; }
.empty .big-ico { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--text-3); stroke-width: 1.4; }
.empty strong { display: block; color: var(--text-2); font-weight: 700; margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }

/* ---------- Sheet / modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(10, 10, 14, .32); display: flex; align-items: flex-end; justify-content: center; animation: fade var(--dur) var(--ease) both; }
.overlay.closing { animation: fadeout 140ms var(--ease) both; } .overlay.closing .modal { animation: sheetout var(--dur) var(--ease) both; }
.modal { width: 100%; max-height: calc(100dvh - 24px); overflow-y: auto; border-radius: var(--r-xl) var(--r-xl) 0 0; animation: sheet 240ms var(--ease-out) both; padding: 8px 18px calc(18px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.modal .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 4px auto 14px; }
@keyframes sheet { from { transform: translateY(40px); opacity: .4 } to { transform: none; opacity: 1 } }
@keyframes sheetout { from { transform: none; opacity: 1 } to { transform: translateY(30px); opacity: 0 } }
@media (min-width: 700px) {
  .overlay { align-items: center; padding: 24px; }
  .modal { max-width: 640px; border-radius: var(--r-xl); padding: 22px 24px; animation: pop 200ms var(--ease-out) both; }
  .modal.wide { max-width: 860px; }
  .modal .grab { display: none; } .overlay.closing .modal { animation: popout 140ms var(--ease) both; }
  @keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }
  @keyframes popout { from { transform: none; opacity: 1 } to { transform: translateY(6px) scale(.985); opacity: 0 } }
  .modal.quick { max-width: 580px; align-self: flex-start; margin-top: 10vh; }
}
.modal-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.modal-h h2 { font-size: 18px; margin: 0; flex: 1; font-weight: 800; }
.modal .title-input { font-size: 19px; font-weight: 700; height: 48px; letter-spacing: -0.01em; }
.modal .form { display: flex; flex-direction: column; gap: 14px; }
.modal .actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal .actions .spacer { flex: 1; }
.meta-line { color: var(--text-3); font-size: 12px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 26px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 300; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 11px 16px 11px 18px; border-radius: var(--r-pill); font-size: 14px; font-weight: 600; animation: rise 220ms var(--ease) both; max-width: 480px; color: var(--text); }
.toast.err { background: var(--danger); color: #fff; }
.toast button { color: inherit; font-weight: 800; padding: 4px 10px; border-radius: var(--r-pill); background: var(--surface-3); }
.toast.err button { background: rgba(255,255,255,.2); }
.toast.out { animation: fadeout 180ms var(--ease) both; }

/* ---------- Login & 2FA ---------- */
.login { flex: 1; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login form, .login .panel { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; padding: 32px 28px; border-radius: var(--r-xl); animation: pop 300ms var(--ease-out) both; }
.login .brand { padding: 0 0 6px; justify-content: center; font-size: 22px; }
.login .brand .logo { width: 42px; height: 42px; border-radius: 13px; } .login .brand .logo .i { width: 22px; height: 22px; }
.login .err { color: var(--danger); font-size: 13.5px; text-align: center; min-height: 18px; font-weight: 600; }
.login .input { height: 48px; text-align: center; font-size: 16px; border-radius: var(--r-pill); } .login .btn { height: 46px; font-size: 15px; }
.login .input.code { font-size: 24px; letter-spacing: .35em; font-weight: 700; font-family: var(--mono); }
.login .alt { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.login .alt button { color: var(--text-2); font-size: 13px; font-weight: 700; } .login .alt button:hover { color: var(--text); }
.login p.lead { margin: 0; text-align: center; color: var(--text-2); font-size: 14px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-family: var(--mono); font-size: 14px; font-weight: 700; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); user-select: all; }
.qr { display: block; width: 200px; height: 200px; margin: 0 auto; border-radius: 14px; background: #fff; padding: 8px; }
.mfa-panel, .mfa-form { display: flex; flex-direction: column; gap: 14px; }
.login .panel .btn .i { margin-right: 6px; }
.login .mfa-form { padding: 0; max-width: none; animation: none; }
.login.embed { min-height: 0; padding: 0; display: block; }
.login.embed .panel { max-width: none; padding: 0; display: flex; flex-direction: column; gap: 14px; animation: none; }
.sec { display: block; scroll-margin-top: 80px; }
.sec .card-box .hint { margin: 0 0 10px; }
.sec .srow .i { flex: none; color: var(--text-3); }
.sec .srow .name small.block { overflow: hidden; text-overflow: ellipsis; }
.sec .srow code, .sec-secret code { font-family: var(--mono); font-size: 12.5px; word-break: break-all; white-space: normal; }
.sec-note { margin: 8px 0 0; }
.sec-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.sec-actions.end { justify-content: flex-end; }
.sec-err { color: var(--danger); font-size: 13.5px; font-weight: 600; min-height: 18px; margin: 0; }
.sec-secret { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.sec-ack { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 14px; font-weight: 600; }
.sec-modal .codes { margin-top: 10px; }
.sec-log.fail .name { color: var(--danger); }
.modal.stepup { max-width: 420px; }
.modal.stepup .login .input { text-align: center; }

/* ---------- Search / filters / settings ---------- */
.searchbar { position: relative; margin-bottom: 12px; }
.searchbar .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.searchbar .input { padding-left: 42px; height: 46px; font-size: 15px; border-radius: var(--r-pill); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters select.input, .filters input.input { height: 34px; width: auto; font-size: 13px; padding-left: 12px; border-radius: var(--r-pill); }
.wp-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.wp-opt { width: 64px; height: 44px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--border-strong); overflow: hidden; position: relative; }
.wp-opt.active { box-shadow: inset 0 0 0 2px var(--accent); }
.wp-opt span { position: absolute; inset: 0; }
.wp-opt[data-wp="aurora"] span { background: linear-gradient(135deg, var(--wp1), var(--wp2) 50%, var(--wp3)); }
.wp-opt[data-wp="dusk"] span { background: linear-gradient(160deg, var(--wp4), var(--wp1) 55%, var(--wp2)); }
.wp-opt[data-wp="mist"] span { background: linear-gradient(180deg, var(--wp3), var(--wp2)); }
.wp-opt[data-wp="none"] span { background: var(--bg); }
.wp-opt[data-wp="custom"] span { background: var(--wallpaper-img, var(--surface-3)) center / cover; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: var(--text-2); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); transition: transform var(--dur-fast); }
.swatch:hover { transform: scale(1.1); } .swatch.active { box-shadow: 0 0 0 2px var(--surface-solid), 0 0 0 4px var(--text); }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.icon-grid button { height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--text-2); background: var(--surface-2); }
.icon-grid button.active { background: var(--accent-soft); color: var(--accent-ink); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 800; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table td.money, .table th.money { text-align: right; }
.table tr.dup td { opacity: .5; } .table tr.bad td { color: var(--danger); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -18px; padding: 0 18px; }
.ua { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; display: block; }

/* ---------- Finance-template components (Phase 01) ---------- */
.tile-card { position: relative; padding: var(--sp-5); border-radius: var(--r-lg); background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 82%, transparent)); box-shadow: inset 0 0 0 1px var(--border), var(--shadow-sm); min-width: 0; }
.tile-card.textured { background-image: var(--dot-texture), linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 82%, transparent)); background-size: var(--dot-size) var(--dot-size), auto; }
.tile-card.dashed { background: transparent; box-shadow: none; border: 1.5px dashed var(--border-strong); display: grid; place-items: center; color: var(--text-3); font-weight: 700; cursor: pointer; transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.tile-card.dashed:hover { color: var(--accent-ink); border-color: var(--accent); }
.badge-delta { display: inline-flex; align-items: center; gap: 3px; font-size: var(--fs-xs); font-weight: 800; padding: 2px 8px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-2); font-variant-numeric: tabular-nums; }
.badge-delta.pos { background: var(--ok-soft); color: var(--ok); } .badge-delta.neg { background: var(--danger-soft); color: var(--danger); }
.pills { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 32px; padding: 0 var(--sp-3); border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 700; color: var(--text-2); background: var(--surface-2); transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.pill:hover { background: var(--surface-3); color: var(--text); }
.pill.active { background: var(--accent); color: var(--accent-text); }
.capsules { display: flex; align-items: flex-end; gap: var(--sp-2); height: 120px; }
.capsule { flex: 1; height: 100%; display: flex; align-items: flex-end; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; min-width: 8px; }
.capsule > i { display: block; width: 100%; height: var(--h, 0%); border-radius: var(--r-pill); background: var(--text-3); opacity: .55; }
.capsule.today > i { background: var(--accent); opacity: 1; }
.cmdhint { position: relative; display: flex; align-items: center; }
.cmdhint .input { width: 100%; padding-right: 56px; }
.cmdhint::after { content: "\2318K"; position: absolute; right: 12px; font-size: var(--fs-xs); font-weight: 700; color: var(--text-3); padding: 2px 6px; border-radius: var(--r-xs); background: var(--surface-2); pointer-events: none; }
.hero-stat { font-size: var(--fs-stat); font-weight: 800; letter-spacing: var(--track-tight); line-height: 1.05; font-variant-numeric: tabular-nums; }

/* forced dark (Styleguide) – mirror of the prefers-color-scheme rule above */
:root[data-theme="dark"] .tag.proj, :root[data-theme="dark"] .tag.cat { color: color-mix(in srgb, var(--p) 60%, #fff); }
:root[data-theme="light"] .tag.proj, :root[data-theme="light"] .tag.cat { color: color-mix(in srgb, var(--p) 70%, var(--text)); }

/* inline field (label above a short input inside a wrapping row) */
.field.inline { flex: 1 1 120px; }
.srow .row.wrap { flex: 1 1 260px; }

/* ---------- Styleguide page (#/styleguide), prefix .sg- ---------- */
.sg-page { max-width: 1100px; margin: 0 auto; }
.sg-bar-top { display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: flex-end; margin-bottom: var(--sp-4); }
.sg-bar-top .hint { flex: 1 1 100%; margin: 0; }
.sg-box > .sg-code { display: block; margin-top: var(--sp-4); }
.sg-code { font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-3); overflow-wrap: anywhere; }
.sg-label { font-size: var(--fs-xs); font-weight: 800; text-transform: uppercase; letter-spacing: var(--track-caps); color: var(--text-3); margin: var(--sp-4) 0 var(--sp-2); }
.sg-demo { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-top: var(--sp-3); }
.sg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-3); }
.sg-charts { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.sg-chart { min-width: 0; padding: var(--sp-3); border-radius: var(--r); background: var(--surface-2); }
.sg-chart .sg-label { margin-top: 0; }
.sg-chart + .sg-chart, .sg-grid + .sg-chart { margin-top: var(--sp-3); }
.sg-inner { margin: 0; }
.sg-gap { height: var(--sp-3); }
.sg-widgets { margin-top: var(--sp-4); }
.sg-swatches, .sg-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.sg-sw { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 92px; }
.sg-sw small, .sg-sp small, .sg-t small { font-family: var(--mono); font-size: 10px; color: var(--text-3); }
.sg-chip { width: 56px; height: 36px; border-radius: var(--r-sm); background: var(--c); box-shadow: inset 0 0 0 1px var(--border-strong); }
.sg-spacing { display: flex; flex-direction: column; gap: var(--sp-2); }
.sg-sp { display: flex; align-items: center; gap: var(--sp-3); }
.sg-sp small { width: 64px; }
.sg-bar { display: block; height: 12px; width: var(--w); border-radius: 3px; background: var(--accent); }
.sg-rad { display: block; width: 56px; height: 40px; border-radius: var(--r); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border-strong); }
.sg-type { display: flex; flex-direction: column; gap: var(--sp-2); }
.sg-t { font-size: var(--s); font-weight: 700; line-height: 1.15; display: flex; align-items: baseline; gap: var(--sp-3); letter-spacing: var(--track-tight); }
.sg-shadow { display: block; width: 72px; height: 48px; border-radius: var(--r); background: var(--surface-solid); box-shadow: var(--s); }
.sg-backdrop { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-4); padding: var(--sp-6) var(--sp-4); border-radius: var(--r-lg); background: linear-gradient(135deg, var(--wp1), var(--wp2) 50%, var(--wp3) 75%, var(--wp4)); }
.sg-pane { position: relative; height: 84px; display: grid; place-items: center; border-radius: var(--r-lg); font-family: var(--mono); font-size: var(--fs-sm); font-weight: 700; }
.sg-narrow { max-width: 360px; }
.sg-bottomnav { position: relative; max-width: 420px; padding: var(--sp-5) var(--sp-4); border-radius: var(--r-lg); background: linear-gradient(135deg, var(--wp1), var(--wp3)); }
.sg-bottomnav .bottomnav { display: flex; position: relative; left: auto; right: auto; bottom: auto; height: 64px; }
/* examples that only show a look: no clicks */
.sg-inert { pointer-events: none; }
.sg-inert .tabs-u { margin-bottom: 0; }
.sg-ring { width: 72px; height: 72px; } .sg-ring .ring { width: 100%; height: 100%; display: block; }
.sg-spark { width: 160px; height: 40px; } .sg-spark .spark { width: 100%; height: 100%; display: block; }
