/* Host-calendar look: white canvas, near-black ink, hairline grey grid, dark reservation pills. */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f7f7;
  --ink: #222222;
  --ink-2: #6a6a6a;
  --ink-3: #929292;
  --line: #ebebeb;
  --line-2: #dddddd;
  --pill: #222222;
  --pill-ink: #ffffff;
  --pill-past: #b0b0b0;
  --accent: #222222;
  --accent-ink: #ffffff;
  --danger: #c13515;
  --flag: #e07912;
  --block: #f2f2f2;
  --radius: 12px;
  --tabbar-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212; --surface: #1c1c1c; --surface-2: #232323; --ink: #f2f2f2; --ink-2: #b0b0b0; --ink-3: #808080;
    --line: #2c2c2c; --line-2: #3a3a3a; --pill: #f2f2f2; --pill-ink: #121212; --pill-past: #5a5a5a;
    --accent: #f2f2f2; --accent-ink: #121212; --danger: #ff7a5c; --flag: #ffa94d; --block: #1f1f1f;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 15px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
.boot { padding: 40vh 0; text-align: center; color: var(--ink-3); }

/* ---------- layout & tab bar ---------- */
.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px 40px; }
.wide { max-width: 1280px; margin: 0 auto; padding: 0 20px 40px; }
.page-title { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 28px 0 18px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--bg);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-brand { display: none; }
.tabbar-items { display: flex; justify-content: space-around; height: var(--tabbar-h); }
.tabbar button {
  flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 11px; font-weight: 500; color: var(--ink-3); cursor: pointer;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.on { color: var(--ink); font-weight: 600; }
.tabbar button.on svg { stroke-width: 2.1; }
@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .tabbar { position: sticky; top: 0; bottom: auto; border-top: 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 32px; }
  .tabbar-brand { display: block; font-weight: 700; font-size: 18px; letter-spacing: -.01em; white-space: nowrap; }
  .tabbar-items { flex: 1; justify-content: center; gap: 8px; height: 72px; margin-right: 140px; }
  .tabbar button { flex: none; flex-direction: row; gap: 8px; font-size: 15px; padding: 10px 16px; border-radius: 999px; color: var(--ink-2); }
  .tabbar button svg { width: 18px; height: 18px; }
  .tabbar button:hover { background: var(--surface-2); }
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-flat { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-title { font-size: 20px; font-weight: 600; margin: 32px 0 12px; letter-spacing: -.01em; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.hint { color: var(--ink-3); font-size: 13px; margin: 10px 0 0; }
.chg { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--flag); }

/* ---------- login ---------- */
.login { max-width: 400px; margin: 14vh auto 0; padding: 0 20px; }
.login h1 { font-size: 30px; font-weight: 700; margin: 0 0 8px; letter-spacing: -.02em; }
.login p { margin: 0 0 24px; color: var(--ink-2); }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
input[type=text], input[type=tel], input[type=url], input[type=time], select {
  width: 100%; padding: 13px 14px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--surface); outline: none; font-size: 16px;
}
input:focus, select:focus { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
input.code { letter-spacing: .4em; font-size: 22px; text-align: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
  border: 0; border-radius: 8px; padding: 13px 22px; cursor: pointer; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
}
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--ink); }
.btn.danger { background: none; color: var(--danger); padding: 8px 10px; }
.btn.sm { padding: 9px 14px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--ink); text-decoration: underline; cursor: pointer; padding: 0; font-weight: 600; }
.err { color: var(--danger); font-size: 14px; min-height: 20px; margin: 8px 0; }

