:root {
  --bg: #15140f;
  --surface: #201e18;
  --surface-hi: #2a271f;
  --cream: #E2D8C6;               /* rgba(226,216,198,1) */
  --cream-soft: rgba(226,216,198,.72);
  --accent: #7EB8A4;              /* sage / teal green */
  --accent-strong: #93c9b5;
  --accent-soft: rgba(126,184,164,.16);
  --text: #ECE7DC;
  --muted: #928b7d;
  --border: rgba(226,216,198,.12);
  --border-strong: rgba(226,216,198,.24);
  --danger: #e07a63;
  --overdue: #d99162;
  --radius: 16px;
  --radius-sm: 12px;
  --nav-h: 66px;
}

:root { color-scheme: dark; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ---- Icons ---- */
.ico { width: 23px; height: 23px; display: inline-block; vertical-align: middle; flex: none; }
.ico-sm { width: 16px; height: 16px; }

/* ---- Layout ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(21,20,15,.85);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 18px; max-width: 640px; margin: 0 auto;
}
.brand { font-weight: 800; font-size: 1.3rem; letter-spacing: -.3px; text-decoration: none; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.iconbtn {
  color: var(--muted); display: inline-flex; padding: 9px; position: relative;
  text-decoration: none; border-radius: 10px;
}
.iconbtn:active { color: var(--cream); background: rgba(226,216,198,.08); }
.bell-badge {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 999px; background: var(--overdue); color: #1b1a14;
  font-size: .62rem; font-weight: 800; line-height: 16px; text-align: center;
  border: 2px solid var(--bg);
}

/* ---- Notifications list ---- */
.notif-enable {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-bottom: 18px;
}
.notif-enable .btn { margin-bottom: 8px; }
.notif-enable p { margin: 0; }
.notif {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 15px; margin-bottom: 10px; text-decoration: none; color: var(--text);
}
.notif.unread { border-left: 3px solid var(--accent); background: var(--surface-hi); }
.notif:active { background: var(--surface-hi); }
.notif-ico {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.notif-ico.notif-assigned { background: rgba(226,216,198,.12); color: var(--cream); }
.notif-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-title { font-weight: 600; }
.notif-body { color: var(--cream-soft); font-size: .9rem; }
.notif-time { color: var(--muted); font-size: .78rem; margin-top: 2px; }

.content { max-width: 640px; margin: 0 auto; padding: 18px 16px; }
.content.has-nav { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 28px); }

/* ---- Bottom nav ---- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-around;
  background: rgba(24,22,17,.92);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; text-decoration: none; color: var(--muted); font-size: .66rem; font-weight: 600;
  letter-spacing: .3px; padding-top: 8px;
}
.bottom-nav a .ico { width: 22px; height: 22px; }
.bottom-nav a.active { color: var(--accent); }

/* ---- Flash messages ---- */
.flashes { margin-bottom: 14px; }
.flash {
  padding: 13px 15px; border-radius: var(--radius-sm); margin-bottom: 8px;
  font-size: .93rem; font-weight: 500; border: 1px solid var(--border);
}
.flash-success { background: var(--accent-soft); color: var(--accent-strong); border-color: rgba(126,184,164,.4); }
.flash-error { background: rgba(224,122,99,.12); color: #f0a692; border-color: rgba(224,122,99,.4); }

/* ---- Task cards ---- */
.page-summary { color: var(--muted); font-size: .88rem; margin: 2px 2px 16px; }
.page-title { font-size: 1.4rem; font-weight: 700; margin: 2px 2px 14px; letter-spacing: -.2px; }
.page-title .sub { display: block; font-size: .85rem; font-weight: 500; color: var(--muted); margin-top: 2px; }
.task-card {
  display: flex; align-items: stretch; gap: 4px;
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  margin-bottom: 11px; overflow: hidden;
  transition: border-color .15s, background .15s;
}
.task-card.overdue { border-left-color: var(--overdue); }
.task-card.done { opacity: .62; border-left-color: var(--border-strong); }
.task-body {
  flex: 1; min-width: 0; display: flex; align-items: center;
  padding: 15px 4px 15px 16px; text-decoration: none; color: var(--text);
}
.task-card:active .task-body { background: var(--surface-hi); }
.task-main { min-width: 0; }
.task-title { font-weight: 600; font-size: 1.03rem; margin-bottom: 4px; line-height: 1.3; }
.task-meta {
  color: var(--muted); font-size: .82rem; display: flex; align-items: center; gap: 5px;
}
.task-meta .ico-sm { color: var(--accent); }
.task-meta + .task-meta { margin-top: 2px; }

.task-go {
  display: flex; align-items: center; padding: 0 14px; color: var(--muted);
  text-decoration: none;
}

/* Inline complete tick */
.task-tick { display: flex; align-items: center; padding: 0 12px 0 6px; }
.tick-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid var(--border-strong); background: transparent;
  color: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  padding: 0;
}
.tick-btn .ico { width: 20px; height: 20px; }
.tick-btn:hover, .tick-btn:focus-visible {
  border-color: var(--accent); color: var(--accent); outline: none;
}
.tick-btn:active { background: var(--accent); color: var(--bg); border-color: var(--accent); transform: scale(.92); }

.badge {
  display: inline-flex; align-items: center; font-size: .68rem; font-weight: 700;
  padding: 2px 9px; border-radius: 999px; margin-left: 8px; letter-spacing: .3px;
  text-transform: uppercase;
}
.badge-overdue { background: rgba(217,145,98,.16); color: var(--overdue); }
.badge-muted { background: var(--border); color: var(--muted); }

/* ---- Groups ---- */
.group { margin-bottom: 26px; }
.group-title {
  font-size: .82rem; font-weight: 700; margin: 0 2px 12px; color: var(--cream-soft);
  text-transform: uppercase; letter-spacing: .6px;
  display: flex; align-items: center; gap: 9px;
}
.group-title .count {
  background: var(--accent-soft); color: var(--accent-strong); font-size: .72rem; font-weight: 700;
  border-radius: 999px; padding: 1px 9px; letter-spacing: 0;
}
.empty-inline { margin: 0 2px 6px; }

/* ---- Empty / motivational states ---- */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty-icon { color: var(--border-strong); margin-bottom: 14px; display: flex; justify-content: center; }
.empty-icon .ico { width: 64px; height: 64px; }
.empty-icon.celebrate { color: var(--accent); }
.empty-title { font-size: 1.35rem; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.empty p { margin: 4px 0; }
.empty .btn { margin-top: 20px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 14px 20px;
  font-size: 1rem; font-weight: 650; cursor: pointer; text-decoration: none; font-family: inherit;
  transition: opacity .15s, background .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; margin-bottom: 11px; }
.btn-primary { background: var(--cream); color: var(--bg); }
.btn-primary:active { background: #d3c8b2; }
.btn-secondary { background: rgba(226,216,198,.12); color: var(--cream); border-color: var(--border-strong); }
.btn-outline { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(224,122,99,.4); }
.btn-link { background: transparent; color: var(--muted); }
.btn-small { padding: 9px 14px; font-size: .84rem; }
.btn-google { background: var(--cream); color: #1c1a14; width: 100%; }
.btn-google .g { font-weight: 800; font-size: 1.1rem; }

/* ---- FAB ---- */
.fab {
  position: fixed; right: 18px; z-index: 21;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--cream); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.fab .ico { width: 28px; height: 28px; }
.fab:active { background: #d3c8b2; }

/* ---- Forms ---- */
.form { margin-top: 4px; }
.card-form {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 26px;
}
.field { display: block; margin-bottom: 18px; }
.field-label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 8px; color: var(--cream-soft); }
.optional { color: var(--muted); font-weight: 400; }
.field input, .field textarea, .field select {
  width: 100%; padding: 14px 15px; font-size: 1rem; font-family: inherit; line-height: 1.3;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text);
  -webkit-appearance: none; appearance: none;
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
/* select: proper alignment + custom cream chevron */
.field select {
  height: 52px; padding-right: 44px; color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath fill='none' stroke='%23E2D8C6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 7 7.5l6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 14px;
}
.field select:invalid { color: var(--muted); }
.field select option { color: #15140f; background: var(--cream); }
.hint { display: block; color: var(--overdue); font-size: .82rem; margin-top: 7px; }

/* ---- Custom dropdown ---- */
.select-wrap { position: relative; }
.select-wrap.js-enhanced .native-select { display: none; }
.select-btn {
  width: 100%; height: 52px; padding: 0 44px 0 15px; font-size: 1rem; font-family: inherit;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); text-align: left; cursor: pointer;
  display: flex; align-items: center; position: relative;
}
.select-btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select-wrap.open .select-btn { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-chev {
  position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
  color: var(--accent); display: flex; transition: transform .18s;
}
.select-chev svg { width: 18px; height: 18px; }
.select-wrap.open .select-chev { transform: translateY(-50%) rotate(180deg); }

.select-list {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  margin: 0; padding: 6px; list-style: none;
  background: var(--surface-hi); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: 0 12px 32px rgba(0,0,0,.5);
  max-height: 280px; overflow-y: auto;
}
.select-wrap:not(.open) .select-list { display: none; }
.select-option {
  display: flex; align-items: center; gap: 8px; padding: 13px 14px;
  border-radius: 10px; cursor: pointer; color: var(--text); font-size: 1rem;
}
.select-option:hover { background: var(--accent-soft); }
.select-option .select-tick { margin-left: auto; color: var(--accent); display: none; }
.select-option .select-tick svg { width: 18px; height: 18px; }
.select-option.selected { color: var(--accent-strong); font-weight: 600; }
.select-option.selected .select-tick { display: flex; }

/* ---- Reassign ---- */
.reassign {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; margin-bottom: 11px;
}
.reassign .field-label { display: block; margin-bottom: 8px; }
.reassign-row { display: flex; gap: 10px; align-items: stretch; }
.reassign-row .select-wrap { flex: 1; min-width: 0; }
.reassign-btn { flex: none; margin: 0; padding: 0 20px; }

/* ---- Report cards + day view ---- */
.date-nav { display: flex; align-items: center; gap: 10px; }
.date-nav input[type="date"] {
  flex: 1; min-width: 0; height: 52px; padding: 0 14px; font-size: 1rem; font-family: inherit;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  -webkit-appearance: none; appearance: none;
}
.date-nav input[type="date"]:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
/* tint the native calendar glyph so it reads on dark */
input[type="date"]::-webkit-calendar-picker-indicator { opacity: .65; cursor: pointer; }
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
.date-step {
  flex: none; width: 46px; height: 52px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none;
}
.date-step:active { background: var(--surface-hi); }
.date-step .ico { width: 20px; height: 20px; }
.ico.flip { transform: rotate(180deg); }

.report-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  border-left: 3px solid var(--accent);
  padding: 15px 16px; margin-bottom: 10px; text-decoration: none; color: var(--text);
}
.report-card:active { background: var(--surface-hi); }
.report-card-main { flex: 1; min-width: 0; }
.report-name { font-weight: 600; font-size: 1.05rem; margin-bottom: 8px; }
.report-name .you {
  font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px;
  vertical-align: middle;
}
.report-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  font-size: .76rem; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: rgba(226,216,198,.10); color: var(--muted);
}
.chip-done { color: var(--accent-strong); background: var(--accent-soft); }
.chip-spill { color: var(--overdue); background: rgba(217,145,98,.16); }
.report-go { color: var(--muted); display: flex; }
.form-actions { margin-top: 6px; }
.section-title { font-size: .82rem; font-weight: 700; margin: 6px 2px 14px; color: var(--cream-soft);
  text-transform: uppercase; letter-spacing: .6px; }

/* ---- Members ---- */
.member-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 13px 15px; margin-bottom: 10px;
}
.member-row.inactive { opacity: .55; }
.member-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.member-email { color: var(--muted); font-size: .82rem; }

/* ---- Detail ---- */
.detail-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px; border-left: 3px solid var(--accent);
}
.detail-card.overdue { border-left-color: var(--overdue); }
.detail-title { font-size: 1.35rem; margin: 0 0 16px; line-height: 1.25; }
.detail-row {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 11px 0; border-top: 1px solid var(--border); font-size: .95rem;
}
.detail-key { color: var(--muted); }
.status-cell { display: inline-flex; align-items: center; gap: 8px; }
.detail-desc {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
  white-space: pre-wrap; color: var(--cream-soft);
}
.detail-actions { margin-top: 10px; }

/* ---- Report ---- */
.report-picker { margin-bottom: 6px; }
.report-totals { display: flex; gap: 11px; margin-bottom: 22px; }
.stat {
  flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 8px; text-align: center; font-size: .74rem; color: var(--muted);
  display: flex; flex-direction: column; gap: 3px; letter-spacing: .3px;
}
.stat-num { font-size: 1.7rem; font-weight: 800; color: var(--text); }
.stat-done .stat-num { color: var(--accent); }
.stat-spill .stat-num { color: var(--overdue); }

.report-person {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px; margin-bottom: 12px;
}
.report-line { font-size: .95rem; padding: 4px 0; display: flex; align-items: center; gap: 9px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot-assigned { background: var(--cream); }
.dot-done { background: var(--accent); }
.dot-open { background: var(--accent); }
.dot-spill { background: var(--overdue); }
.report-details { margin-top: 10px; font-size: .9rem; }
.report-details summary { color: var(--accent); cursor: pointer; }
.report-details ul { margin: 8px 0 0; padding-left: 20px; color: var(--cream-soft); }

/* ---- Login ---- */
.login-screen { min-height: 78vh; display: flex; align-items: center; justify-content: center; }
.login-card { text-align: center; width: 100%; max-width: 340px; }
.login-logo { color: var(--cream); margin-bottom: 14px; display: flex; justify-content: center; }
.login-logo .ico { width: 56px; height: 56px; }
.login-logo-muted { color: var(--muted); }
.login-card h1 { margin: 0 0 6px; font-size: 1.7rem; }
.wordmark { font-weight: 800; letter-spacing: -.5px; font-size: 2.5rem; }
.wm-on { color: var(--text); }
.wm-it { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.notice {
  background: rgba(226,216,198,.08); color: var(--cream-soft); padding: 13px 15px;
  border-radius: var(--radius-sm); font-size: .9rem; border: 1px solid var(--border);
}
.dev-login { margin-top: 30px; padding-top: 20px; border-top: 1px dashed var(--border-strong); }
code { background: var(--surface-hi); padding: 2px 6px; border-radius: 6px; font-size: .85em; color: var(--cream); }
