/* ============================================================
   Life Manager — "planner page" design system
   Warm paper, ink type, saturated class colors as solid blocks.
   ============================================================ */

:root {
  --paper: #F4EFE6;
  --surface: #FFFCF6;
  --surface-2: #EBE4D6;
  --ink: #17140F;
  --ink-2: #4A443B;
  --muted: #7C7366;
  --line: #DCD3C2;
  --accent: #F2542D;
  --accent-ink: #FFFFFF;
  --danger: #D42A3C;
  --ok: #17936D;
  --hard: var(--ink);
  --hatch: rgba(23, 20, 15, .07);

  --c-tomato: #F2542D;
  --c-cobalt: #2F5BEA;
  --c-citron: #E7CC2B;
  --c-mint: #1FAE85;
  --c-violet: #8A4FFF;
  --c-pink: #F0569A;
  --c-orange: #FF9417;
  --c-sky: #239FDB;

  --r: 14px;
  --r-sm: 9px;
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --body: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14120F;
    --surface: #1E1B17;
    --surface-2: #2A2620;
    --ink: #F4EFE6;
    --ink-2: #D2C9BA;
    --muted: #978D7F;
    --line: #353029;
    --hard: #F4EFE6;
    --hatch: rgba(244, 239, 230, .06);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14120F;
  --surface: #1E1B17;
  --surface-2: #2A2620;
  --ink: #F4EFE6;
  --ink-2: #D2C9BA;
  --muted: #978D7F;
  --line: #353029;
  --hard: #F4EFE6;
  --hatch: rgba(244, 239, 230, .06);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.4 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.tnum { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.app { min-height: 100dvh; }
.sidebar { display: none; }
.main {
  padding: calc(var(--safe-t) + 14px) 16px calc(var(--tabbar-h) + var(--safe-b) + 96px);
  max-width: 1180px;
  margin: 0 auto;
  outline: none;
}

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
}
.tab { text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--muted);
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"] .tab-ico { background: var(--ink); color: var(--paper); }
.tab-ico { display: grid; place-items: center; width: 46px; height: 28px; border-radius: 99px; transition: background .15s; }

.fab {
  position: fixed; z-index: 21;
  right: 16px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px);
  width: 60px; height: 60px; border-radius: 18px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--hard);
  transition: transform .12s, box-shadow .12s;
}
.fab:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--hard); }

@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: 240px minmax(0, 1fr); }
  .sidebar {
    display: flex; flex-direction: column; gap: 28px;
    position: sticky; top: 0; height: 100dvh;
    padding: 28px 18px 22px;
    border-right: 1px solid var(--line);
  }
  .tabbar { display: none; }
  .main { padding: 36px 40px 120px; width: 100%; }
  .fab { right: 32px; bottom: 32px; }
  .page-head .icon-btn.settings-btn { display: none; }
}

.wordmark {
  font: 800 30px/0.92 var(--display); letter-spacing: -.035em;
  position: relative; padding-left: 2px;
}
.wordmark-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: 3px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link { text-decoration: none;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  font-weight: 600; color: var(--ink-2);
}
.nav-link svg { width: 22px; height: 22px; }
.nav-link:hover { background: var(--surface-2); }
.nav-link[aria-current="page"] { background: var(--ink); color: var(--paper); }
.nav-link .nav-num { margin-left: auto; font-size: 12px; opacity: .55; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.kbd-hint { margin: 0; font-size: 12px; color: var(--muted); }
kbd { font: 600 11px var(--body); padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); }