/* ---------- Today ---------- */
.welcome { font-size: 15px; color: var(--ink-2); margin: -10px 0 18px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 0 -20px 18px; padding-left: 20px; padding-right: 20px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.pill-chip {
  flex: none; border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px;
  padding: 8px 16px; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.pill-chip.on { border: 2px solid var(--ink); padding: 7px 15px; font-weight: 600; }
.res-list { display: grid; gap: 12px; }
@media (min-width: 760px) { .res-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
.res-card {
  position: relative; text-align: left; border: 1px solid var(--line-2); background: var(--surface);
  border-radius: var(--radius); padding: 18px; cursor: pointer; display: block; width: 100%;
  box-shadow: 0 2px 6px rgba(0,0,0,.04);
}
.res-card:active { transform: scale(.99); }
.res-status { font-size: 13px; font-weight: 600; color: var(--danger); margin-bottom: 8px; }
.res-title { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 2px; padding-right: 20px; }
.res-sub { font-size: 14px; color: var(--ink-2); }
.res-flag { margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--flag); }
.res-dot { position: absolute; top: 20px; right: 18px; width: 10px; height: 10px; border-radius: 50%; }
.res-empty {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 40px 20px; text-align: center; color: var(--ink-2);
}

/* ---------- Calendar header ---------- */
.cal-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 16px; flex-wrap: wrap; }
.listing-pick { position: relative; }
.listing-pick select {
  appearance: none; -webkit-appearance: none; width: auto; max-width: 70vw; padding: 9px 38px 9px 16px; border-radius: 999px;
  border: 1px solid var(--line-2); font-size: 15px; font-weight: 600; cursor: pointer; text-overflow: ellipsis;
}
.listing-pick svg { position: absolute; right: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: currentColor; stroke-width: 2; pointer-events: none; }

/* ---------- Multi-calendar (rows = listings, columns = days) ---------- */
.mc { margin: 0 -20px; }
.mc-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.mc-head, .mc-row { display: flex; width: max-content; }
.mc-corner, .mc-label {
  position: sticky; left: 0; z-index: 3; width: 128px; flex: none; background: var(--bg); border-right: 1px solid var(--line);
}
.mc-label { display: flex; align-items: center; gap: 10px; padding: 0 12px 0 20px; border-top: 1px solid var(--line); }
.mc-label i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.mc-label span { font-size: 13px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mc-headdays { position: relative; padding-top: 30px; }
.mc-month { position: absolute; top: 6px; font-size: 14px; font-weight: 600; padding-left: 8px; white-space: nowrap; }
.mc-dayrow { display: flex; }
.mc-day { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0 10px; }
.mc-day .dow { font-size: 11px; color: var(--ink-3); font-weight: 500; }
.mc-day .dn { font-size: 14px; font-weight: 600; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; }
.mc-day.today .dn { background: var(--ink); color: var(--bg); }
.mc-track {
  position: relative; height: 72px; flex: none; border-top: 1px solid var(--line);
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px);
}
.mc-past { position: absolute; top: 0; bottom: 0; left: 0; background: var(--surface-2); opacity: .6; }
.mc-block {
  position: absolute; top: 0; bottom: 0;
  background: repeating-linear-gradient(135deg, var(--block) 0 6px, var(--surface-2) 6px 12px);
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}
.mc-row:last-child .mc-track, .mc-row:last-child .mc-label { border-bottom: 1px solid var(--line); }

/* reservation pill */
.pill {
  position: absolute; top: 50%; transform: translateY(-50%); height: 40px; border: 0; border-radius: 999px;
  background: var(--pill); color: var(--pill-ink); padding: 0 14px; text-align: left; cursor: pointer;
  font-size: 13px; font-weight: 600; overflow: hidden; z-index: 1; box-shadow: 0 1px 2px rgba(0,0,0,.12);
}
.pill span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill.past { background: var(--pill-past); }
.pill:active { filter: brightness(1.15); }

/* ---------- Single-listing month view ---------- */
.mv-dows {
  position: sticky; top: 0; z-index: 5; background: var(--bg); display: grid; grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--line); padding: 10px 20px; margin: 0 -20px;
}
@media (min-width: 760px) { .mv-dows { top: 72px; } }
.mv-dows span { text-align: center; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.mv-month h2 { font-size: 22px; font-weight: 600; letter-spacing: -.01em; margin: 28px 0 12px; }
.mv-week { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); }
.mv-cell {
  aspect-ratio: 1 / 1.05; min-height: 52px; border-top: 1px solid var(--line); border-left: 1px solid var(--line);
  padding: 8px; position: relative;
}
.mv-cell:nth-child(7) { border-right: 1px solid var(--line); }
.mv-week:last-child .mv-cell { border-bottom: 1px solid var(--line); }
.mv-cell.other { border-top-color: transparent; border-left-color: transparent; }
.mv-week:last-child .mv-cell.other { border-bottom-color: transparent; }
.mv-cell.other:nth-child(7) { border-right-color: transparent; }
.mv-cell.other + .mv-cell:not(.other) { border-left-color: var(--line); }
.mv-cell .dn { font-size: 14px; font-weight: 600; }
.mv-cell.past .dn { color: var(--ink-3); }
.mv-cell.today .dn { background: var(--ink); color: var(--bg); border-radius: 50%; width: 26px; height: 26px; display: inline-grid; place-items: center; margin: -4px 0 0 -4px; }
.mv-cell.blocked { background: repeating-linear-gradient(135deg, var(--block) 0 6px, var(--surface-2) 6px 12px); }
.mv-cell.blocked .dn { color: var(--ink-3); text-decoration: line-through; }
.pill.mv { top: auto; bottom: 10px; transform: none; height: 28px; border-radius: 0; padding: 0 10px; font-size: 12px; }
.pill.mv.rl { border-top-left-radius: 999px; border-bottom-left-radius: 999px; }
.pill.mv.rr { border-top-right-radius: 999px; border-bottom-right-radius: 999px; }
.mv-cell:not(.other):has(+ .other) { border-right: 1px solid var(--line); }
@media (max-width: 520px) {
  .mv-cell { aspect-ratio: auto; min-height: 70px; padding: 6px; }
  .mv-cell .dn { font-size: 13px; }
  .mv-cell.today .dn { width: 24px; height: 24px; margin: -3px 0 0 -3px; }
  .pill.mv { font-size: 11px; padding: 0 8px; height: 24px; bottom: 7px; }
}

