/* ============================================================
   The Dwarf & Tentacle — styles
   Palette from the Adventure Co. guide: forest green, antique gold, parchment.
   ============================================================ */
:root {
  --green: #122820;
  --green-2: #1b3a2f;
  --green-3: #244a3c;
  --green-ink: #0d1d17;
  --gold: #b9975b;
  --gold-2: #d4bc8a;
  --gold-dim: rgba(185,151,91,.35);
  --cream: #fcfaf4;
  --cream-2: #f3eee1;
  --cream-3: #e9e1cd;
  --ink: #1e2a25;
  --ink-2: #5a6660;
  --ink-3: #8f978f;
  --nick: #b9975b;        /* the dwarf — gold */
  --meg:  #3f7f7a;        /* the tentacle — sea teal */
  --both: #122820;
  --danger: #a0463c;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: Lato, "Helvetica Neue", Arial, sans-serif;
  --radius: 18px;
  --shadow: 0 8px 28px rgba(18,40,32,.14);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tab-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%; background: var(--green); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 500; }
.display { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; }
.eyebrow {
  font-family: var(--sans); font-size: 11px; letter-spacing: .28em; text-transform: uppercase;
  color: var(--gold); margin: 0; font-weight: 700;
}
.link { color: var(--gold); font-weight: 700; font-size: 14px; letter-spacing: .02em; }
.link.strong { color: var(--green); }
.sheet .link { color: var(--ink-2); }
.sheet .link.strong { color: var(--green); }

/* ---------- ornaments ---------- */
.ornament { display: flex; align-items: center; gap: 12px; justify-content: center; margin: 14px 0 22px; color: var(--gold); }
.ornament span { flex: 0 0 64px; height: 1px; background: var(--gold); opacity: .7; }
.ornament i { font-style: normal; font-size: 18px; }

/* ---------- login ---------- */
.screen.login {
  min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(185,151,91,.10), transparent 60%),
    var(--green);
  color: var(--cream);
}
.login-frame {
  width: min(420px, 100%); border: 1px solid var(--gold-dim); border-radius: 6px; padding: 28px 22px 22px;
  outline: 1px solid var(--gold-dim); outline-offset: 5px; text-align: center;
}
.login-logo { width: 150px; margin: 6px auto 12px; display: block; }
.login-title { font-family: var(--serif); font-weight: 400; font-size: 34px; color: var(--cream); margin-bottom: 20px; }
.who-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.who-card {
  border: 1px solid var(--gold-dim); border-radius: 12px; padding: 16px 8px 14px; color: var(--cream);
  display: grid; gap: 4px; justify-items: center; transition: all .2s; background: rgba(255,255,255,.02);
}
.who-card .who-glyph { width: 56px; height: 56px; object-fit: contain; margin-bottom: 4px; }
.who-card.on .who-glyph { filter: brightness(.25) sepia(1) hue-rotate(100deg) saturate(.6); }
.who-card .who-name { font-family: var(--serif); font-size: 22px; }
.who-card .who-role { font-size: 10px; letter-spacing: .26em; text-transform: uppercase; color: var(--gold); }
.who-card.on { background: var(--gold); border-color: var(--gold); color: var(--green); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.25); }
.who-card.on .who-role { color: var(--green); }
.field { display: block; text-align: left; margin-bottom: 14px; }
.field span { display: block; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.field input {
  width: 100%; background: rgba(255,255,255,.06); border: 1px solid var(--gold-dim); border-radius: 10px; padding: 13px 14px;
  color: var(--cream); font-size: 17px; outline: none;
}
.field input:focus { border-color: var(--gold); }
.login-error { color: #e8b1a8; font-size: 14px; margin: -4px 0 12px; }
.login-foot { font-family: var(--serif); font-style: italic; color: var(--gold-2); opacity: .8; font-size: 13px; margin: 22px 0 0; }

/* ---------- buttons ---------- */
.btn { border-radius: 12px; padding: 14px 18px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 13px; transition: transform .1s; }
.btn:active { transform: scale(.98); }
.btn-block { display: block; width: 100%; }
.btn-gold { background: var(--gold); color: var(--green); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(160,70,60,.35); margin-top: 18px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; color: var(--green); line-height: 1; }
.icon-btn:active { background: var(--cream-3); }
.btn-round { width: 40px; height: 40px; border-radius: 50%; background: var(--green); color: var(--gold-2); font-size: 20px; display: grid; place-items: center; flex: 0 0 auto; }

/* ---------- app frame ---------- */
#app { min-height: 100dvh; background: var(--cream); display: flex; flex-direction: column; }
.topbar { background: var(--green); color: var(--cream); padding-top: var(--safe-top); position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; gap: 12px; padding: 10px 16px 12px; }
.topbar-mark { height: 40px; width: auto; opacity: .95; }
.topbar-titles { flex: 1; min-width: 0; }
.topbar h1 { font-family: var(--serif); font-size: 24px; font-weight: 400; line-height: 1.1; margin-top: 2px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--gold); display: grid; place-items: center; overflow: hidden;
  background: rgba(185,151,91,.12);
}
.avatar img { width: 30px; height: 30px; object-fit: contain; }
#main { flex: 1; padding: 18px 16px calc(var(--tab-h) + var(--safe-bottom) + 90px); }
.view { animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--green); color: var(--gold-2);
  display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--tab-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  box-shadow: 0 -6px 24px rgba(18,40,32,.25);
}
.tabbar button { display: grid; justify-items: center; gap: 2px; color: rgba(212,188,138,.55); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; padding-top: 6px; }
.tabbar button i { font-style: normal; font-size: 20px; line-height: 1.2; }
.tabbar button.on { color: var(--gold-2); }
.tabbar button.on i { text-shadow: 0 0 14px rgba(185,151,91,.7); }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--tab-h) + var(--safe-bottom) + 16px); z-index: 24;
  width: 58px; height: 58px; border-radius: 50%; background: var(--gold); color: var(--green); font-size: 32px; line-height: 1;
  box-shadow: 0 10px 26px rgba(18,40,32,.35); display: grid; place-items: center; transition: transform .15s;
}
.fab:active { transform: scale(.94); }

