:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #f0f3f2;
  --ink: #16201e;
  --ink-soft: #5c6b68;
  --line: #e2e8e6;
  --brand: #eab308;
  --brand-ink: #854d0e;
  --brand-wash: #fef6c8;
  --on-brand: #1a1205;
  --accent: #f59e0b;
  --danger: #dc2626;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16,32,30,.06), 0 8px 24px rgba(16,32,30,.06);
  --maxw: 560px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1211; --surface: #141b1a; --surface-2: #1b2423; --ink: #e9efed;
    --ink-soft: #9fb0ac; --line: #263230; --brand: #facc15; --brand-ink: #fde047;
    --on-brand: #1a1205;
    --brand-wash: #3a2f05; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #0d1211; --surface: #141b1a; --surface-2: #1b2423; --ink: #e9efed;
  --ink-soft: #9fb0ac; --line: #263230; --brand: #facc15; --brand-ink: #fde047;
  --on-brand: #1a1205;
  --brand-wash: #3a2f05; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased; line-height: 1.45;
}
#app { max-width: var(--maxw); margin: 0 auto; min-height: 100vh; background: var(--bg);
  display: flex; flex-direction: column; }

/* Header */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg);
  padding: 14px 16px 10px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--line); }
.logo { width: 30px; height: 30px; border-radius: 9px; background: #000;
  color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 18px; overflow: hidden; }
.logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pfp { width: 38px; height: 38px; border-radius: 50%; background: var(--brand);
  color: var(--on-brand); display: grid; place-items: center; cursor: pointer;
  flex: none; overflow: hidden; }
.pfp svg { display: block; }
.pfp img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pfp-row { display: flex; align-items: center; gap: 14px; }
.pfp-lg { width: 64px; height: 64px; border-radius: 50%; background: var(--brand);
  color: var(--on-brand); display: grid; place-items: center; overflow: hidden; flex: none; }
.pfp-lg svg { width: 34px; height: 34px; display: block; }
.pfp-lg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.topbar h1 { font-size: 19px; margin: 0; letter-spacing: .5px; font-weight: 800; }
.crown-btn { border: none; background: none; padding: 0; margin: 0; cursor: pointer;
  display: grid; place-items: center; width: 32px; height: 36px; }
.crown-btn img { display: block; width: 26px; height: 26px; object-fit: contain; }
.topbar .sub { font-size: 12px; color: var(--ink-soft); margin: 0; }
.spacer { flex: 1; }
.iconbtn { border: none; background: var(--surface-2); color: var(--ink); width: 36px; height: 36px;
  border-radius: 10px; font-size: 16px; cursor: pointer; display: grid; place-items: center; }
.iconbtn svg { display: block; }

/* Main scroll area */
main { flex: 1; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
.view-title { font-size: 22px; font-weight: 800; margin: 2px 0 2px; }
.view-sub { color: var(--ink-soft); font-size: 13px; margin: 0 0 16px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card.tap { cursor: pointer; transition: transform .08s ease; }
.card.tap:active { transform: scale(.99); }

/* Today strip */
.strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 10px; margin: 0 -16px 4px; padding-left: 16px; padding-right: 16px; }
.strip::-webkit-scrollbar { display: none; }
.pill { flex: 0 0 auto; background: var(--brand-wash); color: var(--brand-ink);
  border-radius: 14px; padding: 10px 14px; min-width: 150px; }
.pill .k { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; opacity: .8; }
.pill .v { font-weight: 700; font-size: 14px; margin-top: 2px; }

/* Event / task rows */
.row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: none; }
.row .emoji { font-size: 20px; width: 26px; text-align: center; }
.row .body { flex: 1; min-width: 0; }
.row .ttl { font-weight: 650; font-size: 15px; }
.row .meta { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }
.row .meta b { color: var(--ink); font-weight: 650; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; vertical-align: middle; margin-right: 5px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-soft); margin-right: 6px; }
.tag.brand { background: var(--brand-wash); color: var(--brand-ink); }
.tag.warn { background: #fef3c7; color: #92400e; }
.prep { margin-top: 6px; font-size: 12px; color: var(--ink-soft); }
.prep b { color: var(--accent); }

/* Checkbox */
.check { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line);
  background: var(--surface); cursor: pointer; flex: 0 0 auto; display: grid; place-items: center;
  color: transparent; font-size: 14px; font-weight: 900; margin-top: 1px; }
.check.on { width: auto; height: auto; min-width: 24px; padding: 4px 10px; border-radius: 999px;
  background: var(--brand); border-color: var(--brand); color: var(--on-brand);
  font-size: 12px; font-weight: 800; letter-spacing: .2px; }
.row.done .ttl { text-decoration: line-through; color: var(--ink-soft); }
.row .del { align-self: center; background: transparent; border: none; color: var(--ink-soft);
  font-size: 18px; line-height: 1; padding: 6px 8px; margin: -6px -4px -6px 0; cursor: pointer; opacity: .7; }
.row .del:active { opacity: 1; color: var(--danger); }

/* Buttons */
.btn { appearance: none; border: none; border-radius: 12px; padding: 13px 16px; font-size: 15px;
  font-weight: 700; cursor: pointer; background: var(--surface-2); color: var(--ink); }
.btn.primary { background: var(--brand); color: var(--on-brand); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn.danger { color: var(--danger); background: transparent; }
.btn-row { display: flex; gap: 10px; }
.btn.block { width: 100%; }

/* Inputs */
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 13px; font-weight: 650; margin-bottom: 6px; color: var(--ink-soft); }
input[type=text], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  font-size: 15px; background: var(--surface); color: var(--ink); font-family: inherit; }
textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); border-color: var(--brand); }

