/* LenDen app — fixed palette, theme-independent. */
:root {
  --ld-primary: #0F766E;
  --ld-accent: #F59E0B;
  --ld-primary-d: color-mix(in srgb, var(--ld-primary) 80%, #000);
  --ld-primary-l: color-mix(in srgb, var(--ld-primary) 11%, #fff);
  --ld-primary-t: var(--ld-primary);
  --ld-ink: #0F2A26;
  --ld-ink-2: #3B524D;
  --ld-muted: #6B7F7B;
  --ld-bg: #F3F6F5;
  --ld-card: #FFFFFF;
  --ld-card-2: #F6F9F8;
  --ld-line: #DCE5E2;
  --ld-in: #15803D;
  --ld-in-bg: #E7F5EC;
  --ld-out: #DC2626;
  --ld-out-bg: #FDECEC;
  --ld-warn: #B45309;
  --ld-warn-bg: #FEF3DC;
  --ld-info: #1D4ED8;
  --ld-info-bg: #E8EFFD;
  --ld-r: 16px;
  --ld-shadow: 0 1px 2px rgba(15, 42, 38, .05), 0 8px 24px rgba(15, 42, 38, .07);
  --ld-font: 'Hind Siliguri', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ld-top-h: 56px;
  --ld-tabs-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
[data-theme="dark"] {
  --ld-primary-l: color-mix(in srgb, var(--ld-primary) 24%, #12211E);
  --ld-primary-t: color-mix(in srgb, var(--ld-primary) 50%, #fff);
  --ld-ink: #E4EEEB;
  --ld-ink-2: #B6C8C3;
  --ld-muted: #8AA09A;
  --ld-bg: #0B1614;
  --ld-card: #12211E;
  --ld-card-2: #172A26;
  --ld-line: #243A34;
  --ld-in: #4ADE80;
  --ld-in-bg: #11301F;
  --ld-out: #F87171;
  --ld-out-bg: #3A1818;
  --ld-warn: #FBBF24;
  --ld-warn-bg: #362A0F;
  --ld-info: #93C5FD;
  --ld-info-bg: #152440;
  --ld-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.ld-body { margin: 0; background: var(--ld-bg); color: var(--ld-ink); font-family: var(--ld-font); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
body.ld-noscroll { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4, p, ul, ol, dl, dd, blockquote { margin: 0; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.ld-ic { flex: none; display: block; }
:focus-visible { outline: 2px solid var(--ld-primary); outline-offset: 2px; }
.in { color: var(--ld-in); }
.out { color: var(--ld-out); }
.ld-muted { color: var(--ld-muted); }
.danger { color: var(--ld-out); }

/* ---------- Splash ---------- */
.ld-splash { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; }
.ld-splash-mark { width: 64px; height: 64px; border-radius: 18px; background: var(--ld-primary); color: #fff; display: grid; place-items: center; font-size: 36px; font-weight: 700; }
.ld-splash-logo { height: 56px; width: auto; }
.ld-spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--ld-line); border-top-color: var(--ld-primary); animation: ld-spin .8s linear infinite; }
@keyframes ld-spin { to { transform: rotate(360deg); } }

/* ---------- Brand ---------- */
.ld-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.ld-brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--ld-primary); color: #fff; display: grid; place-items: center; font-size: 20px; font-weight: 700; flex: none; }
.ld-brand-mark.lg { width: 42px; height: 42px; font-size: 24px; border-radius: 12px; }
.ld-brand-logo { height: 32px; width: auto; }
.ld-brand-logo.lg { height: 42px; }
.ld-top-brand { display: inline-flex; align-items: center; gap: 8px; }
.ld-top-brand .ld-brand-mark { width: 28px; height: 28px; font-size: 16px; border-radius: 8px; }
.ld-top-brand .ld-brand-logo { height: 28px; }

/* ---------- Layout ---------- */
.ld-app { min-height: 100vh; min-height: 100dvh; }
.ld-side { display: none; }
.ld-main { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(var(--ld-tabs-h) + var(--safe-b) + 16px); }
.ld-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px; height: calc(var(--ld-top-h) + var(--safe-t)); padding: var(--safe-t) 10px 0; background: color-mix(in srgb, var(--ld-bg) 86%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); }
.ld-top-me { display: flex; padding: 0 4px; }
.ld-top-title { flex: 1; min-width: 0; font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; }
.ld-top-actions { display: flex; gap: 2px; }
.ld-view { padding: 8px 16px 24px; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.ld-icon-btn { position: relative; width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; color: var(--ld-ink-2); flex: none; }
.ld-icon-btn:hover { background: var(--ld-card-2); }
.ld-icon-btn:disabled { opacity: .3; cursor: default; }
.ld-icon-btn.danger { color: var(--ld-out); }
.ld-icon-btn-bordered { border: 1px solid var(--ld-line); background: var(--ld-card); width: 46px; height: 46px; }

.ld-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--ld-tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--ld-card); border-top: 1px solid var(--ld-line); }
.ld-tabs a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 500; color: var(--ld-muted); transition: color .22s ease, background-color .22s ease; }
.ld-tabs a.active { color: var(--ld-primary-t); }
.ld-tabs a::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--ld-primary); opacity: 0; transform: scaleX(.45); transition: opacity .22s ease, transform .22s cubic-bezier(.2, .8, .2, 1); }
.ld-tabs a.active::before { opacity: 1; transform: scaleX(1); }
.ld-tabs a .ld-ic { transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
.ld-tabs a.active .ld-ic { transform: translateY(-2px); }
.ld-tab-plus { align-self: center; justify-self: center; width: 52px; height: 52px; border-radius: 16px; background: var(--ld-primary); color: #fff; display: grid; place-items: center; transform: translateY(-12px); box-shadow: 0 8px 18px color-mix(in srgb, var(--ld-primary) 38%, transparent); }
.ld-badge-n { position: absolute; top: 6px; left: calc(50% + 5px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--ld-out); color: #fff; font-size: 11px; font-style: normal; font-weight: 600; line-height: 18px; text-align: center; }
.ld-dot { position: absolute; top: 8px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--ld-out); border: 2px solid var(--ld-bg); }

@media (min-width: 960px) {
  .ld-app { display: grid; grid-template-columns: 264px 1fr; }
  .ld-side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; padding: 22px 16px; background: var(--ld-card); border-right: 1px solid var(--ld-line); }
  .ld-side > .ld-brand { padding: 0 6px; }
  .ld-tabs { display: none; }
  .ld-main { padding-bottom: 48px; }
  .ld-top { height: 68px; padding: 0 28px; }
  .ld-top-me { display: none !important; }
  .ld-view { padding: 12px 28px 48px; }
}
.ld-side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.ld-side-link { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--ld-ink-2); font-weight: 500; transition: color .2s ease, background-color .2s ease; }
.ld-side-link:hover { background: var(--ld-card-2); }
.ld-side-link.active { background: var(--ld-primary-l); color: var(--ld-primary-t); font-weight: 600; }
.ld-side-link .ld-badge-n { position: static; margin-left: auto; }
.ld-side-me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; border: 1px solid var(--ld-line); min-width: 0; }
.ld-side-me.active { border-color: var(--ld-primary); }
.ld-side-me span { min-width: 0; }
.ld-side-me strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-side-me small { display: block; color: var(--ld-muted); font-size: 12.5px; }

/* ---------- Avatar ---------- */
.ld-av { border-radius: 50%; object-fit: cover; flex: none; background: var(--ld-card-2); }
.ld-av-i { display: inline-grid; place-items: center; font-weight: 600; background: hsl(var(--h) 45% 88%); color: hsl(var(--h) 50% 26%); }
[data-theme="dark"] .ld-av-i { background: hsl(var(--h) 28% 24%); color: hsl(var(--h) 60% 84%); }

/* ---------- Buttons ---------- */
.ld-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; font-weight: 600; font-size: 15px; border: 1.5px solid transparent; transition: background .15s, border-color .15s, transform .06s; white-space: nowrap; --spin: var(--ld-primary); }
.ld-btn:active { transform: scale(.98); }
.ld-btn:disabled { opacity: .55; cursor: not-allowed; }
.ld-btn-primary { background: var(--ld-primary); color: #fff; --spin: #fff; }
.ld-btn-primary:hover { background: var(--ld-primary-d); }
.ld-btn-outline { border-color: var(--ld-primary); color: var(--ld-primary-t); }
.ld-btn-outline:hover { background: var(--ld-primary-l); }
.ld-btn-ghost { color: var(--ld-ink-2); background: var(--ld-card-2); border-color: var(--ld-line); }
.ld-btn-ghost.danger { color: var(--ld-out); }
.ld-btn-soft { background: var(--ld-primary-l); color: var(--ld-primary-t); }
.ld-btn-danger { background: var(--ld-out); color: #fff; --spin: #fff; }
.ld-btn-block { width: 100%; }
.ld-btn-lg { min-height: 52px; font-size: 16px; border-radius: 14px; }
.ld-btn.sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; gap: 5px; }
.ld-btn.is-busy { color: transparent !important; }
.ld-btn.is-busy > * { visibility: hidden; }
.ld-btn.is-busy::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--spin); border-right-color: transparent; animation: ld-spin .7s linear infinite; }
.ld-link { color: var(--ld-primary-t); font-weight: 600; font-style: normal; }