.offline-pill {
  position: fixed; top: calc(var(--safe-top) + 70px); left: 50%; transform: translateX(-50%); z-index: 30;
  background: var(--ink); color: var(--cream); font-size: 12px; padding: 6px 12px; border-radius: 999px; letter-spacing: .04em;
}

/* ---------- section heads / cards ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 10px; }
.section-head h3 { font-family: var(--serif); font-size: 20px; font-weight: 400; position: relative; padding-bottom: 6px; }
.section-head h3::after { content: ""; position: absolute; left: 0; bottom: 0; width: 44px; height: 1px; background: var(--gold); }
.card-list { display: grid; gap: 10px; }
.card {
  background: #fff; border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 2px 10px rgba(18,40,32,.06);
  border: 1px solid rgba(18,40,32,.06); display: flex; gap: 14px; align-items: center; text-align: left; width: 100%;
}
.card:active { background: var(--cream-2); }
.empty { color: var(--ink-3); font-family: var(--serif); font-style: italic; text-align: center; padding: 18px 0; }

/* ---------- today ---------- */
.today-hero { text-align: center; padding: 6px 0 4px; }
.today-hero .display { font-size: 38px; line-height: 1.05; margin: 6px 0 4px; color: var(--green); }
.today-sub { color: var(--ink-2); font-family: var(--serif); font-style: italic; margin: 0; }
.countdown-row { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.countdown-row::-webkit-scrollbar { display: none; }
.cd {
  flex: 0 0 132px; scroll-snap-align: start; background: var(--green); color: var(--cream); border-radius: var(--radius); padding: 14px 14px 12px;
  display: grid; gap: 2px; text-align: left; position: relative; overflow: hidden;
}
.cd::after { content: ""; position: absolute; inset: 6px; border: 1px solid var(--gold-dim); border-radius: 12px; pointer-events: none; }
.cd .cd-emoji { font-size: 22px; line-height: 1; }
.cd .cd-num { font-family: var(--serif); font-size: 34px; line-height: 1.05; color: var(--gold-2); margin-top: 6px; }
.cd .cd-unit { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.cd .cd-title { font-size: 13px; margin-top: 6px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd.today-hit { background: var(--gold); color: var(--green); }
.cd.today-hit .cd-num, .cd.today-hit .cd-unit { color: var(--green); }
.cd-add { flex: 0 0 60px; border: 1px dashed var(--gold); border-radius: var(--radius); color: var(--gold); font-size: 26px; display: grid; place-items: center; }

/* ---------- event rows ---------- */
.ev { border-left: 4px solid var(--both); }
.ev.who-nick { border-left-color: var(--nick); }
.ev.who-meg { border-left-color: var(--meg); }
.ev.who-both { border-left-color: var(--green); }
.ev-time { flex: 0 0 58px; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--ink-2); line-height: 1.3; }
.ev-time b { display: block; font-size: 14px; color: var(--green); }
.ev-body { flex: 1; min-width: 0; display: block; }
.ev-body > span { display: block; }
.ev-title { font-family: var(--serif); font-size: 17px; color: var(--green); line-height: 1.2; }
.ev-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-day { flex: 0 0 auto; }
.day-label { font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--gold); font-weight: 700; margin: 14px 0 6px; }
.day-label:first-child { margin-top: 0; }
.day-label.is-today { color: var(--green); }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-month { font-family: var(--serif); font-size: 24px; color: var(--green); }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 10px; letter-spacing: .2em; color: var(--gold); font-weight: 700; margin-bottom: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  aspect-ratio: 1 / 1.12; border-radius: 12px; display: grid; grid-template-rows: auto 1fr; justify-items: center; padding: 6px 2px 4px;
  color: var(--ink); background: #fff; border: 1px solid rgba(18,40,32,.05); position: relative;
}
.cal-cell.other { opacity: .35; background: transparent; border-color: transparent; }
.cal-cell .n { font-size: 14px; line-height: 1; font-family: var(--serif); }
.cal-cell.today .n { color: var(--gold); font-weight: 600; }
.cal-cell.today::before { content: ""; position: absolute; top: 3px; left: 3px; right: 3px; bottom: 3px; border: 1px solid var(--gold); border-radius: 10px; pointer-events: none; }
.cal-cell.sel { background: var(--green); color: var(--cream); border-color: var(--green); }
.cal-cell.sel .n { color: var(--gold-2); }
.cal-cell.past .n { color: var(--ink-3); }
.cal-dots { display: flex; gap: 3px; align-items: end; padding-bottom: 2px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--both); }
.dot-nick { background: var(--nick); }
.dot-meg { background: var(--meg); }
.dot-both { background: linear-gradient(90deg, var(--nick) 50%, var(--meg) 50%); }
.cal-dots .dot { width: 5px; height: 5px; }
.legend { display: flex; gap: 16px; justify-content: center; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); margin: 12px 0 4px; }
.legend .dot { margin-right: 6px; vertical-align: 1px; }
.agenda-head { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 0 10px; }
.agenda-head h3 { font-family: var(--serif); font-size: 20px; font-weight: 400; }

