/* Tokens first. The shell's slot is the one that must survive every redesign:
   inside the Second Draft shell a 48px round button floats in the bottom-right
   corner, 16px in from each edge, above everything. Nothing tappable goes
   there. Applied everywhere, shell or not, so one stylesheet stays right. */
:root {
  --shell-switcher-size: 48px;
  --shell-switcher-inset: 16px;
  --shell-switcher-gap: 16px;
  --shell-slot: 80px; /* inset + size + gap: the corner the shell owns */

  --ink: #1f1d1b;
  --quiet: #6b6560;
  --paper: #f7f5f2;
  --card: #ffffff;
  --line: #e4dfd9;
  --accent: #5b3a5e;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* Per-tab themes: the public Book side is warm rose/terracotta, the Owner
   side is dark slate/teal. Completely different headers and accents so the
   two can never be mistaken. */
body[data-tab="book"] {
  --ink: #3a2320;
  --quiet: #8a6f68;
  --paper: #fdf4ec;
  --card: #fffaf5;
  --line: #ecd9c8;
  --accent: #a34a28;
  --font: Georgia, 'Iowan Old Style', serif;
}
body[data-tab="owner"] {
  --ink: #e8edf2;
  --quiet: #9aa7b5;
  --paper: #232a35;
  --card: #2e3743;
  --line: #465364;
  --accent: #3fb598;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--font); }
body { min-height: 100dvh; }

/* The shell gives the page the whole window, behind the clock at the top and
   the gesture bar at the bottom: the background is ours to cover, the content
   ours to keep clear of both. The shell sets --shell-safe-* on <html> before
   the first layout, so nothing moves afterwards; env() answers in a plain
   browser, where the variables are absent. See docs/shell-contract.md. */
.page {
  max-width: 640px;
  margin: 0 auto;
  padding-top: calc(24px + max(var(--shell-safe-top, 0px), env(safe-area-inset-top, 0px)));
  padding-right: calc(20px + max(var(--shell-safe-right, 0px), env(safe-area-inset-right, 0px)));
  padding-bottom: calc(max(var(--shell-safe-bottom, 0px), env(safe-area-inset-bottom, 0px)) + var(--shell-slot));
  padding-left: calc(20px + max(var(--shell-safe-left, 0px), env(safe-area-inset-left, 0px)));
}
.page-heading { font-size: 1.6rem; margin: 0 0 8px; }
.quiet { color: var(--quiet); margin: 0; }

button, input, select, textarea { font: inherit; }
.button {
  appearance: none; border: 0; border-radius: 12px; padding: 12px 18px;
  background: var(--accent); color: #fff; cursor: pointer;
}
body[data-tab="book"] .button--book { font-size: 1.1rem; width: 100%; padding: 14px 18px; border-radius: 16px; }
.button--ghost { background: transparent; color: var(--accent); outline: 2px solid var(--accent); outline-offset: -2px; }
body[data-tab="owner"] .button--ghost { color: var(--accent); }
.button--danger { background: #8c2f2f; }
.button:disabled { opacity: 0.55; cursor: default; }

/* Top-level Book / Owner tabs. */
.top-tabs { display: flex; gap: 8px; margin: 0 0 16px; }
.top-tabs button {
  flex: 1; border-radius: 14px; padding: 12px; cursor: pointer;
  border: 2px solid var(--line); background: var(--card); color: var(--ink);
  font-weight: 700;
}
.top-tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Public brand hero: centred, warm, text logo. */
.brand-hero { text-align: center; padding: 18px 12px 6px; }
.logo-mark {
  width: 64px; height: 64px; margin: 0 auto 8px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 1.7rem;
  background: var(--accent); color: #fff;
}
.brand-eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; color: var(--quiet); margin: 0 0 4px; }
body[data-tab="book"] .page-heading { font-size: 2.2rem; letter-spacing: 0.01em; }
.book-card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px; margin-top: 16px; }
.share-quiet { margin-top: 14px; text-align: center; }
.linklike {
  background: none; border: 0; padding: 4px 8px; cursor: pointer;
  color: var(--quiet); font-size: 0.85rem; text-decoration: underline; text-underline-offset: 3px;
}

/* Owner hero: left-aligned dark control bar — deliberately unlike the public hero. */
.owner-hero { background: #171d26; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 8px; }
.owner-hero-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.owner-eyebrow { font-family: ui-monospace, monospace; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.72rem; color: #7fe3c3; margin: 0 0 4px; }
.owner-heading { font-size: 1.4rem; margin: 0; color: #fff; font-family: system-ui, sans-serif; }
.owner-sub { color: var(--quiet); font-size: 0.9rem; margin: 8px 0 0; }
.owner-pill {
  margin: 0; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  border: 1px solid var(--accent); color: var(--accent); border-radius: 999px; padding: 4px 12px; white-space: nowrap;
}
.owner-panel { border: 1px dashed var(--line); border-radius: 12px; padding: 14px; }

section { margin-top: 28px; }
#view-book section:first-of-type { margin-top: 16px; }
h2 { font-size: 1.2rem; margin: 0 0 8px; }
h3 { font-size: 1rem; margin: 12px 0 4px; }
label { display: block; margin: 10px 0; }
input, select { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #1f1d1b; }
body[data-tab="owner"] input, body[data-tab="owner"] select { background: #1c232e; color: var(--ink); }
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 10px 0; padding: 12px; }
legend { padding: 0 6px; }
.cards { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.tabs { display: flex; gap: 8px; margin: 8px 0; }
.tabs button { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
body[data-tab="owner"] .tabs button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #10151c; }
.slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slot { border: 1px solid var(--accent); background: #fff; color: var(--accent); border-radius: 999px; padding: 8px 12px; cursor: pointer; }
.slot[aria-pressed="true"] { background: var(--accent); color: #fff; }
.slot--taken { border-color: var(--line); color: var(--quiet); }
.booking-open { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: var(--ink); font-weight: 600; width: 100%; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
#detail { border-top: 2px solid var(--line); padding-top: 16px; }

/* Messages that are not the page: keep out of the shell's 80×80 corner. */
#toast {
  position: fixed; left: 16px; right: var(--shell-slot);
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--shell-switcher-inset));
  pointer-events: none;
}
#toast:empty { display: none; }
#toast > * { background: var(--ink); color: var(--paper); border-radius: 12px; padding: 12px 16px; }
body[data-tab="owner"] #toast > * { background: #10151c; color: #e8edf2; border: 1px solid var(--line); }