/* ---------- Forms ---------- */
.ld-form { display: flex; flex-direction: column; gap: 14px; }
.ld-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ld-label { display: block; font-size: 13.5px; font-weight: 600; color: var(--ld-ink-2); }
.ld-hint { font-size: 12.5px; color: var(--ld-muted); }
.ld-hint .ok { color: var(--ld-in); }
.ld-hint .bad { color: var(--ld-out); }
.ld-field input, .ld-field textarea, .ld-field select, .ld-prefix, .ld-money, .ld-pw { width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--ld-line); border-radius: 12px; background: var(--ld-card); font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s; }
.ld-field textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.ld-field input:focus, .ld-field textarea:focus, .ld-prefix:focus-within, .ld-money:focus-within, .ld-pw:focus-within { border-color: var(--ld-primary); box-shadow: 0 0 0 3px var(--ld-primary-l); }
.ld-field input:disabled { opacity: .6; }
.ld-prefix, .ld-money, .ld-pw { display: flex; align-items: center; padding: 0 0 0 14px; }
.ld-field .ld-prefix input, .ld-field .ld-money input, .ld-field .ld-pw input { flex: 1; min-width: 0; border: 0; min-height: 45px; padding: 0 14px 0 6px; background: transparent; box-shadow: none; }
.ld-field .ld-pw input { padding-left: 0; }
.ld-prefix em, .ld-money em { font-style: normal; color: var(--ld-muted); font-weight: 600; }
.ld-pw-eye { width: 46px; height: 45px; display: grid; place-items: center; color: var(--ld-muted); }
.ld-money input { font-weight: 600; font-variant-numeric: tabular-nums; }
.ld-check { display: flex; align-items: center; gap: 10px; font-size: 14.5px; cursor: pointer; }
.ld-check input { width: 18px; height: 18px; accent-color: var(--ld-primary); margin: 0; }
.ld-grid2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 400px) { .ld-grid2 { grid-template-columns: 1fr 1fr; gap: 12px; } }
.ld-row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.ld-card { background: var(--ld-card); border: 1px solid var(--ld-line); border-radius: var(--ld-r); padding: 16px; }
.ld-picker { width: 100%; min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 1.5px dashed var(--ld-primary); border-radius: 14px; color: var(--ld-primary-t); font-weight: 600; background: var(--ld-primary-l); }

/* ---------- Sections, lists ---------- */
.ld-section { display: flex; flex-direction: column; gap: 10px; }
.ld-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ld-section-head h3 { font-size: 16.5px; font-weight: 600; }
.ld-list { display: flex; flex-direction: column; background: var(--ld-card); border: 1px solid var(--ld-line); border-radius: var(--ld-r); overflow: hidden; }
.ld-list > * + * { border-top: 1px solid var(--ld-line); }
.ld-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; text-align: left; }
a.ld-row:hover, button.ld-row:hover, .ld-row-link:hover { background: var(--ld-card-2); }
.ld-row-link { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; margin: -12px 0 -12px -14px; padding: 12px 0 12px 14px; }
.ld-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ld-row-body strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-row-body span { font-size: 13px; color: var(--ld-muted); overflow: hidden; text-overflow: ellipsis; }
.ld-row-end { display: flex; align-items: center; gap: 6px; flex: none; font-weight: 700; }
.ld-sheet-list { max-height: 55vh; overflow-y: auto; }

.ld-badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; font-style: normal; line-height: 1.7; white-space: nowrap; vertical-align: middle; }
.ld-badge-ok { background: var(--ld-in-bg); color: var(--ld-in); }
.ld-badge-warn { background: var(--ld-warn-bg); color: var(--ld-warn); }
.ld-badge-danger { background: var(--ld-out-bg); color: var(--ld-out); }
.ld-badge-muted { background: var(--ld-card-2); color: var(--ld-muted); border: 1px solid var(--ld-line); }
.ld-badge-accent { background: color-mix(in srgb, var(--ld-accent) 22%, transparent); color: #92400E; }
[data-theme="dark"] .ld-badge-accent { color: var(--ld-accent); }

.ld-callout { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; font-size: 14px; line-height: 1.45; }
.ld-callout > p, .ld-callout > span { flex: 1; }
.ld-callout.info { background: var(--ld-info-bg); color: var(--ld-info); }
.ld-callout.warn { background: var(--ld-warn-bg); color: var(--ld-warn); }
.ld-callout.danger { background: var(--ld-out-bg); color: var(--ld-out); }
.ld-callout.ok { background: var(--ld-in-bg); color: var(--ld-in); }
.ld-soft { display: flex; align-items: center; gap: 8px; padding: 14px; border: 1px dashed var(--ld-line); border-radius: 14px; color: var(--ld-muted); font-size: 14px; }
.ld-note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ld-muted); line-height: 1.55; }
.ld-note .ld-ic { margin-top: 2px; }
.ld-note.center { justify-content: center; text-align: center; display: block; }
.ld-note a { color: var(--ld-primary-t); font-weight: 600; }