/* ---------- lists ---------- */
.list-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.list-tile {
  background: #fff; border-radius: var(--radius); padding: 16px 14px 14px; text-align: left; display: grid; gap: 6px; min-height: 118px;
  border: 1px solid rgba(18,40,32,.06); box-shadow: 0 2px 10px rgba(18,40,32,.06); position: relative;
}
.list-tile .lt-emoji { font-size: 26px; line-height: 1; }
.list-tile .lt-name { font-family: var(--serif); font-size: 18px; color: var(--green); margin-top: auto; line-height: 1.15; }
.list-tile .lt-count { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.list-tile .lt-bar { height: 3px; background: var(--cream-3); border-radius: 3px; overflow: hidden; }
.list-tile .lt-bar i { display: block; height: 100%; background: var(--gold); }
.list-tile.new { border: 1px dashed var(--gold); background: transparent; box-shadow: none; place-items: center; color: var(--gold); font-size: 13px; letter-spacing: .2em; text-transform: uppercase; font-weight: 700; }
.list-detail-head { display: flex; align-items: center; gap: 6px; margin: -6px 0 8px; }
.list-detail-head h2 { flex: 1; font-size: 26px; color: var(--green); }
.todo-filter { display: flex; gap: 6px; margin-bottom: 12px; }
.todo-filter button { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; padding: 7px 12px; border-radius: 999px; color: var(--ink-2); background: var(--cream-2); }
.todo-filter button.on { background: var(--green); color: var(--gold-2); }
.todo-list { display: grid; gap: 8px; }
.todo { background: #fff; border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; border: 1px solid rgba(18,40,32,.06); }
.todo .tick {
  flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--gold); display: grid; place-items: center; color: var(--green); font-size: 14px; transition: all .15s;
}
.todo.done .tick { background: var(--green); border-color: var(--green); color: var(--gold-2); }
.todo .t-body { flex: 1; min-width: 0; text-align: left; }
.todo .t-title { font-size: 16px; color: var(--ink); line-height: 1.25; }
.todo.done .t-title { color: var(--ink-3); text-decoration: line-through; }
.todo .t-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; display: flex; gap: 8px; align-items: center; }
.todo .t-meta .dot { width: 8px; height: 8px; }
.todo .t-meta .overdue { color: var(--danger); font-weight: 700; }
.todo-done-head { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 0 8px; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.todo-list.done .todo { background: transparent; border-color: transparent; padding: 8px 14px; }

.quick-add {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--tab-h) + var(--safe-bottom) + 12px); z-index: 24;
  background: #fff; border-radius: 999px; padding: 6px 6px 6px 18px; display: flex; gap: 8px; align-items: center; box-shadow: var(--shadow);
  border: 1px solid rgba(18,40,32,.08);
}
.quick-add input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; min-width: 0; }

