    :root {
      --bg: #080b10;
      --surface: #0e1118;
      --card: #131720;
      --border: #1e2535;
      --accent: #f5c518;
      --accent2: #3d6fff;
      --saffron: #e87a12;
      --danger: #ff4757;
      --warn: #ffa502;
      --text: #eef2ff;
      --muted: #8896b3;
      --subtle: #1e2535;
      --mono: 'DM Mono', monospace;
    }

    *,
    *::before,
    *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    html,
    body {
      height: 100%;
      overflow: hidden;
    }

    body {
      font-family: 'Inter', sans-serif;
      background: var(--bg);
      color: var(--text);
      -webkit-font-smoothing: antialiased;
      -webkit-tap-highlight-color: transparent;
    }

    /* Setup */
    #setup {
      height: 100vh;
      height: 100dvh;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 24px;
      overflow-y: auto;
    }

    .si {
      width: 100%;
      max-width: 420px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
    }

    .logo-text {
      font-family: 'Cormorant Garamond', serif;
      font-size: 44px;
      font-weight: 300;
      letter-spacing: 3px;
      margin-bottom: 4px;
    }

    .logo-text .lo {
      font-weight: 700;
      font-style: italic;
      color: #f5c518;
    }

    .logo-sub {
      font-size: 14px;
      color: var(--muted);
      margin-bottom: 28px;
      text-align: center;
      line-height: 1.6;
    }

    .sc {
      width: 100%;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 18px;
      padding: 24px;
      margin-bottom: 8px;
    }

    .sc h3 {
      font-size: 12px;
      color: var(--accent);
      text-transform: uppercase;
      letter-spacing: 2px;
      margin-bottom: 10px;
    }

    .sc p {
      font-size: 14px;
      color: var(--muted);
      line-height: 1.7;
      margin-bottom: 12px;
    }

    .dots {
      display: flex;
      gap: 8px;
      margin-bottom: 20px;
      justify-content: center;
    }

    .dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--border);
      transition: background .3s;
    }

    .dot.active {
      background: var(--accent);
    }

    .dot.done {
      background: var(--accent2);
    }

    /* Buttons */
    .btn {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      width: 100%;
      border: none;
      border-radius: 12px;
      padding: 13px 20px;
      font-family: 'Inter', sans-serif;
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      transition: opacity .2s, transform .1s;
    }

    .btn:active {
      transform: scale(.98);
    }

    .btn:disabled {
      opacity: .4;
      cursor: not-allowed;
    }

    .bp {
      background: var(--accent);
      color: #000;
    }

    .bs {
      background: var(--card);
      color: var(--text);
      border: 1px solid var(--border);
    }

    .bg {
      background: #fff;
      color: #1f1f1f;
      border: 1px solid #dadce0;
      margin-top: 14px;
    }

    .bsm {
      padding: 7px 14px;
      font-size: 12px;
      width: auto;
      border-radius: 8px;
    }

    /* Inputs */
    .fi,
    .fs {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 11px 14px;
      color: var(--text);
      font-family: 'Inter', sans-serif;
      font-size: 14px;
      outline: none;
      transition: border-color .2s;
      width: 100%;
    }

    .fi:focus,
    .fs:focus {
      border-color: var(--accent2);
    }

    .fi::placeholder {
      color: var(--muted);
    }

    input[type=number]::-webkit-inner-spin-button,
    input[type=number]::-webkit-outer-spin-button {
      -webkit-appearance: none;
      margin: 0;
    }

    input[type=number] {
      -moz-appearance: textfield;
      appearance: textfield;
    }

    .fs option {
      background: var(--card);
    }

    textarea.fi {
      resize: vertical;
      min-height: 100px;
      font-size: 13px;
      font-family: var(--mono);
    }

    .sfi {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px 14px;
      color: var(--text);
      font-family: var(--mono);
      font-size: 13px;
      outline: none;
      width: 100%;
      transition: border-color .2s;
      margin-top: 12px;
    }

    .sfi:focus {
      border-color: var(--accent2);
    }

    .sfi::placeholder {
      color: var(--muted);
    }

    .fl {
      font-size: 11px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 1px;
      margin-bottom: 5px;
      display: block;
    }

    .fg {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .fr {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    .full {
      grid-column: 1/-1;
    }

    /* Type toggle */
    .tt {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }

    .tb {
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 11px;
      font-family: 'Inter', sans-serif;
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      transition: all .2s;
      background: var(--card);
      color: var(--muted);
    }

    .tb.income.active {
      background: #2a2200;
      border-color: var(--accent);
      color: var(--accent);
    }

    .tb.expense.active {
      background: #3d0a10;
      border-color: var(--danger);
      color: var(--danger);
    }

    /* App shell */
    #app {
      height: 100vh;
      height: 100dvh;
      display: none;
      flex-direction: column;
      position: relative;
    }

    .ah {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 16px;
      padding-top: calc(12px + env(safe-area-inset-top));
      border-bottom: 1px solid var(--border);
      background: var(--bg);
      flex-shrink: 0;
      z-index: 10;
    }

    .hl {
      font-family: 'Cormorant Garamond', serif;
      font-size: 22px;
      font-weight: 300;
      letter-spacing: 1px;
    }

    .hl .lo {
      font-weight: 700;
      font-style: italic;
      color: #f5c518;
    }

    .hr2 {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .hp {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 5px 10px;
      font-size: 12px;
      color: var(--muted);
      display: flex;
      align-items: center;
      gap: 5px;
      max-width: 150px;
      overflow: hidden;
    }

    .hp .d {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--accent);
      flex-shrink: 0;
    }

    .hp .e {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .ib {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 8px 14px;
      color: var(--text);
      font-size: 20px;
      cursor: pointer;
      line-height: 1;
    }

    /* Nav */
    .nav {
      display: flex;
      background: var(--surface);
      border-top: 1px solid var(--border);
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      z-index: 100;
      padding-bottom: env(safe-area-inset-bottom);
    }

    .nb {
      flex: 1;
      min-width: 48px;
      background: none;
      border: none;
      color: var(--muted);
      font-family: 'Inter', sans-serif;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      gap: 3px;
      padding: 8px 4px 10px;
      transition: color .2s;
      -webkit-appearance: none;
      appearance: none;
    }

    .nb .ni {
      font-size: 20px;
      line-height: 1;
    }

    .nb .nl {
      font-size: 11px;
      font-weight: 600;
      white-space: nowrap;
      line-height: 1;
    }

    .nb.active {
      color: var(--accent);
    }

    .nb-fab {
      width: 52px;
      height: 52px;
      border-radius: 50%;
      background: var(--accent);
      color: #000;
      border: none;
      font-size: 26px;
      font-weight: 700;
      cursor: pointer;
      flex-shrink: 0;
      align-self: center;
      position: relative;
      bottom: 10px;
      box-shadow: 0 4px 16px rgba(245,197,24,.45);
      display: flex;
      align-items: center;
      justify-content: center;
      -webkit-appearance: none;
      appearance: none;
    }
    .nb-fab:active { transform: scale(.94); box-shadow: 0 2px 8px rgba(245,197,24,.3); }

    .ledger-tabs {
      display: flex;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 10px;
      overflow: hidden;
      margin-bottom: 14px;
    }
    .lt-btn {
      flex: 1;
      background: none;
      border: none;
      color: var(--muted);
      font-family: 'Inter', sans-serif;
      font-size: 11px;
      font-weight: 600;
      height: 36px;
      cursor: pointer;
      white-space: nowrap;
    }
    .lt-btn + .lt-btn { border-left: 1px solid var(--border); }
    .lt-btn.active { background: var(--subtle); color: var(--text); }

    .ledger-section { display: none; }
    .ledger-section.active { display: block; }
    .invest-section { display: none; }
    .invest-section.active { display: block; }

    /* Pages */
    .pages {
      flex: 1;
      overflow: hidden;
      position: relative;
    }

    .page {
      position: absolute;
      inset: 0;
      overflow-y: scroll;
      scrollbar-gutter: stable;
      -webkit-overflow-scrolling: touch;
      padding: 16px;
      display: none;
      padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }

    .page.active {
      display: block;
    }

    .page::-webkit-scrollbar {
      width: 3px;
    }

    .page::-webkit-scrollbar-thumb {
      background: var(--border);
      border-radius: 3px;
    }