/* ---------- Home ---------- */
.ld-hero { position: relative; overflow: hidden; border-radius: 22px; padding: 18px 18px 16px 30px; color: #fff; background-color: var(--ld-primary); background-image: repeating-linear-gradient(to bottom, transparent 0 27px, rgba(255, 255, 255, .08) 27px 28px), linear-gradient(140deg, var(--ld-primary), var(--ld-primary-d)); }
.ld-hero::before { content: ""; position: absolute; top: 0; bottom: 0; left: 16px; width: 2px; background: color-mix(in srgb, var(--ld-accent) 70%, transparent); }
.ld-hero-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ld-hero-top p { opacity: .82; font-size: 14px; }
.ld-hero-top h2 { font-size: 22px; font-weight: 700; line-height: 1.3; }
.ld-hero-av .ld-av { box-shadow: 0 0 0 2px rgba(255, 255, 255, .5); }
.ld-hero-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.ld-hero-split a { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); }
.ld-hero-split span { font-size: 13px; opacity: .85; }
.ld-hero-split strong { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.ld-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ld-quick > * { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; background: var(--ld-card); border: 1px solid var(--ld-line); border-radius: 14px; font-size: 13px; font-weight: 500; color: var(--ld-ink-2); }
.ld-quick > *:hover { border-color: var(--ld-primary); }
.ld-quick .ld-ic { color: var(--ld-primary-t); }
.ld-trio { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--ld-card); border: 1px solid var(--ld-line); border-radius: var(--ld-r); }
.ld-trio > div { padding: 12px 14px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ld-trio > div + div { border-left: 1px solid var(--ld-line); }
.ld-trio span { font-size: 12.5px; color: var(--ld-muted); }
.ld-trio b { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Ledger ---------- */
.ld-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ld-stat { display: flex; flex-direction: column; padding: 14px 16px; border-radius: var(--ld-r); }
.ld-stat.in { background: var(--ld-in-bg); }
.ld-stat.out { background: var(--ld-out-bg); }
.ld-stat span { font-size: 13px; color: var(--ld-ink-2); }
.ld-stat strong { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ld-searchbar { display: flex; align-items: center; gap: 10px; padding: 0 14px; min-height: 46px; background: var(--ld-card); border: 1.5px solid var(--ld-line); border-radius: 14px; color: var(--ld-muted); }
.ld-searchbar:focus-within { border-color: var(--ld-primary); }
.ld-searchbar input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 16px; min-height: 44px; color: var(--ld-ink); }
.ld-searchbar.lg { min-height: 54px; }
.ld-searchbar.as-link span { font-size: 15px; }
.ld-net { display: flex; flex-direction: column; align-items: flex-end; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.ld-net small { font-size: 11.5px; font-weight: 500; color: var(--ld-muted); }
.ld-net.zero { color: var(--ld-muted); font-weight: 500; font-size: 13px; }

.ld-txn { display: flex; gap: 12px; padding: 12px 14px; align-items: flex-start; }
.ld-txn:hover { background: var(--ld-card-2); }
.ld-txn.need { background: color-mix(in srgb, var(--ld-warn-bg) 60%, var(--ld-card)); }
.ld-txn-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--ld-card-2); color: var(--ld-muted); }
.ld-txn-ic.in { background: var(--ld-in-bg); color: var(--ld-in); }
.ld-txn-ic.out { background: var(--ld-out-bg); color: var(--ld-out); }
.ld-txn-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ld-txn-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ld-txn-line strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ld-txn-sub { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ld-muted); }
.ld-txn-sub span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-txn-sub time { white-space: nowrap; flex: none; }
.ld-txn-foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 5px; }
.ld-due { font-size: 12px; color: var(--ld-warn); font-weight: 600; }