/* ---------- notes ---------- */
.note-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.note-card {
  background: #fff; border-radius: var(--radius); padding: 14px; text-align: left; min-height: 130px; display: grid; grid-template-rows: auto 1fr auto; gap: 6px;
  border: 1px solid rgba(18,40,32,.06); box-shadow: 0 2px 10px rgba(18,40,32,.06); position: relative;
}
.note-card.pinned { background: var(--green); color: var(--cream); }
.note-card .nc-title { font-family: var(--serif); font-size: 17px; line-height: 1.2; color: var(--green); }
.note-card.pinned .nc-title { color: var(--gold-2); }
.note-card .nc-body { font-size: 13px; color: var(--ink-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; white-space: pre-line; }
.note-card.pinned .nc-body { color: rgba(252,250,244,.8); }
.note-card .nc-meta { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); }
.note-card.pinned .nc-meta { color: var(--gold); }
.note-card .pin { position: absolute; top: 10px; right: 12px; font-size: 12px; color: var(--gold); }

/* ---------- sheets ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(13,29,23,.55); z-index: 40; backdrop-filter: blur(2px); animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--cream); border-radius: 22px 22px 0 0;
  padding: 8px 18px calc(18px + var(--safe-bottom)); max-height: 92dvh; overflow-y: auto; animation: up .26s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 -10px 40px rgba(0,0,0,.25);
}
.sheet-tall { height: 92dvh; display: flex; flex-direction: column; }
.sheet-tall form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-grab { width: 40px; height: 4px; border-radius: 4px; background: var(--cream-3); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head .eyebrow { color: var(--green); }
.big-input { width: 100%; border: 0; background: transparent; font-family: var(--serif); font-size: 26px; color: var(--green); outline: 0; padding: 6px 0 10px; border-bottom: 1px solid var(--cream-3); margin-bottom: 14px; }
.big-input::placeholder { color: var(--ink-3); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--cream-2); padding: 4px; border-radius: 12px; margin-bottom: 14px; }
.seg button { padding: 9px 4px; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--ink-2); display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg button.on { background: #fff; color: var(--green); box-shadow: 0 2px 8px rgba(18,40,32,.1); }
.rows { background: #fff; border-radius: 14px; border: 1px solid rgba(18,40,32,.07); overflow: hidden; margin-bottom: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--cream-2); min-height: 50px; }
.row:last-child { border-bottom: 0; }
.row > span:first-child { color: var(--ink); flex: 0 0 auto; }
.row input[type=text], .row select, .row input[type=date], .row input[type=time] {
  border: 0; background: var(--cream-2); border-radius: 8px; padding: 7px 10px; text-align: right; outline: 0; max-width: 60%; min-width: 0;
}
.row-inputs { display: flex; gap: 6px; }
.row-inputs input { max-width: none; }
.row textarea { flex: 1; border: 0; background: var(--cream-2); border-radius: 8px; padding: 8px 10px; outline: 0; resize: none; }
.row-tall { align-items: flex-start; }
.row-tall > span:first-child { padding-top: 8px; }
.switch { appearance: none; width: 48px; height: 28px; border-radius: 999px; background: var(--cream-3); position: relative; transition: background .2s; flex: 0 0 auto; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); background: var(--gold-2); }
.emoji-row { display: flex; gap: 10px; align-items: center; }
.emoji-input { width: 60px; flex: 0 0 60px; text-align: center; font-size: 28px; border: 0; background: #fff; border-radius: 12px; padding: 6px; margin-bottom: 14px; outline: 0; }
.emoji-picks { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }
.emoji-picks button { font-size: 22px; width: 40px; height: 40px; border-radius: 10px; background: #fff; }
.note-body { flex: 1; width: 100%; min-height: 220px; border: 0; background: #fff; border-radius: 14px; padding: 14px; outline: 0; resize: none; font-size: 16px; line-height: 1.5; margin-bottom: 12px; }
.add-menu { display: grid; gap: 8px; }
.add-menu button { display: flex; align-items: center; gap: 14px; background: #fff; border-radius: 14px; padding: 14px 16px; font-family: var(--serif); font-size: 18px; color: var(--green); text-align: left; }
.add-menu button i { font-style: normal; width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: var(--gold-2); display: grid; place-items: center; font-size: 16px; }
.me-card { display: flex; gap: 14px; align-items: center; background: var(--green); color: var(--cream); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.me-glyph { width: 56px; height: 56px; object-fit: contain; }
.me-name { font-family: var(--serif); font-size: 24px; color: var(--gold-2); }
.me-role { font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: var(--gold); }
.hint { font-size: 13px; color: var(--ink-2); margin: 0 4px 14px; line-height: 1.4; }
.version { text-align: center; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); margin: 8px 0 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-bottom) + 84px); transform: translateX(-50%); z-index: 60;
  background: var(--green); color: var(--cream); padding: 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); border: 1px solid var(--gold-dim);
  animation: up .2s; max-width: 90vw; text-align: center;
}

@media (min-width: 700px) {
  #main, .topbar-inner { max-width: 640px; margin-left: auto; margin-right: auto; width: 100%; }
  .sheet { max-width: 640px; margin: 0 auto; }
  .quick-add { max-width: 616px; margin: 0 auto; }
  .fab { right: calc(50% - 320px + 18px); }
}

/* ============ v1.1: meals & date nights ============ */
.tabbar { grid-template-columns: repeat(5, 1fr); }
.tabbar button { letter-spacing: .14em; }
.btn-outline { background: transparent; color: var(--green); border: 1px solid var(--gold); margin: 6px 0 4px; }
.btn-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.btn-pair .btn { margin: 0; }
.seg.seg-4 { grid-template-columns: repeat(4, 1fr); }
.seg.seg-6 { grid-template-columns: repeat(6, 1fr); }
.seg.seg-6 button { font-size: 11px; padding: 8px 2px; }
.chip-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 10px; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-row button { flex: 0 0 auto; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; padding: 7px 12px; border-radius: 999px; color: var(--ink-2); background: var(--cream-2); white-space: nowrap; }
.chip-row button.on { background: var(--green); color: var(--gold-2); }
.chip-row.recipes button { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13px; background: #fff; border: 1px solid var(--cream-3); }

/* meals */
.meal-week { display: grid; gap: 8px; margin-bottom: 8px; }
.meal-day { background: #fff; border-radius: 14px; border: 1px solid rgba(18,40,32,.06); display: flex; align-items: center; gap: 12px; padding: 10px 12px; text-align: left; width: 100%; }
.meal-day.is-today { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.meal-day.is-past { opacity: .55; }
.meal-day .md-date { flex: 0 0 44px; text-align: center; line-height: 1; }
.meal-day .md-date b { display: block; font-family: var(--serif); font-size: 20px; color: var(--green); }
.meal-day .md-date span { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.meal-day .md-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.meal-day .md-title { font-family: var(--serif); font-size: 17px; color: var(--green); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meal-day .md-title.empty { color: var(--ink-3); font-style: italic; font-size: 15px; }
.meal-day .md-extra { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meal-day .md-add { flex: 0 0 auto; color: var(--gold); font-size: 22px; line-height: 1; }
.recipe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.recipe-card { background: #fff; border-radius: var(--radius); padding: 12px 12px 10px; text-align: left; display: grid; gap: 4px; border: 1px solid rgba(18,40,32,.06); min-height: 96px; }
.recipe-card .rc-emoji { font-size: 24px; line-height: 1; }
.recipe-card .rc-title { font-family: var(--serif); font-size: 16px; color: var(--green); line-height: 1.2; margin-top: auto; }
.recipe-card .rc-meta { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); font-weight: 700; }

/* us / date nights */
.us-seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--cream-2); padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.us-seg button { padding: 9px; border-radius: 9px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--ink-2); }
.us-seg button.on { background: var(--green); color: var(--gold-2); }
.date-hero { background: var(--green); color: var(--cream); border-radius: var(--radius); padding: 18px 18px 16px; position: relative; overflow: hidden; margin-bottom: 4px; }
.date-hero::after { content: ""; position: absolute; inset: 6px; border: 1px solid var(--gold-dim); border-radius: 12px; pointer-events: none; }
.date-hero .eyebrow { margin-bottom: 4px; }
.date-hero .dh-title { font-family: var(--serif); font-size: 24px; color: var(--gold-2); line-height: 1.15; }
.date-hero .dh-sub { font-size: 13px; color: rgba(252,250,244,.75); margin-top: 4px; }
.date-hero .dh-actions { display: flex; gap: 8px; margin-top: 14px; position: relative; z-index: 1; }
.date-hero .dh-actions .btn { padding: 11px 14px; font-size: 12px; }
.date-hero .btn-outline { color: var(--gold-2); border-color: var(--gold); margin: 0; }
.date-hero .btn-gold { margin: 0; }
.idea { border-left: 4px solid var(--gold); }
.idea .id-emoji { flex: 0 0 34px; font-size: 24px; text-align: center; }
.idea .id-body { flex: 1; min-width: 0; display: block; }
.idea .id-title { display: block; font-family: var(--serif); font-size: 17px; color: var(--green); line-height: 1.2; }
.idea .id-meta { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-top: 3px; }
.idea.done-before { border-left-color: var(--meg); }
.surprise-card { background: var(--green); color: var(--cream); border-radius: var(--radius); padding: 26px 18px; text-align: center; margin-bottom: 14px; position: relative; }
.surprise-card::after { content: ""; position: absolute; inset: 6px; border: 1px solid var(--gold-dim); border-radius: 12px; pointer-events: none; }
.surprise-card .sc-emoji { font-size: 44px; line-height: 1; }
.surprise-card .sc-title { font-family: var(--serif); font-size: 26px; color: var(--gold-2); margin: 10px 0 4px; line-height: 1.15; }
.surprise-card .sc-meta { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.surprise-card .sc-notes { font-size: 13px; color: rgba(252,250,244,.75); margin-top: 8px; font-style: italic; font-family: var(--serif); }
.ev.is-date { background: linear-gradient(90deg, rgba(185,151,91,.10), #fff 60%); border-left-color: var(--gold) !important; }
.ev.is-date .ev-title::after { content: " ✨"; font-size: 13px; }
.cal-cell .dot.dot-date { background: transparent; width: auto; height: auto; font-size: 9px; line-height: 6px; color: var(--gold); }
.cal-cell .dot.dot-date::before { content: "✦"; }
.legend .dot-date::before { content: "✦"; }

.hint-warn { color: var(--danger); font-weight: 700; }
.sheet .login-error { color: var(--danger); margin: 0 4px; }
.row input[type=password] { border: 0; background: var(--cream-2); border-radius: 8px; padding: 7px 10px; text-align: right; outline: 0; max-width: 60%; min-width: 0; }
