/* Kijiji Ledger — extracted stylesheet, unchanged from the client-only version */

  :root{
    --paper:#F6F1E2;
    --paper-dim:#EFE8D4;
    --card:#FFFDF8;
    --ink:#23201A;
    --ink-soft:#5B5647;
    --green:#1F3B2C;
    --green-dark:#14261C;
    --green-soft:#2E5240;
    --gold:#C08A28;
    --gold-light:#E3B45A;
    --rust:#A13D2C;
    --line:#D8CFB8;
    --alive:#3F7D54;
    --deceased:#847C68;
    --radius:10px;
    --shadow: 0 1px 2px rgba(35,32,26,0.06), 0 4px 14px rgba(35,32,26,0.05);
  }
  @media (prefers-reduced-motion: reduce){
    *{ animation-duration:0.001ms !important; transition-duration:0.001ms !important; }
  }
  *{ box-sizing:border-box; }
  html,body{ margin:0; padding:0; }
  body{
    background:var(--paper);
    color:var(--ink);
    font-family:'Inter', system-ui, sans-serif;
    min-height:100vh;
  }
  body::before{
    content:"";
    position:fixed; inset:0;
    background-image: repeating-linear-gradient(transparent, transparent 27px, var(--line) 28px);
    opacity:0.35;
    pointer-events:none;
    z-index:0;
  }
  h1,h2,h3,.display{
    font-family:'Fraunces', serif;
    font-weight:600;
    color:var(--green-dark);
    letter-spacing:-0.01em;
  }
  .mono{ font-family:'IBM Plex Mono', monospace; }
  #app{ position:relative; z-index:1; display:flex; min-height:100vh; }

  /* ---- Spine nav ---- */
  .spine{
    width:220px; flex-shrink:0;
    background: var(--green-dark);
    color:#EFE8D4;
    display:flex; flex-direction:column;
    padding:22px 16px;
    position:sticky; top:0; height:100vh; overflow-y:auto;
  }
  .spine-brand{
    display:flex; align-items:center; gap:10px;
    margin-bottom:26px;
  }
  .spine-menu-toggle{ display:none; }
  .spine-stamp{
    width:34px; height:34px; border-radius:50%;
    border:2px solid var(--gold-light);
    display:flex; align-items:center; justify-content:center;
    font-family:'Fraunces',serif; font-weight:700; font-size:15px; color:var(--gold-light);
    transform:rotate(-8deg);
    flex-shrink:0;
  }
  .spine-brand-text .t1{ font-family:'Fraunces',serif; font-weight:600; font-size:16.5px; line-height:1.1; color:#F6F1E2; }
  .spine-brand-text .t2{ font-size:10.5px; letter-spacing:.06em; text-transform:uppercase; color:#9FB0A2; }
  .spine-nav{ display:flex; flex-direction:column; gap:3px; margin-bottom:22px; }
  .spine-btn{
    all:unset; cursor:pointer; box-sizing:border-box;
    padding:9px 12px; border-radius:8px;
    font-size:13.5px; color:#D9D3BE;
    display:flex; align-items:center; gap:9px;
  }
  .spine-btn:hover{ background:rgba(255,255,255,0.06); color:#fff; }
  .spine-btn.active{ background:var(--green-soft); color:#fff; font-weight:600; }
  .spine-btn:focus-visible{ outline:2px solid var(--gold-light); outline-offset:1px; }
  .spine-dot{ width:6px; height:6px; border-radius:50%; background:var(--gold); flex-shrink:0; }

  .spine-stats{
    margin-top:auto; padding-top:16px; border-top:1px solid rgba(255,255,255,0.12);
    font-size:11.5px; color:#9FB0A2; display:flex; flex-direction:column; gap:6px;
  }
  .spine-stats b{ color:#EADFC0; font-family:'IBM Plex Mono',monospace; }

  /* ---- Main ---- */
  main{ flex:1; padding:34px 40px 60px; max-width:1000px; }
  .crumbs{ font-size:12.5px; color:var(--ink-soft); margin-bottom:14px; display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
  .crumbs button{ all:unset; cursor:pointer; color:var(--ink-soft); }
  .crumbs button:hover{ color:var(--green); text-decoration:underline; }
  .crumbs .sep{ opacity:0.5; }
  .crumbs .current{ color:var(--ink); font-weight:600; }

  .page-head{ display:flex; justify-content:space-between; align-items:flex-end; gap:16px; margin-bottom:22px; flex-wrap:wrap; }
  .page-head h1{ font-size:27px; margin:0 0 4px; }
  .page-head p{ margin:0; color:var(--ink-soft); font-size:13.5px; max-width:56ch; }

  .btn{
    all:unset; cursor:pointer; box-sizing:border-box;
    padding:9px 16px; border-radius:8px; font-size:13.5px; font-weight:600;
    background:var(--green); color:#F6F1E2;
    display:inline-flex; align-items:center; gap:7px;
    box-shadow:var(--shadow);
  }
  .btn:hover{ background:var(--green-soft); }
  .btn:focus-visible{ outline:2px solid var(--gold); outline-offset:2px; }
  .btn.ghost{ background:transparent; color:var(--green); border:1px solid var(--line); box-shadow:none; }
  .btn.ghost:hover{ background:var(--paper-dim); }
  .btn.gold{ background:var(--gold); color:#2b1d05; }
  .btn.gold:hover{ background:var(--gold-light); }
  .btn.small{ padding:6px 12px; font-size:12.5px; }
  .btn.danger{ background:transparent; color:var(--rust); border:1px solid #E3C4BA; box-shadow:none; }
  .btn[disabled]{ opacity:0.45; cursor:not-allowed; }

  .stat-row{ display:flex; gap:14px; flex-wrap:wrap; margin-bottom:26px; }
  .stat-card{
    background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
    padding:14px 18px; min-width:140px; box-shadow:var(--shadow);
  }
  .stat-card .num{ font-family:'IBM Plex Mono', monospace; font-size:21px; font-weight:600; color:var(--green-dark); }
  .stat-card .lbl{ font-size:11.5px; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.05em; margin-top:2px; }

  .grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(230px,1fr)); gap:14px; margin-bottom:10px; }
  .card{
    background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
    padding:16px 18px; box-shadow:var(--shadow); cursor:pointer; text-align:left;
    display:flex; flex-direction:column; gap:6px;
  }
  .card:hover{ border-color:var(--gold); }
  .card:focus-visible{ outline:2px solid var(--gold); outline-offset:2px; }
  .card h3{ font-size:16.5px; margin:0; }
  .card .meta{ font-size:12px; color:var(--ink-soft); }
  .card .foot{ margin-top:6px; font-size:12px; display:flex; justify-content:space-between; color:var(--ink-soft); }
  .card .foot b{ color:var(--green-dark); font-family:'IBM Plex Mono',monospace; }

  .panel{
    background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
    box-shadow:var(--shadow); padding:20px 22px; margin-bottom:20px;
  }
  .panel h2{ font-size:16px; margin:0 0 4px; }
  .panel .sub{ font-size:12.5px; color:var(--ink-soft); margin-bottom:14px; }

  form.inline-form{ display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end; }
  .field{ display:flex; flex-direction:column; gap:5px; }
  .field label{ font-size:11.5px; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.04em; }
  .field input, .field select{
    font:inherit; font-size:13.5px; padding:8px 10px; border-radius:7px;
    border:1px solid var(--line); background:#fff; color:var(--ink); min-width:150px;
  }
  .field input:focus-visible, .field select:focus-visible{ outline:2px solid var(--gold); outline-offset:1px; border-color:var(--gold); }

  table{ width:100%; border-collapse:collapse; font-size:13.5px; }
  th{ text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-soft); padding:8px 10px; border-bottom:2px solid var(--line); }
  td{ padding:10px; border-bottom:1px solid var(--line); }
  tr.row-click{ cursor:pointer; }
  tr.row-click:hover td{ background:var(--paper-dim); }
  .num-cell{ font-family:'IBM Plex Mono', monospace; }

  .empty{ padding:26px 10px; text-align:center; color:var(--ink-soft); font-size:13.5px; border:1px dashed var(--line); border-radius:var(--radius); }

  .member-head{ display:flex; gap:18px; align-items:center; margin-bottom:22px; flex-wrap:wrap; }
  .stamp{
    width:88px; height:88px; border-radius:50%;
    border:3px double var(--gold);
    display:flex; align-items:center; justify-content:center; flex-direction:column;
    transform:rotate(-6deg); flex-shrink:0; color:var(--gold);
  }
  .stamp.deceased-stamp{ border-color:var(--deceased); color:var(--deceased); }
  .stamp .no{ font-family:'IBM Plex Mono',monospace; font-weight:600; font-size:12.5px; }
  .stamp .lbl{ font-size:8px; letter-spacing:.08em; text-transform:uppercase; }

  .balance-box{
    background:var(--green-dark); color:#F6F1E2; border-radius:var(--radius);
    padding:18px 22px; display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; flex-wrap:wrap; gap:14px;
  }
  .balance-box .amt{ font-family:'IBM Plex Mono',monospace; font-size:30px; font-weight:600; color:var(--gold-light); }
  .balance-box .lbl{ font-size:11.5px; text-transform:uppercase; letter-spacing:.05em; color:#B9C4BB; }
  .balance-box .month-status{ font-size:12.5px; color:#D9D3BE; }
  .balance-box .progress-outer{ background:rgba(255,255,255,0.15); }
  .badge{ display:inline-block; padding:2px 9px; border-radius:20px; font-size:11px; font-weight:600; }
  .badge.paid{ background:#dcecdf; color:var(--green-dark); }
  .badge.pending{ background:#f4e1d8; color:var(--rust); }
  .badge.self{ background:#e8e1c9; color:#6b5a20; }
  .badge.advance{ background:#e4e9e0; color:var(--green-soft); }

  .life-dot{ width:8px; height:8px; border-radius:50%; display:inline-block; margin-right:7px; flex-shrink:0; }
  .life-dot.alive{ background:var(--alive); }
  .life-dot.deceased{ background:var(--deceased); }
  .status-pill{ display:inline-flex; align-items:center; font-size:12px; color:var(--ink-soft); }
  .status-pill.big{ font-size:13px; padding:3px 10px; border-radius:20px; background:var(--paper-dim); }

  .search-wrap{ position:relative; margin-bottom:22px; }
  .search-wrap input{
    width:100%; font:inherit; font-size:14.5px; padding:11px 14px; border-radius:9px;
    border:1px solid var(--line); background:#fff;
  }
  .search-results{ margin-top:12px; display:flex; flex-direction:column; gap:6px; }
  .search-hit{
    all:unset; cursor:pointer; display:flex; justify-content:space-between; align-items:center;
    padding:10px 14px; background:var(--card); border:1px solid var(--line); border-radius:8px; font-size:13.5px;
  }
  .search-hit:hover{ border-color:var(--gold); }
  .search-hit .m{ color:var(--ink-soft); font-size:12px; }

  .gen-badge{ font-size:10.5px; padding:2px 8px; border-radius:20px; background:var(--paper-dim); color:var(--ink-soft); font-weight:600; letter-spacing:.03em; }

  .progress-outer{ width:100%; height:7px; border-radius:20px; background:var(--paper-dim); overflow:hidden; margin:8px 0 4px; }
  .progress-inner{ height:100%; background:var(--gold); border-radius:20px; }
  .countdown-overdue{ color:var(--rust) !important; }

  /* ---- Tree ---- */
  .tree-legend{ display:flex; gap:18px; margin-bottom:18px; font-size:12.5px; color:var(--ink-soft); align-items:center; }
  .tree-node{ display:flex; flex-direction:column; }
  .tree-card{
    background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
    padding:14px 16px; box-shadow:var(--shadow); max-width:420px;
  }
  .tree-card .tree-fam-name{ display:flex; align-items:center; gap:8px; font-family:'Fraunces',serif; font-weight:600; font-size:15px; margin-bottom:4px; }
  .tree-card .tree-head{ font-size:11.5px; color:var(--ink-soft); margin-bottom:8px; }
  .tree-member-row{ display:flex; align-items:center; justify-content:space-between; font-size:12.5px; padding:4px 0; border-top:1px dashed var(--line); }
  .tree-member-row:first-of-type{ border-top:none; }
  .tree-member-row .mno{ color:var(--ink-soft); font-family:'IBM Plex Mono',monospace; font-size:11px; }
  .tree-children{
    margin-left:28px; padding-left:22px; margin-top:12px;
    border-left:2px solid var(--line);
    display:flex; flex-direction:column; gap:14px;
  }
  .tree-empty-members{ font-size:12px; color:var(--ink-soft); font-style:italic; }

  .loading-screen{ display:flex; align-items:center; justify-content:center; height:100vh; width:100%; color:var(--ink-soft); font-family:'Fraunces',serif; }

  @media (max-width:760px){
    #app{ flex-direction:column; }

    /* Collapsed by default: just the brand bar + hamburger toggle.
       Nav links and the account panel (which holds the ONLY logout
       and manage-admins controls) live in a drawer that opens below
       the bar, so nothing is ever permanently unreachable on mobile. */
    .spine{
      position:sticky; top:0; z-index:20; width:100%; height:auto;
      padding:14px 16px; max-height:64px; overflow:hidden;
      transition:max-height 0.22s ease;
    }
    .spine.spine-open{ max-height:100vh; overflow-y:auto; }
    .spine-brand{ margin-bottom:0; justify-content:space-between; }
    .spine-menu-toggle{
      all:unset; display:flex; align-items:center; justify-content:center;
      width:36px; height:36px; border-radius:8px; cursor:pointer;
      color:#EFE8D4; background:rgba(255,255,255,0.08); flex-shrink:0;
    }
    .spine-menu-toggle:focus-visible{ outline:2px solid var(--gold-light); outline-offset:1px; }
    .spine-menu-toggle svg{ width:18px; height:18px; }

    .spine-nav{ flex-direction:column; margin-top:18px; margin-bottom:18px; gap:2px; }
    .spine-btn{ padding:12px 14px; font-size:14.5px; } /* comfortable ~44px touch target */
    .spine-stats{ padding-bottom:6px; }

    main{ padding:20px 16px 50px; }
    .tree-children{ margin-left:14px; padding-left:12px; }

    /* Tables scroll horizontally instead of squeezing or breaking layout */
    table{ display:block; overflow-x:auto; -webkit-overflow-scrolling:touch; white-space:nowrap; }
    td, th{ padding:8px; }

    /* Forms: one full-width field per row reads and taps far better
       than several cramped side-by-side inputs on a narrow screen */
    form.inline-form{ flex-direction:column; align-items:stretch; }
    .field{ width:100%; }
    .field input, .field select, .field textarea{ width:100%; min-width:0; font-size:16px; } /* 16px avoids iOS auto-zoom on focus */
    .btn{ justify-content:center; }
    form.inline-form > .btn{ width:100%; margin-top:4px; }

    .page-head{ flex-direction:column; align-items:flex-start; }
    .page-head h1{ font-size:22px; }

    .member-head{ gap:14px; }
    .stamp{ width:64px; height:64px; }
    .stamp .no{ font-size:10.5px; }

    .balance-box{ flex-direction:column; align-items:flex-start; }
    .balance-box > div:last-child{ text-align:left; width:100%; }
    .balance-box .amt{ font-size:26px; }

    .grid{ grid-template-columns:1fr; }
    .stat-row{ gap:10px; }
    .stat-card{ flex:1 1 130px; min-width:0; padding:12px 14px; }

    .tree-card{ max-width:none; }
  }


/* Multi-group header switcher */
.group-switcher{margin:2px 10px 8px;padding:8px 10px;border:1px solid rgba(255,255,255,.12);border-radius:8px;background:rgba(255,255,255,.03)}
.group-switcher-label{display:flex;align-items:center;gap:8px;color:#9FB0A2;font-size:11px;text-transform:uppercase;letter-spacing:.06em;margin-bottom:6px}
.group-switcher .spine-dot{display:inline-block;width:7px;height:7px;border-radius:50%;background:#C08A28}
.group-switch-select{width:100%;min-height:36px;padding:7px 30px 7px 9px;border:1px solid rgba(255,255,255,.18);border-radius:7px;background:#14261C;color:#EADFC0;font:600 12.5px Inter,system-ui,sans-serif;cursor:pointer}
.group-switch-select:focus{outline:2px solid rgba(192,138,40,.55);outline-offset:1px}
@media(max-width:720px){.group-switcher{margin-left:8px;margin-right:8px}}