/* Bottom nav */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; }
.tabbar-inner { max-width: var(--maxw); margin: 0 auto; background: var(--surface);
  border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4,1fr);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); align-items: end; }
.tabbar-5 { grid-template-columns: repeat(5,1fr); }
.tab.cam { color: var(--brand); }
.tab.cam .ic { background: var(--brand); color: var(--on-brand); width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px; margin-top: -16px; box-shadow: 0 6px 16px rgba(234,179,8,.45); }
.tab { background: none; border: none; padding: 7px 0 5px; display: flex; flex-direction: column;
  align-items: center; gap: 3px; color: var(--ink-soft); font-size: 11px; font-weight: 600; cursor: pointer; }
.tab .ic { font-size: 20px; }
.tab.active { color: var(--brand); }
.tab .badge { position: absolute; transform: translate(14px,-6px); background: var(--accent); color:#1a1205;
  font-size: 10px; font-weight: 800; border-radius: 999px; padding: 1px 6px; }

/* Calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--ink-soft); font-weight: 700; padding-bottom: 4px; }
.cal-cell { aspect-ratio: 1; border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
  padding: 4px; font-size: 12px; position: relative; cursor: pointer; overflow: hidden; }
.cal-cell.other { opacity: .4; }
.cal-cell.today { border-color: var(--brand); border-width: 2px; }
.cal-cell.sel { background: var(--brand-wash); }
.cal-cell .d { font-weight: 700; }
.cal-dots { display: flex; gap: 2px; flex-wrap: wrap; margin-top: 3px; }
.cal-dots .dot { width: 6px; height: 6px; margin: 0; }

/* Members / avatars */
.member { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.member:first-child { border-top: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 14px; flex: 0 0 auto; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 7px 12px;
  font-size: 13px; font-weight: 650; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.chip.on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

/* Proposal (inbox extraction result) */
.proposal { border: 1px dashed var(--brand); background: var(--brand-wash); border-radius: var(--radius);
  padding: 14px; margin-top: 14px; }
.proposal h4 { margin: 0 0 4px; font-size: 14px; }
.proposal .sum { font-size: 12px; color: var(--brand-ink); margin-bottom: 10px; font-weight: 700; }

/* Empty + misc */
.empty { text-align: center; color: var(--ink-soft); padding: 36px 16px; }
.empty .big { font-size: 34px; margin-bottom: 8px; }
.muted { color: var(--ink-soft); font-size: 13px; }
.section-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  color: var(--ink-soft); margin: 18px 2px 8px; }
.fwd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; word-break: break-all; }
.fwd.locked { font-family: inherit; color: var(--ink-soft); font-weight: 600; }
.hero { background: linear-gradient(135deg, var(--brand), #f59e0b); color: var(--on-brand); border-radius: var(--radius);
  padding: 22px; margin-bottom: 16px; }
.hero h2 { margin: 0 0 6px; font-size: 20px; }
.hero p { margin: 0; opacity: .92; font-size: 14px; }
.center { text-align: center; }
.grow { flex: 1; }
a.link { color: var(--brand); font-weight: 650; }

/* Row ⋯ menu + reminder sheet */
.rowmenu { background: transparent; color: var(--ink-soft); width: 34px; height: 34px; font-size: 20px;
  flex: 0 0 auto; align-self: flex-start; line-height: 1; }
.rowmenu:active { background: var(--surface-2); }
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60;
  display: flex; align-items: flex-end; animation: fade .15s ease; }
.sheet { background: var(--surface); border-radius: 20px 20px 0 0; width: 100%; max-width: var(--maxw);
  margin: 0 auto; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.3);
  animation: slideup .2s ease; max-height: 82vh; overflow-y: auto; }
.sheet-title { font-weight: 800; font-size: 18px; margin-bottom: 4px; }
@keyframes fade { from { opacity: 0; } }
@keyframes slideup { from { transform: translateY(40px); } }

/* settings list rows (Personvern / Vurder / Del) */
.set-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 12px; padding: 13px 14px; margin-bottom: 8px; font: inherit;
  font-size: 15px; font-weight: 650; cursor: pointer; }
.set-row .em { font-size: 18px; line-height: 1; }
.set-row .lbl { flex: 1; }
.set-row .set-val { color: var(--ink-soft); font-weight: 600; font-size: 14px; }
.set-row .chev { color: var(--ink-soft); font-size: 20px; font-weight: 400; }
.set-row.open .chev { transform: rotate(90deg); }
/* Bip Plus upsell — stands out as a gold call-to-action until subscribed. */
.set-row.cta { background: linear-gradient(135deg, var(--brand), var(--accent));
  border-color: var(--brand); color: var(--on-brand); font-weight: 800;
  box-shadow: 0 2px 10px rgba(234,179,8,.35); }
.set-row.cta .em { filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.set-row.cta .lbl { white-space: nowrap; }
.set-row.cta .set-val { color: var(--on-brand); font-weight: 800; opacity: .95;
  white-space: nowrap; background: rgba(0,0,0,.14); border-radius: 999px; padding: 3px 9px; }
.set-row.cta .chev { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .set-row.cta { animation: ctaPulse 2.4s ease-in-out infinite; }
  @keyframes ctaPulse { 0%,100% { box-shadow: 0 2px 10px rgba(234,179,8,.35); }
    50% { box-shadow: 0 2px 16px rgba(234,179,8,.6); } }
}
.set-sub { margin: -2px 0 8px; padding-left: 4px; }

/* transient toast */
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(10px); background: var(--ink); color: var(--bg);
  padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 650;
  box-shadow: var(--shadow); opacity: 0; transition: opacity .25s ease, transform .25s ease;
  z-index: 80; max-width: 86%; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
