/* Dashboard styles. Colours, radii and sizes come from /assets/tokens.css. */
html, body { min-height: 100%; }
body { overflow-x: hidden; }
.boot { padding: 3rem 1.2rem; text-align: center; color: var(--ink-3); font-weight: 700; }
button { font-family: inherit; }
.icon { flex: none; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #8f1d17; border-color: #8f1d17; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1240px; margin: 0 auto; padding: 0 0.9rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-height: 56px; }
.topbar .wordmark { min-height: var(--tap); }
.nav { display: flex; gap: 0.1rem; }
.nav a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 0.7rem; border-radius: var(--radius-s); font-weight: 650; font-size: var(--fs-s); text-decoration: none; color: var(--ink-2); position: relative; }
.nav a:hover { color: var(--ink); background: var(--paper-2); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: 0.7rem; right: 0.7rem; bottom: 9px; height: 5px; background: var(--mark); border-radius: 2px; z-index: -1; }

.main { max-width: 1240px; margin: 0 auto; padding: 1.4rem 1rem 5rem; }
.narrow { max-width: 720px; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem; margin-bottom: 1.3rem; }
.page-head h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.row-between { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; justify-content: space-between; }
.section-title { font-size: var(--fs-l); margin: 0 0 0.8rem; }
.lead { color: var(--ink-2); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); border: 0; background: transparent; color: var(--ink-2); border-radius: var(--radius-s); cursor: pointer; }
.icon-btn:hover:not([disabled]) { background: var(--paper-2); color: var(--ink); }
.icon-btn[disabled] { opacity: 0.3; cursor: not-allowed; }
.loading { display: flex; align-items: center; gap: 0.7rem; color: var(--ink-3); padding: 2rem 0.2rem; }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--line-2); border-top-color: var(--ink); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.errbox { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); border-radius: var(--radius); padding: 1rem 1.1rem; }
.errbox p { margin: 0 0 0.6rem; } .errbox p:last-child { margin: 0; }
.notice { background: var(--mark-soft); border: 1px solid color-mix(in srgb, var(--mark) 70%, #8a7a1a); border-radius: var(--radius); padding: 0.85rem 1rem; font-size: var(--fs-s); }
.notice p { margin: 0; }
.field-grid { display: grid; gap: 0 1rem; }
.field input[type="color"] { padding: 0.25em; }
.field .input[disabled], .field .textarea[disabled] { background: var(--paper-2); color: var(--ink-3); }

/* Toasts */
.toasts { position: fixed; z-index: 100; left: 0; right: 0; bottom: calc(1rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 0.5rem; pointer-events: none; padding: 0 1rem; }
.toast { display: inline-flex; align-items: center; gap: 0.55rem; background: var(--ink); color: var(--paper); padding: 0.75rem 1.1rem; border-radius: 999px; font-size: var(--fs-s); font-weight: 600; box-shadow: var(--shadow); max-width: 100%; animation: pop 0.18s ease; }
.toast-ok svg { color: var(--mark); }
.toast-error { background: var(--danger); color: #fff; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

/* Switch */
.switch-row { display: flex; align-items: flex-start; gap: 0.8rem; min-height: var(--tap); padding: 0.5rem 0; margin-bottom: 0.4rem; }
.switch-row label { padding-top: 0.55rem; font-weight: 600; font-size: var(--fs-s); cursor: pointer; flex: 1; }
.switch-row label small { display: block; font-weight: 400; margin-top: 0.15rem; }
.switch { position: relative; flex: none; width: 52px; height: 32px; margin-top: 0.4rem; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--paper-2); cursor: pointer; transition: background 0.15s; padding: 0; }
.switch-knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 1.5px solid var(--ink-3); transition: transform 0.15s; }
.switch[aria-checked="true"] { background: var(--ink); border-color: var(--ink); }
.switch[aria-checked="true"] .switch-knob { transform: translateX(20px); background: var(--mark); border-color: var(--mark); }
.switch[disabled] { cursor: not-allowed; }
.switch-row.is-disabled { opacity: 0.55; }

/* Login and welcome */
.auth { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; max-width: 480px; margin: 0 auto; padding: 1.5rem 1.1rem 3rem; gap: 1.4rem; }
.auth .wordmark { font-size: 1.4rem; }
.auth h1 { font-size: clamp(1.7rem, 6vw, 2.2rem); margin-bottom: 0.6rem; }
.auth .tagline { color: var(--ink-2); margin: 0; }
.invite-toggle { background: none; border: 0; padding: 0.6rem 0; min-height: var(--tap); color: var(--ink-2); font-weight: 650; font-size: var(--fs-s); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; display: inline-flex; align-items: center; gap: 0.3rem; }
.divider { display: flex; align-items: center; gap: 0.8rem; color: var(--ink-3); font-size: var(--fs-xs); margin: 1rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.address-preview { font-family: var(--mono); font-size: var(--fs-s); background: var(--paper-2); padding: 0.7rem 0.85rem; border-radius: var(--radius-s); overflow-wrap: anywhere; }
.address-preview b { background: var(--mark); color: #15171a; padding: 0 0.15em; border-radius: 3px; font-weight: 600; }
.check-ok { color: var(--ok); } 
.sent { text-align: center; padding: 0.5rem 0; }
.sent .big { width: 56px; height: 56px; border-radius: 50%; background: var(--mark); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 0.8rem; color: #15171a; }
.dev-box { border: 1.5px dashed var(--ink-3); border-radius: var(--radius); padding: 0.9rem; margin-top: 1rem; }
.dev-box p { font-size: var(--fs-xs); color: var(--ink-3); margin: 0 0 0.6rem; }

/* Pages list */
.page-list { display: grid; gap: 0.8rem; list-style: none; margin: 0; padding: 0; }
.page-row { display: block; text-decoration: none; padding: 1rem 1.1rem; transition: border-color 0.15s, transform 0.1s; }
.page-row:hover { border-color: var(--ink-3); }
.page-row h3 { font-size: 1.15rem; margin: 0.4rem 0 0.2rem; overflow-wrap: anywhere; }
.page-row .meta { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; color: var(--ink-3); font-size: var(--fs-xs); }
.page-row .top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.empty { text-align: center; padding: 2.2rem 1.2rem; }
.empty .ico { width: 56px; height: 56px; margin: 0 auto 0.8rem; border-radius: 16px; background: var(--paper-2); display: flex; align-items: center; justify-content: center; }
.empty p { max-width: 34em; margin-left: auto; margin-right: auto; color: var(--ink-2); }
@media (min-width: 700px) { .page-list { grid-template-columns: 1fr 1fr; } }

/* Editor */
.editor-head { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 1rem; }
.crumb { display: inline-flex; align-items: center; gap: 0.3rem; font-size: var(--fs-s); color: var(--ink-3); text-decoration: none; min-height: 36px; }
.crumb:hover { color: var(--ink); }
.editor-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.8rem; }
.editor-title h1 { font-size: clamp(1.5rem, 5vw, 2rem); flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tabs { display: flex; gap: 0.2rem; border-bottom: 1.5px solid var(--line); margin: 0 -1rem 1.3rem; padding: 0 1rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 0.45rem; min-height: var(--tap); padding: 0 0.85rem; text-decoration: none; font-weight: 650; font-size: var(--fs-s); color: var(--ink-3); border-bottom: 3px solid transparent; margin-bottom: -1.5px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.save-ind { display: inline-flex; align-items: center; gap: 0.35rem; font-size: var(--fs-xs); color: var(--ink-3); min-height: 24px; }
.save-ind.is-ok { color: var(--ok); } .save-ind.is-err { color: var(--danger); }
.split { display: block; }
.split-side { display: none; }
@media (min-width: 1000px) {
  .split { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 2rem; align-items: start; }
  .split-side { display: block; position: sticky; top: 140px; }
  .preview-btn { display: none !important; }
}
.phone { width: 100%; max-width: 380px; margin: 0 auto; border: 10px solid var(--ink); border-radius: 44px; background: #fff; overflow: hidden; height: min(760px, calc(100svh - 180px)); box-shadow: var(--shadow); position: relative; }
.phone::before { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 90px; height: 18px; background: var(--ink); border-radius: 0 0 12px 12px; z-index: 2; }
.phone iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.phone-note { text-align: center; margin-top: 0.7rem; }

/* Cards in the content tab */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.ecard { padding: 0; overflow: hidden; }
.ecard-head { display: flex; align-items: center; gap: 0.2rem; padding: 0.15rem 0.3rem 0.15rem 0.5rem; }
.ecard-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.7rem; background: none; border: 0; text-align: left; min-height: var(--tap); cursor: pointer; padding: 0.3rem 0.4rem; color: var(--ink); border-radius: var(--radius-s); }
.type-chip { flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--paper-2); display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); }
.type-chip.t-heading { background: var(--ink); color: var(--paper); }
.ecard-title { flex: 1; min-width: 0; }
.ecard-title b { display: block; font-size: var(--fs-s); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ecard-title small { color: var(--ink-3); font-size: var(--fs-xs); }
.ecard-body { padding: 0.4rem 1.1rem 1.1rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.ecard-tools { display: flex; gap: 0; flex: none; }
.ecard-tools .icon-btn { width: 44px; height: 44px; }
.ecard.is-heading { background: var(--paper-2); box-shadow: none; }
.add-wrap { margin-top: 1.1rem; }
.type-list { display: grid; gap: 0.5rem; }
.type-opt { display: flex; align-items: center; gap: 0.9rem; text-align: left; width: 100%; min-height: 64px; padding: 0.7rem 0.9rem; border: 1.5px solid var(--line-2); background: var(--card); border-radius: var(--radius); cursor: pointer; color: var(--ink); }
.type-opt:hover { border-color: var(--ink); }
.type-opt b { display: block; font-size: var(--fs-s); }
.type-opt small { display: block; color: var(--ink-3); font-size: var(--fs-xs); line-height: 1.35; }

/* Results */
.totals { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
@media (min-width: 560px) { .totals { grid-template-columns: repeat(5, 1fr); } }
.stat { padding: 0.9rem 1rem; }
.stat b { display: block; font-size: 1.9rem; letter-spacing: -0.03em; font-weight: 800; line-height: 1.1; }
.stat span { font-size: var(--fs-xs); color: var(--ink-2); font-weight: 650; }
.chart { width: 100%; height: auto; display: block; }
.chart .ax { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.legend { display: flex; gap: 1rem; font-size: var(--fs-xs); color: var(--ink-2); margin-top: 0.5rem; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 0.35rem; }
.tbl-wrap { overflow-x: auto; margin: 0 -0.2rem; }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-s); }
.tbl th { text-align: left; font-size: var(--fs-xs); color: var(--ink-3); font-weight: 700; padding: 0.5rem 0.6rem; border-bottom: 1.5px solid var(--line-2); white-space: nowrap; }
.tbl td { padding: 0.65rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl th.num { text-align: right; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 0.8rem; align-items: flex-start; justify-content: space-between; padding: 0.8rem 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.stars { display: inline-flex; gap: 1px; color: #15171a; vertical-align: middle; }
.stars svg { fill: var(--mark); stroke: #15171a; }
.stars .off svg { fill: none; stroke: var(--line-2); }
.big-avg { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.03em; }

/* Settings */
.premium-block { border-style: dashed; border-color: var(--line-2); box-shadow: none; background: var(--paper-2); }
.lock-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.7rem 0; border-top: 1px solid var(--line); font-size: var(--fs-s); font-weight: 600; }
.checks { display: grid; gap: 0.4rem; margin-bottom: 0.6rem; }
.check { display: flex; align-items: center; gap: 0.75rem; min-height: var(--tap); padding: 0 0.85rem; border: 1.5px solid var(--line-2); border-radius: var(--radius-s); background: var(--card); font-weight: 600; font-size: var(--fs-s); cursor: pointer; }
.check:has(input:checked) { border-color: var(--ink); background: var(--mark-soft); }
.check input { width: 20px; height: 20px; accent-color: #15171a; flex: none; }
@media (min-width: 560px) { .checks { grid-template-columns: 1fr 1fr; } }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }

/* Admin */
.badge-sm { font-size: 0.75rem; }
.invite-link { font-family: var(--mono); font-size: var(--fs-xs); overflow-wrap: anywhere; color: var(--ink-2); margin: 0.2rem 0 0.5rem; }
.hr { height: 1px; background: var(--line); border: 0; margin: 1.3rem 0; }
.rot{transform:rotate(-90deg)}
.chart { max-width: 760px; }

/* ===================================================================
   Version 1.1 polish: native feel on phones. Motion uses transform and opacity;
   prefers-reduced-motion is switched off globally by tokens.css.
   =================================================================== */
:root { --ease: cubic-bezier(0.2, 0.8, 0.2, 1); --topbar-h: 57px; --tabbar-h: 0px; --safe-b: env(safe-area-inset-bottom, 0px); }
html { -webkit-tap-highlight-color: transparent; }
a, button, [role="button"], [role="switch"], label, select, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button, .btn, .tab, .tb, .nav a, .icon-btn, .type-opt, .switch, .page-row, .fab, .check, .ecard-toggle, .crumb, .wordmark {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
input, textarea, select { -webkit-tap-highlight-color: transparent; }

/* Pressed states */
.btn, .icon-btn, .tab, .type-opt, .page-row, .ecard-toggle, .check, .tb, .nav a, .invite-toggle, .crumb, .switch, .fab {
  transition: transform 0.14s var(--ease), background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn:active, .icon-btn:active, .type-opt:active, .page-row:active, .check:active, .tb:active, .ecard-toggle:active, .tab:active, .switch:active, .nav a:active, .invite-toggle:active { transform: scale(0.97); }
.btn:active { background: #373b42; border-color: #373b42; }
.btn-ghost:active { background: var(--line); border-color: var(--ink-3); }
.btn-mark:active { background: #f5d210; border-color: #15171a; }
.btn-danger:active { background: var(--danger-soft); }
.btn-danger-solid:active { background: #8f1d17; border-color: #8f1d17; }
.icon-btn:active { background: var(--line); }
.type-opt:active, .page-row:active { background: var(--paper-2); }
.ecard-toggle:active { background: var(--paper-2); }

/* Top bar and phone tab bar */
.topbar { view-transition-name: topbar; }
.tabbar { display: none; view-transition-name: tabbar; }
@media (max-width: 759.98px) {
  :root { --tabbar-h: 60px; --topbar-h: 53px; }
  .topbar-in { min-height: 52px; padding: 0 1rem; }
  .nav { display: none; }
  .tabbar { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: color-mix(in srgb, var(--paper) 94%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
  .tabbar-in { display: flex; height: var(--tabbar-h); max-width: 520px; margin: 0 auto; }
  .tb { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--ink-3); font-size: 11px; font-weight: 650; min-height: 48px; }
  .tb-ico { display: flex; align-items: center; justify-content: center; width: 58px; height: 30px; border-radius: 999px; transition: background-color 0.22s ease; }
  .tb[aria-current="page"] { color: var(--ink); }
  .tb[aria-current="page"] .tb-ico { background: var(--mark); }
  .main { padding: 1rem 1rem calc(var(--tabbar-h) + var(--safe-b) + 32px); }
  body.kb-open .tabbar, body.kb-open .fab-wrap { display: none; }
}

/* Route and tab transitions */
.view, .tab-view { animation: view-in 0.26s var(--ease); }
html.has-vt .view, html.has-vt .tab-view { animation: none; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
::view-transition-old(root) { animation: vt-out 0.14s ease both; }
::view-transition-new(root) { animation: vt-in 0.24s var(--ease) both; }
::view-transition-group(topbar), ::view-transition-group(tabbar) { animation: none; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
.page-list > li { animation: view-in 0.32s var(--ease) both; }
.page-list > li:nth-child(2) { animation-delay: 40ms; } .page-list > li:nth-child(3) { animation-delay: 80ms; }
.page-list > li:nth-child(4) { animation-delay: 120ms; } .page-list > li:nth-child(n+5) { animation-delay: 150ms; }

/* Sheets (phones) and dialogs (640 px and up) */
body.modal-open { overflow: hidden; }
.overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; --backdrop: 1; }
.overlay::before { content: ""; position: absolute; inset: 0; background: rgba(21, 23, 26, 0.5); opacity: var(--backdrop); animation: fade-in 0.2s ease; }
.overlay.is-closing::before { animation: fade-out 0.19s ease forwards; }
.dialog { position: relative; display: flex; flex-direction: column; width: 100%; max-height: 92svh; background: var(--paper); border-radius: 22px 22px 0 0; box-shadow: var(--shadow); animation: sheet-in 0.3s var(--ease); outline: none; padding: 0; will-change: transform; }
.is-closing .dialog { animation: sheet-out 0.19s ease-in forwards; }
.sheet-top { touch-action: none; padding: 0.55rem 1.2rem 0; cursor: grab; flex: none; }
.grab { display: block; width: 42px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto 0.35rem; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.4rem; }
.dialog-head h2 { font-size: var(--fs-l); }
.dialog-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 1.2rem calc(1.2rem + var(--safe-b)); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: flex-end; margin-top: 0.6rem; }
.dialog-actions .btn { flex: 1 1 8rem; }
.dialog-full { height: 94svh; max-height: 94svh; }
.dialog-full .dialog-body { padding: 0; overflow: hidden; }
.dialog-full iframe { width: 100%; height: 100%; border: 0; background: #fff; display: block; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes dlg-in { from { opacity: 0; transform: scale(0.96) translateY(6px); } }
@keyframes dlg-out { to { opacity: 0; transform: scale(0.97); } }
@media (min-width: 640px) {
  .overlay { align-items: center; padding: 1.5rem; }
  .dialog { max-width: 520px; border-radius: 22px; animation: dlg-in 0.2s var(--ease); }
  .is-closing .dialog { animation: dlg-out 0.17s ease-in forwards; }
  .dialog-wide { max-width: 640px; }
  .dialog-full { max-width: 440px; height: 88svh; }
  .grab { display: none; }
  .sheet-top { padding-top: 1.1rem; cursor: default; touch-action: auto; }
}

/* Toasts above the tab bar */
.toasts { bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); }
.toast { animation: toast-in 0.26s var(--ease), toast-out 0.22s ease-in var(--life, 2.3s) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* Editor header */
.editor-head { gap: 0.4rem; margin-bottom: 0.4rem; }
.editor-title { display: flex; flex-wrap: nowrap; align-items: center; gap: 0.5rem; min-height: var(--tap); }
.editor-title h1 { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: clamp(1.3rem, 5vw, 2rem); }
.editor-title .badge { flex: none; }
.back-btn { margin-left: -0.75rem; flex: none; text-decoration: none; }
.crumb-desk { display: none; }
.save-ind { flex: none; display: inline-flex; align-items: center; justify-content: flex-end; gap: 0.35rem; min-width: 1.3rem; font-size: var(--fs-xs); color: var(--ink-3); transition: color 0.3s ease; }
.save-ind.is-ok { color: var(--ok); } .save-ind.is-err { color: var(--danger); }
.save-ind.is-busy svg { animation: pulse 0.9s ease-in-out infinite; }
.save-txt { display: none; }
@keyframes pulse { 50% { opacity: 0.25; } }
.editor-actions { display: flex; flex-wrap: nowrap; gap: 0.4rem; }
.btn-c { flex: 1 1 auto; min-width: 0; padding: 0 0.75em; font-size: 0.875rem; gap: 0.4em; white-space: nowrap; }
.btn-c:first-child { flex: 1.4 1 auto; }
@media (min-width: 760px) {
  .crumb-desk { display: inline-flex; }
  .back-btn { display: none; }
  .save-txt { display: inline; }
  .save-ind { min-width: 8.5rem; }
  .btn-c { flex: 0 0 auto; font-size: var(--fs-s); padding: 0 1.15em; }
  .btn-c:first-child { flex: 0 0 auto; }
  .editor-head { margin-bottom: 0.6rem; }
}

/* Segmented tab row */
.tabs-wrap { position: sticky; top: var(--topbar-h); z-index: 15; margin: 0 -1rem 1rem; padding: 0.45rem 1rem; background: var(--paper); }
.tabs { position: relative; display: flex; gap: 0; margin: 0; padding: 4px; border: 0; background: var(--paper-2); border-radius: 14px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
.tab { position: relative; z-index: 1; flex: none; scroll-snap-align: center; min-height: 46px; padding: 0 0.95rem; margin: 0; border: 0; border-radius: 10px; color: var(--ink-3); }
.tab[aria-current="page"] { color: var(--ink); border: 0; }
.tab-pill { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; background: var(--card); border-radius: 10px; box-shadow: 0 1px 3px rgba(21, 23, 26, 0.14); transition: transform 0.28s var(--ease), width 0.28s var(--ease); }
@media (min-width: 760px) { .tabs { display: inline-flex; max-width: 100%; } .tabs-wrap { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; } }
@media (max-width: 380px) { .tab svg { display: none; } .tab { padding: 0 0.8rem; } }

/* Cards: expand, new, delete, reorder */
.cards { display: block; }
.cards > li { margin-bottom: 0.7rem; position: relative; }
.ecard-wrap { display: grid; grid-template-rows: 1fr; animation: expand 0.26s var(--ease); }
.ecard-wrap.is-leaving { animation: collapse 0.2s ease-in forwards; }
.ecard-clip { min-height: 0; overflow: hidden; }
.ecard-body { border-top: 1px solid var(--line); }
@keyframes expand { from { grid-template-rows: 0fr; opacity: 0; } }
@keyframes collapse { to { grid-template-rows: 0fr; opacity: 0; } }
.chev { transition: transform 0.22s var(--ease); }
.chev.is-open { transform: rotate(180deg); }
.ecard.is-new { animation: card-in 0.34s var(--ease); }
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(0.98); } }
.ecard.is-gone { height: 0 !important; opacity: 0; margin-bottom: 0 !important; border-width: 0; transition: height 0.26s var(--ease), opacity 0.2s ease, margin 0.26s var(--ease), border-width 0.26s; }
.switch-knob { transition: transform 0.2s var(--ease), background-color 0.2s; }

/* Floating add button (phones) */
.fab-wrap { display: none; }
@media (max-width: 759.98px) {
  .fab-wrap { display: block; position: fixed; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); z-index: 25; pointer-events: none; padding-right: calc(16px + env(safe-area-inset-right, 0px)); }
  .fab { pointer-events: auto; display: inline-flex; align-items: center; gap: 0.5rem; min-height: 52px; padding: 0 1.25rem 0 1rem; border: 1.5px solid #15171a; border-radius: 999px; background: var(--mark); color: #15171a; font: 700 0.95rem/1 var(--font); cursor: pointer; box-shadow: 0 6px 20px rgba(21, 23, 26, 0.24); }
  .fab:active { transform: scale(0.95); background: #f5d210; }
  .add-wrap { margin-bottom: 4.5rem; }
}

/* Skeletons */
.skel { display: block; position: relative; overflow: hidden; background: var(--paper-2); }
.skel::after, .skel-box::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent); transform: translateX(-100%); animation: shimmer 1.3s ease-in-out infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-card { box-shadow: none; }
.skel-box { position: relative; overflow: hidden; }
.skel-box::before { content: ""; display: block; width: 100%; max-width: 300px; aspect-ratio: 760 / 920; background: rgba(255, 255, 255, 0.8); border-radius: 16px; }

/* Results on phones */
.totals { grid-template-columns: repeat(2, 1fr); }
.totals .stat:first-child { grid-column: 1 / -1; }
@media (min-width: 560px) { .totals { grid-template-columns: repeat(5, 1fr); } .totals .stat:first-child { grid-column: auto; } }
@media (max-width: 559.98px) {
  .tbl-wrap { overflow: visible; margin: 0; }
  .tbl-stack thead { display: none; }
  .tbl-stack, .tbl-stack tbody, .tbl-stack tr, .tbl-stack td { display: block; }
  .tbl-stack tr { border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); padding: 0.65rem 0.9rem; margin-bottom: 0.6rem; }
  .tbl-stack td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border: 0; padding: 0.2rem 0; text-align: right; }
  .tbl-stack td::before { content: attr(data-label); color: var(--ink-3); font-size: var(--fs-xs); font-weight: 650; text-align: left; }
  .tbl-stack td.cell-main { display: block; text-align: left; font-weight: 650; padding-bottom: 0.35rem; }
  .tbl-stack td.cell-main::before { content: none; }
  .tbl-stack td:not([data-label]):not(.cell-main) { display: none; }
}

/* Auth screens respect the safe area */
.auth { padding-bottom: calc(3rem + var(--safe-b)); }
@media (min-width: 760px) { .editor-title h1 { flex: 0 1 auto; } .save-ind { margin-left: auto; } }

/* ===================================================================
   Version 1.1: new card types, import, own anchor, results, badge style
   =================================================================== */
.rows { margin: 0.2rem 0 0.9rem; }
.row-list { list-style: none; margin: 0 -4px; padding: 0; }
.row-item { display: grid; grid-template-rows: 1fr; }
.row-item.is-fresh { animation: expand 0.26s var(--ease); }
.row-item.is-leaving { animation: collapse 0.2s ease-in forwards; }
.row-clip { min-height: 0; overflow: hidden; }
.row-inner { padding: 4px 4px 6px; }
.row-line { display: flex; align-items: center; gap: 0.15rem; }
.row-line .input { flex: 1; min-width: 0; }
.row-tools { display: inline-flex; flex: none; }
.row-tools .icon-btn { width: 42px; height: 48px; }
.rows-compact .row-tools .icon-btn { width: 40px; }
.row-box { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 0.4rem 0.9rem 0.2rem; background: var(--paper); }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.2rem; min-height: 48px; }
.row-head b { font-size: var(--fs-s); }
.row-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin-top: 0.3rem; }
.ready-note { display: flex; gap: 0.6rem; align-items: flex-start; background: var(--mark-soft); border: 1px solid color-mix(in srgb, var(--mark) 60%, #8a7a1a); border-radius: var(--radius-s); padding: 0.65rem 0.8rem; font-size: var(--fs-s); margin: 0.2rem 0 0.9rem; }
.ready-note svg { margin-top: 2px; }
.ready-note span { flex: 1; }
.live-link { margin: 0.4rem 0 0.4rem; }
.adv { margin-top: 0.9rem; border-top: 1px solid var(--line); padding-top: 0.2rem; }
.adv-toggle { display: inline-flex; align-items: center; gap: 0.4rem; min-height: var(--tap); background: none; border: 0; padding: 0; color: var(--ink-2); font-weight: 650; font-size: var(--fs-s); cursor: pointer; }
.adv-body { animation: view-in 0.22s var(--ease); }
.alias-prev { font-family: var(--mono); font-size: var(--fs-xs); background: var(--paper-2); padding: 0.2em 0.45em; border-radius: 6px; overflow-wrap: anywhere; }
.alias-prev b { background: var(--mark); color: #15171a; font-weight: 600; }
.imp-text { min-height: 13rem; font-family: var(--mono); font-size: 0.9375rem; line-height: 1.45; }
.imp-count { font-weight: 700; margin: 0.2rem 0 0.4rem; color: var(--ink-3); }
.imp-count.has { color: var(--ink); }

/* Result bars */
.res-block { padding: 1.1rem 1.1rem 1.2rem; }
.res-title { font-size: 1.1rem; overflow-wrap: anywhere; }
.bars { list-style: none; margin: 0.9rem 0 0; padding: 0; display: grid; gap: 0.75rem; }
.bar-top { display: flex; justify-content: space-between; gap: 1rem; font-size: var(--fs-s); margin-bottom: 0.3rem; }
.bar-label { font-weight: 600; overflow-wrap: anywhere; }
.bar-num { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 700; }
.bar-num small { color: var(--ink-3); font-weight: 600; margin-left: 0.25rem; }
.bar-track { height: 14px; background: var(--paper-2); border-radius: 7px; overflow: hidden; }
.bar-fill { display: block; height: 100%; width: 0; background: var(--ink); border-radius: 7px; transition: width 0.5s var(--ease); }
.sv-q { border-top: 1px solid var(--line); padding-top: 0.9rem; margin-top: 0.9rem; }
.sv-q:first-of-type { border-top: 0; margin-top: 0.5rem; }
.sv-label { font-weight: 700; margin: 0; }
.scale { display: flex; align-items: flex-end; gap: 1.3rem; margin-top: 0.6rem; }
.scale-avg b { display: block; font-size: 2.1rem; letter-spacing: -0.03em; line-height: 1; }
.scale-avg span { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 650; }
.scale-bars { display: flex; align-items: flex-end; gap: 0.5rem; flex: 1; }
.scale-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0.25rem; }
.scale-fill { width: 100%; background: var(--mark); border: 1.5px solid var(--ink); border-radius: 5px; display: block; }
.scale-n { font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums; }
.scale-k { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 650; }
.texts { list-style: none; margin: 0; padding: 0; max-height: 14rem; overflow: auto; display: grid; gap: 0.4rem; }
.texts li { background: var(--paper-2); border-radius: var(--radius-s); padding: 0.55rem 0.75rem; font-size: var(--fs-s); overflow-wrap: anywhere; }
/* Add-card sheet: categories with compact two-column tiles */
.cat + .cat { margin-top: 0.9rem; }
.cat-head { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 0.45rem; position: sticky; top: -1px; background: var(--paper); padding: 0.3rem 0; z-index: 1; }
.type-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.type-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; text-align: left; min-height: 100px; padding: 0.6rem 0.7rem; border: 1.5px solid var(--line-2); background: var(--card); border-radius: var(--radius); cursor: pointer; color: var(--ink); font: inherit; transition: transform 0.14s var(--ease), border-color 0.15s, background-color 0.15s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; }
.type-tile:hover { border-color: var(--ink); }
.type-tile:active { transform: scale(0.97); background: var(--paper-2); }
.type-tile .type-chip { width: 30px; height: 30px; margin-bottom: 0.25rem; }
.type-tile b { font-size: var(--fs-s); line-height: 1.2; }
.type-tile small { color: var(--ink-3); font-size: 0.78rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.apps-line { display: flex; gap: 0.5rem; align-items: flex-start; font-size: var(--fs-s); color: var(--ink-2); margin: -0.2rem 0 0.8rem; }
.apps-line svg { margin-top: 3px; flex: none; }
.convert { margin: 0.2rem 0 0.9rem; }


/* ===================================================================
   Premium: tag, locks, upgrade sheet, #/premium, brand
   =================================================================== */
.plan-badge { margin: 0 auto 0 0.6rem; display: inline-flex; align-items: center; gap: 0.25rem; min-height: 28px; padding: 0 0.6rem; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); font-size: 0.75rem; font-weight: 700; text-decoration: none; letter-spacing: 0.02em; }
.plan-badge.is-premium { background: var(--mark); color: #15171a; }
.plan-badge:active { transform: scale(0.96); }
.ptag { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.15em 0.55em; border-radius: 999px; background: var(--mark); color: #15171a; border: 1px solid color-mix(in srgb, #15171a 70%, transparent); font-size: var(--fs-xs); font-weight: 750; line-height: 1.3; white-space: nowrap; vertical-align: middle; }
.ptag svg { fill: #15171a; stroke: #15171a; }
.ptag-s { font-size: 0.6875rem; padding: 0.1em 0.5em; }
.lockbox { position: relative; border: 1.5px dashed var(--line-2); border-radius: var(--radius); padding: 0.8rem 0.9rem 0.2rem; margin: 0 0 0.9rem; background: color-mix(in srgb, var(--paper-2) 70%, transparent); cursor: pointer; transition: border-color 0.15s, transform 0.14s var(--ease); }
.lockbox:hover { border-color: var(--ink-3); }
.lockbox:active { transform: scale(0.99); }
.lockbox:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.lockbox-in { opacity: 0.55; pointer-events: none; user-select: none; }
.lockbox-tag { position: absolute; top: 0.5rem; right: 0.6rem; z-index: 2; }
.lockbox-inline { display: inline-block; }
.tile-tag { position: absolute; top: 0.5rem; right: 0.5rem; }
.type-tile { position: relative; }
.type-tile.is-locked { background: var(--paper-2); }
.count-note { margin: 0.6rem 0 0; font-size: var(--fs-xs); color: var(--ink-3); text-align: center; }
.upsheet .up-feature { display: flex; gap: 0.7rem; align-items: flex-start; font-weight: 650; margin: 0 0 1rem; }
.upsheet .up-feature span:last-child { flex: 1; }
.up-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.5rem; }
.up-list li { display: flex; gap: 0.6rem; align-items: flex-start; font-size: var(--fs-s); }
.up-list svg { color: var(--ok); flex: none; margin-top: 2px; }
.seg { display: inline-flex; background: var(--paper-2); border-radius: 12px; padding: 3px; gap: 2px; }
.seg-b { min-height: 40px; padding: 0 0.85rem; border: 0; background: transparent; border-radius: 9px; font: 650 var(--fs-xs)/1 var(--font); color: var(--ink-3); cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem; transition: background-color 0.2s, color 0.2s, box-shadow 0.2s; }
.seg-b.is-on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(21, 23, 26, 0.14); }
.seg-b:active { transform: scale(0.96); }
.sub-addr { margin-top: 1.1rem; border-top: 1px solid var(--line); padding-top: 0.9rem; }
.premium-block.is-live { border-style: solid; border-color: var(--line-2); background: var(--card); box-shadow: var(--shadow); }

/* #/premium */
.prem-hero h1 { font-size: clamp(1.7rem, 6vw, 2.3rem); margin: 0.6rem 0 0.5rem; }
.prem-beta { background: var(--mark-soft); border-radius: var(--radius-s); padding: 0.7rem 0.9rem; font-size: var(--fs-s); margin: 0; }
.prem-state { display: flex; gap: 0.9rem; align-items: flex-start; }
.prem-state h2 { font-size: 1.15rem; margin-bottom: 0.25rem; }
.prem-state p { margin: 0; color: var(--ink-2); font-size: var(--fs-s); }
.prem-ico { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: inline-flex; align-items: center; justify-content: center; }
.prem-state.is-on .prem-ico { background: var(--mark); color: #15171a; }
.cmp { display: grid; }
.cmp-row { display: grid; grid-template-columns: minmax(0, 1fr) 84px 84px; align-items: center; gap: 0.4rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); font-size: var(--fs-s); }
.cmp-row > span { min-width: 0; }
.cmp-row > span:not(.cmp-label) { text-align: center; }
.cmp-head { font-size: var(--fs-xs); font-weight: 700; color: var(--ink-3); position: sticky; top: var(--topbar-h); background: var(--card); z-index: 2; border-bottom-width: 1.5px; }
.cmp-prem { background: var(--mark-soft); border-radius: 8px; padding: 0.25rem 0.2rem; font-weight: 650; }
.cmp-head .cmp-prem { color: var(--ink); }
.cmp-label { font-weight: 600; }
.cmp-yes { color: var(--ok); display: inline-flex; }
.cmp-no { color: var(--ink-3); }
.cmp-val { font-variant-numeric: tabular-nums; line-height: 1.25; display: block; font-size: var(--fs-xs); }
@media (max-width: 420px) { .cmp-row { grid-template-columns: minmax(0, 1fr) 76px 76px; } }

/* Brand */
.brand-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 0.7rem; }
.brand-tile { position: relative; min-height: 110px; border-radius: var(--radius); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; padding: 1.6rem 0.6rem 0.6rem; }
.brand-tile.is-light { background: #fff; }
.brand-tile.is-dark { background: #15171a; }
.brand-tile.is-dark .muted { color: #8a8e96; }
.brand-tile img { max-width: 100%; max-height: 70px; object-fit: contain; display: block; }
.tile-cap { position: absolute; top: 0.4rem; left: 0.6rem; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.brand-tile.is-dark .tile-cap { color: #8a8e96; }

/* File card and storage */
.dropzone { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem; min-height: 132px; padding: 1rem; border: 2px dashed var(--line-2); border-radius: var(--radius); background: var(--paper-2); color: var(--ink); font: inherit; cursor: pointer; transition: border-color 0.15s, background-color 0.15s, transform 0.14s var(--ease); -webkit-tap-highlight-color: transparent; }
.dropzone:hover, .dropzone.is-drag { border-color: var(--ink); background: var(--mark-soft); }
.dropzone:active { transform: scale(0.98); }
.dropzone b { font-size: var(--fs); }
.dz-ico { width: 48px; height: 48px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 0.25rem; }
.dz-drop { font-size: var(--fs-xs); color: var(--ink-3); }
@media (hover: none) { .dz-drop { display: none; } }
.upload { border: 1.5px solid var(--line-2); border-radius: var(--radius); padding: 0.8rem; background: var(--card); }
.upload-top { display: flex; align-items: center; gap: 0.7rem; }
.upload .grow { flex: 1; min-width: 0; }
.file-chip { flex: none; width: 40px; height: 40px; border-radius: 11px; background: var(--paper-2); display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); }
.file-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-s); }
.upload .muted { font-size: var(--fs-xs); }
.upload-bar { margin-top: 0.7rem; }
.upload.is-busy .bar-fill { transition: width 0.2s linear; }
.storage-line { margin: 0 0 0.35rem; font-size: var(--fs-xs); color: var(--ink-2); font-weight: 600; }
.storage-track { height: 6px; background: var(--paper-2); border-radius: 3px; overflow: hidden; }
.storage-track span { display: block; height: 100%; background: var(--ink); border-radius: 3px; transition: width 0.4s var(--ease); }
.store-sub { font-size: var(--fs-s); margin: 1.1rem 0 0.2rem; }
.list > li > .file-chip { margin-top: 2px; }
.list a.file-name { text-decoration: none; font-weight: 600; }
