/* Daftar — Apple Notes look over a Notion-style engine, with a budget dashboard. RTL-first via logical properties. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Arabic", "Segoe UI Variable Text", "Segoe UI", "IBM Plex Sans Arabic", "Inter", sans-serif;
  --font-serif: "New York", "Lora", "Noto Naskh Arabic", Georgia, serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --bg: #ffffff;
  --bg-side: #f2f2f4;
  --bg-list: #fbfbfc;
  --bg-soft: #f4f4f6;
  --bg-elev: #ffffff;
  --text: #1d1d1f;
  --text-2: rgba(29, 29, 31, .66);
  --text-3: rgba(29, 29, 31, .44);
  --hover: rgba(0, 0, 0, .045);
  --hover-2: rgba(0, 0, 0, .075);
  --border: rgba(0, 0, 0, .075);
  --border-2: rgba(0, 0, 0, .14);
  /* Apple Notes gold */
  --gold: #f5b800;
  --gold-ink: #3a2c00;
  --gold-text: #b27f00;
  --sel: #ffe27a;
  --accent: #e3a300;
  --accent-2: #c98f00;
  --accent-soft: rgba(245, 184, 0, .2);
  --green: #34c759;
  --danger: #eb5757;
  --good: #16a34a;
  --bad: #e11d48;
  --shadow-pop: 0 0 0 1px rgba(15, 15, 15, .05), 0 3px 6px rgba(15, 15, 15, .1), 0 9px 24px rgba(15, 15, 15, .2);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --chart-track: rgba(55, 53, 47, .07);
  --radius: 6px;
  /* Notion palette: text colours, block backgrounds, tags */
  --c-gray: #787774; --c-brown: #9f6b53; --c-orange: #d9730d; --c-yellow: #cb912f; --c-green: #448361; --c-blue: #337ea9; --c-purple: #9065b0; --c-pink: #c14c8a; --c-red: #d44c47;
  --b-gray: #f1f1ef; --b-brown: #f4eeee; --b-orange: #fbecdd; --b-yellow: #fbf3db; --b-green: #edf3ec; --b-blue: #e7f3f8; --b-purple: #f6f3f9; --b-pink: #faf1f5; --b-red: #fdebec;
  --t-gray: #e3e2e0; --t-brown: #eee0da; --t-orange: #fadec9; --t-yellow: #fdecc8; --t-green: #dbeddb; --t-blue: #d3e5ef; --t-purple: #e8deee; --t-pink: #f5e0e9; --t-red: #ffe2dd;
  --t-ink: #32302c;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #1e1e1e;
  --bg-side: #2a2a2b;
  --bg-list: #232324;
  --bg-soft: #2c2c2e;
  --bg-elev: #2c2c2e;
  --text: rgba(255, 255, 255, .9);
  --text-2: rgba(255, 255, 255, .62);
  --text-3: rgba(255, 255, 255, .4);
  --hover: rgba(255, 255, 255, .055);
  --hover-2: rgba(255, 255, 255, .09);
  --border: rgba(255, 255, 255, .09);
  --border-2: rgba(255, 255, 255, .16);
  --gold: #ffd60a;
  --gold-ink: #2b2000;
  --gold-text: #ffd60a;
  --sel: #7a6200;
  --accent: #ffd60a;
  --accent-2: #f0c800;
  --accent-soft: rgba(255, 214, 10, .2);
  --shadow-pop: 0 0 0 1px rgba(255, 255, 255, .08), 0 3px 6px rgba(0, 0, 0, .3), 0 9px 24px rgba(0, 0, 0, .45);
  --shadow-card: 0 0 0 1px rgba(255, 255, 255, .04);
  --chart-track: rgba(255, 255, 255, .08);
  --c-gray: #9b9b9b; --c-brown: #ba856f; --c-orange: #c77d48; --c-yellow: #ca9849; --c-green: #529e72; --c-blue: #5e87c9; --c-purple: #9d68d3; --c-pink: #d15796; --c-red: #df5452;
  --b-gray: #2f2f2f; --b-brown: #4a3228; --b-orange: #5c3b23; --b-yellow: #564328; --b-green: #243d30; --b-blue: #143a4e; --b-purple: #3c2d49; --b-pink: #4e2c3c; --b-red: #522e2a;
  --t-gray: #373737; --t-brown: #5a3a2e; --t-orange: #693e1f; --t-yellow: #6b5121; --t-green: #2b4b38; --t-blue: #28456c; --t-purple: #483164; --t-pink: #5b2e4b; --t-red: #6e3630;
  --t-ink: rgba(255, 255, 255, .88);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