.sync-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  text-align: left;
}
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.sync-dot.ok { background: var(--ok); }
.sync-dot.busy { background: var(--c-orange); animation: pulse 1s infinite; }
.sync-dot.err { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.page-title { font: 800 clamp(38px, 11vw, 60px)/.9 var(--display); letter-spacing: -.045em; margin: 0; }
.page-title .accent { color: var(--accent); }
.page-sub { margin: 10px 0 0; color: var(--ink-2); font-size: 15px; }
.page-sub b { color: var(--ink); }
.head-actions { display: flex; gap: 8px; flex: none; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .sync-dot { position: absolute; }

/* ---------- Sections ---------- */
.section { margin: 0 0 26px; }
.section-head { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.section-title { font: 700 13px/1 var(--body); letter-spacing: .1em; text-transform: uppercase; margin: 0; color: var(--ink); }
.section-count { font: 700 12px/1 var(--body); padding: 4px 7px; border-radius: 99px; background: var(--ink); color: var(--paper); }
.section-count.danger { background: var(--danger); color: #fff; }
.section-rule { flex: 1; height: 1px; background: var(--line); }
.section-link { font-size: 13px; font-weight: 600; color: var(--muted); }
.section-link:hover { color: var(--ink); }

.cols { display: grid; gap: 0 32px; }
@media (min-width: 960px) {
  .cols.two { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
}

/* ---------- Hero: next deadline ---------- */
.hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr; gap: 4px 18px; align-items: end;
  padding: 18px 18px 18px;
  border-radius: var(--r);
  background: var(--cc, var(--accent)); color: var(--cf, #fff);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--hard);
  margin-bottom: 26px; width: 100%; text-align: left;
}
.hero-num { font: 800 84px/.78 var(--display); letter-spacing: -.06em; grid-row: span 2; }
.hero-unit { font: 700 13px var(--body); letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.hero-title { font: 700 22px/1.12 var(--display); letter-spacing: -.02em; margin: 0; }
.hero-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; padding-top: 12px; border-top: 1.5px dashed currentColor; font-size: 13px; font-weight: 600; opacity: .9; }
.hero-tag { position: absolute; top: 14px; right: 14px; font: 700 11px var(--body); letter-spacing: .12em; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; background: var(--ink); color: var(--paper); }
.hero.calm { --cc: var(--surface); --cf: var(--ink); }

/* ---------- List items ---------- */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 12px 14px 12px 12px; min-height: 60px;
  border-top: 1px solid var(--line); position: relative;
}
.item:first-child { border-top: 0; }
.item::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--cc, transparent); }
.item-main { min-width: 0; text-align: left; padding: 2px 0; }
.item-title { font-weight: 600; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 3px; font-size: 13px; color: var(--muted); }
.item-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.item.done .item-title { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); }
.item.done::before { opacity: .35; }
.prio-high .item-title::after { content: " !"; color: var(--danger); font-weight: 800; }

.check {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--cc, var(--ink)); display: grid; place-items: center; flex: none;
  transition: background .15s, transform .15s;
}
.check svg { width: 16px; height: 16px; opacity: 0; color: var(--cf, #fff); }
.check:active { transform: scale(.88); }
.done .check, .check.on { background: var(--cc, var(--ink)); }
.done .check svg, .check.on svg { opacity: 1; }
.check.sq { border-radius: 8px; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; color: var(--ink-2);
}
.tag-sw { width: 9px; height: 9px; border-radius: 3px; background: var(--cc); }

.chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 52px; padding: 5px 9px; border-radius: 8px;
  font: 700 12px/1 var(--body); letter-spacing: .02em; white-space: nowrap;
  border: 1.5px solid var(--line); color: var(--ink-2); background: var(--paper);
}
.chip.overdue { background: var(--danger); border-color: var(--danger); color: #fff; }
.chip.today { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.soon { border-color: var(--ink); color: var(--ink); }
.chip.big { font-family: var(--display); font-size: 15px; padding: 7px 10px; }

/* ---------- Empty states ---------- */
.empty {
  padding: 22px 18px; border: 1.5px dashed var(--line); border-radius: var(--r);
  color: var(--muted); font-size: 15px; text-align: center;
  background: repeating-linear-gradient(-45deg, transparent 0 9px, var(--hatch) 9px 10px);
}
.empty strong { display: block; color: var(--ink); font: 700 18px var(--display); margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 12px;
  font-weight: 700; font-size: 15px;
  background: var(--surface); border: 1.5px solid var(--ink); color: var(--ink);
}
.btn.primary { background: var(--ink); color: var(--paper); box-shadow: 3px 3px 0 var(--accent); }
.btn.primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--accent); }
.btn.accent { background: var(--accent); color: #fff; border-color: var(--ink); box-shadow: 3px 3px 0 var(--hard); }
.btn.ghost { border-color: var(--line); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }

/* ---------- Segmented control ---------- */
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); margin-bottom: 18px; }
.seg button { padding: 8px 16px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 0 var(--line), 0 0 0 1px var(--line); }