.ld-person { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--ld-card); border: 1px solid var(--ld-line); border-radius: var(--ld-r); width: 100%; text-align: left; }
.ld-person > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ld-person strong { font-weight: 600; }
.ld-person span { font-size: 13px; color: var(--ld-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-person > .ld-ic { color: var(--ld-muted); }
.ld-person.sm { padding: 10px 12px; }
.ld-balance { position: relative; display: flex; flex-direction: column; padding: 18px; border-radius: 20px; background: var(--ld-card); border: 1px solid var(--ld-line); }
.ld-balance > span { font-size: 14px; color: var(--ld-ink-2); }
.ld-balance > strong { font-size: 34px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.ld-balance.in { background: var(--ld-in-bg); border-color: transparent; }
.ld-balance.out { background: var(--ld-out-bg); border-color: transparent; }
.ld-balance.in > strong { color: var(--ld-in); }
.ld-balance.out > strong { color: var(--ld-out); }
.ld-balance.zero > strong { color: var(--ld-muted); }
.ld-balance-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 10px; font-size: 13px; color: var(--ld-ink-2); }
.ld-balance-meta b { font-weight: 600; color: var(--ld-ink); }
.ld-balance.sm { flex-direction: row; justify-content: space-between; align-items: center; padding: 14px 18px; }
.ld-balance.sm > strong { font-size: 22px; }

.ld-seg { display: flex; gap: 4px; padding: 4px; background: var(--ld-card-2); border: 1px solid var(--ld-line); border-radius: 14px; }
.ld-seg button { flex: 1; min-height: 38px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--ld-muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; white-space: nowrap; transition: color .2s ease, background-color .2s ease, box-shadow .2s ease; }
.ld-seg button.on { background: var(--ld-card); color: var(--ld-ink); box-shadow: 0 1px 3px rgba(15, 42, 38, .1); }
.ld-seg.sm button { min-height: 32px; font-size: 13px; }
.ld-seg.scroll { overflow-x: auto; scrollbar-width: none; }
.ld-seg.scroll::-webkit-scrollbar { display: none; }
.ld-seg.scroll button { flex: 1 0 auto; }
.ld-seg-type button.on[data-type="expense"] { color: var(--ld-out); }
.ld-seg-type button.on[data-type="income"] { color: var(--ld-in); }
.ld-seg.is-locked { opacity: .6; pointer-events: none; }

/* New transaction */
.ld-dir-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ld-dir { position: relative; }
.ld-dir.in, .ld-dir.out { color: var(--ld-ink); }
.ld-dir input { position: absolute; opacity: 0; pointer-events: none; }
.ld-dir > span { display: flex; flex-direction: column; gap: 1px; height: 100%; padding: 12px; border: 1.5px solid var(--ld-line); border-radius: 14px; background: var(--ld-card); cursor: pointer; transition: border-color .15s, background .15s; }
.ld-dir .ld-ic { color: var(--ld-muted); margin-bottom: 6px; }
.ld-dir strong { font-size: 15px; font-weight: 600; }
.ld-dir small { font-size: 12px; color: var(--ld-muted); line-height: 1.4; }
.ld-dir.in input:checked + span { border-color: var(--ld-in); background: var(--ld-in-bg); }
.ld-dir.out input:checked + span { border-color: var(--ld-out); background: var(--ld-out-bg); }
.ld-dir.in input:checked + span .ld-ic { color: var(--ld-in); }
.ld-dir.out input:checked + span .ld-ic { color: var(--ld-out); }
.ld-dir input:focus-visible + span { outline: 2px solid var(--ld-primary); outline-offset: 2px; }
.ld-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ld-chips button { padding: 5px 12px; border-radius: 999px; background: var(--ld-card-2); border: 1px solid var(--ld-line); font-size: 13px; font-weight: 500; }
.ld-summary { padding: 12px 14px; border-radius: 12px; background: var(--ld-primary-l); font-size: 14px; }
.ld-summary b { color: var(--ld-primary-t); }
.ld-summary .bad { color: var(--ld-out); font-weight: 600; }

/* ---------- Transaction slip (signature element) ---------- */
.ld-slip { position: relative; background: var(--ld-card); border: 1px solid var(--ld-line); border-radius: 20px; padding: 18px 18px 6px; box-shadow: var(--ld-shadow); }
.ld-slip-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ld-ref { font-size: 13px; color: var(--ld-muted); font-weight: 600; letter-spacing: .03em; font-variant-numeric: tabular-nums; }
.ld-slip-dir { margin-top: 16px; font-size: 14.5px; color: var(--ld-ink-2); }
.ld-slip-amt { font-size: 42px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ld-slip.rejected .ld-slip-amt, .ld-slip.cancelled .ld-slip-amt { text-decoration: line-through; opacity: .45; }
.ld-slip-split { display: flex; gap: 28px; margin-top: 10px; }
.ld-slip-split div { display: flex; flex-direction: column; }
.ld-slip-split span { font-size: 12.5px; color: var(--ld-muted); }
.ld-slip-split b { font-size: 16px; font-variant-numeric: tabular-nums; }
.ld-stamp { position: absolute; top: 58px; right: 16px; padding: 3px 14px; border: 3px double var(--ld-in); border-radius: 10px; color: var(--ld-in); font-size: 24px; font-weight: 700; letter-spacing: .04em; transform: rotate(-12deg); opacity: .88; animation: ld-stamp .38s cubic-bezier(.2, 1.5, .4, 1) both; pointer-events: none; }
@keyframes ld-stamp { from { transform: rotate(-12deg) scale(1.9); opacity: 0; } to { transform: rotate(-12deg) scale(1); opacity: .88; } }
.ld-slip-tear { position: relative; margin: 18px -18px 12px; border-top: 2px dashed var(--ld-line); }
.ld-slip-tear::before, .ld-slip-tear::after { content: ""; position: absolute; top: -11px; width: 20px; height: 20px; border-radius: 50%; background: var(--ld-bg); border: 1px solid var(--ld-line); }
.ld-slip-tear::before { left: -11px; clip-path: inset(0 0 0 50%); }
.ld-slip-tear::after { right: -11px; clip-path: inset(0 50% 0 0); }
.ld-slip-party { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; }
.ld-slip-party > div { flex: 1; display: flex; flex-direction: column; }
.ld-slip-party small { font-size: 12.5px; color: var(--ld-muted); }
.ld-slip-party strong { font-weight: 600; }
.ld-slip-party > .ld-ic { color: var(--ld-muted); }
.ld-dl { border-top: 1px solid var(--ld-line); }
.ld-dl > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; font-size: 14px; }
.ld-dl > div + div { border-top: 1px dashed var(--ld-line); }
.ld-dl dt { color: var(--ld-muted); flex: none; }
.ld-dl dd { text-align: right; font-weight: 500; word-break: break-word; }

.ld-mismatch { border-radius: 18px; padding: 16px; background: var(--ld-out-bg); border: 1px solid color-mix(in srgb, var(--ld-out) 28%, transparent); color: var(--ld-ink); }
.ld-mismatch.revision { background: var(--ld-warn-bg); border-color: color-mix(in srgb, var(--ld-warn) 30%, transparent); }
.ld-mismatch-head { display: flex; align-items: center; gap: 8px; color: var(--ld-out); margin-bottom: 12px; font-size: 16px; }
.ld-mismatch.revision .ld-mismatch-head { color: var(--ld-warn); }
.ld-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ld-compare > div { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 12px; background: var(--ld-card); min-width: 0; }
.ld-compare small { font-size: 12px; color: var(--ld-muted); line-height: 1.35; }
.ld-compare b { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ld-compare span { font-size: 12.5px; color: var(--ld-ink-2); }
.ld-compare .new { box-shadow: inset 0 0 0 2px var(--ld-out); }
.ld-mismatch.revision .ld-compare .new { box-shadow: inset 0 0 0 2px var(--ld-warn); }
.ld-diff { margin-top: 10px; font-size: 14px; }
.ld-mismatch blockquote { margin-top: 10px; padding: 8px 12px; border-left: 3px solid currentColor; border-radius: 0 10px 10px 0; background: var(--ld-card); color: var(--ld-ink-2); font-size: 14px; }
.ld-actions { display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 600px) { .ld-actions { flex-direction: row; flex-wrap: wrap; } .ld-actions .ld-btn { flex: 1 1 200px; } }

.ld-timeline { list-style: none; padding: 4px 0 0 2px; }
.ld-timeline li { position: relative; display: flex; gap: 12px; padding-bottom: 16px; }
.ld-timeline li:not(:last-child)::before { content: ""; position: absolute; left: 5px; top: 18px; bottom: 0; width: 2px; background: var(--ld-line); }
.ld-tl-dot { width: 12px; height: 12px; margin-top: 6px; border-radius: 50%; background: var(--ld-muted); flex: none; }
.ld-tl-dot.create { background: var(--ld-primary); }
.ld-tl-dot.approve, .ld-tl-dot.accept { background: var(--ld-in); }
.ld-tl-dot.counter, .ld-tl-dot.reject, .ld-tl-dot.cancel { background: var(--ld-out); }
.ld-tl-dot.revise { background: var(--ld-accent); }
.ld-timeline p { font-size: 14px; }
.ld-timeline time { font-size: 12px; color: var(--ld-muted); }
.ld-tl-note { margin-top: 4px; padding: 6px 10px; border-radius: 8px; background: var(--ld-card-2); color: var(--ld-ink-2); font-size: 13px; }

/* ---------- Cashbook ---------- */
.ld-month { display: flex; align-items: center; justify-content: space-between; padding: 4px; background: var(--ld-card); border: 1px solid var(--ld-line); border-radius: 14px; }
.ld-month strong { font-size: 16px; font-weight: 600; }
.ld-book { background: var(--ld-card); border: 1px solid var(--ld-line); border-radius: 20px; overflow: hidden; }
.ld-book-main { display: flex; flex-direction: column; padding: 16px 18px 12px; background-image: repeating-linear-gradient(to bottom, transparent 0 25px, color-mix(in srgb, var(--ld-primary) 8%, transparent) 25px 26px); }
.ld-book-main span { font-size: 13px; color: var(--ld-muted); }
.ld-book-main strong { font-size: 30px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.ld-book-row { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--ld-line); }
.ld-book-row > div { display: flex; flex-direction: column; padding: 12px 18px; }
.ld-book-row > div + div { border-left: 1px solid var(--ld-line); }
.ld-book-row span { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ld-muted); }
.ld-book-row b { font-size: 18px; font-variant-numeric: tabular-nums; }
.ld-wallets { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
.ld-wallets::-webkit-scrollbar { display: none; }
.ld-wallet { flex: none; display: flex; flex-direction: column; min-width: 118px; padding: 10px 14px; background: var(--ld-card); border: 1px solid var(--ld-line); border-radius: 14px; }
.ld-wallet span { font-size: 13px; color: var(--ld-ink-2); white-space: nowrap; }
.ld-wallet b { font-size: 15px; font-variant-numeric: tabular-nums; }
.ld-wallet.add { min-width: 50px; align-items: center; justify-content: center; color: var(--ld-muted); }
.ld-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ld-toolbar .ld-seg { flex: 0 1 auto; }
.ld-toolbar-end { display: flex; gap: 2px; }
.ld-filter { display: inline-flex; align-self: flex-start; align-items: center; gap: 6px; padding: 5px 6px 5px 12px; border-radius: 999px; background: var(--ld-primary-l); color: var(--ld-primary-t); font-size: 14px; font-weight: 600; }
.ld-filter a { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; }
#cb { display: flex; flex-direction: column; gap: 12px; }
.ld-day { background: var(--ld-card); border: 1px solid var(--ld-line); border-radius: var(--ld-r); overflow: hidden; }
.ld-day-head { display: flex; justify-content: space-between; gap: 10px; padding: 8px 14px; background: var(--ld-card-2); font-size: 13px; font-weight: 600; color: var(--ld-ink-2); }
.ld-day-head b + b { margin-left: 10px; }
.ld-entry { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; text-align: left; border-top: 1px solid var(--ld-line); }
.ld-entry:hover { background: var(--ld-card-2); }
.ld-entry-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ld-entry-body strong { font-weight: 600; font-size: 14.5px; }
.ld-entry-body span { font-size: 12.5px; color: var(--ld-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-entry > b { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ld-tag { margin-left: 4px; padding: 1px 7px; border-radius: 6px; background: var(--ld-primary-l); color: var(--ld-primary-t); font-size: 11px; font-style: normal; font-weight: 600; vertical-align: middle; }
.ld-cat { display: inline-grid; place-items: center; flex: none; border-radius: 12px; line-height: 1; background: color-mix(in srgb, var(--c) 17%, var(--ld-card)); color: var(--c); }
.ld-fab { position: fixed; right: 16px; bottom: calc(var(--ld-tabs-h) + var(--safe-b) + 16px); z-index: 25; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 18px; background: var(--ld-accent); color: #2A1A00; box-shadow: 0 10px 24px rgba(0, 0, 0, .18); }
@media (min-width: 960px) { .ld-fab { right: 36px; bottom: 36px; } }
.ld-donut-wrap { position: relative; width: 200px; height: 200px; margin: 6px auto; }
.ld-donut { width: 100%; height: 100%; }
.ld-donut-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ld-donut-c small { font-size: 12.5px; color: var(--ld-muted); }
.ld-donut-c strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.ld-catrow { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
a.ld-catrow:hover { background: var(--ld-card-2); }
.ld-catrow-body { flex: 1; min-width: 0; }
.ld-catrow-body > div:first-child { display: flex; justify-content: space-between; gap: 8px; }
.ld-catrow-body strong { font-weight: 600; font-size: 14.5px; }
.ld-catrow-body b { font-variant-numeric: tabular-nums; }
.ld-catrow-body small { font-size: 12px; color: var(--ld-muted); }
.ld-bar { height: 6px; margin: 6px 0 2px; border-radius: 3px; background: var(--ld-card-2); overflow: hidden; }
.ld-bar i { display: block; height: 100%; border-radius: 3px; background: var(--ld-primary); }
.ld-bar i.hot { background: var(--ld-out); }
.ld-legend { display: flex; gap: 16px; margin-bottom: 12px; font-size: 13px; }
.ld-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; background: currentColor; }
.ld-bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; height: 190px; align-items: end; }
.ld-bars-col { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.ld-bars-pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.ld-bars-pair i { width: 38%; max-width: 12px; min-height: 2px; border-radius: 3px 3px 0 0; }
.ld-bars-pair i.in { background: var(--ld-in); }
.ld-bars-pair i.out { background: var(--ld-out); }
.ld-bars-col small { font-size: 10.5px; color: var(--ld-muted); white-space: nowrap; }

/* ---------- Sheet / modal ---------- */
.ld-sheet { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.ld-sheet.open { pointer-events: auto; }
.ld-sheet-bg { position: absolute; inset: 0; background: rgba(6, 18, 16, .48); opacity: 0; transition: opacity .2s; }
.ld-sheet.open .ld-sheet-bg { opacity: 1; }
.ld-sheet-card { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 14px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; padding: 8px 18px calc(18px + var(--safe-b)); background: var(--ld-card); border-radius: 22px 22px 0 0; transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1); }
.ld-sheet.open .ld-sheet-card { transform: none; }
.ld-sheet-grab { flex: none; width: 40px; height: 4px; margin: 0 auto; border-radius: 2px; background: var(--ld-line); }
.ld-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ld-sheet-head h3 { font-size: 18px; font-weight: 600; }
.ld-sheet-text { color: var(--ld-ink-2); font-size: 15px; }
.ld-sheet-foot { display: flex; gap: 10px; padding-top: 4px; }
.ld-sheet-foot .ld-btn { flex: 1; }
@media (min-width: 720px) {
  .ld-sheet-card { left: 50%; top: 50%; right: auto; bottom: auto; width: min(540px, 92vw); max-height: 86vh; padding: 20px 22px 22px; border-radius: 22px; opacity: 0; transform: translate(-50%, -46%); transition: transform .2s, opacity .2s; box-shadow: 0 30px 80px rgba(0, 0, 0, .25); }
  .ld-sheet.open .ld-sheet-card { opacity: 1; transform: translate(-50%, -50%); }
  .ld-sheet-grab { display: none; }
}
.ld-quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ld-quick-tile { display: flex; flex-direction: column; gap: 3px; padding: 14px; border: 1px solid var(--ld-line); border-radius: 16px; background: var(--ld-card-2); text-align: left; color: var(--ld-ink); }
.ld-quick-tile:hover { border-color: var(--ld-primary); }
.ld-quick-tile .ld-ic { color: var(--ld-primary-t); margin-bottom: 6px; }
.ld-quick-tile.in .ld-ic { color: var(--ld-in); }
.ld-quick-tile.out .ld-ic { color: var(--ld-out); }
.ld-quick-tile strong { font-size: 15px; font-weight: 600; }
.ld-quick-tile small { font-size: 12.5px; color: var(--ld-muted); line-height: 1.4; }
.ld-amount-big { display: flex; align-items: center; gap: 6px; padding: 4px 2px 6px; border-bottom: 2px solid var(--ld-line); }
.ld-amount-big:focus-within { border-color: var(--ld-primary); }
.ld-amount-big em { font-style: normal; font-size: 28px; font-weight: 600; color: var(--ld-muted); }
.ld-amount-big input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; padding: 0; font-size: 36px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ld-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; max-height: 236px; overflow-y: auto; margin-top: 8px; }
.ld-cat-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border: 1.5px solid transparent; border-radius: 14px; font-size: 12.5px; line-height: 1.25; text-align: center; }
.ld-cat-tile.on { border-color: var(--ld-primary); background: var(--ld-primary-l); }
.ld-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ld-pill { padding: 7px 14px; border: 1.5px solid var(--ld-line); border-radius: 999px; background: var(--ld-card); font-size: 14px; font-weight: 500; }
.ld-pill.on { border-color: var(--ld-primary); background: var(--ld-primary-l); color: var(--ld-primary-t); }
.ld-emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; margin-top: 8px; }
.ld-emoji-grid button { height: 42px; border: 1.5px solid transparent; border-radius: 10px; background: var(--ld-card-2); font-size: 20px; }
.ld-emoji-grid button.on { border-color: var(--ld-primary); background: var(--ld-primary-l); }
.ld-color-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.ld-color-row button { width: 32px; height: 32px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--ld-card), 0 0 0 4px transparent; }
.ld-color-row button.on { box-shadow: 0 0 0 2px var(--ld-card), 0 0 0 4px var(--c); }
.ld-cat-preview { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--ld-card-2); }
.ld-cat-preview strong { font-size: 16px; }

/* ---------- Profile ---------- */
.ld-profile { background: var(--ld-card); border: 1px solid var(--ld-line); border-radius: 20px; overflow: hidden; }
.ld-cover { position: relative; height: 140px; background-color: var(--ld-primary); background-image: repeating-linear-gradient(to bottom, transparent 0 21px, rgba(255, 255, 255, .09) 21px 22px), linear-gradient(135deg, var(--ld-primary), var(--ld-primary-d)); background-size: cover; background-position: center; }
@media (min-width: 720px) { .ld-cover { height: 200px; } }
.ld-profile-body { display: flex; flex-direction: column; align-items: flex-start; padding: 0 18px 18px; }
.ld-profile-av { position: relative; display: inline-block; margin-top: -50px; padding: 4px; border-radius: 50%; background: var(--ld-card); }
.ld-profile h2 { margin-top: 6px; font-size: 22px; font-weight: 700; line-height: 1.3; }
.ld-handle { font-size: 14.5px; color: var(--ld-muted); }
.ld-biz { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-weight: 600; color: var(--ld-primary-t); }
.ld-bio { margin-top: 8px; font-size: 14.5px; color: var(--ld-ink-2); }
.ld-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 13.5px; color: var(--ld-muted); }
.ld-meta > * { display: inline-flex; align-items: center; gap: 5px; }
.ld-pstats { display: flex; gap: 26px; width: 100%; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--ld-line); }
.ld-pstats div { display: flex; align-items: baseline; gap: 6px; }
.ld-pstats b { font-size: 17px; }
.ld-pstats span { font-size: 13.5px; color: var(--ld-muted); }
.ld-profile-actions { display: flex; gap: 8px; }
.ld-profile-actions .ld-btn { flex: 1; min-height: 46px; }
.ld-cover-btn { position: absolute; right: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
.ld-av-btn { position: absolute; right: 2px; bottom: 2px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 3px solid var(--ld-card); background: var(--ld-primary); color: #fff; cursor: pointer; }
.ld-profile.edit .ld-profile-body { padding-bottom: 14px; }
.is-uploading { opacity: .55; pointer-events: none; }
.ld-menu { display: flex; flex-direction: column; }
.ld-menu.card { background: var(--ld-card); border: 1px solid var(--ld-line); border-radius: var(--ld-r); overflow: hidden; }
.ld-menu > a, .ld-menu > button, .ld-menu > label { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; font-size: 15px; font-weight: 500; text-align: left; cursor: pointer; }
.ld-menu > a:hover, .ld-menu > button:hover, .ld-menu > label:hover { background: var(--ld-card-2); }
.ld-menu > * + * { border-top: 1px solid var(--ld-line); }
.ld-menu .ld-ic { color: var(--ld-muted); }
.ld-menu > * > span { flex: 1; }
.ld-menu .danger, .ld-menu .danger .ld-ic { color: var(--ld-out); }
.ld-menu .ld-badge-n { position: static; }
.ld-menu-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.ld-switch { position: relative; flex: none; width: 44px; height: 26px; border-radius: 13px; background: var(--ld-line); transition: background .2s; }
.ld-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .2s; }
.ld-menu-toggle input:checked + .ld-switch { background: var(--ld-primary); }
.ld-menu-toggle input:checked + .ld-switch::after { transform: translateX(18px); }
.ld-menu-toggle input:focus-visible + .ld-switch { outline: 2px solid var(--ld-primary); outline-offset: 2px; }

/* ---------- Notifications ---------- */
.ld-notif { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; }
.ld-notif:hover { background: var(--ld-card-2); }
.ld-notif.unread { background: var(--ld-primary-l); }
.ld-notif p { font-size: 14.5px; line-height: 1.45; }
.ld-notif time { font-size: 12px; color: var(--ld-muted); }
.ld-notif-ic { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--ld-card-2); color: var(--ld-primary-t); }