[dir="rtl"] body { font-family: -apple-system, BlinkMacSystemFont, "SF Arabic", "Segoe UI Variable Text", "Segoe UI", "IBM Plex Sans Arabic", sans-serif; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
kbd { font-family: var(--font); font-size: 11px; color: var(--text-3); border: 1px solid var(--border-2); border-radius: 4px; padding: 1px 5px; background: var(--bg); }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.ic { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ic svg { display: block; }
[dir="rtl"] .ic-arrowR svg, [dir="rtl"] .ic-arrowL svg { transform: none; }
.picon { line-height: 1; display: inline-flex; align-items: center; justify-content: center; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
::selection { background: rgba(35, 131, 226, .28); }

/* -------------------------------------------------------------- boot */
.boot { height: 100vh; display: grid; place-items: center; }
.boot-logo { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; color: #fff; font-size: 28px; font-weight: 700;
  background: linear-gradient(135deg, #2f6fec, #a855f7); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .8; } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--hover-2); border-top-color: var(--accent); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-loading, .fin-loading { display: grid; place-items: center; padding: 80px 0; }

/* ----------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--border-2);
  background: var(--bg); color: var(--text); font-weight: 500; font-size: 14px; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-ghost { color: var(--danger); border-color: transparent; }
.btn.danger-ghost:hover { background: rgba(235, 87, 87, .1); }
.btn.ghost { border-color: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 42px; padding: 0 18px; font-size: 15px; border-radius: 8px; }
.btn.block { width: 100%; justify-content: center; }
.btn.light { background: #fff; color: #b42318; border-color: #fff; }
.btn.outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .7); }
.btn:disabled { opacity: .55; pointer-events: none; }
.icon-btn { width: 28px; height: 28px; border-radius: var(--radius); display: inline-grid; place-items: center; color: var(--text-2); transition: background .12s; }
.icon-btn:hover { background: var(--hover-2); color: var(--text); }
.icon-btn.sm { width: 24px; height: 24px; }
.icon-btn.xs { width: 20px; height: 20px; border-radius: 4px; }
.icon-btn:disabled { opacity: .35; pointer-events: none; }
.icon-btn.fav-on { color: #f5b301; }
.input { width: 100%; height: 34px; padding: 0 10px; border-radius: var(--radius); border: 1px solid var(--border-2); background: var(--bg-soft); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 80px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--bg); }
select.input { padding-inline-end: 6px; cursor: pointer; }
.row-end { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; min-width: 0; }
.field > label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 13.5px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.switch { width: 34px; height: 20px; border-radius: 99px; background: var(--hover-2); position: relative; flex-shrink: 0; transition: background .2s; }
.switch span { position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: inset-inline-start .2s; }
.switch.on { background: var(--green); }
.switch.on span { inset-inline-start: 16px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 8px; background: var(--hover); }
.seg-btn { height: 28px; padding: 0 12px; border-radius: 6px; font-weight: 500; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.seg-btn.active { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .1), 0 0 0 1px var(--border); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 28px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border-2); font-size: 13px; color: var(--text-2); }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--gold-text); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.bar { height: 6px; border-radius: 99px; background: var(--chart-track); overflow: hidden; }
.bar.big { height: 10px; }
.bar-fill { height: 100%; border-radius: inherit; transition: width .6s cubic-bezier(.2, .8, .2, 1); }

/* ------------------------------------------------------------ layout */
.layout { --sbw: 230px; --lw: 310px; display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
#sidebar { width: var(--sbw); flex-shrink: 0; background: var(--bg-side); display: flex; flex-direction: column; position: relative; z-index: 20;
  transition: margin .25s cubic-bezier(.2, .8, .2, 1); border-inline-end: 1px solid var(--border); user-select: none; }
.layout.sb-collapsed #sidebar { margin-inline-start: calc(-1 * var(--sbw)); }
#list { width: var(--lw); flex-shrink: 0; background: var(--bg-list); border-inline-end: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.layout.mode-budget #list { display: none; }
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.main-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; }
.sb-scrim { display: none; }
body.is-resizing, body.is-resizing * { cursor: col-resize !important; user-select: none !important; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none !important; }

/* ---------------------------------------------------- sidebar (folders) */
.sb-head { display: flex; align-items: center; gap: 4px; padding: 10px 10px 6px; }
.sb-ws { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px; border-radius: 8px; font-weight: 600; }
.sb-ws:hover { background: var(--hover-2); }
.sb-ws-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.sb-ws .ic { color: var(--text-3); }
.sb-avatar { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--gold-ink); font-size: 11.5px; font-weight: 700; flex-shrink: 0;
  background: linear-gradient(160deg, #ffe066, var(--gold)); }
.sb-collapse { color: var(--text-3); }
.sb-nav { padding: 4px 10px 6px; display: flex; flex-direction: column; gap: 1px; }
.sb-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 0 8px; border-radius: 8px; color: var(--text);
  font-size: 14px; text-align: start; cursor: pointer; position: relative; }
.sb-item:hover { background: var(--hover); }
.sb-item.active { background: var(--hover-2); font-weight: 600; }
.sb-ico { width: 22px; height: 22px; display: inline-grid; place-items: center; flex-shrink: 0; position: relative; color: var(--accent); font-size: 16px; }
.sb-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-count { color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.sb-budget .sb-ico { color: #30b85a; }
.sb-scroll { flex: 1; overflow-y: auto; padding: 0 10px 12px; }
.sb-section { display: flex; align-items: center; justify-content: space-between; height: 28px; padding: 0 8px; margin-top: 14px; font-size: 12px; font-weight: 700; color: var(--text-3); }
.sb-section .icon-btn { opacity: 0; }
.sb-scroll:hover .sb-section .icon-btn { opacity: 1; }
.sb-tree { display: flex; flex-direction: column; gap: 1px; min-height: 8px; }
.sb-page { padding-inline-end: 6px; gap: 4px; }
.sb-tog, .sb-tog-space { width: 16px; height: 22px; display: inline-grid; place-items: center; flex-shrink: 0; color: var(--text-3); border-radius: 4px; }
.sb-tog:hover { background: var(--hover-2); }
.sb-tog .ic { transition: transform .15s; }
[dir="rtl"] .sb-tog .ic svg { transform: scaleX(-1); }
.sb-tog.open .ic { transform: rotate(90deg); }
[dir="rtl"] .sb-tog.open .ic { transform: rotate(-90deg); }
.sb-folder .picon { font-size: 16px; }
.sb-actions { display: none; gap: 2px; align-items: center; }
.sb-page:hover .sb-actions { display: inline-flex; }
.sb-page:hover .sb-count { display: none; }
.sb-page.dragging { opacity: .4; }
.sb-page.drop-inside { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.sb-page.drop-before::before, .sb-page.drop-after::after { content: ""; position: absolute; inset-inline: 6px; height: 3px; border-radius: 2px; background: var(--accent); }
.sb-page.drop-before::before { top: -2px; }
.sb-page.drop-after::after { bottom: -2px; }
.sb-empty { font-size: 13px; color: var(--text-3); padding: 4px 8px; }
.sb-foot { padding: 6px 10px 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 1px; }
.sb-foot .sb-item { color: var(--text-2); min-height: 30px; }
.sb-foot .sb-ico { color: var(--text-3); }
.sb-new { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: 8px; color: var(--gold-text); font-weight: 600; margin-top: 2px; }
.sb-new:hover { background: var(--hover); }
.sb-resize { position: absolute; top: 0; bottom: 0; inset-inline-end: -3px; width: 6px; cursor: col-resize; z-index: 2; }

/* ---------------------------------------------------------- notes list */
.nl-head { padding: 10px 14px 8px; flex-shrink: 0; }
.nl-head-row { display: flex; align-items: center; height: 34px; }
.nl-back { display: none; width: auto; gap: 2px; padding: 0 6px 0 2px; color: var(--gold-text); font-size: 16px; }
.compose { color: var(--gold-text); width: 34px; height: 34px; border-radius: 8px; }
.compose:hover { background: var(--hover-2); color: var(--gold-text); }
.nl-title { margin: 2px 4px 0; font-size: 22px; font-weight: 750; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[dir="rtl"] .nl-title { letter-spacing: 0; }
.nl-count { margin: 0 4px 10px; color: var(--text-3); font-size: 12.5px; }
.nl-search-wrap { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 9px; background: var(--hover); color: var(--text-3); }
.nl-search-wrap:focus-within { background: var(--hover-2); }
.nl-search { flex: 1; min-width: 0; border: 0; outline: none; background: none; height: 100%; font-size: 14px; color: var(--text); }
.nl-scroll { flex: 1; overflow-y: auto; padding: 0 8px 20px; }
.nl-group { display: flex; align-items: center; gap: 5px; padding: 16px 10px 6px; font-size: 13px; font-weight: 700; color: var(--text); }
.nl-group .ic { color: var(--gold-text); }
.nl-box { display: flex; flex-direction: column; }
.nl-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: inherit; position: relative; }
.nl-row::after { content: ""; position: absolute; bottom: 0; inset-inline: 12px; height: 1px; background: var(--border); }
.nl-row:last-child::after, .nl-row.active::after, .nl-row:has(+ .nl-row.active)::after { display: none; }
.nl-row:hover:not(.active) { background: var(--hover); }
.nl-row.active { background: var(--sel); }
.nl-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nl-name { font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 5px; min-width: 0; }
.nl-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nl-name .ic { color: var(--text-3); }
.nl-emoji { font-size: 14px; }
.nl-meta { display: flex; gap: 8px; font-size: 13px; min-width: 0; }
.nl-date { color: var(--text); opacity: .78; white-space: nowrap; flex-shrink: 0; }
.nl-snip { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nl-row.active .nl-snip { color: var(--text-2); }
.nl-folder { display: flex; align-items: center; gap: 4px; color: var(--text-3); font-size: 12px; margin-top: 1px; }
.nl-folder span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nl-thumb { width: 44px; height: 44px; border-radius: 7px; object-fit: cover; flex-shrink: 0; box-shadow: 0 0 0 1px var(--border); }
.nl-empty { color: var(--text-3); text-align: center; padding: 60px 10px; font-size: 15px; }

/* ----------------------------------------------------------- toolbar */
.topbar { height: 52px; flex-shrink: 0; display: flex; align-items: center; gap: 4px; padding: 0 12px; background: var(--bg); z-index: 5; }
.tb-menu { color: var(--text-2); width: 34px; height: 34px; border-radius: 8px; }
.tb-back { display: none; align-items: center; gap: 2px; color: var(--gold-text); text-decoration: none; font-size: 16px; min-width: 0; }
.tb-back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.tb-title { font-weight: 650; font-size: 15px; margin-inline-start: 6px; }
.tb-right { display: flex; align-items: center; gap: 4px; }
.tb-group { display: flex; align-items: center; gap: 2px; padding: 0 4px; }
.tb-group + .tb-group { border-inline-start: 1px solid var(--border); }
.tb-act { width: 34px; height: 34px; border-radius: 8px; color: var(--text-2); }
.tb-act:hover { color: var(--text); }
.tb-aa { font-size: 15.5px; font-weight: 650; letter-spacing: -.02em; font-family: -apple-system, "Segoe UI", sans-serif; }
.tb-right > .tb-act:last-child { color: var(--gold-text); }
.save-state { font-size: 12px; color: var(--text-3); white-space: nowrap; margin-inline-end: 6px; }
.save-state.saving::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); margin-inline-end: 6px; vertical-align: 1px; animation: pulse 1s infinite; }
.save-state.error { color: var(--danger); }

/* -------------------------------------------------------------- note */
.page { position: relative; min-height: 100%; padding-bottom: 30vh; }
.cover { height: 180px; position: relative; margin: 0 16px; border-radius: 14px; overflow: hidden; }
.cover-tools { position: absolute; bottom: 10px; inset-inline-end: 10px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.cover:hover .cover-tools { opacity: 1; }
.cover-btn { height: 26px; padding: 0 10px; border-radius: 7px; background: rgba(255, 255, 255, .92); color: #1d1d1f; font-size: 12px; font-weight: 500; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.page-inner { max-width: 780px; margin: 0 auto; padding: 0 56px; position: relative; }
.page-inner.wide { max-width: none; }
.note-stamp { text-align: center; color: var(--text-3); font-size: 12.5px; margin: 6px 0 22px; }
.page-icon { font-size: 44px; line-height: 1.1; width: fit-content; border-radius: 10px; cursor: pointer; user-select: none; margin-bottom: 6px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; transition: background .15s; }
.page-icon:hover { background: var(--hover); }
.page-icon.none { display: none; }
.page-icon.big { cursor: default; font-size: 40px; margin-top: 20px; }
.page-title { font-size: 28px; font-weight: 750; line-height: 1.25; margin: 0 0 10px; outline: none; letter-spacing: -.015em; word-break: break-word; padding: 2px 2px; }
[dir="rtl"] .page-title { letter-spacing: 0; }
.page-title:empty::before { content: attr(data-ph); color: var(--text-3); opacity: .6; cursor: text; }
.page-title.static { margin: 0; font-size: 30px; }
.font-serif .page-title, .font-serif .editor { font-family: var(--font-serif); }
.font-mono .page-title, .font-mono .editor { font-family: var(--font-mono); font-size: 14.5px; }
.font-mono .page-title { font-size: 26px; }
.page-body { margin-top: 2px; }
.trash-banner { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 12px; background: #ff3b30; color: #fff; font-weight: 500; position: sticky; top: 0; z-index: 4; }
.notfound { text-align: center; padding: 120px 20px; color: var(--text-2); }
.nf-emoji { font-size: 56px; }
.empty-pane { max-width: 560px; margin: 0 auto; padding: 14vh 24px 40px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.empty-ico { width: 86px; height: 86px; border-radius: 22px; display: grid; place-items: center; color: var(--gold-ink); background: linear-gradient(160deg, #ffe680, var(--gold)); box-shadow: 0 14px 30px -14px rgba(196, 140, 0, .7); }
.empty-pane h2 { margin: 20px 0 4px; font-size: 21px; }
.empty-pane p { margin: 0 0 20px; }
.empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 32px; }
.empty-pane .home-money { width: 100%; text-align: start; }

/* ------------------------------------------------------------ editor */
.editor { font-size: 16px; line-height: 1.55; padding-bottom: 20px; position: relative; }
.editor-tail { min-height: 140px; cursor: text; }
.blk { position: relative; padding-inline-start: calc(var(--indent, 0) * 1.6em); margin: 1px 0; }
.blk-gutter { position: absolute; top: 3px; inset-inline-start: calc(var(--indent, 0) * 1.6em - 48px); display: flex; gap: 0; opacity: 0; transition: opacity .12s; height: 24px; align-items: center; }
.blk:hover > .blk-gutter, .blk.menu-open > .blk-gutter { opacity: 1; }
.blk-btn { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 4px; color: var(--text-3); }
.blk-btn:hover { background: var(--hover-2); color: var(--text-2); }
.blk-grip { cursor: grab; width: 18px; }
.blk.dragging { opacity: .35; }
.blk-body { display: flex; align-items: flex-start; min-width: 0; border-radius: 4px; }
.blk-text { flex: 1; min-width: 1px; outline: none; padding: 3px 2px; white-space: pre-wrap; word-break: break-word; caret-color: var(--text); }
.blk-text:empty::before { content: attr(data-ph); color: var(--text-3); pointer-events: none; }
.blk-paragraph .blk-text:empty:not(:focus)::before { content: ""; }
.blk-pre { flex-shrink: 0; user-select: none; display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 30px; }
.blk-h1 { margin-top: 1.4em; } .blk-h2 { margin-top: 1.1em; } .blk-h3 { margin-top: .8em; }
.blk:first-child.blk-h1, .blk:first-child.blk-h2, .blk:first-child.blk-h3 { margin-top: 2px; }
.blk-h1 .blk-text { font-size: 1.875em; font-weight: 700; line-height: 1.3; }
.blk-h2 .blk-text { font-size: 1.5em; font-weight: 650; line-height: 1.3; }
.blk-h3 .blk-text { font-size: 1.25em; font-weight: 600; line-height: 1.3; }
.blk-h1 .blk-gutter { top: 14px; } .blk-h2 .blk-gutter { top: 10px; } .blk-h3 .blk-gutter { top: 6px; }
.blk-dot { font-size: 1.3em; width: 24px; line-height: 1; }
.blk-num { min-width: 24px; padding-inline-end: 4px; font-variant-numeric: tabular-nums; }
.blk-check { width: 20px; height: 20px; min-width: 20px; margin: 4px 4px 0 6px; border: 1.5px solid var(--border-2); border-radius: 50%; cursor: pointer; transition: background .15s, transform .15s; color: #fff; }
.blk-check:hover { background: var(--hover-2); }
.blk-check.on { background: var(--gold); border-color: var(--gold); transform: scale(1.04); }
.blk-check.on:hover { background: var(--accent-2); }
.blk-todo.checked .blk-text { color: var(--text-3); }
.blk-tog { width: 24px; height: 24px; margin-top: 3px; border-radius: 4px; cursor: pointer; color: var(--text); }
.blk-tog:hover { background: var(--hover-2); }
.blk-tog .ic { transition: transform .15s; }
.blk-body[dir="rtl"] .blk-tog .ic svg, [dir="rtl"] .blk-body:not([dir="ltr"]) .blk-tog .ic svg { transform: scaleX(-1); }
.blk-toggle.open .blk-tog .ic { transform: rotate(90deg); }
.blk-toggle.open .blk-body[dir="rtl"] .blk-tog .ic, [dir="rtl"] .blk-toggle.open .blk-body:not([dir="ltr"]) .blk-tog .ic { transform: rotate(-90deg); }
.blk-quote .blk-body { border-inline-start: 3px solid var(--gold); padding-inline-start: 14px; margin: 4px 0; }
.blk-quote .blk-text { font-size: 1.15em; }
.blk-callout .blk-body { padding: 14px 16px 14px 12px; border-radius: 6px; margin: 4px 0; gap: 4px; }
.blk-emoji { font-size: 1.3em; width: 30px; height: 30px; border-radius: 4px; cursor: pointer; }
.blk-emoji:hover { background: var(--hover-2); }
.blk-divider { width: 100%; padding: 10px 0; cursor: default; }
.blk-divider hr { border: 0; border-top: 1px solid var(--border-2); margin: 0; }
.blk-code .blk-body { flex-direction: column; background: var(--bg-soft); border-radius: 6px; margin: 4px 0; padding: 8px 4px 4px; }
.blk-code .blk-text { font-family: var(--font-mono); font-size: 13.5px; line-height: 1.6; padding: 6px 14px 12px; tab-size: 2; width: 100%; direction: ltr; text-align: left; }
.code-head { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 0 10px; font-size: 12px; color: var(--text-3); }
.code-copy { width: 24px; height: 24px; border-radius: 4px; display: grid; place-items: center; opacity: 0; }
.blk-code:hover .code-copy { opacity: 1; }
.code-copy:hover { background: var(--hover-2); }
.blk-page { display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 4px; border-radius: 4px; text-decoration: none; font-weight: 500; }
.blk-page:hover { background: var(--hover); }
.blk-page .blk-page-title { border-bottom: 1px solid var(--border-2); line-height: 1.3; }
.blk-page.missing { color: var(--text-3); font-weight: 400; }
.blk-page .ic { color: var(--text-3); }
.blk-img { margin: 8px 0; position: relative; max-width: 100%; }
.blk-img img { display: block; width: 100%; border-radius: 4px; }
.blk-img figcaption { font-size: 14px; color: var(--text-2); padding: 6px 2px 2px; outline: none; }
.blk-img figcaption:empty::before { content: attr(data-ph); color: var(--text-3); opacity: 0; }
.blk-img:hover figcaption:empty::before, .blk-img figcaption:focus:empty::before { opacity: 1; }
.img-resize { position: absolute; top: 50%; inset-inline-end: 6px; width: 6px; height: 46px; margin-top: -32px; border-radius: 4px; background: rgba(15, 15, 15, .55); border: 1px solid rgba(255, 255, 255, .8); cursor: ew-resize; opacity: 0; transition: opacity .15s; }
.blk-img:hover .img-resize { opacity: 1; }
.img-empty { width: 100%; display: flex; align-items: center; gap: 10px; padding: 14px 14px; border-radius: 6px; background: var(--bg-soft); color: var(--text-3); margin: 4px 0; flex-wrap: wrap; }
.img-empty.over { box-shadow: inset 0 0 0 2px var(--accent); }
.img-empty-actions { margin-inline-start: auto; display: flex; gap: 6px; }
.editor.readonly .blk-text { cursor: text; }

/* inline marks & colours */
.blk-text code, .sr-snip code { font-family: var(--font-mono); font-size: .85em; padding: .15em .4em; border-radius: 4px; background: rgba(135, 131, 120, .15); color: #eb5757; }
.blk-text a { color: inherit; text-decoration: underline; text-decoration-color: var(--text-3); text-underline-offset: 2px; cursor: pointer; }
.blk-text a:hover { text-decoration-color: currentColor; }
.c-gray { color: var(--c-gray); } .c-brown { color: var(--c-brown); } .c-orange { color: var(--c-orange); } .c-yellow { color: var(--c-yellow); } .c-green { color: var(--c-green); }
.c-blue { color: var(--c-blue); } .c-purple { color: var(--c-purple); } .c-pink { color: var(--c-pink); } .c-red { color: var(--c-red); }
.bg-gray { background: var(--b-gray); } .bg-brown { background: var(--b-brown); } .bg-orange { background: var(--b-orange); } .bg-yellow { background: var(--b-yellow); } .bg-green { background: var(--b-green); }
.bg-blue { background: var(--b-blue); } .bg-purple { background: var(--b-purple); } .bg-pink { background: var(--b-pink); } .bg-red { background: var(--b-red); }
span.bg-gray, span.bg-brown, span.bg-orange, span.bg-yellow, span.bg-green, span.bg-blue, span.bg-purple, span.bg-pink, span.bg-red { border-radius: 3px; padding: 0 2px; }
.col-gray .blk-body { color: var(--c-gray); } .col-brown .blk-body { color: var(--c-brown); } .col-orange .blk-body { color: var(--c-orange); } .col-yellow .blk-body { color: var(--c-yellow); }
.col-green .blk-body { color: var(--c-green); } .col-blue .blk-body { color: var(--c-blue); } .col-purple .blk-body { color: var(--c-purple); } .col-pink .blk-body { color: var(--c-pink); } .col-red .blk-body { color: var(--c-red); }
.col-gray_bg .blk-body { background: var(--b-gray); } .col-brown_bg .blk-body { background: var(--b-brown); } .col-orange_bg .blk-body { background: var(--b-orange); } .col-yellow_bg .blk-body { background: var(--b-yellow); }
.col-green_bg .blk-body { background: var(--b-green); } .col-blue_bg .blk-body { background: var(--b-blue); } .col-purple_bg .blk-body { background: var(--b-purple); } .col-pink_bg .blk-body { background: var(--b-pink); } .col-red_bg .blk-body { background: var(--b-red); }
.swatch { width: 22px; height: 22px; border-radius: 4px; display: inline-grid; place-items: center; border: 1px solid var(--border-2); font-weight: 600; font-size: 13px; flex-shrink: 0; }
.swatch::before { content: "A"; }
.swatch[class*="bg-"]::before { content: ""; }
.swatch.c-default::before { color: var(--text); }
.swatch.bg-default { background: var(--bg); }
.swatch.tagsw { border: 0; width: 18px; height: 18px; }
.swatch.tagsw::before { content: ""; }

/* drag ghost */
.drag-ghost { position: fixed; z-index: 1000; pointer-events: none; padding: 4px 10px; border-radius: 6px; background: var(--bg-elev); box-shadow: var(--shadow-pop); font-size: 14px; max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .92; }
.drop-line { position: fixed; height: 3px; background: rgba(35, 131, 226, .6); border-radius: 2px; z-index: 999; pointer-events: none; }

/* inline toolbar */
.toolbar { position: fixed; z-index: 900; display: flex; align-items: center; height: 34px; padding: 0 3px; border-radius: 7px; background: var(--bg-elev); box-shadow: var(--shadow-pop);
  opacity: 0; pointer-events: none; transform: translateY(4px); transition: opacity .12s, transform .12s; }
.toolbar.in { opacity: 1; pointer-events: auto; transform: none; }
.tb-btn { height: 28px; min-width: 28px; padding: 0 6px; border-radius: 4px; display: inline-grid; place-items: center; color: var(--text); font-size: 14px; }
.tb-btn:hover { background: var(--hover-2); }
.tb-sep { width: 1px; height: 18px; background: var(--border-2); margin: 0 3px; }
.tb-color { text-decoration: underline; text-decoration-color: #eb5757; text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* template strip on empty pages */
.tpl-strip { margin-top: -120px; position: relative; z-index: 1; }
.tpl-strip:empty { display: none; }
.tpl-hint { color: var(--text-3); font-size: 14px; margin: 0 0 6px; padding-inline-start: 2px; }
.tpl-item { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 6px; border-radius: 4px; color: var(--text-2); font-size: 14px; width: 260px; max-width: 100%; }
.tpl-item:hover { background: var(--hover-2); color: var(--text); }
.tpl-item > span:first-child { width: 20px; text-align: center; }

/* ------------------------------------------------------ popover/menu */
.pop { position: fixed; z-index: 1000; background: var(--bg-elev); border-radius: 8px; box-shadow: var(--shadow-pop); opacity: 0; transform: translateY(-3px) scale(.99);
  transition: opacity .1s, transform .1s; max-height: min(70vh, 520px); overflow-y: auto; }
.pop.in { opacity: 1; transform: none; }
.menu { min-width: 220px; max-width: 320px; padding: 6px 4px; display: flex; flex-direction: column; }
.menu-item { display: flex; align-items: center; gap: 10px; min-height: 30px; padding: 3px 10px; border-radius: 4px; text-align: start; font-size: 14px; color: var(--text); width: 100%; }
.menu-item:hover, .menu-item.active.slash-item { background: var(--hover-2); }
.menu-item > .ic { color: var(--text-2); }
.menu-item.danger, .menu-item.danger > .ic { color: var(--danger); }
.menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-hint { font-size: 12px; color: var(--text-3); }
.menu-emoji { width: 20px; text-align: center; font-size: 13px; color: var(--text-2); font-weight: 600; }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.menu-head { font-size: 12px; font-weight: 500; color: var(--text-3); padding: 6px 10px 4px; }
.menu-empty { font-size: 13px; color: var(--text-3); padding: 10px 12px; }
.menu-input { padding: 4px 6px 6px; }
.menu-foot { font-size: 12px; color: var(--text-3); padding: 6px 10px 2px; line-height: 1.6; border-top: 1px solid var(--border); margin-top: 4px; }
.pop-form { display: flex; gap: 6px; padding: 8px; min-width: 280px; align-items: center; }
.pop-form .input { height: 30px; }
.slash-menu { width: 320px; max-width: 90vw; }
.slash-item { gap: 12px; min-height: 48px; }
.slash-thumb { width: 44px; height: 44px; flex-shrink: 0; border-radius: 6px; border: 1px solid var(--border-2); background: var(--bg); display: grid; place-items: center; font-weight: 600; font-size: 15px; color: var(--text-2); }
.slash-text { display: flex; flex-direction: column; min-width: 0; }
.slash-text b { font-weight: 500; }
.slash-text small { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-pick { display: flex; gap: 4px; padding: 4px 6px; }
.font-opt { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 6px; color: var(--text-2); }
.font-opt:hover { background: var(--hover-2); }
.font-opt b { font-size: 22px; color: var(--text); font-weight: 500; }
.font-opt.active b { color: var(--accent); }
.f-serif { font-family: var(--font-serif); } .f-mono { font-family: var(--font-mono); }

/* emoji picker */
.emoji-picker { width: 352px; max-width: 92vw; }
.emoji-head { position: sticky; top: 0; background: var(--bg-elev); border-bottom: 1px solid var(--border); padding: 6px 8px; display: flex; flex-direction: column; gap: 6px; z-index: 1; }
.emoji-tabs { display: flex; gap: 2px; }
.emoji-tab { width: 34px; height: 30px; border-radius: 6px; font-size: 18px; opacity: .6; }
.emoji-tab.active, .emoji-tab:hover { background: var(--hover-2); opacity: 1; }
.emoji-actions { display: flex; gap: 6px; }
.emoji-grid { display: grid; grid-template-columns: repeat(9, 1fr); padding: 6px; gap: 2px; }
.emoji { height: 34px; border-radius: 6px; font-size: 22px; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.emoji:hover { background: var(--hover-2); }

/* ------------------------------------------------------------- modal */
.modal-back { position: fixed; inset: 0; z-index: 800; background: rgba(15, 15, 15, .45); display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px;
  opacity: 0; transition: opacity .15s; overflow-y: auto; }
.modal-back.in { opacity: 1; }
.modal-box { width: 520px; max-width: 100%; background: var(--bg-elev); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 22px; transform: translateY(8px) scale(.985); transition: transform .18s cubic-bezier(.2, .8, .2, 1); }
.modal-back.in .modal-box { transform: none; }
.modal-title { font-size: 18px; font-weight: 650; margin-bottom: 4px; }
.confirm p { margin: 0 0 6px; font-size: 15px; line-height: 1.6; }

/* search */
.modal-search { padding: 0; overflow: hidden; }
.modal-back:has(.modal-search) { padding-top: 12vh; }
.search-top { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 54px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.search-field { flex: 1; border: 0; outline: none; background: none; font-size: 17px; color: var(--text); height: 100%; }
.search-results { max-height: 56vh; overflow-y: auto; padding: 6px; }
.sr-item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.sr-item.active { background: var(--hover-2); }
.sr-ico { width: 22px; display: grid; place-items: center; color: var(--text-3); font-size: 17px; flex-shrink: 0; }
.sr-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sr-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.sr-snip { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.sr-meta { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.sr-create .sr-title { color: var(--text-2); }

/* trash, share */
.pop-trash { width: 380px; max-width: 94vw; }
.trash-box { padding: 10px; }
.trash-head { padding: 2px 4px 8px; }
.trash-list { margin-top: 6px; max-height: 50vh; overflow-y: auto; }
.trash-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-radius: 6px; cursor: pointer; }
.trash-row:hover { background: var(--hover-2); }
.trash-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.trash-t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-t small { color: var(--text-3); font-size: 12px; }
.pop-share { width: 400px; max-width: 94vw; }
.share-box { padding: 14px; }
.share-row { display: flex; align-items: center; gap: 12px; }
.share-row > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.share-ico { width: 36px; height: 36px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.share-link { display: flex; gap: 6px; margin-top: 12px; }

/* cover picker */
.cover-picker { width: 400px; max-width: 92vw; padding: 6px 8px 10px; }
.cover-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 4px; }
.cover-swatch { height: 56px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); transition: transform .12s; }
.cover-swatch:hover { transform: scale(1.04); }
.cover-up { padding: 4px; }

/* templates modal */
.tpl-modal p { margin: 0 0 14px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tpl-card { text-align: start; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; padding: 0 0 12px; transition: box-shadow .15s, transform .15s; background: var(--bg); }
.tpl-card:hover { box-shadow: var(--shadow-card), 0 0 0 1px var(--border-2); transform: translateY(-2px); }
.tpl-prev { height: 108px; background: var(--bg-soft); padding: 12px 14px; overflow: hidden; display: flex; flex-direction: column; gap: 5px; }
.tpl-prev.db { display: grid; place-items: center; color: var(--text-3); }
.tp-line { font-size: 9px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; background: var(--hover); border-radius: 2px; min-height: 9px; }
.tp-line.h2, .tp-line.h3 { font-weight: 700; color: var(--text-2); background: none; font-size: 10px; }
.tp-line.callout, .tp-line.quote { background: var(--b-blue); color: var(--c-blue); padding: 2px 4px; }
.tpl-name { display: flex; align-items: center; gap: 8px; padding: 10px 14px 2px; }
.tpl-card small { color: var(--text-3); padding: 0 14px; display: block; font-size: 12.5px; }

/* settings */
.modal-settings { padding: 0; overflow: hidden; }
.settings { display: flex; min-height: 460px; }
.set-nav { width: 210px; background: var(--bg-side); padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.set-tab { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: 6px; color: var(--text-2); font-weight: 500; text-align: start; }
.set-tab:hover { background: var(--hover-2); }
.set-tab.active { background: var(--hover-2); color: var(--text); }
.set-body { flex: 1; padding: 20px 28px 26px; overflow-y: auto; max-height: 76vh; }
.set-body h3 { font-size: 16px; margin: 0 0 4px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.set-body h3:not(:first-child) { margin-top: 28px; }
.set-body h4 { margin: 24px 0 8px; font-size: 14px; }
.sc-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.sc-row kbd { direction: ltr; }
.data-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }

/* toasts */
#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 8px; background: #2f2f2f; color: #fff; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; max-width: 90vw; }
.toast.in { opacity: 1; transform: none; }
.toast.error { background: #c0392b; }
.toast button { color: #8ec5ff; font-weight: 600; }

/* --------------------------------------------------------- databases */
.db { margin-top: 4px; }
.db-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--border); flex-wrap: wrap; padding-bottom: 2px; }
.db-tabs { display: flex; align-items: center; gap: 2px; overflow-x: auto; }
.db-tab { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px; color: var(--text-3); font-weight: 500; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -3px; white-space: nowrap; border-radius: 4px 4px 0 0; }
.db-tab:hover { color: var(--text-2); background: var(--hover); }
.db-tab.active { color: var(--text); border-bottom-color: var(--text); }
.db-tools { display: flex; align-items: center; gap: 2px; }
.db-tool { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 8px; border-radius: 4px; color: var(--text-3); font-size: 14px; }
.db-tool:hover { background: var(--hover-2); color: var(--text-2); }
.db-tool.on { color: var(--accent); }
.db-search-wrap { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 6px; border-radius: 4px; color: var(--text-3); }
.db-search-wrap:focus-within { background: var(--hover); }
.db-search { border: 0; outline: none; background: none; width: 90px; transition: width .2s; }
.db-search:focus { width: 160px; }
.db-new { margin-inline-start: 6px; }
.db-body { padding-top: 6px; }
.db-empty { color: var(--text-3); padding: 24px 6px; display: flex; gap: 10px; align-items: center; }
.dt-scroll { overflow-x: auto; padding-bottom: 6px; }
.dt { display: inline-flex; flex-direction: column; min-width: 100%; }
.dt-row { display: flex; position: relative; border-bottom: 1px solid var(--border); }
.dt-head { border-top: 1px solid var(--border); }
.dt-cell { flex-shrink: 0; min-height: 34px; padding: 6px 8px; border-inline-end: 1px solid var(--border); display: flex; align-items: center; gap: 6px; font-size: 14px; overflow: hidden; position: relative; }
.dt-th { color: var(--text-2); cursor: pointer; font-weight: 500; white-space: nowrap; user-select: none; }
.dt-th span { overflow: hidden; text-overflow: ellipsis; }
.dt-th:hover { background: var(--hover); }
.dt-th .ic { color: var(--text-3); }
.dt-resize { position: absolute; top: 0; bottom: 0; inset-inline-end: -3px; width: 6px; cursor: col-resize; z-index: 1; }
.dt-resize:hover { background: var(--accent); opacity: .5; }
.dt-add { width: 40px; justify-content: center; color: var(--text-3); cursor: pointer; border-inline-end: 0; }
.dt-add:hover { background: var(--hover); }
.dt-td { cursor: pointer; flex-wrap: wrap; }
.dt-td:hover { background: var(--hover); }
.dt-title { font-weight: 500; display: inline-flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.dt-title > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-bottom: 1px solid transparent; }
.dt-title .ic { color: var(--text-3); }
.dt-open { display: none; align-items: center; gap: 4px; height: 22px; padding: 0 6px; border-radius: 4px; font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--bg); box-shadow: 0 0 0 1px var(--border-2); position: absolute; inset-inline-end: 6px; }
.dt-row:hover .dt-open { display: inline-flex; }
.dt-rowtools { position: absolute; inset-inline-start: -26px; top: 7px; opacity: 0; }
.dt-row:hover .dt-rowtools { opacity: 1; }
.dt-new { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px; color: var(--text-3); cursor: pointer; border-bottom: 1px solid var(--border); font-size: 14px; }
.dt-new:hover { background: var(--hover); }
.dt-foot { display: flex; gap: 18px; padding: 8px; color: var(--text-3); font-size: 12px; }
.cell-num { font-variant-numeric: tabular-nums; margin-inline-start: auto; }
.cell-check { width: 16px; height: 16px; border: 1.5px solid var(--text-2); border-radius: 3px; display: grid; place-items: center; color: #fff; }
.cell-check.on { background: var(--accent); border-color: var(--accent); }
.cell-url { color: var(--text-2); text-decoration: underline; text-decoration-color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-date { color: var(--text); white-space: nowrap; }
.pop-cell .cell-editor { padding: 6px; }
.cell-input { width: 100%; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 3px; font-size: 13px; line-height: 1; white-space: nowrap; color: var(--t-ink); background: var(--t-gray); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.t-gray { background: var(--t-gray); } .t-brown { background: var(--t-brown); } .t-orange { background: var(--t-orange); } .t-yellow { background: var(--t-yellow); } .t-green { background: var(--t-green); }
.t-blue { background: var(--t-blue); } .t-purple { background: var(--t-purple); } .t-pink { background: var(--t-pink); } .t-red { background: var(--t-red); }
.tag.t-none { background: transparent; color: var(--text-3); padding: 0; }
.tag-x { margin-inline-start: 4px; opacity: .6; font-size: 14px; }
.pop-opts { width: 300px; }
.opt-picker { padding-bottom: 6px; }
.opt-top { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 8px; background: var(--bg-soft); border-bottom: 1px solid var(--border); }
.opt-top .input { border: 0; background: none; box-shadow: none; height: 26px; padding: 0 4px; flex: 1; min-width: 120px; }
.opt-chips { display: contents; }
.opt-list { padding: 4px; }
.opt-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 4px; cursor: pointer; min-height: 30px; }
.opt-row:hover { background: var(--hover-2); }
.opt-row .icon-btn { opacity: 0; }
.opt-row:hover .icon-btn { opacity: 1; }
.opt-grip { color: var(--text-3); opacity: .6; }
.opt-row.create { gap: 8px; color: var(--text-2); font-size: 13px; }
.opt-menu { width: 220px; padding: 8px 4px; }
.opt-menu > .input { margin: 0 4px 6px; width: calc(100% - 8px); }
.row-props { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.rp-row { display: flex; align-items: flex-start; gap: 8px; min-height: 34px; }
.rp-name { width: 160px; flex-shrink: 0; display: flex; align-items: center; gap: 6px; color: var(--text-3); height: 34px; padding: 0 6px; font-size: 14px; }
.rp-val { flex: 1; min-height: 34px; padding: 6px 8px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 14px; }
.rp-val:hover { background: var(--hover); }
.rp-val.empty { color: var(--text-3); }
.rp-back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13px; text-decoration: none; margin-top: 8px; padding: 4px 6px; border-radius: 4px; width: fit-content; }
.rp-back:hover { background: var(--hover); color: var(--text-2); }

/* board */
.board { display: flex; gap: 14px; overflow-x: auto; padding: 6px 0 16px; align-items: flex-start; }
.board-col { width: 264px; flex-shrink: 0; }
.board-head { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 2px; }
.board-head .icon-btn { opacity: 0; }
.board-col:hover .board-head .icon-btn { opacity: 1; }
.board-count { color: var(--text-3); font-size: 13px; }
.board-list { display: flex; flex-direction: column; gap: 8px; min-height: 60px; padding: 4px; border-radius: 8px; transition: background .12s; }
.board-list.over { background: var(--accent-soft); }
.card { background: var(--bg); border-radius: 6px; padding: 10px 10px 8px; cursor: pointer; box-shadow: 0 0 0 1px var(--border-2), 0 2px 4px rgba(15, 15, 15, .06); display: flex; flex-direction: column; gap: 6px; transition: background .12s; user-select: none; }
[data-theme="dark"] .card { background: var(--bg-soft); }
.card:hover { background: var(--bg-soft); }
.card.dragging { opacity: .4; }
.card-title { font-weight: 500; font-size: 14px; display: flex; gap: 6px; align-items: center; word-break: break-word; }
.card-prop { font-size: 12.5px; color: var(--text-2); }
.board-add { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px; border-radius: 4px; color: var(--text-3); font-size: 14px; }
.board-add:hover { background: var(--hover-2); }
.board-newgroup { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 4px; color: var(--text-3); white-space: nowrap; flex-shrink: 0; }
.board-newgroup:hover { background: var(--hover-2); }

/* list view */
.dl { display: flex; flex-direction: column; }
.dl-item { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 4px 6px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 4px; }
.dl-item:hover { background: var(--hover); }
.dl-icon { width: 22px; display: grid; place-items: center; color: var(--text-3); }
.dl-title { flex: 1; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-props { display: flex; gap: 8px; align-items: center; color: var(--text-2); font-size: 13px; }

/* -------------------------------------------------------------- home */
.home .page-inner { padding-top: 60px; max-width: 1080px; margin: 0 auto; }
.home-greet { font-size: 34px; font-weight: 700; margin: 0; text-align: center; letter-spacing: -.01em; }
.home-date { text-align: center; color: var(--text-3); margin: 6px 0 36px; }
.home-sec { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; font-weight: 600; margin: 26px 0 12px; }
.home-cards { display: grid; grid-auto-flow: column; grid-auto-columns: 148px; gap: 14px; overflow-x: auto; padding: 2px 2px 10px; }
.home-card { height: 148px; border-radius: 14px; background: var(--bg); box-shadow: 0 0 0 1px var(--border), var(--shadow-card); text-decoration: none; position: relative; overflow: hidden;
  display: flex; flex-direction: column; padding: 0 0 12px; transition: transform .15s, box-shadow .15s; text-align: start; }
.home-card:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--border-2), 0 14px 30px -14px rgba(15, 23, 42, .3); }
.hc-top { height: 46px; flex-shrink: 0; opacity: .85; }
.hc-icon { margin: -14px 14px 0; height: 30px; font-size: 26px; display: flex; align-items: flex-end; color: var(--text-3); }
.hc-title { padding: 10px 14px 0; font-weight: 600; font-size: 14px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; flex: 1; }
.home-card small { padding: 0 14px; color: var(--text-3); font-size: 12px; }
.home-card.new { align-items: center; justify-content: center; gap: 8px; color: var(--text-3); padding: 0; border: 1.5px dashed var(--border-2); box-shadow: none; background: transparent; }
.home-card.new:hover { color: var(--accent); border-color: var(--accent); }
.home-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.hq { text-align: start; padding: 16px; border-radius: 14px; background: var(--bg); box-shadow: 0 0 0 1px var(--border); display: flex; flex-direction: column; gap: 4px; transition: background .15s, transform .15s; }
.hq:hover { background: var(--bg-soft); transform: translateY(-2px); }
.hq > span { font-size: 22px; margin-bottom: 6px; }
.hq small { color: var(--text-3); font-size: 12.5px; }
.home-money-card { display: flex; align-items: center; gap: 28px; padding: 20px 24px; border-radius: 16px; text-decoration: none;
  background: linear-gradient(120deg, #ecfdf5 0%, #eff6ff 55%, #f5f3ff 100%); box-shadow: 0 0 0 1px rgba(16, 185, 129, .15); transition: transform .15s; }
[data-theme="dark"] .home-money-card { background: linear-gradient(120deg, #10291f, #13233b 55%, #221a38); }
.home-money-card:hover { transform: translateY(-2px); }
.hm-col { display: flex; flex-direction: column; gap: 2px; }
.hm-col b { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.hm-col small { color: var(--text-2); font-size: 12px; font-weight: 500; }
.hm-bar { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.hm-legend { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); }
.hm-end { text-align: end; }
.home-money-cta { display: flex; align-items: center; gap: 16px; padding: 18px 22px; border-radius: 16px; text-decoration: none; background: linear-gradient(120deg, #fef3c7, #fde68a 40%, #bbf7d0); color: #3f3a1e; }
.home-money-cta > span { font-size: 30px; }
.home-money-cta div { flex: 1; display: flex; flex-direction: column; }
.home-money-cta small { opacity: .8; }

/* ------------------------------------------------------------ budget */
.budget-page .page-inner.wide { max-width: 1240px; margin: 0 auto; }
.cover-budget { height: 200px; max-height: 200px; min-height: 0; background-size: cover !important; position: relative; overflow: hidden; }
.cover-budget::after { content: ""; position: absolute; inset: 0; background:
  radial-gradient(400px 160px at 15% 40%, rgba(255, 255, 255, .55), transparent 70%),
  radial-gradient(500px 200px at 85% 30%, rgba(255, 255, 255, .35), transparent 70%); }
.budget-page .page-icon.big { margin-top: -46px; }
.fin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.fin-sub { color: var(--text-2); margin: 6px 0 0; font-size: 15px; }
.fin-head-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.period { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 10px; background: var(--bg-soft); box-shadow: inset 0 0 0 1px var(--border); }
.period-label { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px; border-radius: 7px; font-weight: 600; white-space: nowrap; }
.period-label:hover { background: var(--hover-2); }
.period-now { font-size: 11px; font-weight: 600; color: #059669; background: rgba(16, 185, 129, .14); padding: 2px 7px; border-radius: 99px; }
.income-btn { color: #15803d; border-color: rgba(22, 163, 74, .35); background: rgba(22, 163, 74, .06); }
.income-btn:hover { background: rgba(22, 163, 74, .12); }
.fin-tabs { display: flex; gap: 4px; margin: 22px 0 18px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.fin-tab { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; color: var(--text-3); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.fin-tab:hover { color: var(--text-2); }
.fin-tab.active { color: var(--text); border-bottom-color: var(--text); }
.fin-body { display: flex; flex-direction: column; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { position: relative; padding: 16px 18px 14px; border-radius: 16px; overflow: hidden; box-shadow: 0 0 0 1px var(--kb), var(--shadow-card); background: linear-gradient(150deg, var(--k1) 0%, var(--k2) 100%); animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
.kpi:nth-child(2) { animation-delay: .05s; } .kpi:nth-child(3) { animation-delay: .1s; } .kpi:nth-child(4) { animation-delay: .15s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.kpi::after { content: ""; position: absolute; width: 140px; height: 140px; border-radius: 50%; inset-inline-end: -40px; top: -50px; background: var(--kc); opacity: .12; }
.k-income { --k1: #f0fdf4; --k2: #dcfce7; --kb: rgba(22, 163, 74, .18); --kc: #16a34a; }
.k-spent { --k1: #fff1f2; --k2: #ffe4e6; --kb: rgba(225, 29, 72, .16); --kc: #e11d48; }
.k-left { --k1: #eff6ff; --k2: #dbeafe; --kb: rgba(37, 99, 235, .16); --kc: #2563eb; }
.k-save { --k1: #f5f3ff; --k2: #ede9fe; --kb: rgba(124, 58, 237, .16); --kc: #7c3aed; }
[data-theme="dark"] .k-income { --k1: #11251a; --k2: #0f2e1d; }
[data-theme="dark"] .k-spent { --k1: #2a1218; --k2: #33121c; }
[data-theme="dark"] .k-left { --k1: #111d33; --k2: #12213f; }
[data-theme="dark"] .k-save { --k1: #1d1633; --k2: #23193f; }
.kpi-top { display: flex; align-items: center; gap: 8px; }
.kpi-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff; background: var(--kc); box-shadow: 0 4px 10px -4px var(--kc); }
.kpi-label { font-weight: 600; font-size: 13px; color: var(--text-2); }
.kpi-value { font-size: 28px; font-weight: 750; margin: 12px 0 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; z-index: 1; }
[dir="rtl"] .kpi-value { letter-spacing: 0; }
.kpi-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-2); min-height: 30px; position: relative; z-index: 1; }
.kpi-spark { opacity: .9; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; padding: 1px 6px; border-radius: 99px; font-size: 12px; }
.delta.good { color: #15803d; background: rgba(22, 163, 74, .14); }
.delta.bad { color: #be123c; background: rgba(225, 29, 72, .12); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2.wide-left { grid-template-columns: 1.6fr 1fr; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card-x { background: var(--bg); border-radius: 16px; padding: 18px 20px; box-shadow: 0 0 0 1px var(--border), var(--shadow-card); min-width: 0; }
.card-x.flush { padding: 6px 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card-head h3 .ic { color: #a855f7; }
.card-sub { color: var(--text-3); font-size: 12.5px; }
.card-link { color: var(--gold-text); font-size: 13px; text-decoration: none; font-weight: 500; }
.card-link:hover { text-decoration: underline; }
.legend-inline { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.legend-inline i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend-inline i.dash { width: 14px; height: 0; border-top: 2px dashed; border-radius: 0; }
.plan-row { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.plan-row:last-of-type { border-bottom: 0; }
.plan-label { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.plan-label .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-bar { height: 10px; border-radius: 99px; background: var(--chart-track); position: relative; overflow: hidden; }
.plan-fill { height: 100%; border-radius: inherit; transition: width .7s cubic-bezier(.2, .8, .2, 1); }
.plan-nums { display: flex; align-items: baseline; gap: 4px; font-size: 13px; flex-wrap: wrap; }
.plan-nums small { margin-inline-start: auto; color: var(--text-3); font-size: 12px; }
.plan-nums b.over { color: var(--bad); }
.plan-advice { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: linear-gradient(120deg, #faf5ff, #eff6ff); color: #4c1d95; font-size: 13.5px; line-height: 1.55; }
[data-theme="dark"] .plan-advice { background: linear-gradient(120deg, #23193f, #13233b); color: #ddd6fe; }
.plan-advice .ic { color: #a855f7; margin-top: 2px; }
.where-wrap { display: flex; align-items: center; gap: 22px; }
.donut-host { width: 200px; flex-shrink: 0; position: relative; display: grid; place-items: center; }
.legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.legend-row { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 8px; font-size: 13.5px; transition: opacity .15s; }
.legend-row.dim { opacity: .35; }
.legend-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; flex-shrink: 0; }
.legend-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-val { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.legend-pct { color: var(--text-3); font-size: 12px; width: 38px; text-align: end; }
.insight { display: flex; gap: 12px; padding: 11px 12px; border-radius: 12px; margin-bottom: 8px; background: var(--bg-soft); }
.insight b { font-size: 13.5px; }
.insight p { margin: 3px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.insight-ico { width: 32px; height: 32px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center; font-size: 16px; background: var(--bg); box-shadow: 0 0 0 1px var(--border); }
.insight.good { background: rgba(22, 163, 74, .07); }
.insight.warn { background: rgba(245, 158, 11, .1); }
.insight.bad { background: rgba(225, 29, 72, .07); }
.insight.info { background: rgba(59, 130, 246, .06); }
.brow { display: flex; gap: 12px; align-items: center; padding: 8px 0; }
.brow-ico, .bud-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; flex-shrink: 0; }
.brow-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.brow-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.brow-top b { font-weight: 600; }
.brow-foot { color: var(--text-3); font-size: 12px; }
.brow.over .brow-foot { color: var(--bad); font-weight: 500; }
.brow.near .brow-foot { color: #b45309; }
.up-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.up-row:last-child { border-bottom: 0; }
.up-date { width: 42px; height: 44px; border-radius: 10px; background: var(--bg-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: inset 0 0 0 1px var(--border); }
.up-date b { font-size: 16px; line-height: 1; } .up-date small { font-size: 10.5px; color: var(--text-3); margin-top: 2px; }
.up-name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 500; }
.up-name small { color: var(--text-3); font-weight: 400; font-size: 12px; }
.amount { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.amount.income { color: #16a34a; }
.amount.expense { color: var(--text); }
.goal-mini { display: flex; gap: 12px; align-items: center; padding: 8px 0; }
.goal-mini-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; flex-shrink: 0; }
.goal-mini-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.goal-mini-top { display: flex; justify-content: space-between; font-size: 13.5px; }
.goal-mini-top span { color: var(--text-2); font-weight: 600; }
.tx-row { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 10px; cursor: pointer; transition: background .12s; }
.tx-row:hover { background: var(--hover); }
.tx-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 18px; flex-shrink: 0; }
.tx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tx-main b { font-weight: 550; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-main small { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-note { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: var(--text-3); padding: 22px 10px; font-size: 13.5px; }
.tx-summary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-radius: 14px; background: var(--bg-soft); box-shadow: inset 0 0 0 1px var(--border); }
.tx-summary > div { display: flex; flex-direction: column; padding-inline-end: 18px; border-inline-end: 1px solid var(--border); }
.tx-summary > div:nth-child(4) { border-inline-end: 0; margin-inline-end: auto; }
.tx-summary small { color: var(--text-3); font-size: 12px; }
.tx-summary b { font-size: 18px; font-variant-numeric: tabular-nums; }
.tx-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tx-filters select { width: auto; min-width: 180px; }
.search-input { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 200px; position: relative; color: var(--text-3); }
.search-input .ic { position: absolute; inset-inline-start: 10px; }
.search-input .input { padding-inline-start: 32px; }
.tx-day { display: flex; justify-content: space-between; padding: 14px 8px 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.tx-day:first-child { padding-top: 6px; }
.tx-day .amount { font-weight: 600; font-size: 12.5px; }

/* transaction modal */
.tx-modal { padding: 22px 24px; }
.tx-form .seg-kind { margin-top: 12px; width: 100%; }
.tx-form .seg-kind .seg-btn { flex: 1; justify-content: center; height: 34px; }
.seg-btn.expense.active { color: #e11d48; }
.seg-btn.income.active { color: #16a34a; }
.amount-wrap { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 10px 16px; border-radius: 14px; background: var(--bg-soft); box-shadow: inset 0 0 0 1px var(--border); direction: ltr; }
.amount-wrap:focus-within { box-shadow: inset 0 0 0 2px var(--accent); background: var(--bg); }
.amount-cur { font-weight: 600; color: var(--text-3); font-size: 15px; }
.amount-cur select { border: 0; background: transparent; font-weight: 700; color: var(--text-2); font-size: 15px; outline: none; cursor: pointer; }
.amount-input { flex: 1; border: 0; outline: none; background: none; font-size: 34px; font-weight: 700; min-width: 0; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.amount-input.big { font-size: 44px; }
.is-income .amount-wrap:focus-within { box-shadow: inset 0 0 0 2px #16a34a; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; max-height: 236px; overflow-y: auto; padding: 2px; }
.cat-chip { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--border); font-size: 13px; text-align: start; transition: background .12s, box-shadow .12s; min-width: 0; }
.cat-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-chip:hover { background: var(--hover); }
.cat-chip.active { box-shadow: inset 0 0 0 2px var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); font-weight: 600; }
.cat-chip-ico { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; flex-shrink: 0; background: color-mix(in srgb, var(--c, #64748b) 16%, transparent); }
.cat-chip.add { color: var(--text-3); box-shadow: inset 0 0 0 1px var(--border-2); border: 0; }
.cat-chip.add .cat-chip-ico { background: var(--hover); }
.cat-name-row { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.cat-icon-btn { width: 46px; height: 46px; border-radius: 12px; font-size: 24px; flex-shrink: 0; display: grid; place-items: center; transition: transform .1s; }
.cat-icon-btn:hover { transform: scale(1.06); }
.color-row { display: flex; flex-wrap: wrap; gap: 7px; }
.color-dot { width: 22px; height: 22px; border-radius: 50%; transition: transform .1s; }
.color-dot:hover { transform: scale(1.15); }
.color-dot.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px currentColor; color: var(--text-2); }

/* budgets tab */
.budget-summary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bs-item { padding: 12px 18px; border-radius: 14px; background: var(--bg-soft); box-shadow: inset 0 0 0 1px var(--border); display: flex; flex-direction: column; min-width: 150px; }
.bs-item small { color: var(--text-3); font-size: 12px; }
.bs-item b { font-size: 19px; font-variant-numeric: tabular-nums; }
.bs-item.good { background: rgba(22, 163, 74, .08); box-shadow: inset 0 0 0 1px rgba(22, 163, 74, .2); }
.bs-item.good b { color: #15803d; }
.bs-item.bad { background: rgba(225, 29, 72, .07); box-shadow: inset 0 0 0 1px rgba(225, 29, 72, .2); }
.bs-item.bad b { color: #be123c; }
.bs-actions { display: flex; gap: 8px; margin-inline-start: auto; flex-wrap: wrap; }
.alloc-bar { display: flex; height: 30px; border-radius: 10px; overflow: hidden; gap: 2px; }
.alloc-seg { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 600; min-width: 4px; overflow: hidden; white-space: nowrap; transition: flex-grow .5s; }
.alloc-seg span { padding: 0 8px; overflow: hidden; text-overflow: ellipsis; }
.alloc-seg.free { background: repeating-linear-gradient(45deg, var(--hover), var(--hover) 6px, var(--hover-2) 6px, var(--hover-2) 12px); color: var(--text-2); }
.group-card .card-head h3 { font-size: 15px; }
.bud-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.bud-row:last-child { border-bottom: 0; }
.bud-ico { cursor: pointer; transition: transform .1s; }
.bud-ico:hover { transform: scale(1.07); }
.bud-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.bud-name b { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bud-spent { width: 120px; display: flex; flex-direction: column; align-items: flex-end; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.bud-spent small { color: var(--text-3); font-size: 11.5px; }
.bud-spent b.over { color: var(--bad); }
.bud-limit { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 9px; background: var(--bg-soft); box-shadow: inset 0 0 0 1px var(--border); width: 150px; direction: ltr; }
.bud-limit:focus-within { box-shadow: inset 0 0 0 2px var(--accent); background: var(--bg); }
.bud-limit span { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.budget-input { border: 0; outline: none; background: none; width: 100%; font-weight: 600; font-variant-numeric: tabular-nums; }
details.archived { color: var(--text-2); }
details.archived summary { cursor: pointer; padding: 6px 0; font-size: 13px; }

/* recurring */
.hint { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; margin: 0; }
.rec-row { display: flex; align-items: center; gap: 12px; padding: 9px 6px; border-radius: 10px; cursor: pointer; }
.rec-row:hover { background: var(--hover); }
.rec-row.paused { opacity: .55; }

/* goals */
.goals-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.goals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.goal-card { padding: 18px; border-radius: 18px; background: linear-gradient(160deg, color-mix(in srgb, var(--gc) 9%, var(--bg)), var(--bg) 70%); box-shadow: 0 0 0 1px color-mix(in srgb, var(--gc) 22%, transparent), var(--shadow-card); display: flex; flex-direction: column; gap: 12px; }
.goal-top { display: flex; gap: 14px; align-items: center; }
.goal-ring { position: relative; width: 88px; height: 88px; flex-shrink: 0; }
.goal-ring circle:last-child { transition: stroke-dashoffset 1s cubic-bezier(.2, .8, .2, 1); }
.goal-emoji { position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; }
.goal-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.goal-info > b { font-size: 16px; }
.goal-amt span { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.goal-pct { color: var(--text-2); font-size: 12.5px; }
.goal-need { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); background: var(--bg-soft); padding: 8px 10px; border-radius: 10px; }
.goal-need.done { color: #15803d; background: rgba(22, 163, 74, .1); font-weight: 600; }
.goal-actions { display: flex; gap: 6px; align-items: center; }
.goal-new { align-items: center; justify-content: center; min-height: 190px; color: var(--text-3); background: transparent; box-shadow: none; border: 1.5px dashed var(--border-2); gap: 8px; flex-direction: row; font-weight: 500; }
.goal-new:hover { color: var(--accent); border-color: var(--accent); }

/* onboarding */
.onboard { max-width: 680px; margin-top: 10px; }
.ob-card { margin-top: 22px; padding: 24px; border-radius: 20px; background: var(--bg); box-shadow: 0 0 0 1px var(--border), 0 24px 60px -30px rgba(15, 23, 42, .35); }
.ob-label { font-weight: 600; font-size: 14px; }
.ob-note { font-size: 13px; color: var(--text-2); line-height: 1.5; padding-top: 6px; }
.ob-head { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; font-size: 14px; }
.ob-head .ic { color: #a855f7; }
.ob-preview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ob-split { padding: 14px; border-radius: 14px; background: color-mix(in srgb, var(--c) 8%, var(--bg)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 20%, transparent); display: flex; flex-direction: column; gap: 4px; }
.ob-split-top { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.ob-split-top .muted { margin-inline-start: auto; }
.ob-split-val { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ob-split small { color: var(--text-3); font-size: 11.5px; line-height: 1.4; }
.fab { display: none; }

/* ------------------------------------------------------------ charts */
.chart { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart-host { width: 100%; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .axis.hl { fill: var(--text); font-weight: 600; }
.chart .guide { stroke: var(--border-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .line.draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.1s cubic-bezier(.4, 0, .2, 1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart .area { animation: fade .8s ease both; }
@keyframes fade { from { opacity: 0; } }
.chart .bar { transform-box: fill-box; transform-origin: bottom; animation: grow .6s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 45ms); }
@keyframes grow { from { transform: scaleY(0); } }
.bar-group.hot .bar { filter: brightness(.92); }
.donut-seg { transition: stroke-width .15s, opacity .15s; animation: fade .5s ease both; animation-delay: calc(var(--i) * 60ms); cursor: pointer; }
.donut.hovering .donut-seg:not(.hot) { opacity: .35; }
.donut-val { font-size: 22px; font-weight: 750; fill: var(--text); font-family: var(--font); }
.donut-lbl { font-size: 12px; fill: var(--text-3); font-family: var(--font); }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--bg-elev); box-shadow: var(--shadow-pop); border-radius: 8px; padding: 8px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 3px;
  opacity: 0; transform: translateY(4px); transition: opacity .1s, transform .1s; white-space: nowrap; }
.chart-tip.in { opacity: 1; transform: none; }
.chart-tip b { font-size: 12.5px; }
.chart-tip span { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.chart-tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* -------------------------------------------------------------- auth */
.auth { display: grid; grid-template-columns: minmax(360px, 1fr) 1.15fr; height: 100vh; height: 100dvh; overflow-y: auto; }
.auth-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; }
.auth-form h1 { font-size: 30px; margin: 10px 0 0; letter-spacing: -.01em; }
.auth-sub { color: var(--text-2); margin: 0 0 14px; line-height: 1.6; }
.auth-form .input { height: 42px; font-size: 15px; border-radius: 9px; }
.auth-logo span { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-size: 24px; font-weight: 700; background: linear-gradient(135deg, #2f6fec, #a855f7); box-shadow: 0 10px 24px -10px #6d5cf0; }
.auth-err { color: var(--danger); font-size: 13.5px; min-height: 18px; }
.auth-switch { text-align: center; color: var(--text-2); margin: 6px 0 0; }
.auth-switch a { color: var(--accent); font-weight: 600; text-decoration: none; }
.auth-lang { text-align: center; margin-top: 10px; }
.auth-lang button { color: var(--text-3); font-size: 13px; }
.auth-lang button:hover { color: var(--text); }
.auth-art { position: relative; overflow: hidden; background:
  radial-gradient(600px 400px at 20% 20%, #c7d2fe 0, transparent 60%),
  radial-gradient(600px 420px at 85% 30%, #fbcfe8 0, transparent 60%),
  radial-gradient(700px 500px at 50% 100%, #a7f3d0 0, transparent 60%), #f5f7ff; }
[data-theme="dark"] .auth-art { background: radial-gradient(600px 400px at 20% 20%, #312e81 0, transparent 60%), radial-gradient(600px 420px at 85% 30%, #831843 0, transparent 60%), radial-gradient(700px 500px at 50% 100%, #065f46 0, transparent 60%), #111; }
.art-card { position: absolute; background: rgba(255, 255, 255, .72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: 18px; padding: 16px 18px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 24px 50px -20px rgba(30, 41, 89, .35); color: #1f2937; animation: float 7s ease-in-out infinite; }
[data-theme="dark"] .art-card { background: rgba(30, 30, 30, .6); color: #eee; }
.art-card.a1 { top: 16%; inset-inline-start: 12%; animation-delay: -2s; }
.art-card.a2 { top: 36%; inset-inline-end: 12%; width: 250px; }
.art-card.a3 { bottom: 18%; inset-inline-start: 18%; animation-delay: -4s; }
@keyframes float { 50% { transform: translateY(-12px); } }
.art-row { display: flex; gap: 10px; align-items: center; font-size: 15px; }
.art-row span { font-size: 22px; }
.art-kpi small { display: block; font-size: 12px; opacity: .7; }
.art-kpi b { font-size: 28px; }
.art-bars { display: flex; gap: 8px; align-items: flex-end; height: 70px; margin-top: 10px; }
.art-bars i { flex: 1; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, #818cf8, #22c55e); }
.art-tags { display: flex; gap: 6px; margin-top: 10px; }
.art-title { position: absolute; bottom: 7%; inset-inline-end: 8%; text-align: end; display: flex; flex-direction: column; color: #1e1b4b; }
[data-theme="dark"] .art-title { color: #e0e7ff; }
.art-title b { font-size: 42px; letter-spacing: -.02em; }
.art-title span { opacity: .7; max-width: 300px; }

/* ---------------------------------------------------- shared page view */
.share-page .page-inner { padding-bottom: 80px; }
.share-foot { text-align: center; color: var(--text-3); font-size: 12px; padding: 30px 0; }

/* -------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
  .page-inner { padding: 0 48px; }
  .grid-2, .grid-2.wide-left { grid-template-columns: 1fr; }
  .home-quick { grid-template-columns: 1fr 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  #sidebar { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: min(300px, 86vw); box-shadow: var(--shadow-pop); }
  .layout.sb-collapsed #sidebar { margin-inline-start: calc(-1 * min(300px, 86vw) - 20px); }
  .layout:not(.sb-collapsed) .sb-scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 15; }
  .tb-menu { display: inline-grid !important; }
  .sb-collapse { opacity: 1; }
  .sb-resize { display: none; }
  .sb-actions { display: inline-flex; }
  .edited, .tb-right .btn.ghost { display: none; }
  .crumb-t { max-width: 140px; }
  .crumbs .crumb:not(:last-child), .crumbs .crumb-sep { display: none; }
  .page-inner { padding: 0 18px; }
  .page-icon { font-size: 60px; margin-top: 40px; }
  .cover { height: 22vh; min-height: 120px; }
  .cover + .page-inner .page-icon { margin-top: -32px; }
  .page-title { font-size: 30px; }
  .page-controls { opacity: 1; }
  .editor { font-size: 16px; }
  .blk-gutter { display: none; }
  .tpl-strip { margin-top: -100px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 21px; }
  .kpi-spark { display: none; }
  .grid-3 { grid-template-columns: 1fr; }
  .where-wrap { flex-direction: column; }
  .fin-head-tools { width: 100%; }
  .fin-head-tools .period { flex: 1; justify-content: space-between; }
  .fin-head-tools .btn { display: none; }
  .fab { display: grid; place-items: center; position: fixed; bottom: 20px; inset-inline-end: 20px; width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: #fff; box-shadow: 0 12px 28px -8px rgba(35, 131, 226, .7); z-index: 30; }
  .bud-row { flex-wrap: wrap; }
  .bud-spent { width: auto; }
  .bud-limit { width: 100%; }
  .ob-preview { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .settings { flex-direction: column; }
  .set-nav { width: auto; flex-direction: row; overflow-x: auto; }
  .set-body { padding: 16px; }
  .home .page-inner { padding-top: 30px; }
  .home-quick { grid-template-columns: 1fr; }
  .home-money-card { flex-direction: column; align-items: stretch; gap: 14px; }
  .hm-end { text-align: start; }
  .tx-summary > div { border: 0; padding: 0; min-width: 40%; }
  .modal-back { padding: 16px 10px; }
  .modal-box { padding: 18px; }
  .board-col { width: 240px; }
  .rp-name { width: 120px; }
  .db-search { width: 60px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Phone: folders drawer → notes list → note, one screen at a time (like Notes on iPhone). */
@media (max-width: 760px) {
  #list { width: 100%; border: 0; }
  .layout:not(.m-note) #main { display: none; }
  .layout.m-note #list { display: none; }
  .nl-back { display: inline-flex; }
  .nl-title { font-size: 30px; }
  .tb-back { display: inline-flex; }
  .tb-menu { display: none !important; }
  .save-state { display: none; }
  .topbar { padding: 0 8px; }
  .tb-group { padding: 0 2px; }
  .cover { margin: 0; border-radius: 0; height: 150px; }
  .note-stamp { margin-top: 2px; }
  .page-title { font-size: 26px; }
  .nl-row { padding: 12px 12px; }
}

/* ===================================================== budget analytics */
.reveal { opacity: 0; transform: translateY(18px) scale(.985); transition: opacity .7s cubic-bezier(.2, .8, .2, 1), transform .7s cubic-bezier(.2, .8, .2, 1); }
.reveal.in { opacity: 1; transform: none; }
.an-hero { display: grid; grid-template-columns: minmax(300px, 430px) 1fr; gap: 34px; align-items: center; padding: 26px 28px; border-radius: 24px; position: relative; overflow: hidden;
  background: radial-gradient(600px 300px at 0% 0%, #fff4c7 0, transparent 65%), radial-gradient(520px 320px at 100% 100%, #ffe1ef 0, transparent 60%), radial-gradient(500px 260px at 100% 0%, #dff3ff 0, transparent 60%), var(--bg);
  box-shadow: 0 0 0 1px var(--border), 0 30px 60px -40px rgba(120, 90, 0, .35); }
[data-theme="dark"] .an-hero { background: radial-gradient(600px 300px at 0% 0%, #3b3110 0, transparent 65%), radial-gradient(520px 320px at 100% 100%, #3a1a2a 0, transparent 60%), var(--bg-soft); }
.an-hero::before { content: ""; position: absolute; width: 380px; height: 380px; border-radius: 50%; inset-inline-end: -120px; top: -160px;
  background: conic-gradient(from 0deg, #ffd60a55, #ff9f0a44, #ff375f33, #bf5af233, #64d2ff44, #ffd60a55); filter: blur(40px); animation: spinSlow 18s linear infinite; }
@keyframes spinSlow { to { transform: rotate(360deg); } }
.an-hero > * { position: relative; }
.an-kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--gold-text); background: var(--accent-soft); padding: 4px 10px; border-radius: 99px; }
.an-headline { font-size: 30px; margin: 12px 0 6px; letter-spacing: -.02em; line-height: 1.2; }
[dir="rtl"] .an-headline { letter-spacing: 0; }
.an-lead { color: var(--text-2); margin: 0 0 18px; font-size: 15px; line-height: 1.6; }
.an-mini { display: flex; gap: 10px; flex-wrap: wrap; }
.an-mini-item { flex: 1; min-width: 140px; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--c) 8%, var(--bg)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 18%, transparent); }
.an-mini-ico { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: var(--c); box-shadow: 0 6px 14px -6px var(--c); flex-shrink: 0; }
.an-mini-item small { display: block; color: var(--text-2); font-size: 12px; }
.an-mini-item b { font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* tilting salary card */
.sc-wrap { perspective: 1100px; position: relative; padding: 8px 6px 26px; }
.salary-card { position: relative; aspect-ratio: 1.586; border-radius: 22px; transform-style: preserve-3d; transition: transform .35s cubic-bezier(.2, .8, .2, 1); will-change: transform;
  animation: floatCard 6s ease-in-out infinite; --mx: 30%; --my: 20%; }
.sc-wrap:hover .salary-card { animation-play-state: paused; }
@keyframes floatCard { 0%, 100% { translate: 0 0; rotate: 0deg; } 50% { translate: 0 -8px; rotate: -.6deg; } }
.sc-inner { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; padding: 20px 22px; display: flex; flex-direction: column; justify-content: space-between; color: #fff;
  background: linear-gradient(135deg, #ffb300 0%, #ff7a59 38%, #ff4f9a 68%, #8b5cf6 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.sc-inner::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, .28), transparent 55%), radial-gradient(80% 70% at 0% 100%, rgba(80, 40, 160, .35), transparent 60%); }
.sc-inner > * { position: relative; transform: translateZ(30px); }
.sc-inner > .sc-sheen { position: absolute; inset: -40%; transform: none; pointer-events: none;
  background: radial-gradient(circle at var(--mx) var(--my), rgba(255, 255, 255, .55), rgba(255, 255, 255, .08) 22%, transparent 45%); mix-blend-mode: soft-light; }
.sc-inner > .sc-glow { position: absolute; inset: 0; transform: none; pointer-events: none; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .35) 45%, transparent 60%); background-size: 250% 100%; animation: sheen 5s ease-in-out infinite; mix-blend-mode: overlay; }
@keyframes sheen { 0%, 60% { background-position: 150% 0; } 100% { background-position: -100% 0; } }
.sc-top, .sc-bottom { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.sc-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .02em; }
.sc-logo { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(255, 255, 255, .25); backdrop-filter: blur(6px); font-weight: 800; }
.sc-cycle { background: rgba(255, 255, 255, .2); padding: 3px 10px; border-radius: 99px; font-weight: 600; font-size: 12px; backdrop-filter: blur(6px); }
.sc-mid { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sc-mid small { opacity: .85; font-size: 12.5px; font-weight: 600; }
.sc-amount { font-size: clamp(24px, 3.2vw, 36px); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; text-shadow: 0 2px 12px rgba(80, 20, 60, .25); white-space: nowrap; }
.sc-sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.sc-ring-wrap { position: relative; width: 78px; height: 78px; flex-shrink: 0; }
.sc-ring { width: 100%; height: 100%; }
.sc-ring-fill { animation: ringIn 1.6s .3s cubic-bezier(.2, .8, .2, 1) forwards; }
@keyframes ringIn { to { stroke-dashoffset: var(--off); } }
.sc-ring-txt { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.sc-bottom b { font-size: 15px; }
.sc-chip { width: 38px; height: 28px; border-radius: 7px; background: linear-gradient(135deg, #fff6d0, #e9c46a 45%, #fff1b8 60%, #d4a72c); box-shadow: inset 0 0 0 1px rgba(120, 80, 0, .25); }
.sc-shadow { position: absolute; left: 12%; right: 12%; bottom: 4px; height: 26px; border-radius: 50%; background: radial-gradient(closest-side, rgba(150, 60, 120, .35), transparent); filter: blur(6px); animation: shadowPulse 6s ease-in-out infinite; }
@keyframes shadowPulse { 50% { transform: scaleX(.88); opacity: .7; } }

/* 3D stages */
.an-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 16px; }
.an-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.an-3d { overflow: hidden; }
.stage { position: relative; height: 300px; margin: -6px -10px 0; border-radius: 14px; }
.stage canvas { display: block; width: 100% !important; animation: fade .9s ease both; }
.stage.flat { display: grid; place-items: center; height: auto; margin: 0; }
.stage-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); }
.stage-ring { background: radial-gradient(closest-side, color-mix(in srgb, var(--gold) 12%, transparent), transparent 75%); }
.stage-towers { background: linear-gradient(180deg, transparent 55%, color-mix(in srgb, #8b5cf6 6%, transparent)); }
.ring-center { position: absolute; left: 50%; top: 47%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; z-index: 2; display: flex; flex-direction: column; }
.stage.flat .ring-center { display: none; }
.ring-center b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; text-shadow: 0 2px 10px var(--bg), 0 0 18px var(--bg); }
.ring-center small { color: var(--text-2); font-weight: 600; text-shadow: 0 0 10px var(--bg); }
.stage-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--bg-elev); box-shadow: var(--shadow-pop); border-radius: 10px; padding: 8px 11px; font-size: 12.5px;
  display: flex; flex-direction: column; gap: 3px; opacity: 0; transform: translateY(4px) scale(.98); transition: opacity .12s, transform .12s; white-space: nowrap; }
.stage-tip.in { opacity: 1; transform: none; }
.stage-tip span { color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.stage-tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.tw-label { position: absolute; left: 0; top: 0; font-size: 11.5px; color: var(--text-3); font-weight: 600; pointer-events: none; white-space: nowrap; will-change: transform; }
.tw-label.now { color: var(--text); background: var(--accent-soft); padding: 1px 8px; border-radius: 99px; }
.an-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; margin-top: 6px; }
.an-leg { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 5px 4px; animation: rise .6s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 60ms + .3s); }
.an-leg-dot { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 18%, transparent); box-shadow: inset 0 -2px 0 var(--c); font-size: 13px; flex-shrink: 0; }
.an-leg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-leg b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.an-leg small { color: var(--text-3); width: 34px; text-align: end; }

/* heat-map (drawn left-to-right, mirrored for Arabic so the newest week sits on the reading start) */
.hm-wrap { position: relative; overflow-x: auto; padding-bottom: 4px; direction: ltr; }
[dir="rtl"] .hm-wrap { transform: scaleX(-1); }
[dir="rtl"] .hm-months span, [dir="rtl"] .hm-tip { transform: scaleX(-1); }
.hm-months { display: grid; grid-template-columns: repeat(var(--cols), 16px); gap: 4px; height: 16px; font-size: 11px; color: var(--text-3); min-width: max-content; }
.hm-months span { grid-column: calc(var(--col) + 1) / span 3; grid-row: 1; white-space: nowrap; }
.hm-grid { display: grid; grid-template-columns: repeat(var(--cols), 16px); gap: 4px; min-width: max-content; }
.hm-col { display: grid; grid-template-rows: repeat(7, 16px); gap: 4px; }
.hm-cell { width: 16px; height: 16px; border-radius: 5px; background: var(--chart-track); display: inline-block; animation: pop .45s cubic-bezier(.2, .8, .2, 1.4) both; animation-delay: var(--d, 0ms); transition: transform .12s; }
.hm-cell:not(.blank):hover { transform: scale(1.35); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--text-2); position: relative; z-index: 2; }
.hm-cell.blank { background: none; }
.hm-cell.l1 { background: #fff1b3; } .hm-cell.l2 { background: #ffd65a; } .hm-cell.l3 { background: #ffaa33; } .hm-cell.l4 { background: #ff6b4a; } .hm-cell.l5 { background: #e0245e; }
[data-theme="dark"] .hm-cell.l1 { background: #5a4a10; }
@keyframes pop { from { transform: scale(0); opacity: 0; } }
.hm-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--bg-elev); box-shadow: var(--shadow-pop); border-radius: 9px; padding: 7px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 2px; opacity: 0; transition: opacity .12s; white-space: nowrap; }
.hm-tip.in { opacity: 1; }
.hm-tip span { color: var(--text-2); }
.hm-scale { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: 12px; font-size: 11.5px; color: var(--text-3); }
.hm-scale .hm-cell { width: 13px; height: 13px; border-radius: 4px; animation: none; }
.hm-scale span:first-child { margin-inline-end: 4px; }
.hm-scale span:last-child { margin-inline-start: 4px; }

/* weekly rhythm */
.rh-bars { display: flex; align-items: flex-end; gap: 10px; height: 210px; padding-top: 18px; }
.rh-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.rh-bar { width: 100%; max-width: 34px; height: var(--h); min-height: 4px; border-radius: 10px 10px 6px 6px; background: linear-gradient(180deg, #c4b5fd, #8b5cf6);
  transform-origin: bottom; animation: growY .9s cubic-bezier(.2, .8, .2, 1.2) both; animation-delay: calc(var(--i) * 70ms + .2s); box-shadow: 0 8px 18px -10px #8b5cf6; }
@keyframes growY { from { transform: scaleY(0); } }
.rh-col.top .rh-bar { background: linear-gradient(180deg, #ffd60a, #ff7a59); box-shadow: 0 10px 22px -10px #ff7a59; }
.rh-val { font-size: 11px; color: var(--text-3); font-weight: 600; }
.rh-col.top .rh-val { color: var(--text); }
.rh-day { font-size: 12px; color: var(--text-2); font-weight: 600; }

/* top places */
.pl-row { display: flex; gap: 12px; align-items: center; padding: 7px 0; animation: rise .6s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 70ms + .2s); }
.pl-rank { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--text-2); background: var(--hover); flex-shrink: 0; }
.pl-row:first-child .pl-rank { background: linear-gradient(135deg, #ffe066, var(--gold)); color: var(--gold-ink); }
.pl-body { flex: 1; min-width: 0; }
.pl-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.pl-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pl-top span { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl-bar { height: 7px; border-radius: 99px; background: var(--chart-track); margin: 6px 0 3px; overflow: hidden; }
.pl-bar i { display: block; height: 100%; width: var(--w); border-radius: inherit; background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 55%, #fff)); transform-origin: left; animation: growX 1s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 80ms + .3s); }
[dir="rtl"] .pl-bar i { background: linear-gradient(270deg, var(--c), color-mix(in srgb, var(--c) 55%, #fff)); transform-origin: right; }
@keyframes growX { from { transform: scaleX(0); } }
.pl-body small { color: var(--text-3); font-size: 11.5px; }

/* movers */
.mv-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); animation: rise .6s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 70ms + .2s); }
.mv-row:last-child { border-bottom: 0; }
.mv-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; flex-shrink: 0; }
.mv-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mv-body b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-body small { color: var(--text-3); font-size: 11.5px; }
.mv-chip { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.mv-chip.up { color: #be123c; background: rgba(225, 29, 72, .1); }
.mv-chip.down { color: #15803d; background: rgba(22, 163, 74, .12); }

@media (max-width: 1180px) { .an-grid3 { grid-template-columns: 1fr 1fr; } .an-grid3 > :last-child { grid-column: 1 / -1; } }
@media (max-width: 960px) { .an-hero { grid-template-columns: 1fr; } .an-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .an-hero { padding: 16px; gap: 18px; border-radius: 18px; }
  .an-headline { font-size: 24px; }
  .an-grid3 { grid-template-columns: 1fr; }
  .stage { height: 260px; }
  .an-legend { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* iPad-sized screens: folders slide over the list (like Notes on iPad); list and note keep the width. */
@media (min-width: 761px) and (max-width: 1100px) {
  .layout { --lw: 290px; }
  #sidebar { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; box-shadow: var(--shadow-pop); }
  .layout.sb-collapsed #sidebar { margin-inline-start: calc(-1 * var(--sbw) - 24px); }
  .layout:not(.sb-collapsed) .sb-scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .18); z-index: 15; }
  .sb-resize { display: none; }
  .page-inner { padding: 0 32px; }
  .kpis { grid-template-columns: 1fr 1fr; }
}
/* Notch and home-bar safe areas when opened from the home screen. */
@supports (padding: env(safe-area-inset-top)) {
  .topbar, .nl-head, .sb-head { padding-top: max(0px, env(safe-area-inset-top)); }
  .topbar { height: calc(52px + env(safe-area-inset-top)); }
  .fab { bottom: calc(20px + env(safe-area-inset-bottom)); }
  .nl-scroll, .main-scroll { padding-bottom: env(safe-area-inset-bottom); }
}

/* ------------------------------------------------------- users (admin) */
.us-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.us-head h3 { border: 0; padding: 0; margin: 0; }
.us-note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text-2); background: var(--accent-soft); padding: 10px 12px; border-radius: 10px; margin: 14px 0; line-height: 1.55; }
.us-note .ic { color: var(--gold-text); margin-top: 2px; }
.us-list { display: flex; flex-direction: column; }
.us-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.us-row:last-child { border-bottom: 0; }
.us-row.off { opacity: .55; }
.us-avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: var(--gold-ink); background: linear-gradient(160deg, #ffe680, var(--gold)); flex-shrink: 0; }
.us-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.us-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.us-main small { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; text-align: start; }
.us-seen { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.badge { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--hover-2); color: var(--text-2); }
.badge.gold { background: var(--accent-soft); color: var(--gold-text); }
.badge.red { background: rgba(255, 59, 48, .12); color: #d70015; }
.badge.blue { background: rgba(0, 122, 255, .1); color: #0060df; }
.us-pass { display: flex; gap: 6px; }
.us-pass .input { font-family: var(--font-mono); letter-spacing: .04em; }
.us-share { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--bg-soft); box-shadow: inset 0 0 0 1px var(--border); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.us-share pre { margin: 0; white-space: pre-wrap; font-family: var(--font); font-size: 13.5px; line-height: 1.6; width: 100%; }
.us-warn { color: #d70015; background: rgba(255, 59, 48, .08); padding: 10px 12px; border-radius: 10px; font-size: 13.5px; line-height: 1.55; }
.empty-ico.sm { width: 52px; height: 52px; border-radius: 15px; margin-bottom: 8px; }
@media (max-width: 760px) { .us-seen { display: none; } }