/* ---------- Timeline (today) ---------- */
.timeline { display: flex; flex-direction: column; gap: 8px; }
.slot { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 10px; align-items: stretch; }
.slot-time { font: 700 13px/1.15 var(--body); color: var(--ink-2); padding-top: 11px; text-align: right; font-variant-numeric: tabular-nums; }
.slot-time small { display: block; font-weight: 500; color: var(--muted); }
.slot-card {
  padding: 10px 12px; border-radius: 12px; text-align: left; width: 100%;
  background: var(--cc); color: var(--cf);
}
.slot-card.soft { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left: 5px solid var(--cc); }
.slot-title { font: 700 16px/1.2 var(--display); letter-spacing: -.01em; }
.slot-meta { font-size: 13px; opacity: .85; margin-top: 2px; }
.slot.past { opacity: .45; }
.slot.now .slot-card { outline: 2.5px solid var(--ink); outline-offset: 2px; }
.now-line { display: grid; grid-template-columns: 58px 1fr; gap: 10px; align-items: center; }
.now-line span:first-child { font: 800 11px var(--body); letter-spacing: .1em; color: var(--accent); text-align: right; }
.now-line span:last-child { height: 2px; background: var(--accent); border-radius: 2px; position: relative; }
.now-line span:last-child::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* ---------- Balance bar ---------- */
.balance { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.balance-bar { display: flex; height: 22px; border-radius: 7px; overflow: hidden; background: repeating-linear-gradient(-45deg, var(--surface-2) 0 6px, transparent 6px 12px); border: 1px solid var(--line); }
.balance-bar span { height: 100%; }
.balance-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.balance-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: 0; }
.balance-note { margin: 10px 0 0; font-size: 14px; font-weight: 600; }

/* ---------- Habits ---------- */
.habit-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.habit-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px 8px 8px; border-radius: 99px;
  border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px;
}
.habit-pill .check { width: 24px; height: 24px; }
.habit-pill .check svg { width: 14px; height: 14px; }
.habit-pill.on { border-color: var(--cc); }
.habit-pill .streak { font: 800 13px var(--display); color: var(--muted); }

.habit-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px; border-top: 1px solid var(--line); }
.habit-row:first-child { border-top: 0; }
.habit-row .check { width: 44px; height: 44px; border-width: 2.5px; }
.habit-row .check svg { width: 24px; height: 24px; }
.habit-name { font: 700 18px/1.15 var(--display); letter-spacing: -.01em; text-align: left; }
.week-dots { display: flex; gap: 5px; margin-top: 8px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; font-weight: 700; color: var(--muted); }
.wd b { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line); display: block; }
.wd.on b { background: var(--cc); border-color: var(--cc); }
.wd.today { color: var(--ink); }
.wd.today b { border-color: var(--ink); }
.streak-big { text-align: right; }
.streak-big b { display: block; font: 800 34px/.9 var(--display); letter-spacing: -.04em; }
.streak-big span { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.streak-big.hot b { color: var(--accent); }

/* ---------- Classes ---------- */
.class-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 700px) { .class-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }
.class-card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  min-height: 150px; padding: 14px; border-radius: var(--r); text-align: left;
  background: var(--cc); color: var(--cf); border: 2px solid var(--ink);
  transition: transform .12s, box-shadow .12s;
}
.class-card:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--hard); }
.class-code { font: 800 26px/.95 var(--display); letter-spacing: -.035em; overflow-wrap: anywhere; }
.class-name { font-size: 14px; font-weight: 600; opacity: .9; margin-top: 4px; }
.class-foot { display: flex; justify-content: space-between; align-items: end; gap: 8px; font-size: 12px; font-weight: 700; }
.class-due { font: 800 30px/.85 var(--display); letter-spacing: -.04em; text-align: right; }
.class-due small { display: block; font: 700 10px var(--body); letter-spacing: .1em; text-transform: uppercase; opacity: .8; }
.class-card.add { background: transparent; color: var(--muted); border: 2px dashed var(--line); align-items: center; justify-content: center; font-weight: 700; }
.class-card.add:hover { color: var(--ink); border-color: var(--ink); box-shadow: none; }

