/* Tidy Hive Cal — emerald, gold and ivory, matching thetidyhivefl.com */
:root {
  --emerald: #033412;
  --emerald-2: #0b4a22;
  --emerald-3: #1d6a3a;
  --emerald-tint: #e3efe6;
  --gold: #e2990b;
  --gold-hi: #fdf396;
  --gold-ink: #8a5a06;
  --gold-tint: #fdf1d2;
  --ivory: #fbf7ec;
  --paper: #fffdf7;
  --cream: #f4ead1;
  --ink: #0d2316;
  --muted: #56655a;
  --line: #e6dcc0;
  --red: #a3341f;
  --red-tint: #f8e3dc;
  --grey: #6b726c;
  --grey-tint: #ecebe5;
  --display: "Marcellus", Georgia, serif;
  --body: "Jost", system-ui, -apple-system, sans-serif;
  --r: 14px;
  --shadow: 0 1px 2px rgba(3, 52, 18, .06), 0 8px 24px rgba(3, 52, 18, .07);
  --bottom-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ivory); color: var(--ink); font: 400 16px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.15; margin: 0; color: var(--emerald); }
a { color: var(--emerald-3); }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent; font-weight: 500; text-decoration: none; cursor: pointer; background: var(--paper); border-color: var(--line); color: var(--emerald); white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--emerald); color: #fff; border-color: var(--emerald); }
.btn-primary:hover:not(:disabled) { background: var(--emerald-2); }
.btn-gold { background: var(--gold); color: #1d1300; border-color: var(--gold); }
.btn-danger { color: var(--red); border-color: #e7c2b8; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.btn-block { width: 100%; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); display: inline-grid; place-items: center; cursor: pointer; color: var(--emerald); font-size: 1.25rem; line-height: 1; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- login ---------- */
.login-body { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; background: radial-gradient(120% 70% at 50% 0%, #0b4a22 0%, var(--emerald) 55%, #021f0b 100%); }
.login { width: 100%; max-width: 380px; padding: 32px 16px; text-align: center; color: #f1ead6; }
.login h1 { color: #fff; font-size: 2rem; margin-top: 12px; }
.login .muted { color: #c9d6c9; }
.login-badge { width: 120px; height: auto; margin: 0 auto; filter: drop-shadow(0 6px 18px rgba(0,0,0,.35)); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.login-card { padding: 22px; margin: 22px 0 14px; text-align: left; color: var(--ink); display: grid; gap: 10px; }
.login-card label { font-weight: 500; }
input[type=password], input[type=text], input[type=email], textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #d4c9aa; border-radius: 10px; background: #fff; font-size: 16px; }
input:focus, textarea:focus { outline: 3px solid rgba(226,153,11,.45); border-color: var(--gold); }
.form-err { color: var(--red); margin: 0; font-weight: 500; }

/* ---------- shell ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--emerald); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: var(--display); font-size: 1.2rem; }
.brand img { width: 40px; height: auto; }
.tabs { display: none; gap: 4px; margin-left: 12px; }
.tabs a { color: #dfe9df; text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.tabs a[aria-current=page] { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 0 -2px 0 var(--gold); }
#logout { margin-left: auto; color: #dfe9df; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--gold); color: #1d1300; font-size: .78rem; font-weight: 600; }
main { padding: 16px 16px calc(var(--bottom-h) + 24px + env(safe-area-inset-bottom)); max-width: 1320px; margin: 0 auto; outline: none; }
.bottom-tabs { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(3, 1fr); height: calc(var(--bottom-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--paper); border-top: 1px solid var(--line); }
.bottom-tabs a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .78rem; font-weight: 500; }
.bottom-tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottom-tabs a[aria-current=page] { color: var(--emerald); }
.bottom-tabs a[aria-current=page] svg { stroke: var(--emerald); }
.bottom-tabs .count { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 20px; height: 20px; font-size: .72rem; }
@media (min-width: 900px) {
  .tabs { display: flex; }
  .bottom-tabs { display: none; }
  main { padding: 24px 24px 48px; }
}

/* ---------- needs banner ---------- */
.needs-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 14px; border-radius: var(--r); background: var(--gold-tint); border: 1px solid #f0d48b; color: var(--ink); text-decoration: none; }
.needs-banner .big { font-family: var(--body); font-weight: 600; font-size: 1.7rem; line-height: 1; color: var(--gold-ink); }
.needs-banner span { flex: 1; font-weight: 500; }
.needs-banner .go { color: var(--gold-ink); font-weight: 600; }

/* ---------- calendar ---------- */
.cal-layout { display: grid; gap: 16px; }
@media (min-width: 1000px) { .cal-layout { grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr); align-items: start; } }
.month { padding: 12px; }
.month-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.month-head h2 { flex: 1; font-size: 1.5rem; }
.dow, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dow div { text-align: center; font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 4px 0 6px; }
.grid { gap: 3px; }
.day { position: relative; min-height: 58px; padding: 4px; border-radius: 10px; border: 1px solid transparent; background: #fff; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.day:hover { border-color: var(--line); }
.day .num { font-size: .9rem; font-weight: 500; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.day.other { background: transparent; color: #a9ad9f; }
.day.today .num { background: var(--emerald); color: #fff; }
.day.sel { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.day.blocked { background: repeating-linear-gradient(135deg, #f1ece0 0 6px, #e8e1cf 6px 12px); }
.day.blocked .num::after { content: ""; }
.day .dots { display: flex; gap: 3px; flex-wrap: wrap; padding-left: 3px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grey); }
.chips { display: none; }
@media (min-width: 700px) {
  .day { min-height: 96px; }
  .day .dots { display: none; }
  .chips { display: grid; gap: 2px; }
}
.chip { display: block; font-size: .74rem; line-height: 1.25; padding: 2px 5px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid; }
.chip.est { border-left-style: dashed; }
.chip-est { font-size: .62rem; font-weight: 700; letter-spacing: .04em; margin-right: 4px; padding: 0 3px; border-radius: 3px; border: 1px dashed var(--gold); color: var(--gold-ink); background: #fff; }
.dot.est { background: #fff; box-shadow: inset 0 0 0 2px var(--c); }
.more { font-size: .72rem; color: var(--muted); padding-left: 4px; }
.blocked-tag { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* status colors */
.s-requested { --c: var(--gold); --t: var(--gold-tint); --i: var(--gold-ink); }
.s-confirmed { --c: var(--emerald-3); --t: var(--emerald-tint); --i: var(--emerald); }
.s-completed { --c: #7f9a86; --t: #eef1ec; --i: #3f5646; }
.s-declined { --c: var(--red); --t: var(--red-tint); --i: var(--red); }
.s-cancelled { --c: var(--grey); --t: var(--grey-tint); --i: #4a504b; }
.chip, .dot { background: var(--t); border-color: var(--c); color: var(--i); }
.dot { background: var(--c); }
.s-cancelled.chip, .s-declined.chip { text-decoration: line-through; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--t); color: var(--i); border: 1px solid var(--c); text-transform: capitalize; }
.visit { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 6px; font-size: .74rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.visit-clean { background: var(--emerald); color: #fff; }
.visit-estimate { background: #fff; color: var(--gold-ink); border: 1.5px dashed var(--gold); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: .8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

/* agenda */
.agenda { padding: 14px; }
.agenda-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.agenda-head h3 { flex: 1; font-size: 1.3rem; min-width: 160px; }
.list { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 5px 1fr auto; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 12px 12px 12px 0; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; overflow: hidden; }
.item:hover { border-color: #d4c9aa; }
.item .bar { align-self: stretch; background: var(--c); }
.item .when { font-size: .82rem; color: var(--muted); }
.item .who { font-weight: 600; }
.item .what { font-size: .88rem; color: var(--muted); }
.item .tags { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.empty { padding: 22px 12px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; }
.blocked-note { margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--grey-tint); color: #3e443f; font-weight: 500; }

/* needs list */
.page-head { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 14px; flex-wrap: wrap; }
.page-head h2 { font-size: 1.7rem; }
.needs-card { padding: 14px; display: grid; gap: 10px; }
.needs-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.needs-grid { display: grid; gap: 12px; }
@media (min-width: 800px) { .needs-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } }

/* ---------- sheet (booking detail, compose) ---------- */
.sheet { border: 0; padding: 0; width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; margin: auto auto 0; border-radius: 20px 20px 0 0; background: var(--paper); color: var(--ink); box-shadow: 0 -10px 40px rgba(0,0,0,.25); }
.sheet::backdrop { background: rgba(2, 31, 11, .55); }
.sheet-inner { display: flex; flex-direction: column; max-height: inherit; }
.sheet-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 16px 10px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { flex: 1; font-size: 1.45rem; }
.sheet-body { padding: 14px 16px; overflow: auto; }
.sheet-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.sheet-foot .btn { flex: 1 1 140px; }
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 20px; } }
.kv { display: grid; grid-template-columns: 100px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: .88rem; padding-top: 2px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.contact { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 14px; }
.contact a, .contact button { flex-direction: column; gap: 2px; min-height: 60px; border-radius: 12px; font-size: .82rem; }
.contact svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tagrow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.notes { white-space: pre-wrap; background: var(--ivory); border-radius: 10px; padding: 10px 12px; }

/* ---------- mail ---------- */
.mail-layout { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.mail-layout > * { min-width: 0; }
@media (min-width: 900px) { .mail-layout { grid-template-columns: 200px minmax(300px, 400px) minmax(0, 1fr); min-height: calc(100vh - 120px); align-items: start; } }
.folders { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.folders a { flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); font-weight: 500; font-size: .92rem; }
.folders a[aria-current=true] { background: var(--emerald); color: #fff; border-color: var(--emerald); }
@media (min-width: 900px) {
  .folders { flex-direction: column; position: sticky; top: 80px; }
  .folders a { border-radius: 10px; }
}
.compose-btn { margin-bottom: 8px; }
.msgs { overflow: hidden; }
.msg { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); background: #fff; }
.msg:last-child { border-bottom: 0; }
.msg .from { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg .time { font-size: .8rem; color: var(--muted); }
.msg .subj, .msg .sum { grid-column: 1 / -1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg .sum { font-size: .86rem; color: var(--muted); }
.msg.unread { background: #fffbea; }
.msg.unread .from, .msg.unread .subj { font-weight: 700; }
.msg.unread .from::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--gold); vertical-align: 1px; }
.msg[aria-current=true] { box-shadow: inset 4px 0 0 var(--gold); }
.pager { display: flex; justify-content: space-between; gap: 8px; padding: 10px; }
.reader { padding: 16px; min-width: 0; }
.reader h2 { font-size: 1.35rem; margin-bottom: 8px; overflow-wrap: anywhere; }
.reader .meta { font-size: .88rem; color: var(--muted); display: grid; gap: 2px; margin-bottom: 12px; overflow-wrap: anywhere; }
.reader .meta b { color: var(--ink); font-weight: 600; }
.reader-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.mailframe { width: 100%; min-height: 60vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.mail-empty { padding: 28px 22px; text-align: center; }
.mail-empty h2 { font-size: 1.6rem; margin-bottom: 8px; }
.mail-empty ol { text-align: left; max-width: 520px; margin: 14px auto; padding-left: 22px; }
.mail-empty li { margin-bottom: 6px; }
.reader-placeholder { display: none; }
@media (min-width: 900px) {
  .reader-placeholder { display: grid; place-items: center; min-height: 300px; color: var(--muted); }
  .mail-layout.reading .back-to-list { display: none; }
}
@media (max-width: 899px) {
  .mail-layout.reading .msgs, .mail-layout.reading .folders, .mail-layout.reading .compose-btn { display: none; }
  .mail-layout:not(.reading) .reader-wrap { display: none; }
}
.compose-form { display: grid; gap: 10px; }
.compose-form label { font-size: .85rem; color: var(--muted); font-weight: 500; display: grid; gap: 4px; }
.compose-form textarea { min-height: 220px; resize: vertical; line-height: 1.5; }
.note { font-size: .85rem; color: var(--muted); background: var(--ivory); padding: 8px 10px; border-radius: 8px; }

/* toast + loading */
.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(var(--bottom-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 500; box-shadow: var(--shadow); }
.toast.err { background: var(--red); }
@media (min-width: 900px) { .toast { bottom: 24px; } }
.loading { padding: 30px; text-align: center; color: var(--muted); }
.error-box { padding: 14px; border-radius: 12px; background: var(--red-tint); color: var(--red); font-weight: 500; }
