/* ════════════════════════════════════════════════════════════════════════════
   ACCENT COLORS – 12 in spectrum order (2 × 6 rows)
   Row 1 cool: Green Teal Cyan Blue Indigo Violet
   Row 2 warm: Red Orange Amber Lime Pink Rose
   ════════════════════════════════════════════════════════════════════════════ */
html[data-accent="green"]  { --blue:#10b981; --blue-d:#059669; --blue-l:#ecfdf5; --blue-ring:#a7f3d0; }
html[data-accent="cyan"]   { --blue:#06b6d4; --blue-d:#0891b2; --blue-l:#ecfeff; --blue-ring:#a5f3fc; }
html[data-accent="indigo"] { --blue:#6366f1; --blue-d:#4f46e5; --blue-l:#eef2ff; --blue-ring:#c7d2fe; }
html[data-accent="violet"] { --blue:#8b5cf6; --blue-d:#7c3aed; --blue-l:#f5f3ff; --blue-ring:#ddd6fe; }
html[data-accent="red"]    { --blue:#ef4444; --blue-d:#dc2626; --blue-l:#fef2f2; --blue-ring:#fecaca; }
html[data-accent="orange"] { --blue:#f97316; --blue-d:#ea580c; --blue-l:#fff7ed; --blue-ring:#fed7aa; }
html[data-accent="amber"]  { --blue:#f59e0b; --blue-d:#d97706; --blue-l:#fffbeb; --blue-ring:#fde68a; }
html[data-accent="lime"]   { --blue:#84cc16; --blue-d:#65a30d; --blue-l:#f7fee7; --blue-ring:#d9f99d; }
html[data-accent="pink"]   { --blue:#ec4899; --blue-d:#db2777; --blue-l:#fdf2f8; --blue-ring:#fbcfe8; }
html[data-accent="fuchsia"]{ --blue:#d946ef; --blue-d:#c026d3; --blue-l:#fdf4ff; --blue-ring:#f0abfc; }
html[data-accent="rose"]   { --blue:#f43f5e; --blue-d:#e11d48; --blue-l:#fff1f2; --blue-ring:#fecdd3; }

:root {
  --blue:#3b82f6;--blue-d:#2563eb;--blue-l:#eff6ff;--blue-ring:#bfdbfe;
  --green:#10b981;--green-l:#ecfdf5;--green-b:#a7f3d0;
  --red:#ef4444;--red-l:#fef2f2;
  --text:#0f172a;--text-2:#334155;--text-3:#64748b;--text-4:#94a3b8;
  --border:#e2e8f0;--border-2:#f1f5f9;--bg:#f8fafc;--white:#fff;
  --radius-s:8px;--radius-m:12px;--radius-l:16px;--radius-xl:20px;
  --font:'Sora',sans-serif;--mono:'DM Mono',monospace;
  --shadow-s:0 1px 3px rgba(0,0,0,.05);--shadow-m:0 4px 16px rgba(0,0,0,.08);--shadow-l:0 8px 28px rgba(0,0,0,.12);
  --nav-h:60px;--sidebar-w:240px;--safe-b:env(safe-area-inset-bottom,0px);
  --item-row-pad-y:9px;--item-row-gap:10px;--section-head-pad-y:10px;--done-head-pad-y:6px;--add-item-pad-y:4px;
}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html,body{height:100%;overflow-x:hidden}
body{font-family:var(--font);background:var(--bg);color:var(--text-2);font-size:15px;line-height:1.5;-webkit-font-smoothing:antialiased}
button{font-family:var(--font);cursor:pointer}
input,textarea,select{font-family:var(--font)}
a{color:var(--blue);text-decoration:none}

/* ── Mobile layout ────────────────────────────────────────────────────────────── */
#app{max-width:430px;margin:0 auto;min-height:100vh;background:var(--bg);position:relative}
#view{padding-bottom:calc(var(--nav-h) + var(--safe-b))}
.sidebar{display:none}

/* ── Desktop layout ──────────────────────────────────────────────────────────── */
@media(min-width:768px){
  body{background:var(--border-2)}
  #app{max-width:100%;position:relative;min-height:100vh;margin:0}
  #view{margin-left:var(--sidebar-w);padding:0 24px 24px;max-width:calc(1100px + var(--sidebar-w))}
  .bottom-nav{display:none}
  .sidebar{display:flex;flex-direction:column;width:var(--sidebar-w);background:var(--white);border-right:1px solid var(--border-2);position:fixed;top:0;left:0;bottom:0;padding:0;overflow-y:auto;z-index:40}
  .sidebar-logo{padding:24px 20px 20px;border-bottom:1px solid var(--border-2)}
  .sidebar-logo .name{font-weight:800;font-size:17px;color:var(--text);letter-spacing:-.03em}
  .sidebar-logo .name span{color:var(--blue)}
  .sidebar-logo .ver{font-family:var(--mono);font-size:10px;color:var(--text-4);margin-top:2px}
  .sidebar-nav{padding:12px 10px;flex:1}
  .sidebar-nav-item{display:flex;align-items:center;gap:10px;padding:9px 12px;border-radius:var(--radius-s);cursor:pointer;font-size:var(--fs-base);font-weight:500;color:var(--text-3);border:none;background:none;width:100%;transition:all .15s;margin-bottom:2px}
  .sidebar-nav-item:hover{background:var(--bg);color:var(--text-2)}
  .sidebar-nav-item.active{background:var(--blue-l);color:var(--blue);font-weight:700}
  .sidebar-nav-item svg{flex-shrink:0}
  .sidebar-user{padding:16px 20px;border-top:1px solid var(--border-2);display:flex;align-items:center;gap:10px}
  .sidebar-user .name{font-size:13px;font-weight:600;color:var(--text-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .sidebar-user .email{font-size:11px;color:var(--text-4);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  /* Desktop appbar becomes just a page title */
  .appbar{padding:28px 0 16px;border-bottom:none;background:transparent}
  .appbar .appbar-logo,.appbar .avatar,.appbar .appbar-sub{display:none}
  .desktop-page-title{display:block;font-size:22px;font-weight:800;color:var(--text);letter-spacing:-.03em;padding:28px 0 4px}
  /* Trip cards grid */
  .cards{display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:0}
  .add-card{margin:0 0 0 0}
  /* Section view wider */
  .trip-header{border-radius:var(--radius-l);margin-bottom:4px;padding:24px 24px 0}
  .sections{background:var(--white);border-radius:var(--radius-l);padding:4px 0;margin-top:4px}
  /* Content area padding */
  .section-bar{padding:0 0 12px 0}
  .trip-group-header{padding:20px 0 8px}
  .cards-wrap{padding:0}
}
@media(min-width:768px) and (max-width:1023px){
  #view{max-width:calc(800px + var(--sidebar-w))}
  .cards{grid-template-columns:1fr}
}
@media(min-width:1280px){
  :root{--sidebar-w:260px}
  #view{max-width:calc(1200px + var(--sidebar-w))}
  .cards{grid-template-columns:1fr 1fr 1fr}
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:11px 20px;border-radius:var(--radius-s);font-size:var(--fs-sm);font-weight:600;border:none;transition:all .15s;white-space:nowrap}
.btn-primary{background:var(--blue);color:var(--white)}
.btn-primary:hover{background:var(--blue-d);transform:translateY(-1px);box-shadow:0 4px 12px rgba(59,130,246,.35)}
.btn-primary:active{transform:translateY(0)}
.btn-ghost{background:var(--border-2);color:var(--text-3)}
.btn-ghost:hover{background:var(--border)}
.btn-block{width:100%}
.btn-sm{padding:7px 13px;font-size:var(--fs-xs);border-radius:7px}
.btn-icon{width:32px;height:32px;padding:0;border-radius:50%;background:var(--border-2);color:var(--text-3);display:inline-flex;align-items:center;justify-content:center;border:none}
.btn-icon:hover{background:var(--border)}
.icon-btn{width:28px;height:28px;border-radius:6px;border:none;background:none;display:flex;align-items:center;justify-content:center;color:var(--text-3);opacity:.4;transition:opacity .15s,background .15s;flex-shrink:0}
.icon-btn:hover,.icon-btn.open{opacity:1;background:var(--border-2)}
.item-row:hover .icon-btn{opacity:.6}

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.field{margin-bottom:16px}
.field label{display:block;font-size:var(--fs-xs);font-weight:600;color:var(--text-3);margin-bottom:5px;letter-spacing:.01em}
.field input,.field textarea,.field select{width:100%;padding:11px 13px;border:1.5px solid var(--border);border-radius:var(--radius-s);font-size:var(--fs-base);color:var(--text);background:var(--white);outline:none;transition:border-color .15s,box-shadow .15s}
.field input:focus,.field textarea:focus,.field select:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(59,130,246,.15)}
.field .hint{font-size:11px;color:var(--text-4);margin-top:4px;font-family:var(--mono)}
.field-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.pw-wrap{position:relative}
.pw-wrap input{padding-right:40px}
.pw-toggle{position:absolute;right:10px;top:50%;transform:translateY(-50%);background:none;border:none;color:var(--text-4);padding:4px}

/* ── Alerts ──────────────────────────────────────────────────────────────────── */
.alert{padding:12px 14px;border-radius:var(--radius-s);font-size:13px;margin-bottom:16px}
.alert-err{background:var(--red-l);border:1px solid #fecaca;color:#dc2626}
.alert-ok{background:var(--green-l);border:1px solid var(--green-b);color:#065f46}

/* ── Login ───────────────────────────────────────────────────────────────────── */
.login-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px;background:var(--bg)}
.login-card{background:var(--white);border-radius:var(--radius-xl);box-shadow:var(--shadow-l);padding:36px 32px;width:100%;max-width:380px}
.login-logo{font-weight:800;font-size:22px;color:var(--text);letter-spacing:-.03em;margin-bottom:4px}
.login-logo span{color:var(--blue)}
.login-sub{font-size:13px;color:var(--text-4);margin-bottom:28px}
.login-footer{margin-top:20px;font-size:12px;color:var(--text-4);text-align:center;line-height:1.6}

/* ── App bar (mobile) ────────────────────────────────────────────────────────── */
.appbar{background:var(--white);border-bottom:1px solid var(--border-2);padding:48px 18px 14px;display:flex;align-items:center;justify-content:space-between}
.appbar-logo{font-weight:800;font-size:20px;color:var(--text);letter-spacing:-.03em}
.appbar-logo span{color:var(--blue)}
.appbar-sub{font-size:12px;color:var(--text-4);margin-top:1px}
.avatar{width:34px;height:34px;border-radius:50%;background:linear-gradient(135deg,var(--blue),#06b6d4);display:flex;align-items:center;justify-content:center;font-weight:800;font-size:13px;color:white;flex-shrink:0;cursor:pointer}
.desktop-page-title{display:none}
.section-bar{display:flex;align-items:center;justify-content:space-between;padding:16px 18px 12px}
.section-bar h2{font-size:var(--fs-sm);font-weight:700;color:var(--text-2)}

/* ── Trip group headers ──────────────────────────────────────────────────────── */
.trip-group-header{display:flex;align-items:center;gap:8px;padding:16px 18px 8px;cursor:pointer;user-select:none}
@media(min-width:768px){.trip-group-header{padding:20px 0 8px}}
.trip-group-header h2{font-size:12px;font-weight:700;color:var(--text-4);text-transform:uppercase;letter-spacing:.06em;flex:1}
.trip-group-header .count{font-family:var(--mono);font-size:11px;color:var(--text-4);background:var(--border-2);border:1px solid var(--border);border-radius:20px;padding:1px 8px}
.trip-group-header .chev{color:var(--text-4);transition:transform .2s}
.trip-group-header.closed .chev{transform:rotate(-90deg)}

/* ── Trip cards ──────────────────────────────────────────────────────────────── */
.cards{display:flex;flex-direction:column;gap:10px;padding:0 16px}
@media(min-width:768px){.cards{padding:0}}
.trip-card{background:var(--white);border:1.5px solid #e8edf2;border-radius:var(--radius-l);overflow:hidden;cursor:pointer;transition:transform .15s,box-shadow .15s,border-color .15s;box-shadow:var(--shadow-s);position:relative}
.trip-card:hover{transform:translateY(-2px);box-shadow:var(--shadow-l);border-color:var(--blue-ring)}
.trip-card:active{transform:translateY(0)}
.card-stripe{height:4px}
.card-body{padding:12px 14px 14px}
.card-top-row{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
.card-main-row{display:flex;align-items:flex-start;gap:10px;margin-bottom:10px}
.card-info{flex:1;min-width:0}
.type-pill{display:inline-block;font-family:var(--mono);font-size:10px;border-radius:4px;padding:2px 6px;border:1px solid}
.card-title{font-weight:800;font-size:17px;letter-spacing:-.025em;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-bottom:2px}
.card-title input{font-weight:800;font-size:17px;letter-spacing:-.025em;color:var(--text);border:none;border-bottom:2px solid var(--blue);background:transparent;outline:none;width:100%}
.card-date{font-size:var(--fs-xs);color:var(--text-4)}
.card-chips{display:flex;flex-wrap:wrap;gap:5px}
.chip{font-size:var(--fs-xs);border-radius:20px;padding:3px 9px;border:1px solid}
.chip-done{color:var(--green);background:var(--green-l);border-color:var(--green-b)}
.chip-open{color:var(--text-3);background:var(--bg);border-color:var(--border)}
.add-card{display:flex;align-items:center;gap:12px;padding:14px 16px;border:1.5px dashed var(--border);border-radius:var(--radius-l);cursor:pointer;margin:10px 16px 0;transition:border-color .15s}
@media(min-width:768px){.add-card{margin:0;grid-column:1/-1}}
.add-card:hover{border-color:var(--blue-ring)}
.add-card-icon{width:38px;height:38px;border-radius:10px;background:var(--border-2);display:flex;align-items:center;justify-content:center;font-size:20px;flex-shrink:0}

/* ── Progress ring ───────────────────────────────────────────────────────────── */
.prog-wrap{display:flex;flex-direction:column;align-items:center;gap:3px;flex-shrink:0}
.prog-ring{position:relative}
.prog-ring svg{transform:rotate(-90deg);display:block}
.prog-pct{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-family:var(--mono);font-size:10px;font-weight:600}
.prog-label{font-family:var(--mono);font-size:10px;color:var(--text-4)}

/* ── Trip view ───────────────────────────────────────────────────────────────── */
.trip-header{padding:48px 16px 0;background:var(--white);border-bottom:1px solid var(--border-2)}
@media(min-width:768px){.trip-header{padding:24px 24px 0}}
.trip-header-top{display:flex;align-items:center;gap:10px;margin-bottom:12px}
.trip-title{font-weight:800;font-size:24px;letter-spacing:-.03em;color:var(--text);margin:0 0 12px}
.progress-bar-wrap{padding-bottom:14px}
.progress-bar-row{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:6px}
.progress-bar-label{font-size:12px;color:var(--text-4)}
.progress-bar-val{font-family:var(--mono);font-size:12px;font-weight:600;color:var(--blue)}
.progress-bar-val.done{color:var(--green)}
.progress-bar-track{height:5px;background:var(--border-2);border-radius:99px;overflow:hidden}
.progress-bar-fill{height:100%;border-radius:99px;transition:width .5s ease;background:linear-gradient(to right,var(--blue),#06b6d4)}
.progress-bar-fill.done{background:var(--green)}

/* ── Sections ────────────────────────────────────────────────────────────────── */
.sections{padding-top:4px}
@media(min-width:768px){.sections{background:var(--white);border-radius:var(--radius-l);padding:4px 0 8px;margin-top:4px;box-shadow:var(--shadow-s);border:1.5px solid var(--border)}}
.section{margin-bottom:2px}
.section-head{display:flex;align-items:center;gap:9px;padding:var(--section-head-pad-y) 10px var(--section-head-pad-y) 14px;border-radius:10px;cursor:pointer;transition:background .12s;user-select:none}
.section-head:hover{background:var(--bg)}
.section-title-text{flex:1;font-weight:700;font-size:15.5px;letter-spacing:-.01em;color:var(--text);transition:color .2s}
.section-title-text.all-done{color:var(--text-4);text-decoration:line-through}
.section-count{font-family:var(--mono);font-size:var(--fs-xs);border-radius:20px;padding:2px 8px;border:1px solid;transition:all .2s}
.section-count.done{color:var(--green);background:var(--green-l);border-color:var(--green-b)}
.section-count.open{color:var(--text-3);background:var(--border-2);border-color:var(--border)}
.chevron{color:var(--text-4);transition:transform .2s;flex-shrink:0}
.chevron.closed{transform:rotate(-90deg)}
.section-divider{height:1px;background:var(--border-2);margin:0 14px}
.section-items{padding-bottom:4px}

/* ── Done sub-section ────────────────────────────────────────────────────────── */
.done-section{margin:4px 8px;border-radius:var(--radius-s);overflow:hidden}
.done-section-head{display:flex;align-items:center;gap:8px;padding:var(--done-head-pad-y) 10px;cursor:pointer;background:var(--border-2);border-radius:var(--radius-s);user-select:none;transition:background .12s}
.done-section-head:hover{background:var(--border)}
.done-section-label{font-size:12px;font-weight:600;color:var(--text-3);flex:1}
.done-section-count{font-family:var(--mono);font-size:10px;color:var(--text-4)}
.done-chevron{color:var(--text-4);transition:transform .2s}
.done-chevron.closed{transform:rotate(-90deg)}
.done-items-wrap{background:var(--border-2);border-radius:0 0 var(--radius-s) var(--radius-s);padding:2px 0 4px}
.done-items-wrap .item-row{opacity:.7}

/* ── Items ───────────────────────────────────────────────────────────────────── */
.item-row{display:flex;align-items:flex-start;gap:var(--item-row-gap);padding:var(--item-row-pad-y) 6px var(--item-row-pad-y) 14px;border-radius:var(--radius-s);transition:background .1s;position:relative;border-top:2px solid transparent;user-select:none}
.item-row:hover{background:var(--bg)}
.item-row.drag-over{background:var(--blue-l);border-top-color:var(--blue)}
.item-row.dragging{opacity:.35}
.drag-grip{width:18px;flex-shrink:0;display:flex;align-items:center;justify-content:center;align-self:center;cursor:grab;opacity:.45;transition:opacity .15s;touch-action:none}
.drag-grip:hover{opacity:1}
.item-row{cursor:grab}
.item-row:hover .drag-grip{opacity:.75}
.drag-grip:active{cursor:grabbing}
.item-cb{width:30px;height:30px;border-radius:9px;flex-shrink:0;margin-top:0;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .15s cubic-bezier(.34,1.56,.64,1);border:1.5px solid var(--border);background:var(--white);box-shadow:inset 0 0 0 1px rgba(255,255,255,.65)}
html[data-theme="light"] .item-cb,
html:not([data-theme]) .item-cb{border-color:#94a3b8}
html[data-theme="light"] .item-cb:hover,
html:not([data-theme]) .item-cb:hover{border-color:#64748b;background:#f8fafc}
.item-cb.checked{background:var(--blue);border-color:var(--blue);transform:scale(1.03);box-shadow:0 1px 6px rgba(59,130,246,.35)}
.item-cb svg{width:16px;height:16px}
.item-text{flex:1;font-size:15px;color:var(--text-2);line-height:1.5;cursor:pointer;transition:color .18s}
.item-text.done{color:var(--text-4);text-decoration:line-through}
.tmpl-tag{font-size:9px;font-family:var(--mono);color:var(--text-4);background:var(--bg);border:1px solid var(--border);border-radius:3px;padding:1px 4px;flex-shrink:0;white-space:nowrap;line-height:1;align-self:center;margin-left:5px}
.item-edit-row{display:flex;align-items:center;gap:10px;padding:9px 10px 9px 14px;background:var(--bg);border-radius:var(--radius-s);margin:0 4px}
.item-edit-placeholder{width:20px;height:20px;border:1.5px dashed var(--text-4);border-radius:6px;flex-shrink:0}
.item-edit-input{flex:1;border:none;outline:none;background:transparent;font-family:var(--font);font-size:15px;color:var(--text-2)}
.item-confirm-btn{width:24px;height:24px;border-radius:6px;background:var(--blue);border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0}

/* ── Add item row ────────────────────────────────────────────────────────────── */
.add-item-btn{width:100%;display:flex;align-items:center;gap:8px;padding:var(--add-item-pad-y) 10px var(--add-item-pad-y) 14px;background:none;border:none;cursor:pointer;border-radius:var(--radius-s);opacity:.38;transition:opacity .15s}
.add-item-btn:hover{opacity:.75}
.add-item-grip{width:18px;flex-shrink:0}
.add-item-icon{width:16px;height:16px;display:flex;align-items:center;justify-content:center;flex-shrink:0;color:var(--text-4)}
.add-item-label{font-size:12px;color:var(--text-3);font-weight:500}

/* ── Bottom nav (mobile only) ────────────────────────────────────────────────── */
.bottom-nav{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:100%;max-width:430px;background:rgba(255,255,255,.92);backdrop-filter:blur(14px);border-top:1px solid var(--border-2);display:flex;padding:10px 0;padding-bottom:calc(10px + var(--safe-b));z-index:50}
.nav-item{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;background:none;border:none;padding:3px 0;cursor:pointer;color:var(--text-4);transition:color .15s}
.nav-item.active{color:var(--blue)}
.nav-item span{font-size:var(--fs-xs);font-weight:400}
.nav-item.active span{font-weight:700}

/* ── Context menu ────────────────────────────────────────────────────────────── */
.ctx-menu{position:fixed;background:var(--white);border-radius:10px;box-shadow:0 4px 24px rgba(0,0,0,.14),0 0 0 1px rgba(0,0,0,.06);padding:4px;z-index:500;min-width:162px;animation:fadeUp2 .12s ease}
.ctx-item{width:100%;padding:8px 11px;border:none;background:none;cursor:pointer;text-align:left;font-family:var(--font);font-size:var(--fs-base);color:var(--text-2);border-radius:7px;display:flex;align-items:center;gap:9px}
.ctx-item:hover{background:var(--bg)}
.ctx-item.danger{color:var(--red)}
.ctx-item.danger:hover{background:var(--red-l)}
.ctx-item.disabled{color:var(--text-4);cursor:default;pointer-events:none}
.ctx-divider{height:1px;background:var(--border-2);margin:3px 6px}

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-overlay{position:fixed;inset:0;background:rgba(15,23,42,.45);backdrop-filter:blur(4px);z-index:400;display:flex;align-items:flex-end;padding-bottom:var(--safe-b)}
@media(min-width:500px){.modal-overlay{align-items:center}}
.modal-box{background:var(--white);border-radius:var(--radius-xl) var(--radius-xl) 0 0;padding:24px 22px 28px;width:100%;max-width:480px;margin:0 auto;max-height:92vh;overflow-y:auto;animation:slideUp .22s cubic-bezier(.22,1,.36,1)}
@media(min-width:500px){.modal-box{border-radius:var(--radius-xl)}}
.modal-title{font-weight:800;font-size:var(--fs-lg);letter-spacing:-.02em;margin-bottom:16px}
.modal-btns{display:flex;gap:10px;margin-top:20px}
.modal-btns .btn{flex:1}

/* ── Type selector ───────────────────────────────────────────────────────────── */
.type-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:4px}
.type-btn{padding:12px 10px;border-radius:var(--radius-m);border:1.5px solid var(--border);background:var(--white);cursor:pointer;text-align:center;transition:all .15s}
.type-btn .emoji{font-size:22px;display:block;margin-bottom:4px}
.type-btn .label{font-size:12px;font-weight:600;color:var(--text-2)}
.type-btn:hover,.type-btn.sel{border-color:var(--blue);background:var(--blue-l)}
.type-btn.sel .label{color:var(--blue)}

/* ── Toast ───────────────────────────────────────────────────────────────────── */
.toast{position:fixed;bottom:calc(var(--nav-h) + 16px + var(--safe-b));left:50%;transform:translateX(-50%);background:var(--text);color:var(--white);font-size:13px;padding:10px 18px;border-radius:16px;z-index:600;white-space:nowrap;box-shadow:var(--shadow-m);pointer-events:none;max-width:88vw;text-align:center}
@media(min-width:768px){.toast{bottom:24px}}

/* ── Drag ghost ──────────────────────────────────────────────────────────────── */
.drag-ghost{position:fixed;pointer-events:none;z-index:9999;border-radius:var(--radius-s);box-shadow:0 8px 24px rgba(0,0,0,.2);background:white;opacity:.85;left:0}

/* ── Settings card ───────────────────────────────────────────────────────────── */
.settings-card{background:var(--white);border-radius:var(--radius-l);border:1.5px solid var(--border);overflow:hidden;margin-bottom:12px}
.settings-row{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:14px 16px;border-bottom:1px solid var(--border-2)}
.settings-row:last-child{border-bottom:none}
.settings-label{font-size:var(--fs-base);font-weight:600;color:var(--text-2)}
.settings-hint{font-size:var(--fs-sm);color:var(--text-4);margin-top:2px}
.toggle-wrap{display:flex;border-radius:8px;overflow:hidden;border:1.5px solid var(--border);flex-shrink:0;align-self:center}
.toggle-opt{padding:8px 12px;border:none;background:var(--bg);font-family:var(--font);font-size:var(--fs-sm);font-weight:600;color:var(--text-3);cursor:pointer;transition:all .15s;flex:1;text-align:center}
.toggle-opt.active{background:var(--blue);color:white}

/* ── Skeleton ────────────────────────────────────────────────────────────────── */
.skel{background:linear-gradient(90deg,var(--border-2) 25%,var(--border) 50%,var(--border-2) 75%);background-size:200%;border-radius:var(--radius-s);animation:shimmer 1.4s infinite}
@keyframes shimmer{from{background-position:200% 0}to{background-position:-200% 0}}

/* ── Animations ──────────────────────────────────────────────────────────────── */
@keyframes fadeUp2{from{opacity:0;transform:translateY(-5px)}to{opacity:1;transform:translateY(0)}}
@keyframes slideUp{from{transform:translateY(100%)}to{transform:translateY(0)}}
@keyframes fadeIn{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
.anim-out{animation:fadeOutMove .16s ease forwards}
.anim-in{animation:fadeIn .13s ease}
.done-items-wrap .item-row.anim-in{animation:fadeIn .18s ease, donePulse .18s ease}
@keyframes fadeOutMove{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-8px) scale(.98)}}
@keyframes donePulse{0%{filter:brightness(1)}50%{filter:brightness(1.03)}100%{filter:brightness(1)}}
.d-none{display:none !important}

/* ═══════════════════════════════════════════════════════════════════════════
   THEMING: Dark / Contrast + Accent Colors + Font Size
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Dark theme ─────────────────────────────────────────────────────────────── */
html[data-theme="dark"] {
  --text:     #f1f5f9;
  --text-2:   #cbd5e1;
  --text-3:   #94a3b8;
  --text-4:   #64748b;
  --border:   #334155;
  --border-2: #1e293b;
  --bg:       #0f172a;
  --white:    #1e293b;
  --blue-l:   #1e3a5f;
  --green-l:  #064e3b;
  --green-b:  #065f46;
  --red-l:    #450a0a;
}
html[data-theme="dark"] body { background: #0f172a; }
html[data-theme="dark"] .login-wrap { background: #0f172a; }
html[data-theme="dark"] .login-card { background: #1e293b; box-shadow: 0 4px 24px rgba(0,0,0,.4); }
html[data-theme="dark"] .trip-card  { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .trip-card:hover { border-color: var(--blue); }
html[data-theme="dark"] .appbar, html[data-theme="dark"] .trip-header { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .section-head:hover { background: #0f172a; }
html[data-theme="dark"] .item-row:hover { background: #0f172a; }
html[data-theme="dark"] .bottom-nav { background: rgba(15,23,42,.92); border-color: #334155; }
html[data-theme="dark"] .settings-card { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .ctx-menu { background: #1e293b; box-shadow: 0 4px 24px rgba(0,0,0,.4), 0 0 0 1px #334155; }
html[data-theme="dark"] .ctx-item:hover { background: #0f172a; }
html[data-theme="dark"] .modal-box { background: #1e293b; }
html[data-theme="dark"] .field input, html[data-theme="dark"] .field textarea, html[data-theme="dark"] .field select { background: #0f172a; border-color: #334155; color: var(--text); }
html[data-theme="dark"] .type-btn { background: #0f172a; border-color: #334155; }
html[data-theme="dark"] .type-btn:hover, html[data-theme="dark"] .type-btn.sel { background: var(--blue-l); }
html[data-theme="dark"] .toggle-opt { background: #0f172a; color: var(--text-3); }
html[data-theme="dark"] .sidebar { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .sidebar-nav-item:hover { background: #0f172a; }
html[data-theme="dark"] .sections { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .item-cb { background: #0f172a; border-color: #475569; }
html[data-theme="dark"] .done-section-head { background: #0f172a; }
html[data-theme="dark"] .done-items-wrap { background: #0f172a; }


/* ── Accent colors ───────────────────────────────────────────────────────────── */
html[data-accent="cyan"]   { --blue:#06b6d4; --blue-d:#0891b2; --blue-l:#ecfeff; --blue-ring:#a5f3fc; }
html[data-accent="green"]  { --blue:#10b981; --blue-d:#059669; --blue-l:#ecfdf5; --blue-ring:#a7f3d0; }
html[data-accent="violet"] { --blue:#8b5cf6; --blue-d:#7c3aed; --blue-l:#f5f3ff; --blue-ring:#ddd6fe; }
html[data-accent="fuchsia"]{ --blue:#d946ef; --blue-d:#c026d3; --blue-l:#fdf4ff; --blue-ring:#f0abfc; }
html[data-accent="rose"]   { --blue:#f43f5e; --blue-d:#e11d48; --blue-l:#fff1f2; --blue-ring:#fecdd3; }
html[data-accent="amber"]  { --blue:#f59e0b; --blue-d:#d97706; --blue-l:#fffbeb; --blue-ring:#fde68a; }
html[data-accent="indigo"] { --blue:#6366f1; --blue-d:#4f46e5; --blue-l:#eef2ff; --blue-ring:#c7d2fe; }
html[data-accent="orange"] { --blue:#f97316; --blue-d:#ea580c; --blue-l:#fff7ed; --blue-ring:#fed7aa; }


/* ── Color swatches in options ───────────────────────────────────────────────── */
.color-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.color-swatch { width: 38px; height: 38px; border-radius: 10px; cursor: pointer; border: 3px solid transparent; transition: all .15s; flex-shrink: 0; }
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--text); }

/* ── Share indicator on cards ────────────────────────────────────────────────── */
.share-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-family: var(--mono); background: var(--green-l); color: var(--green); border: 1px solid var(--green-b); border-radius: 4px; padding: 2px 6px; cursor: pointer; transition: all .15s; flex-shrink: 0; }
.share-badge:hover { background: var(--green); color: white; }

html[data-theme="dark"] .toggle-opt { background: #334155; color: var(--text-3); border-right: 1px solid #475569; }
html[data-theme="dark"] .toggle-opt.active { background: var(--blue); color: white; }
html[data-theme="dark"] .toggle-wrap { border-color: #475569; }
html[data-theme="dark"] .modal-box { background: #1e293b; color: var(--text); }
html[data-theme="dark"] .modal-title { color: var(--text); }
html[data-theme="dark"] .btn-ghost { background: #334155; color: var(--text-2); }
html[data-theme="dark"] .btn-ghost:hover { background: #475569; }
/* Contrast mode – fix dark sections and invisible elements */
html[data-theme="contrast"] .done-section-head { background: #e0e0e0; border: 1px solid #000; }
html[data-theme="contrast"] .done-items-wrap { background: #f0f0f0; border: 1px solid #888; }
html[data-theme="contrast"] .section-count.done { background: #ccffcc; color: #006600; border-color: #006600; }
html[data-theme="contrast"] .section-count.open { background: #e0e0e0; color: #000; border-color: #000; }
html[data-theme="contrast"] .progress-bar-fill { background: #0040cc !important; }
html[data-theme="contrast"] .toggle-opt { background: #e0e0e0; color: #000; border: 1.5px solid #000; }
html[data-theme="contrast"] .toggle-opt.active { background: #0040cc; color: white; border-color: #0040cc; }
html[data-theme="contrast"] .toggle-wrap { border: 2px solid #000; }
html[data-theme="contrast"] .modal-box { background: #fff; border: 2px solid #000; }
html[data-theme="contrast"] .chip { border: 1.5px solid #333; }
html[data-theme="contrast"] .item-cb { border: 2px solid #000; background: #fff; }
html[data-theme="contrast"] .item-cb.checked { background: #0040cc; border-color: #0040cc; }
html[data-theme="contrast"] .section-head:hover { background: #e0e0e0; }
html[data-theme="contrast"] .btn-ghost { background: #e0e0e0; color: #000; border: 2px solid #000; }
html[data-theme="contrast"] .type-btn { border: 2px solid #000; }
html[data-theme="contrast"] .type-btn.sel { border-color: #0040cc; background: #cce0ff; }
html[data-theme="contrast"] .add-item-box { border-color: #000; }
html[data-theme="contrast"] .add-item-label { color: #000; }
/* ── Font size – comprehensive ─────────────────────────────────────────────── */
html[data-font="small"]  { font-size: 13px; }
html[data-font="small"]  .item-text { font-size: 13px; }
html[data-font="small"]  .section-title-text { font-size: 13px; }
html[data-font="small"]  .item-cb { width: 16px; height: 16px; border-radius: 4px; }
html[data-font="small"]  .item-row { padding: 6px 6px 6px 14px; }
html[data-font="small"]  .drag-grip { width: 16px; }
html[data-font="small"]  .add-item-label { font-size: 11px; }
html[data-font="small"]  .section-count { font-size: 10px; }
html[data-font="small"]  .card-title { font-size: 15px; }
html[data-font="small"]  .chip { font-size: 10px; padding: 2px 7px; }

html[data-font="large"]  { font-size: 17px; }
html[data-font="large"]  .item-text { font-size: 17px; line-height: 1.55; }
html[data-font="large"]  .section-title-text { font-size: 17px; }
html[data-font="large"]  .item-cb { width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0; }
html[data-font="large"]  .item-row { padding: 12px 6px 12px 14px; gap: 12px; }
html[data-font="large"]  .section-head { padding: 13px 10px 13px 14px; }
html[data-font="large"]  .drag-grip { width: 20px; }
html[data-font="large"]  .add-item-label { font-size: 15px; }
html[data-font="large"]  .section-count { font-size: 13px; padding: 3px 10px; }
html[data-font="large"]  .card-title { font-size: 19px; }
html[data-font="large"]  .chip { font-size: 13px; padding: 4px 11px; }
html[data-font="large"]  .btn { font-size: 16px; }
html[data-font="large"]  .nav-item span { font-size: 12px; }

/* ════════════════════════════════════════════════════════════════════════════
   FONT SIZE SCALING – affects entire app via CSS custom properties
   ════════════════════════════════════════════════════════════════════════════ */
:root {
  --fs-base:    15px;
  --fs-sm:      13px;
  --fs-xs:      11px;
  --fs-lg:      17px;
  --fs-xl:      20px;
  --fs-2xl:     24px;
  --fs-h1:      26px;
  --cb-size:    20px;
  --cb-radius:  6px;
  --row-pad:    9px;
}

/* Small */
html[data-font="small"] {
  --fs-base:  13px;
  --fs-sm:    11px;
  --fs-xs:    10px;
  --fs-lg:    14px;
  --fs-xl:    17px;
  --fs-2xl:   20px;
  --fs-h1:    22px;
  --cb-size:  17px;
  --cb-radius:5px;
  --row-pad:  7px;
}

/* Large */
html[data-font="large"] {
  --fs-base:  17px;
  --fs-sm:    15px;
  --fs-xs:    12px;
  --fs-lg:    19px;
  --fs-xl:    22px;
  --fs-2xl:   27px;
  --fs-h1:    28px;
  --cb-size:  24px;
  --cb-radius:7px;
  --row-pad:  12px;
}

/* Apply to all elements */
body                      { font-size: var(--fs-base); }
.item-text                { font-size: var(--fs-base); }
.section-title-text       { font-size: var(--fs-lg); }
.card-title               { font-size: var(--fs-xl); }
.trip-title               { font-size: var(--fs-2xl); }
.appbar-logo              { font-size: var(--fs-xl); }
.btn                      { font-size: var(--fs-sm); }
.btn.btn-primary          { font-size: var(--fs-sm); }
.modal-title              { font-size: var(--fs-lg); }
.ctx-item                 { font-size: var(--fs-base); }
.nav-item span            { font-size: 10px; }
html[data-font="large"] .nav-item span { font-size: 12px; }
.add-item-label           { font-size: var(--fs-sm); }
.section-count            { font-size: var(--fs-xs); }
.chip                     { font-size: var(--fs-xs); }
.card-date                { font-size: var(--fs-xs); }
.type-pill                { font-size: var(--fs-xs); }
.settings-label           { font-size: var(--fs-base); }
.settings-hint            { font-size: var(--fs-sm); }
.sidebar-nav-item         { font-size: var(--fs-base); }
.sidebar-logo .name       { font-size: var(--fs-lg); }
.trip-group-header h2     { font-size: var(--fs-xs); }
.progress-bar-label       { font-size: var(--fs-xs); }
.progress-bar-val         { font-size: var(--fs-xs); }
.tmpl-tag                 { font-size: 9px; }
.item-cb {
  width:  var(--cb-size);
  height: var(--cb-size);
  border-radius: var(--cb-radius);
}
.item-row                 { padding: var(--row-pad) 6px var(--row-pad) 14px; }
.section-head             { padding: var(--row-pad) 10px var(--row-pad) 14px; }

/* ── Density: compact list spacing ─────────────────────────────────────────── */
html[data-density="compact"] {
  --row-pad: 5px;
  --item-row-pad-y: 5px;
  --item-row-gap: 7px;
  --section-head-pad-y: 7px;
  --done-head-pad-y: 4px;
  --add-item-pad-y: 2px;
}
html[data-density="compact"] .item-text { line-height: 1.35; }
html[data-density="compact"] .section-items { padding-bottom: 2px; }


/* ════════════════════════════════════════════════════════════════════════════
   ACCENT COLORS – 12 colors, 2 rows of 6
   Row 1: Blue · Cyan · Green · Teal · Violet · Indigo
   Row 2: Orange · Amber · Rose · Sky · Pink · Red
   ════════════════════════════════════════════════════════════════════════════ */
html[data-accent="cyan"]   { --blue:#06b6d4; --blue-d:#0891b2; --blue-l:#ecfeff; --blue-ring:#a5f3fc; }
html[data-accent="green"]  { --blue:#10b981; --blue-d:#059669; --blue-l:#ecfdf5; --blue-ring:#a7f3d0; }
html[data-accent="violet"] { --blue:#8b5cf6; --blue-d:#7c3aed; --blue-l:#f5f3ff; --blue-ring:#ddd6fe; }
html[data-accent="indigo"] { --blue:#6366f1; --blue-d:#4f46e5; --blue-l:#eef2ff; --blue-ring:#c7d2fe; }
html[data-accent="orange"] { --blue:#f97316; --blue-d:#ea580c; --blue-l:#fff7ed; --blue-ring:#fed7aa; }
html[data-accent="amber"]  { --blue:#f59e0b; --blue-d:#d97706; --blue-l:#fffbeb; --blue-ring:#fde68a; }
html[data-accent="fuchsia"]{ --blue:#d946ef; --blue-d:#c026d3; --blue-l:#fdf4ff; --blue-ring:#f0abfc; }
html[data-accent="rose"]   { --blue:#f43f5e; --blue-d:#e11d48; --blue-l:#fff1f2; --blue-ring:#fecdd3; }
html[data-accent="pink"]   { --blue:#ec4899; --blue-d:#db2777; --blue-l:#fdf2f8; --blue-ring:#fbcfe8; }
html[data-accent="red"]    { --blue:#ef4444; --blue-d:#dc2626; --blue-l:#fef2f2; --blue-ring:#fecaca; }

/* ── Contrast (high contrast) theme ─────────────────────────────────────────── */
/* Preserves accent color – only maximises text/border contrast */
html[data-theme="contrast"] {
  --text:      #000000;
  --text-2:    #111111;
  --text-3:    #2a2a2a;
  --text-4:    #444444;
  --border:    #000000;
  --border-2:  #444444;
  --bg:        #f2f2f2;
  --white:     #ffffff;
  /* Keep --blue / accent as-is so user's chosen color stays */
}
html[data-theme="contrast"] body                { background: #f2f2f2; }
html[data-theme="contrast"] .login-wrap         { background: #f2f2f2; }
html[data-theme="contrast"] .login-card         { box-shadow: 0 0 0 2px #000; }
html[data-theme="contrast"] .trip-card          { border: 2px solid #000; box-shadow: none; }
html[data-theme="contrast"] .item-cb            { border: 2px solid #000 !important; }
html[data-theme="contrast"] .section-count      { border: 1.5px solid #000 !important; font-weight: 700; }
html[data-theme="contrast"] .section-head:hover { background: #e0e0e0; }
html[data-theme="contrast"] .item-row:hover     { background: #e8e8e8; }
html[data-theme="contrast"] .progress-bar-track { background: #ccc; border: 1px solid #000; }
html[data-theme="contrast"] .bottom-nav         { border-top: 2px solid #000; background: #fff; }
html[data-theme="contrast"] .appbar             { border-bottom: 2px solid #000; }
html[data-theme="contrast"] .toggle-opt         { background: #e8e8e8; color: #000; border: 1.5px solid #000; font-weight: 700; }
html[data-theme="contrast"] .toggle-opt.active  { color: white; /* background stays accent */ }
html[data-theme="contrast"] .toggle-wrap        { border: 2px solid #000; }
html[data-theme="contrast"] .modal-box          { background: #fff; border: 2px solid #000; box-shadow: none; }
html[data-theme="contrast"] .done-section-head  { background: #e0e0e0; border: 1.5px solid #555; }
html[data-theme="contrast"] .done-items-wrap    { background: #ebebeb; }
html[data-theme="contrast"] .chip               { border: 1.5px solid #333; font-weight: 600; }
html[data-theme="contrast"] .ctx-menu           { border: 2px solid #000; box-shadow: none; }
html[data-theme="contrast"] .btn-ghost          { background: #e0e0e0; color: #000; border: 2px solid #555; }
html[data-theme="contrast"] .field input, html[data-theme="contrast"] .field select { border: 2px solid #000; }
html[data-theme="contrast"] .type-btn           { border: 2px solid #555; }
html[data-theme="contrast"] .type-btn.sel       { border-color: #000; border-width: 2.5px; }


/* ── Font size !important overrides (for JS-rendered inline styles) ─────────── */
[data-font] .ctx-item      { font-size: var(--fs-base) !important; }
[data-font] .modal-title   { font-size: var(--fs-lg)   !important; }
[data-font] .settings-label{ font-size: var(--fs-base) !important; }
[data-font] .settings-hint { font-size: var(--fs-sm)   !important; }
[data-font] .nav-item span { font-size: var(--fs-xs)   !important; }
html[data-font="large"] .nav-item span { font-size: 12px   !important; }
[data-font] .type-btn .label { font-size: var(--fs-sm) !important; }
[data-font] .sidebar-nav-item { font-size: var(--fs-base) !important; }
[data-font] .section-bar h2 { font-size: var(--fs-sm)  !important; }
[data-font] .appbar-sub    { font-size: var(--fs-xs)   !important; }
[data-font] .trip-group-header .count { font-size: var(--fs-xs) !important; }
