:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede7;
  --text: #1c1b18;
  --muted: #6a675f;
  --line: #e1ded4;
  --accent: #1f5f4a;
  --accent-text: #ffffff;
  --danger: #a3261f;
  --warn-bg: #fdf0d2;
  --warn-text: #6b4a00;
  --ok-bg: #dcefe5;
  --ok-text: #1b4d39;
  --bad-bg: #f6dcd9;
  --bad-text: #7d1f19;
  --gyg: #c2410c;
  --guru: #15803d;
  --abnb: #be185d;
  --free: #1d4ed8;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14130f;
    --surface: #1d1c17;
    --surface-2: #27251f;
    --text: #efede6;
    --muted: #a19e93;
    --line: #35332b;
    --accent: #5fbf9a;
    --accent-text: #0f1f18;
    --danger: #f08a82;
    --warn-bg: #3a2f10;
    --warn-text: #f2d48a;
    --ok-bg: #1b3328;
    --ok-text: #9fdcbf;
    --bad-bg: #3b1e1b;
    --bad-text: #f0aaa4;
    --gyg: #fb923c;
    --guru: #4ade80;
    --abnb: #f472b6;
    --free: #7ca4ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }
h1 { font-size: 1.15rem; margin: 0; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error { color: var(--danger); }

button, select, input {
  font: inherit;
  color: inherit;
}
button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
}
button:hover { background: var(--surface-2); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.primary:hover { filter: brightness(1.08); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
select, input[type="text"], input[type="search"], input[type="email"], input[type="password"] {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  min-width: 0;
}

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.login-card { width: min(380px, 100%); padding: 24px; display: grid; gap: 8px; }
.login-card h1 { font-size: 1.4rem; }
.login-card label { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
.login-card button { margin-top: 12px; padding: 10px; }

/* layout */
#app { max-width: 1000px; margin: 0 auto; padding: 0 16px 48px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 0 8px; flex-wrap: wrap; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-top: 4px; overflow-x: auto; }
.tabs button { border: none; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 10px 14px; white-space: nowrap; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.count { background: var(--danger); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 0.75rem; margin-left: 4px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 0 6px; align-items: center; }
.filters .grow { flex: 1 1 180px; }
.chip-clear { background: var(--surface-2); border-radius: 999px; padding: 4px 12px; }
.summary { padding: 4px 0 10px; color: var(--muted); }

/* list */
.day { margin-top: 18px; }
.day > h2 { font-size: 0.95rem; margin: 0 0 8px; position: sticky; top: 0; background: var(--bg); padding: 6px 0; z-index: 1; }
.day > h2 .today { background: var(--accent); color: var(--accent-text); border-radius: 999px; padding: 1px 8px; font-size: 0.75rem; margin-left: 6px; font-weight: 500; }
.slot { margin-bottom: 10px; }
.slot-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; padding: 0 2px 4px; flex-wrap: wrap; }
.slot-head .time { font-weight: 700; font-variant-numeric: tabular-nums; }
.slot-head .total { font-weight: 600; }
.rows { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { border-top: 1px solid var(--line); }
.row:first-child { border-top: none; }
.row-main { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; width: 100%; text-align: left; background: none; border: none; border-radius: 0; padding: 10px 12px; }
.row-main:hover { background: var(--surface-2); }
.row-name { font-weight: 600; }
.row-sub { color: var(--muted); font-size: 0.85rem; }
.row-guests { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.cancelled .row-name, .replaced .row-name { text-decoration: line-through; color: var(--muted); }

.platform { display: inline-block; min-width: 92px; text-align: center; font-size: 0.75rem; font-weight: 700; border: 1.5px solid currentColor; border-radius: 6px; padding: 2px 6px; }
.platform.gyg { color: var(--gyg); } .platform.guru { color: var(--guru); }
.platform.abnb { color: var(--abnb); } .platform.free { color: var(--free); }
.badge { display: inline-block; font-size: 0.72rem; border-radius: 999px; padding: 1px 8px; margin-left: 6px; font-weight: 600; }
.badge.cancelled { background: var(--bad-bg); color: var(--bad-text); }
.badge.replaced { background: var(--surface-2); color: var(--muted); }
.badge.review { background: var(--warn-bg); color: var(--warn-text); }

.detail { padding: 4px 14px 14px 14px; background: var(--surface-2); display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 18px; }
.detail dt { font-size: 0.75rem; color: var(--muted); }
.detail dd { margin: 0; word-break: break-word; }
.detail a { color: var(--accent); }
.detail .wide { grid-column: 1 / -1; }

.empty { text-align: center; padding: 48px 12px; color: var(--muted); }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0 10px; }
.cal-head h2 { margin: 0; font-size: 1.05rem; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .dow { font-size: 0.75rem; color: var(--muted); text-align: center; padding: 2px 0; }
.cell { min-height: 74px; text-align: left; padding: 6px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line); }
.cell.blank { background: none; border: none; cursor: default; }
.cell.blank:hover { background: none; }
.cell .n { font-size: 0.78rem; color: var(--muted); }
.cell .g { font-size: 1.15rem; font-weight: 700; line-height: 1.1; }
.cell .b { font-size: 0.72rem; color: var(--muted); }
.cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cell.has { background: var(--ok-bg); }
.cell.has .n, .cell.has .b { color: var(--ok-text); }

/* review */
.rev { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.rev h3 { margin: 0 0 2px; font-size: 0.95rem; }
.rev a { color: var(--accent); }
.section-title { margin: 20px 0 8px; font-size: 0.95rem; }

@media (max-width: 560px) {
  .row-main { grid-template-columns: 1fr auto; }
  .row-main .platform { grid-column: 1 / -1; justify-self: start; }
  .cell { min-height: 58px; padding: 4px; }
  .cell .g { font-size: 1rem; }
  .cell .b { display: none; }
}