/* ---------- Plan ---------- */
.ld-plan-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px; border-radius: 20px; color: #fff; background: linear-gradient(135deg, var(--ld-primary), var(--ld-primary-d)); }
.ld-plan-card.off { background: linear-gradient(135deg, #B91C1C, #7F1D1D); }
.ld-plan-card small { font-size: 13px; opacity: .82; }
.ld-plan-card h2 { font-size: 24px; font-weight: 700; line-height: 1.3; }
.ld-plan-card p { font-size: 14px; opacity: .9; }
.ld-plan-card .ld-ic { color: var(--ld-accent); }
.ld-usage + .ld-usage { margin-top: 14px; }
.ld-usage > div:first-child { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.ld-usage b { font-weight: 600; font-variant-numeric: tabular-nums; }
.ld-packages { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.ld-pkg { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--ld-card); border: 1px solid var(--ld-line); border-radius: 18px; }
.ld-pkg.hl { border: 2px solid var(--ld-accent); }
.ld-pkg header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ld-pkg h4 { font-size: 17px; font-weight: 600; }
.ld-pkg-price strong { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ld-pkg-price span { margin-left: 6px; font-size: 14px; color: var(--ld-muted); }
.ld-pkg-desc { font-size: 13.5px; color: var(--ld-ink-2); }
.ld-pkg ul { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 0; list-style: none; font-size: 14px; }
.ld-pkg li { display: flex; align-items: center; gap: 8px; }
.ld-pkg li .ld-ic { color: var(--ld-in); }
.ld-pkg li.no { color: var(--ld-muted); }
.ld-pkg li.no .ld-ic { color: var(--ld-muted); }
.ld-pay-amt { display: flex; flex-direction: column; align-items: center; padding: 14px; border-radius: 14px; background: var(--ld-card-2); }
.ld-pay-amt span, .ld-pay-amt small { font-size: 13px; color: var(--ld-muted); }
.ld-pay-amt strong { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ld-pay-acc { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 14px; border: 1.5px dashed var(--ld-primary); border-radius: 14px; background: var(--ld-primary-l); }
.ld-pay-acc span { width: 100%; font-size: 13px; color: var(--ld-ink-2); }
.ld-pay-acc strong { flex: 1; font-size: 20px; letter-spacing: .03em; font-variant-numeric: tabular-nums; word-break: break-all; }

/* ---------- Empty, skeleton, toast ---------- */
.ld-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 20px; text-align: center; background: var(--ld-card); border: 1px dashed var(--ld-line); border-radius: var(--ld-r); }
.ld-empty.sm { padding: 22px 16px; }
.ld-empty-ic { width: 60px; height: 60px; margin-bottom: 4px; display: grid; place-items: center; border-radius: 50%; background: var(--ld-primary-l); color: var(--ld-primary-t); }
.ld-empty-ic.err { background: var(--ld-out-bg); color: var(--ld-out); }
.ld-empty h3 { font-size: 17px; font-weight: 600; }
.ld-empty p { max-width: 360px; font-size: 14px; color: var(--ld-muted); }
.ld-empty .ld-btn { margin-top: 8px; }
.ld-skel { display: flex; flex-direction: column; gap: 14px; }
.ld-skel-block { height: 120px; border-radius: 18px; }
.ld-skel-row { display: flex; align-items: center; gap: 12px; }
.ld-skel-c { width: 42px; height: 42px; border-radius: 50%; flex: none; }
.ld-skel-l { flex: 1; height: 16px; border-radius: 8px; }
.ld-skel-block, .ld-skel-c, .ld-skel-l { background: linear-gradient(90deg, var(--ld-card-2), var(--ld-line), var(--ld-card-2)); background-size: 200% 100%; animation: ld-sh 1.2s linear infinite; }
@keyframes ld-sh { to { background-position: -200% 0; } }
.ld-toast { position: fixed; left: 50%; bottom: calc(var(--ld-tabs-h) + var(--safe-b) + 14px); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); transform: translateX(-50%); pointer-events: none; }
@media (min-width: 960px) { .ld-toast { bottom: 28px; } }
.ld-toast-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--ld-ink); color: var(--ld-bg); font-size: 14.5px; box-shadow: 0 12px 30px rgba(0, 0, 0, .22); opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; pointer-events: auto; }
.ld-toast-item.show { opacity: 1; transform: none; }
.ld-toast-item span { flex: 1; }
.ld-toast-ok .ld-ic { color: #4ADE80; }
[data-theme="dark"] .ld-toast-ok .ld-ic { color: var(--ld-in-bg); }
.ld-toast-err { background: #7F1D1D; color: #fff; }
.ld-toast-item a { color: #FDE68A; font-weight: 600; white-space: nowrap; }

/* ---------- Auth ---------- */
.ld-auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1fr; background: var(--ld-bg); }
.ld-auth-side { display: none; }
.ld-auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 16px calc(28px + var(--safe-b)); }
.ld-auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 12px; padding: 26px 22px; background: var(--ld-card); border: 1px solid var(--ld-line); border-radius: 22px; box-shadow: var(--ld-shadow); }
.ld-auth-card > .ld-brand { margin-bottom: 8px; }
.ld-auth-title { font-size: 24px; font-weight: 700; line-height: 1.3; }
.ld-auth-sub { margin-bottom: 6px; font-size: 14.5px; color: var(--ld-muted); }
.ld-auth-alt { margin-top: 4px; text-align: center; font-size: 14.5px; color: var(--ld-ink-2); }
.ld-auth-foot { margin-top: 16px; font-size: 14px; }
.ld-auth-foot a { display: inline-flex; align-items: center; gap: 4px; color: var(--ld-muted); }
.ld-brand-inv .ld-brand-mark { background: #fff; color: var(--ld-primary); }
.ld-auth-slip { position: relative; align-self: center; width: min(340px, 100%); padding: 20px 22px; border-radius: 16px; background: #fff; color: #0F2A26; box-shadow: 0 24px 60px rgba(0, 0, 0, .28); transform: rotate(-2deg); }
.ld-auth-slip-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed #DCE5E2; }
.ld-auth-slip-row span { color: #6B7F7B; }
.ld-auth-slip-row b { font-size: 20px; font-variant-numeric: tabular-nums; }
.ld-auth-stamp { position: absolute; right: -12px; bottom: -20px; padding: 3px 16px; border: 3px double #15803D; border-radius: 10px; background: rgba(255, 255, 255, .92); color: #15803D; font-size: 24px; font-weight: 700; transform: rotate(-14deg); }
@media (min-width: 900px) {
  .ld-auth { grid-template-columns: minmax(380px, 44%) 1fr; }
  .ld-auth-side { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 40px 48px 48px 84px; overflow: hidden; color: #fff; background-color: var(--ld-primary); background-image: repeating-linear-gradient(to bottom, transparent 0 31px, rgba(255, 255, 255, .08) 31px 32px), linear-gradient(160deg, var(--ld-primary), var(--ld-primary-d)); }
  .ld-auth-side::before { content: ""; position: absolute; top: 0; bottom: 0; left: 60px; width: 2px; background: color-mix(in srgb, var(--ld-accent) 70%, transparent); }
  .ld-auth-tag { position: relative; max-width: 400px; font-size: 24px; font-weight: 600; line-height: 1.45; }
}

/* ---------- Page transitions ---------- */
.ld-loader { position: fixed; top: calc(var(--ld-top-h) + var(--safe-t) + 8px); left: 50%; z-index: 40; width: 38px; height: 38px; margin-left: -19px; display: grid; place-items: center; border-radius: 50%; background: var(--ld-card); box-shadow: 0 4px 16px rgba(15, 42, 38, .16); opacity: 0; transform: translateY(-10px) scale(.8); transition: opacity .18s, transform .18s; pointer-events: none; }
.ld-loader span { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--ld-line); border-top-color: var(--ld-primary); animation: ld-spin .7s linear infinite; }
.ld-loader.show { opacity: 1; transform: none; }
@media (min-width: 960px) { .ld-loader { top: 80px; left: calc(50% + 132px); } }
.ld-view.is-loading { opacity: .5; pointer-events: none; transition: opacity .2s; }
.ld-view.ld-enter { animation: ld-enter .24s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes ld-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ld-view { view-transition-name: ld-page; }
::view-transition-old(ld-page) { animation: ld-page-out .22s ease-in both; }
::view-transition-new(ld-page) { animation: ld-page-in .26s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes ld-page-out { to { opacity: 0; transform: translateY(-4px); } }
@keyframes ld-page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Admin panel ---------- */
.ld-side-sep { height: 1px; margin: 8px 12px; background: var(--ld-line); }
button.ld-side-me { width: 100%; text-align: left; color: var(--ld-ink-2); }
.is-admin-only .ld-main { padding-bottom: calc(var(--ld-tabs-h) + var(--safe-b) + 16px); }
.ld-anav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 4px; }
.ld-anav::-webkit-scrollbar { display: none; }
.ld-anav a { position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--ld-line); background: var(--ld-card); color: var(--ld-ink-2); font-size: 13.5px; font-weight: 500; }
.ld-anav a.on { background: var(--ld-primary); border-color: var(--ld-primary); color: #fff; }
.ld-anav a em { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--ld-out); color: #fff; font-size: 11px; font-style: normal; font-weight: 600; line-height: 18px; text-align: center; }
@media (min-width: 960px) { .ld-anav { flex-wrap: wrap; margin: 0; padding: 0; overflow: visible; } }
.ld-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .ld-kpis { grid-template-columns: repeat(3, 1fr); } }
.ld-kpi { display: flex; flex-direction: column; min-width: 0; padding: 14px 16px; background: var(--ld-card); border: 1px solid var(--ld-line); border-radius: var(--ld-r); }
.ld-kpi span { font-size: 13px; color: var(--ld-muted); }
.ld-kpi strong { font-size: 24px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-kpi small { font-size: 12px; color: var(--ld-muted); }
.ld-kpi.accent { background: var(--ld-primary); border-color: var(--ld-primary); color: #fff; background-image: repeating-linear-gradient(to bottom, transparent 0 23px, rgba(255, 255, 255, .08) 23px 24px); }
.ld-kpi.accent span, .ld-kpi.accent small { color: rgba(255, 255, 255, .82); }
.ld-agrid { display: grid; gap: 14px; }
@media (min-width: 1100px) { .ld-agrid { grid-template-columns: 1fr 1fr; align-items: start; } }
.ld-agrid > .ld-card { display: flex; flex-direction: column; gap: 12px; }
.ld-legend .in2, .ld-legend .acc { color: var(--ld-ink-2); }
.ld-legend .in2::before { background: var(--ld-primary); }
.ld-legend .acc::before { background: var(--ld-accent); }
.ld-section-head .ld-legend { margin: 0; }
.ld-bars-14 { grid-template-columns: repeat(14, 1fr); height: 150px; }
.ld-bars-pair i.u { background: var(--ld-primary); }
.ld-bars-pair i.t { background: var(--ld-accent); }
.ld-checklist { list-style: none; padding: 0; }
.ld-checklist li { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.ld-checklist li + li { border-top: 1px solid var(--ld-line); }
.ld-checklist li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ld-checklist small { font-size: 12.5px; color: var(--ld-muted); }
.ld-checklist li.ok strong { color: var(--ld-muted); font-weight: 500; }
.ld-ck { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--ld-line); color: #fff; }
.ld-checklist li.ok .ld-ck { background: var(--ld-in); border-color: var(--ld-in); }
.ld-seg-n { font-style: normal; padding: 0 6px; border-radius: 99px; background: var(--ld-line); font-size: 11.5px; color: var(--ld-ink-2); }
.ld-seg-n.hot { background: var(--ld-out); color: #fff; }
.ld-row-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.ld-row-meta { flex-direction: column; align-items: flex-end; gap: 0; font-weight: 500; color: var(--ld-muted); }
.ld-row-meta small { font-size: 12px; white-space: nowrap; }
.ld-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ld-pair { display: inline-flex; flex: none; }
.ld-pair .ld-av + .ld-av { margin-left: -12px; box-shadow: 0 0 0 2px var(--ld-card); }
.ld-conn .ld-row-body strong a:hover { color: var(--ld-primary-t); }
.ld-log .ld-row-body span { white-space: normal; }
.ld-log code { font-size: 13px; }
.ld-selectbar { display: flex; align-items: center; gap: 10px; padding: 0 14px; min-height: 46px; background: var(--ld-card); border: 1.5px solid var(--ld-line); border-radius: 14px; color: var(--ld-muted); }
.ld-selectbar select { flex: 1; min-height: 44px; border: 0; background: transparent; outline: none; font-size: 15px; color: var(--ld-ink); }
.ld-pay-list > * + * { border-top: 1px solid var(--ld-line); }
.ld-pay { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.ld-pay-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ld-pay-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ld-pay-user span { display: flex; flex-direction: column; min-width: 0; }
.ld-pay-user small { font-size: 12.5px; color: var(--ld-muted); }
.ld-pay-top > b { font-size: 20px; font-variant-numeric: tabular-nums; }
.ld-pay-dl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; padding: 10px 12px; border-radius: 12px; background: var(--ld-card-2); }
.ld-pay-dl > div { display: flex; flex-direction: column; min-width: 0; }
.ld-pay-dl dt { font-size: 12px; color: var(--ld-muted); }
.ld-pay-dl dd { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; word-break: break-all; }
.ld-pay-dl code { font-size: 14px; font-weight: 700; letter-spacing: .03em; }
.ld-mini-btn { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 8px; color: var(--ld-primary-t); background: var(--ld-card); border: 1px solid var(--ld-line); }
.ld-pay-actions { display: flex; gap: 8px; justify-content: flex-end; }
.ld-pay-actions .ld-btn { flex: 1; }
@media (min-width: 600px) { .ld-pay-actions .ld-btn { flex: 0 0 auto; } }
.ld-pay-done { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--ld-muted); }
.ld-pay-done p { width: 100%; color: var(--ld-ink-2); }
.ld-plan-line { display: flex; flex-direction: column; }
.ld-plan-line strong { font-size: 18px; }
.ld-plan-line span { font-size: 13px; color: var(--ld-muted); }
.ld-card .ld-dl { border-top: 0; }
.ld-card .ld-dl > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; font-size: 14px; }
.ld-card .ld-dl > div + div { border-top: 1px dashed var(--ld-line); }
.ld-pkg.off { opacity: .65; }
.ld-pkg header span { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.ld-pkg-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px solid var(--ld-line); font-size: 13px; }
.ld-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ld-grid3 .ld-label { font-size: 12.5px; }
.ld-toggles { display: flex; flex-direction: column; border: 1px solid var(--ld-line); border-radius: 14px; overflow: hidden; }
.ld-toggles > * + * { border-top: 1px solid var(--ld-line); }
.ld-toggle-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; font-size: 14.5px; }
.ld-toggle-row > span { flex: 1; }
.ld-toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.ld-toggle-row input:checked + .ld-switch { background: var(--ld-primary); }
.ld-toggle-row input:checked + .ld-switch::after { transform: translateX(18px); }
.ld-toggle-row input:focus-visible + .ld-switch { outline: 2px solid var(--ld-primary); outline-offset: 2px; }
.ld-logo-box { display: flex; gap: 14px; align-items: flex-start; padding: 12px; border: 1px dashed var(--ld-line); border-radius: 14px; }
.ld-logo-box .ld-note { margin: 2px 0 8px; }
.ld-logo-prev { flex: none; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 14px; background: var(--ld-card-2); overflow: hidden; }
.ld-logo-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ld-logo-box label.ld-btn { cursor: pointer; }
.ld-colorpick { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 12px; border: 1.5px solid var(--ld-line); border-radius: 12px; background: var(--ld-card); }
.ld-colorpick input { width: 44px; height: 32px; padding: 0; border: 0; background: none; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Overflow guards (mobile): rotated stamp and grid children must never widen the page. */
.ld-slip { overflow: hidden; }
.ld-agrid > * { min-width: 0; }
.ld-view { overflow-x: clip; }