.day-group { margin-bottom: 18px; }
.day-label { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; font: 800 20px/1 var(--display); letter-spacing: -.02em; }
.day-label small { font: 600 13px var(--body); color: var(--muted); letter-spacing: 0; }
.day-label.overdue { color: var(--danger); }

/* ---------- Quick add (tasks) ---------- */
.quick-add { display: flex; gap: 8px; margin-bottom: 22px; }
.quick-add input { flex: 1; min-width: 0; }
.hint { font-size: 12px; color: var(--muted); margin: -14px 0 20px; }
.hint code { font: 600 12px var(--body); background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

details.done-group summary { cursor: pointer; list-style: none; font-weight: 700; color: var(--muted); font-size: 14px; padding: 6px 0 10px; }
details.done-group summary::-webkit-details-marker { display: none; }

/* ---------- Week grid ---------- */
.day-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 16px; }
.day-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; border-radius: 12px; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .06em; }
.day-btn b { font: 800 20px/1 var(--display); color: var(--ink); letter-spacing: -.02em; }
.day-btn.is-today b { color: var(--accent); }
.day-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.day-btn[aria-pressed="true"] b { color: var(--paper); }
.day-btn .load { width: 18px; height: 4px; border-radius: 2px; background: var(--line); margin-top: 2px; overflow: hidden; }
.day-btn .load i { display: block; height: 100%; background: var(--accent); }

