/* BLETHER • brand tokens and the light pages (sign-in, dashboard, join).
   Moss green buttons, thistle accents, linen paper, bog-oak text. */
:root {
  --linen: #F4F6F1;
  --surface: #FFFFFF;
  --surface-2: #EEF2EA;
  --bog: #1E2A22;
  --muted: #56645A;
  --line: #D6DDD2;
  --moss: #3E5F3A;
  --moss-hover: #34512F;
  --moss-soft: #E3EBDF;
  --thistle: #B07CC6;
  --thistle-ink: #6E3F86;
  --thistle-soft: #F1E7F5;
  --bracken: #8A9A3B;
  --bracken-ink: #5F6B22;
  --rowan: #B5332E;
  --rowan-soft: #F8E4E2;
  --night: #121A14;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 42, 34, .06), 0 8px 24px rgba(30, 42, 34, .06);
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--linen); color: var(--bog); font: 15px/1.55 var(--sans); }
body { min-height: 100vh; }
a { color: var(--moss); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--thistle); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: -.01em; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(28px, 4vw, 38px); }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--bog); }
.brand img { width: 34px; height: 34px; }
.brand span { font-family: var(--serif); font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--thistle-ink); }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--moss); background: var(--moss); color: #fff; font-weight: 650; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--moss-hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--bog); border-color: var(--line); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--moss); }
.btn.ghost:hover { background: var(--moss-soft); }
.btn.danger { background: var(--rowan); border-color: var(--rowan); color: #fff; }
.btn.danger:hover { filter: brightness(.94); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn svg { width: 18px; height: 18px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 650; }
.field small { color: var(--muted); font-size: 12px; }
.input, .field input, .field select, .field textarea { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid #BFC9BB;
  background: var(--surface); }
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: 2px solid var(--moss); outline-offset: 0; border-color: var(--moss); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 3px; accent-color: var(--moss); width: 18px; height: 18px; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--thistle-soft); color: #4C2B5D; border: 1px solid #E2CDEB; font-size: 14px; }
.notice.error { background: var(--rowan-soft); color: #7A1F1B; border-color: #EDC3BF; }
.notice.ok { background: var(--moss-soft); color: #22371F; border-color: #C9D8C3; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }

/* Toast */
#toast-root { position: fixed; z-index: 2000; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); }
.toast { background: var(--bog); color: #fff; border-radius: 12px; padding: 12px 16px; box-shadow: 0 12px 30px rgba(0,0,0,.25); font-size: 14px;
  display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.toast .btn { min-height: 32px; }

/* Centered single-card pages (sign-in, join) */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(ellipse at 15% 0%, rgba(176, 124, 198, .14), transparent 45%),
  radial-gradient(ellipse at 90% 100%, rgba(62, 95, 58, .12), transparent 50%), var(--linen); }
.auth-card { width: min(440px, 100%); padding: 30px 28px; display: grid; gap: 18px; }
.auth-card form { display: grid; gap: 14px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.link-button { background: none; border: 0; padding: 0; color: var(--moss); font-weight: 650; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* Landing */
.landing { max-width: 1040px; margin: 0 auto; padding: 24px 20px 64px; }
.landing header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; padding: 56px 0 40px; }
.hero h1 { font-size: clamp(34px, 6vw, 56px); }
.hero p { font-size: 18px; color: var(--muted); margin-top: 16px; max-width: 34em; }
.hero-art { aspect-ratio: 4 / 3; border-radius: 22px; background: var(--night); position: relative; overflow: hidden; box-shadow: var(--shadow); }
.hero-art .tile { position: absolute; border-radius: 14px; background: #1B261D; border: 1px solid #2A3A2C; display: grid; place-items: center; }
.hero-art .tile span { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-size: 28px; font-weight: 700; }
.hero-art .t1 { inset: 18px 52% 18px 18px; } .hero-art .t1 span { background: var(--moss); color: #fff; }
.hero-art .t2 { inset: 18px 18px 18px 52%; border-color: var(--thistle); } .hero-art .t2 span { background: var(--thistle); color: #2A1533; }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.features .card { padding: 20px; display: grid; gap: 8px; }

/* Dashboard */
.app-header { position: sticky; top: 0; z-index: 50; background: rgba(244, 246, 241, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.app-header-inner { max-width: 1120px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 18px; }
.app-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.app-nav button { border: 0; background: none; padding: 9px 12px; border-radius: 10px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.app-nav button[aria-current="page"] { background: var(--moss-soft); color: var(--moss); }
.app-nav button svg { display: none; }
.app-user { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--thistle-soft); color: var(--thistle-ink);
  font-weight: 700; flex: none; border: 1px solid #E2CDEB; }
.app-main { max-width: 1120px; margin: 0 auto; padding: 28px 20px 80px; display: grid; gap: 22px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin-top: 6px; }
/* minmax(0, …) lets long links shrink instead of pushing the page wider than a phone. */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 22px; align-items: start; }
.grid-2 > * { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.room-card { padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; background: linear-gradient(135deg, #FFFFFF 0%, #F6F1F8 100%); }
.room-link { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 6px 14px; }
.room-link code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.list { display: grid; }
.list-item { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.busy-note { color: var(--thistle-ink); font-weight: 600; }
.list-item strong { overflow: hidden; text-overflow: ellipsis; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.empty { padding: 26px 18px; color: var(--muted); text-align: center; }
.when { min-width: 76px; display: grid; text-align: right; font-weight: 650; font-size: 14px; }
.when small { font-weight: 400; color: var(--muted); }
.bar { width: 3px; align-self: stretch; border-radius: 3px; background: var(--thistle); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--moss-soft); color: var(--moss); }
.badge.thistle { background: var(--thistle-soft); color: var(--thistle-ink); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bracken); box-shadow: 0 0 0 4px rgba(138, 154, 59, .2); display: inline-block; }
.waiting-card { border-color: #E2CDEB; }
.waiting-card .list-head { background: var(--thistle-soft); border-radius: var(--radius) var(--radius) 0 0; }
.usage-card { display: grid; gap: 10px; }
.list-head-plain { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.meter { height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--moss); border-radius: 999px; }
.usage-card.warn .meter span { background: var(--thistle); }
.usage-card.red .meter span { background: var(--rowan); }
.usage-alert { color: #7A1F1B; font-weight: 600; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(18, 26, 20, .45); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal { width: min(560px, 100%); padding: 24px; display: grid; gap: 16px; }
.modal form { display: grid; gap: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.field-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

/* Join (client) page */
.join-card { width: min(920px, 100%); padding: 0; overflow: hidden; display: grid; grid-template-columns: 1.15fr 1fr; }
.join-preview { background: var(--night); position: relative; min-height: 320px; display: grid; place-items: center; }
.join-preview video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.join-preview .me { width: 96px; height: 96px; border-radius: 50%; background: var(--thistle); color: #2A1533; display: grid; place-items: center; font-family: var(--serif); font-size: 40px; font-weight: 700; }
.join-toggles { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 12px; }
.round { width: 50px; height: 50px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); background: var(--moss); color: #fff; display: grid; place-items: center; cursor: pointer; }
.round.off { background: var(--rowan); }
.round svg { width: 22px; height: 22px; }
.join-side { padding: 28px; display: grid; gap: 14px; align-content: start; }
.join-side form { display: grid; gap: 14px; }
.waiting { display: grid; gap: 16px; justify-items: center; text-align: center; padding: 36px 28px; }
.pulse { width: 74px; height: 74px; border-radius: 50%; background: var(--thistle-soft); display: grid; place-items: center; position: relative; }
.pulse::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid var(--thistle); opacity: .6; animation: pulse 2s ease-out infinite; }
@keyframes pulse { from { transform: scale(.85); opacity: .7; } to { transform: scale(1.25); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pulse::after { animation: none; } }

@media (max-width: 860px) {
  .hero, .grid-2, .join-card { grid-template-columns: minmax(0, 1fr); }
  .features { grid-template-columns: 1fr; }
  .join-preview { min-height: 240px; }
  /* The blur would trap the fixed tab bar inside the header, so phones get a plain header. */
  .app-header { backdrop-filter: none; background: var(--linen); }
  .app-header-inner { justify-content: space-between; }
  /* Phone tab bar, Zoom style: icons with labels along the bottom. */
  .app-nav { position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; gap: 0; overflow: visible; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px);
    border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .app-nav button { position: relative; flex: 1; min-width: 0; display: grid; justify-items: center; gap: 2px; padding: 6px 2px; font-size: 11px; border-radius: 10px; }
  .app-nav button svg { display: block; }
  .app-nav button[aria-current="page"] { background: none; }
  .app-nav button[aria-current="page"] svg { background: var(--moss-soft); border-radius: 999px; padding: 2px 12px; box-sizing: content-box; }
  .app-nav .badge { position: absolute; top: 0; left: calc(50% + 8px); padding: 1px 6px; font-size: 10px; }
  .app-main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); gap: 18px; }
  #toast-root { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .call-pill { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .room-card { padding: 20px; }
  .room-card .row-actions { flex-direction: column; }
  .room-card .row-actions .btn { width: 100%; }
  /* Meetings become cards: time and title on top, buttons underneath. */
  .meeting-item { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 4px 12px; }
  .meeting-item .when { text-align: left; }
  .meeting-item .grow strong { white-space: normal; }
  .meeting-item .row-actions { grid-column: 1 / -1; flex-wrap: nowrap; }
  .meeting-item .row-actions .btn:not(.ghost) { flex: 1; }
  .field-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .auth-card { padding: 24px 18px; }
  .list-item { flex-wrap: wrap; }
  .row-actions .btn { flex: 1; }
  .field-row { grid-template-columns: 1fr; }
}

/* Booking pages (/book/<slug> and /booking/<id>) */
.book-page { max-width: 640px; margin: 0 auto; padding: 20px 16px 56px; display: grid; gap: 18px; justify-items: start; }
.book-card { width: 100%; padding: 22px 18px; display: grid; gap: 18px; }
.book-card section { display: grid; gap: 14px; }
.book-head { display: grid; gap: 6px; }
.book-head h1, .book-card h2 { overflow-wrap: anywhere; }
.book-card h1:focus, .book-card h2:focus { outline: none; }
.chosen-time { font-weight: 650; font-size: 16px; }
.zone-field select { max-width: 100%; min-height: 44px; }
.slot-day { display: grid; gap: 8px; margin-top: 4px; }
.slot-day h3 { font-size: 16px; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.slot { min-height: 44px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--moss); background: var(--surface); color: var(--moss); font-weight: 650; cursor: pointer; }
.slot:hover { background: var(--moss-soft); }
.slot[aria-pressed="true"] { background: var(--moss); color: #fff; }
.book-form { display: grid; gap: 14px; }
.book-form input, .book-form textarea, .book-form select { width: 100%; max-width: 100%; }
.book-alt { font-size: 14px; }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.book-card, .book-card section { min-width: 0; max-width: 100%; }
.book-card .room-link { padding: 10px 14px; min-width: 0; }
.book-card .room-link code { white-space: normal; overflow-wrap: anywhere; word-break: break-all; text-overflow: clip; }
.book-card .row-actions .btn { flex: 1 1 160px; }
@media (min-width: 640px) { .book-card { padding: 28px; } }

/* Booking: settings, requests, booked meetings */
.badge.muted-badge { background: var(--line); color: var(--muted); }
.email-problem { color: #7A1F1B; }
.hours { display: grid; gap: 10px; }
.hours-day { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.hours-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.range-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.range-row input[type=time] { min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--card, #fff); color: inherit; }
.request-item { align-items: flex-start; }
.request-times { display: grid; gap: 8px; margin-top: 6px; }
.request-time { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