/* ---------- reservation sheet ---------- */
.sheet-bg {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0); display: flex; align-items: flex-end; justify-content: center;
  transition: background .2s;
}
.sheet-bg.open { background: rgba(0,0,0,.45); }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--surface);
  border-radius: 20px 20px 0 0; padding: 14px 24px calc(28px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .22s ease-out;
}
.sheet-bg.open .sheet { transform: none; }
@media (min-width: 760px) {
  .sheet-bg { align-items: center; }
  .sheet { border-radius: 16px; padding-top: 24px; }
  .grab { display: none; }
}
.grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); margin: 0 auto 14px; }
.sheet-x { position: absolute; top: 14px; right: 16px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--surface-2); cursor: pointer; font-size: 14px; }
.sheet-listing { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 6px 40px 10px 0; }
.sheet-listing i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.sheet h2 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 4px; }
.sheet-times { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line-2); border-radius: var(--radius); margin: 20px 0 16px; }
.sheet-times > div { padding: 14px 16px; display: grid; gap: 2px; }
.sheet-times > div + div { border-left: 1px solid var(--line-2); }
.sheet-times .lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.sheet-times b { font-size: 15px; }
.sheet-links { display: flex; gap: 8px; flex-wrap: wrap; }
.sheet-edit { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 18px; }
.sheet-edit-title { font-weight: 600; font-size: 16px; margin-bottom: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- alerts / manage ---------- */
.row { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; }
.switch { position: relative; width: 48px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 999px; transition: .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::after { transform: translateX(18px); }
.copybox { display: flex; gap: 8px; }
.copybox input { font-size: 13px; }
.form { padding: 18px; display: grid; gap: 4px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 8px; font-size: 14px; cursor: pointer; }
.status { font-size: 12px; }
.status.ok { color: #008a05; }
.status.bad { color: var(--danger); }
.swatch { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.sms-item { padding: 14px 18px; border-top: 1px solid var(--line); font-size: 14px; }
.sms-item:first-child { border-top: 0; }
.sms-when { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-bottom: 2px; }
.banner { padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); font-size: 14px; margin: 0 0 16px; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 10px; font-size: 14px; z-index: 60; white-space: nowrap;
}
details.edit > summary { list-style: none; cursor: pointer; }
details.edit > summary::-webkit-details-marker { display: none; }

@media (max-width: 520px) {
  .form .two, .two { grid-template-columns: 1fr; }
  .mc-corner, .mc-label { width: 104px; }
  .mc-label { padding-left: 16px; }
  .page-title { font-size: 28px; }
}
.mc-corner { display: flex; align-items: flex-end; padding: 0 12px 14px 20px; }
.mc-corner span { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
@media (max-width: 520px) { .mc-corner { padding-left: 16px; } .mc-corner span { font-size: 14px; } }