.wgrid { --hour: 52px; display: grid; grid-template-columns: 44px minmax(0, 1fr); position: relative; }
.wgrid-hours { display: flex; flex-direction: column; }
.wgrid-hours span { height: var(--hour); font-size: 11px; font-weight: 700; color: var(--muted); text-align: right; padding-right: 8px; transform: translateY(-7px); font-variant-numeric: tabular-nums; }
.wgrid-days { display: grid; grid-template-columns: minmax(0, 1fr); }
.wcol { position: relative; border-left: 1px solid var(--line); background: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--hour)); display: none; }
.wcol.sel { display: block; }
.wcol-head { display: none; }
.wblock {
  position: absolute; left: 4px; right: 4px; overflow: hidden;
  padding: 5px 8px; border-radius: 9px; text-align: left;
  background: var(--cc); color: var(--cf); font-size: 12px; line-height: 1.2;
}
.wblock.soft { background: color-mix(in srgb, var(--cc) 22%, var(--surface)); color: var(--ink); border-left: 4px solid var(--cc); }
.wblock b { display: block; font: 700 13px/1.15 var(--display); }
.wnow { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); z-index: 2; }
.wnow::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
@media (min-width: 960px) {
  .day-strip { display: none; }
  .wgrid { --hour: 46px; padding-top: 34px; }
  .wgrid-days { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .wcol { display: block; }
  .wcol-head { display: block; position: absolute; top: -34px; left: 0; right: 0; text-align: center; font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
  .wcol-head b { font: 800 16px var(--display); color: var(--ink); margin-left: 4px; }
  .wcol.is-today .wcol-head b { color: var(--accent); }
  .wcol.is-today { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }
}

/* ---------- Sheet / modal ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(15, 12, 8, .42); animation: fade .18s ease-out; }
.sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: 0;
  max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 10px 18px calc(22px + var(--safe-b));
  background: var(--paper); color: var(--ink);
  border-radius: 22px 22px 0 0; border-top: 2px solid var(--ink);
  animation: up .24s cubic-bezier(.2, .9, .3, 1.1);
}
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 8vh; width: 520px; transform: translateX(-50%); border-radius: 20px; border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--hard); max-height: 84vh; animation: pop .18s ease-out; padding-bottom: 22px; }
  .sheet-grip { display: none; }
}
@keyframes up { from { transform: translateY(100%); } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 10px); } }
@keyframes fade { from { opacity: 0; } }

.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sheet-title { font: 800 28px/1 var(--display); letter-spacing: -.035em; margin: 0; }
.type-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -18px 16px; padding: 0 18px 2px; scrollbar-width: none; }
.type-tabs::-webkit-scrollbar { display: none; }
.type-tabs button { flex: none; padding: 8px 14px; border-radius: 99px; font-weight: 700; font-size: 14px; border: 1.5px solid var(--line); background: var(--surface); }
.type-tabs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span, .field-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.input, .form input[type="text"], .form input[type="email"], .form input[type="password"], .form input[type="date"], .form input[type="time"], .form input[type="url"], .form select, .form textarea {
  width: 100%; min-height: 48px; padding: 11px 13px;
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface);
  font-size: 16px; /* prevents iOS zoom */
  -webkit-appearance: none; appearance: none;
}
.input:focus, .form input:focus, .form select:focus, .form textarea:focus { border-color: var(--ink); outline: none; }
.form input.title-input { font: 700 20px var(--display); letter-spacing: -.01em; }
.form textarea { min-height: 80px; resize: vertical; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.opt[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.opt .tag-sw { width: 10px; height: 10px; }
.opt.day { width: 40px; height: 40px; padding: 0; justify-content: center; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 38px; height: 38px; border-radius: 11px; background: var(--cc); border: 2px solid transparent; box-shadow: inset 0 0 0 2px var(--paper); }
.swatch[aria-pressed="true"] { border-color: var(--ink); }
.meet-row { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); position: relative; }
.meet-row .row input { min-height: 44px; }
.meet-del { position: absolute; top: 8px; right: 8px; font-size: 13px; font-weight: 700; color: var(--muted); padding: 4px 6px; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }
.form-actions .btn.primary { flex: 1; }
.form-note { font-size: 13px; color: var(--muted); margin: -6px 0 0; }

/* settings */
.set-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.set-group h3 { margin: 0; font: 800 18px var(--display); letter-spacing: -.01em; }
.set-group p { margin: 0; font-size: 14px; color: var(--ink-2); }
.set-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 90px);
  display: flex; align-items: center; gap: 14px;
  padding: 11px 12px 11px 16px; border-radius: 14px;
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: 14px;
  max-width: calc(100vw - 32px); animation: pop2 .2s ease-out;
}
.toast button { color: var(--accent); font-weight: 800; padding: 4px 6px; }
@keyframes pop2 { from { opacity: 0; transform: translate(-50%, 8px); } }
@media (min-width: 960px) { .toast { bottom: 32px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Radio / checkbox inputs styled as buttons (state via :has) */
.opt:has(input:checked) { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.opt:has(input:checked) .tag-sw { box-shadow: 0 0 0 1.5px var(--paper); }
.swatch:has(input:checked) { border-color: var(--ink); }
.opt:has(input:focus-visible), .swatch:has(input:focus-visible) { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.opt, .swatch { cursor: pointer; user-select: none; -webkit-user-select: none; }
code { font: 600 .9em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
