:root {
  --bg: #f5f5f7; --card: #fff; --ink: #1d1d1f; --muted: #6e6e73; --line: #e5e5ea;
  --shadow: 0 0 0 .5px rgba(0, 0, 0, .05), 0 1px 2px rgba(0, 0, 0, .04), 0 6px 20px rgba(0, 0, 0, .05);
  --card-line: transparent; --chrome: rgba(255, 255, 255, .72); --fill: rgba(118, 118, 128, .12);
  --ring: color-mix(in srgb, var(--accent) 28%, transparent);
  --accent: #0071e3; --accent-ink: #fff; --ok: #1a7f37; --warn: #9a6700; --bad: #cf222e;
  --soldout: #fde2e1; --low: #fff4d6; --pending: #e7f0ff;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000; --card: #1c1c1e; --ink: #f5f5f7; --muted: #98989d; --line: #38383a;
    --shadow: none; --card-line: var(--line); --chrome: rgba(28, 28, 30, .72); --fill: rgba(118, 118, 128, .24);
    --accent: #0a84ff; --soldout: #4a1f22; --low: #3d3215; --pending: #1b2a45;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--bad); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 0 0 16px; }
button { font: inherit; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 6px; padding: 7px 14px; cursor: pointer; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button:disabled { opacity: .5; cursor: default; }
button { transition: transform 160ms var(--ease-out); }
button:active:not(:disabled) { transform: scale(.97); }
.tabs button:active { transform: none; }
input, select { font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-width: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 6px; align-self: end; padding-bottom: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.spacer { flex: 1; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 10px; }

.top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); text-transform: uppercase; letter-spacing: .04em; }
.pill.staging { color: var(--warn); border-color: var(--warn); }
.pill.production { color: var(--ok); border-color: var(--ok); }
#logout { margin-left: auto; }
.tabs { display: flex; gap: 4px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { background: none; color: var(--muted); border-radius: 0; border-bottom: 2px solid transparent; padding: 10px 12px; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
.banner { margin: 12px 16px 0; padding: 10px 14px; border-radius: 8px; background: var(--low); }
main { padding: 16px; max-width: 1400px; margin: 0 auto; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar label { flex-direction: row; align-items: center; }

.cal-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 16px; }
.cal { border-collapse: collapse; font-size: 12px; min-width: 100%; }
.cal th, .cal td { border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); padding: 4px 6px; text-align: center; white-space: nowrap; }
.cal th:first-child, .cal td:first-child { position: sticky; left: 0; background: var(--card); text-align: left; border-left: 0; min-width: 190px; z-index: 1; }
.cal thead th { font-weight: 600; }
.cal thead .wd { color: var(--muted); font-weight: 400; display: block; }
.cal .weekend { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.cal tr.room td:first-child { font-weight: 600; }
.cal tr.plan td:first-child { padding-left: 18px; color: var(--muted); }
.cal td.cell { cursor: pointer; min-width: 58px; }
.cal td.cell:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal td.soldout { background: var(--soldout); }
.cal td.low { background: var(--low); }
.cal td.closed { background: var(--soldout); text-decoration: line-through; }
.cal td.pending { box-shadow: inset 0 -3px 0 var(--accent); }
.cal .sub { display: block; color: var(--muted); font-size: 10px; }
.cal .tag { font-size: 9px; color: var(--warn); display: block; }

.days { border: 0; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 10px; }
.days legend { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.days label { flex-direction: row; align-items: center; gap: 4px; color: var(--ink); font-size: 13px; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; }
.status { font-size: 11px; padding: 2px 8px; border-radius: 99px; text-transform: capitalize; }
.status.new { background: #dafbe1; color: #1a7f37; }
.status.modified { background: #fff4d6; color: #9a6700; }
.status.cancelled { background: #ffe1e0; color: #cf222e; }
.warn { color: var(--warn); font-size: 11px; }

.steps { padding-left: 20px; }
#channels-frame { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.tree { list-style: none; padding: 0; margin: 0; }
.tree li { padding: 4px 0; }
.tree ul { list-style: none; padding-left: 18px; margin: 4px 0; }
.tree code { font-size: 11px; color: var(--muted); }

dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / .35); }
/* enter/exit; older browsers just snap, as before */
dialog { opacity: 0; transform: scale(.96); transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out), overlay 150ms allow-discrete, display 150ms allow-discrete; }
dialog[open] { opacity: 1; transform: none; transition-duration: 200ms; }
dialog::backdrop { opacity: 0; transition: opacity 150ms var(--ease-out), overlay 150ms allow-discrete, display 150ms allow-discrete; }
dialog[open]::backdrop { opacity: 1; transition-duration: 200ms; }
@starting-style {
  dialog[open] { opacity: 0; transform: scale(.96); }
  dialog[open]::backdrop { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  dialog { transform: none; }
  @starting-style { dialog[open] { transform: none; } }
}

@media (max-width: 600px) {
  .top { gap: 8px; }
  #sync { display: none; }
  main { padding: 12px; }
}

/* Info tab */
.info { max-width: 900px; }
.info p, .info li { line-height: 1.55; }
.info ol, .info ul { margin: 0; padding-left: 20px; }
.info li + li { margin-top: 6px; }
.info code { font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.flow { display: flex; flex-direction: column; align-items: center; gap: 22px; margin-top: 16px; }
.flow .pair { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.flow .node { position: relative; text-align: center; font-weight: 600; padding: 10px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); min-width: 200px; }
.flow .node span { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.flow .node.main { border-color: var(--ok); }
.flow .node.hub { border-color: var(--accent); background: var(--pending); }
.flow > *:not(:last-child)::after { content: ""; position: absolute; left: 50%; bottom: -19px; height: 16px; border-left: 2px solid var(--line); }
.flow > .pair { position: relative; }
.flow > .pair > .node::after { content: none; }

/* -- Apple-style layer: system type, neutral surfaces, soft depth, translucent chrome -- */
body { font: 14px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif; letter-spacing: -.006em; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.022em; line-height: 1.15; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -.012em; }
h3 { font-weight: 600; letter-spacing: -.01em; }
.top { position: sticky; top: 0; z-index: 5; background: var(--chrome); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.brand { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
button { border-radius: 980px; padding: 7px 15px; font-weight: 500; }
button.ghost { border: 0; background: var(--fill); }
.tabs button { padding: 11px 12px; border-radius: 0; transition: color .15s ease; }
.tabs button.active { font-weight: 600; }
input, select { border-radius: 10px; padding: 7px 10px; transition: border-color .15s ease, box-shadow .15s ease; }
input:focus, select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
input[type=checkbox]:focus, input[type=radio]:focus { box-shadow: none; outline: 2px solid var(--accent); outline-offset: 2px; }
.card, .cal-wrap, .table-wrap { border-radius: 16px; border-color: var(--card-line); box-shadow: var(--shadow); }
.card { padding: 18px 20px; }
.banner { border-radius: 12px; }
th { font-weight: 500; }
.cal thead th { font-weight: 600; }
.cal td.cell { transition: background-color .15s ease; }
.flow .node { border-radius: 12px; }
#channels-frame { border-radius: 16px; }
dialog { border: 0; border-radius: 18px; padding: 24px; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .1), 0 24px 60px rgba(0, 0, 0, .25); }
dialog::backdrop { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.login-card { max-width: 340px; padding: 32px; border-radius: 20px; gap: 12px; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .06), 0 20px 50px rgba(0, 0, 0, .1); }
@media (prefers-reduced-transparency: reduce) {
  .top { background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none; }
  dialog::backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) { .card, .cal-wrap, .table-wrap { border-color: var(--muted); } button.ghost { border: 1px solid var(--muted); } }

/* -- Vibrant colour layer: blue-to-indigo accent, tinted page -- */
:root { --accent: #0066f5; --pending: #e6efff; --grad: linear-gradient(135deg, #0066f5, #5e5ce6);
  --page: radial-gradient(1100px 560px at 8% -8%, rgba(10, 132, 255, .13), transparent 60%), radial-gradient(900px 520px at 100% 0%, rgba(191, 90, 242, .11), transparent 60%), radial-gradient(900px 600px at 60% 110%, rgba(48, 209, 88, .07), transparent 60%), #f4f6fc; }
@media (prefers-color-scheme: dark) { :root { --accent: #4c9bff; --pending: #14264a;
  --page: radial-gradient(1100px 560px at 8% -8%, rgba(10, 132, 255, .22), transparent 60%), radial-gradient(900px 520px at 100% 0%, rgba(191, 90, 242, .16), transparent 60%), #000; } }
body { background: var(--page); background-attachment: fixed; }
button { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(0, 102, 245, .28); }
button.ghost, .tabs button { box-shadow: none; }
button.ghost { background: var(--fill); color: var(--ink); }
.tabs button { background: none; color: var(--muted); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.brand { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; font-weight: 700; }
.cal .weekend { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.cal tr.room td:first-child { color: var(--accent); }
.flow .node.hub { border-color: var(--accent); }
@media (prefers-color-scheme: dark) { .brand { filter: brightness(1.5); } }
@media (prefers-contrast: more) { body { background: var(--bg); } .brand { background: none; color: var(--ink); -webkit-text-fill-color: currentColor; } }
