/* GameGrid design system. One file, no build step. */
:root {
    --ink: #14172e;
    --ink-2: #232850;
    --paper: #f4f5fa;
    --surface: #ffffff;
    --line: #e1e4f0;
    --text: #1a1d33;
    --muted: #5e6384;
    --brand: #5b3df5;
    --brand-dark: #4326d6;
    --ok: #0e7a4a;
    --ok-bg: #e4f6ec;
    --warn: #8a5a00;
    --warn-bg: #fff2d6;
    --danger: #c4243f;
    --danger-bg: #fde8ec;
    --radius: 10px;
    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--text); background: var(--paper); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 .5rem; }
a { color: var(--brand-dark); }
p { margin: 0 0 1rem; max-width: 70ch; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.muted { color: var(--muted); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; padding: .65rem 1.1rem; min-height: 44px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; text-decoration: none; background: var(--surface); color: var(--text); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn--ghost:hover { border-color: var(--brand); }
.btn--warn { background: var(--warn-bg); color: var(--warn); border-color: #f0d9a0; }
.btn--danger { background: var(--danger-bg); color: var(--danger); border-color: #f3c0ca; }
.btn--sm { min-height: 36px; padding: .35rem .8rem; font-size: .9rem; }
.btn--block { width: 100%; }
.btn:disabled, .btn.is-disabled { opacity: .55; cursor: not-allowed; }

/* ---------- forms ---------- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .95rem; }
.field input, .field select, .field textarea { width: 100%; font: inherit; padding: .65rem .75rem; min-height: 44px; border: 1px solid #c9cde3; border-radius: 8px; background: #fff; color: var(--text); }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--danger); }
.field__hint { display: block; color: var(--muted); margin-top: .25rem; font-size: .85rem; }
.field__error { color: var(--danger); margin: .3rem 0 0; font-size: .9rem; font-weight: 600; }
.check { display: flex; gap: .6rem; align-items: flex-start; margin: .25rem 0 1rem; font-size: .95rem; }
.check input { margin-top: .25rem; width: 18px; height: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }

/* ---------- alerts + badges ---------- */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 600; }
.alert--ok { background: var(--ok-bg); color: var(--ok); }
.alert--error { background: var(--danger-bg); color: var(--danger); }
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.badge--active { background: var(--ok-bg); color: var(--ok); }
.badge--suspended { background: var(--warn-bg); color: var(--warn); }
.badge--archived { background: #e9eaf2; color: var(--muted); }

/* ---------- sign-in / register screens ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(300px, 5fr) minmax(320px, 6fr); }
.auth__brand { background: var(--ink); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: center; gap: 1rem; }
.auth__brand h1 { font-size: 2.2rem; max-width: 18ch; }
.auth__brand p { color: #c3c7e6; }
.brand { color: #fff; font-weight: 800; font-size: 1.3rem; text-decoration: none; letter-spacing: -0.02em; }
.auth__panel { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth__card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 2rem; }
.auth__links { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 1.25rem 0 0; font-size: .95rem; max-width: none; }

/* the station grid: tiles show the four states a station can be in */
.grid-art { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; max-width: 320px; margin-top: 1rem; }
.tile { aspect-ratio: 1 / 1; border-radius: 10px; display: block; }
.tile--free { background: #22c58b; }
.tile--live { background: #7c5cff; }
.tile--booked { background: #ffb020; }
.tile--off { background: #3a3f66; }
.legend { list-style: none; display: flex; gap: 1rem; padding: 0; margin: .5rem 0 0; color: #c3c7e6; font-size: .85rem; flex-wrap: wrap; }
.legend li { display: flex; align-items: center; gap: .4rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- application shell ---------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.side { background: var(--ink); color: #fff; padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: 1.25rem; }
.side__brand { font-weight: 800; font-size: 1.2rem; padding: 0 .5rem; letter-spacing: -0.02em; }
.side__nav { display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.side__link { color: #c3c7e6; text-decoration: none; padding: .6rem .75rem; border-radius: 8px; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.side__link:hover { background: var(--ink-2); color: #fff; }
.side__link.is-active { background: var(--brand); color: #fff; }
.side__foot { border-top: 1px solid var(--ink-2); padding-top: 1rem; display: flex; flex-direction: column; gap: .75rem; }
.side__user { display: flex; flex-direction: column; font-size: .9rem; }
.side__user span { color: #aab0d6; }
.main { min-width: 0; }
.topbar { padding: 1.5rem 2rem 0; }
.topbar h1 { font-size: 1.6rem; margin: 0; }
.content { padding: 1.25rem 2rem 3rem; }

/* ---------- cards, stats, tables ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.card__title { font-size: 1.1rem; margin-bottom: .75rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: .25rem; }
.stat__label { color: var(--muted); font-size: .9rem; }
.stat__value { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: .6rem .75rem; border-bottom: 2px solid var(--line); white-space: nowrap; }
.table td { padding: .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
td.actions { align-items: flex-start; }
.toolbar { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar .field { margin-bottom: 0; min-width: 200px; }
.empty { color: var(--muted); padding: 1rem 0; }
.pager { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 0 0 1rem; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
    .auth { grid-template-columns: 1fr; }
    .auth__brand { padding: 1.75rem 1.5rem; }
    .auth__brand h1 { font-size: 1.6rem; }
    .grid-art, .legend { display: none; }
    .shell { grid-template-columns: 1fr; }
    .side { flex-direction: row; flex-wrap: wrap; align-items: center; padding: .75rem 1rem; gap: .5rem 1rem; }
    .side__nav { flex-direction: row; flex: 1 1 100%; order: 3; overflow-x: auto; }
    .side__foot { border: 0; padding: 0; flex-direction: row; align-items: center; margin-left: auto; }
    .side__user { display: none; }
    .topbar { padding: 1.25rem 1rem 0; }
    .content { padding: 1rem 1rem 2.5rem; }
    .grid-2 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Phase 3 additions ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.badge--available { background: var(--ok-bg); color: var(--ok); }
.badge--maintenance { background: var(--warn-bg); color: var(--warn); }
.badge--disabled { background: #e9eaf2; color: var(--muted); }
.spaced { margin-top: 1.25rem; }
.card--narrow { max-width: 520px; }
.inline-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.inline-form input[type="text"], .inline-form select { font: inherit; padding: .35rem .5rem; min-height: 36px; border: 1px solid #c9cde3; border-radius: 8px; max-width: 170px; }
fieldset.field { border: 0; padding: 0; margin: 0 0 1rem; }
fieldset.field legend { font-weight: 600; margin-bottom: .3rem; padding: 0; }

.progress { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: .5rem; }
.progress span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.checklist__mark { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #c9cde3; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 800; flex: none; }
.checklist .is-done .checklist__mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.checklist .is-done .checklist__label { color: var(--muted); }
.checklist__label { flex: 1; }

.cafe-head { display: flex; gap: 1.25rem; align-items: flex-start; flex-wrap: wrap; }
.cafe-logo { width: 72px; height: 72px; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: #fff; }

.hours-row { display: grid; grid-template-columns: 110px auto 130px 130px auto; gap: .25rem 1rem; align-items: end; padding: .6rem 0; border-top: 1px solid var(--line); }
.hours-row .field, .hours-row .check { margin-bottom: 0; }
.hours-row__day { align-self: center; }
.hours-row__error { grid-column: 1 / -1; margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .8rem; border: 1px solid #c9cde3; border-radius: 999px; background: #fff; font-weight: 600; min-height: 40px; }

.card--secret { border: 2px solid var(--warn); background: var(--warn-bg); }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.3rem; letter-spacing: .08em; user-select: all; }

@media (max-width: 860px) {
    .hours-row { grid-template-columns: 1fr 1fr; }
    .hours-row__day { grid-column: 1 / -1; }
}

/* ---------- Phase 4A additions ---------- */
.badge--confirmed { background: #e3ecff; color: #2a3fb8; }
.badge--checked_in { background: var(--ok-bg); color: var(--ok); }
.badge--completed { background: var(--ok-bg); color: var(--ok); }
.badge--cancelled { background: #e9eaf2; color: var(--muted); }
.badge--no_show { background: var(--warn-bg); color: var(--warn); }
.rule { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.notice { background: #eef1ff; border-left: 4px solid var(--brand); padding: .75rem 1rem; border-radius: 6px; max-width: 70ch; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .4rem 0; border-top: 1px solid var(--line); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.reference { font-size: 2.2rem; font-weight: 800; letter-spacing: .12em; margin: 0 0 .5rem; }

/* public booking pages */
body.pub { background: var(--paper); }
.pub__head { background: var(--ink); padding: .9rem 1.25rem; }
.pub__brand { display: inline-flex; align-items: center; gap: .75rem; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.2rem; letter-spacing: -0.01em; }
.pub__brand .cafe-logo { width: 48px; height: 48px; }
.pub__main { max-width: 860px; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
.pub__foot { max-width: 860px; margin: 0 auto; padding: 0 1rem 2.5rem; text-align: center; color: var(--muted); }
.pub__foot p { margin: 0 auto .25rem; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.type-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; background: #fff; }
.type-card h3 { margin-bottom: .25rem; }
.chips-links { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.chips-links .chip { text-decoration: none; color: var(--text); }
.chip--on { background: var(--brand); border-color: var(--brand); color: #fff !important; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .6rem; }
.slot-grid form { margin: 0; }
.slot { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; padding: .5rem; font: inherit; font-weight: 700; color: var(--brand-dark); background: #fff; border: 2px solid var(--brand); border-radius: 10px; cursor: pointer; text-decoration: none; }
.slot:hover { background: var(--brand); color: #fff; }

/* staff calendar */
.timeline { overflow-x: auto; }
.timeline__row { display: grid; grid-template-columns: 170px minmax(520px, 1fr); gap: .75rem; align-items: center; margin-bottom: .5rem; }
.timeline__label { display: flex; flex-direction: column; gap: .15rem; font-size: .9rem; }
.timeline__scale { position: relative; height: 22px; font-size: .78rem; color: var(--muted); }
.timeline__scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.timeline__track { position: relative; height: 44px; background: repeating-linear-gradient(90deg, #f0f2fa 0, #f0f2fa 1px, transparent 1px, transparent 8.333%), #f7f8fd; border: 1px solid var(--line); border-radius: 8px; }
.bar { position: absolute; top: 4px; bottom: 4px; padding: 0 .4rem; border-radius: 6px; font-size: .78rem; font-weight: 700; line-height: 34px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-decoration: none; color: #fff; background: var(--brand); min-width: 8px; }
.bar--checked_in, .bar--completed { background: var(--ok); }
.bar--cancelled { background: #a9aec9; text-decoration: line-through; }
.bar--no_show { background: #b88a2a; }
.bar--overlap { outline: 3px solid var(--danger); z-index: 2; }
.bar--unavailable { background: repeating-linear-gradient(45deg, var(--danger), var(--danger) 6px, #e2536b 6px, #e2536b 12px); }
.week th, .week td { vertical-align: top; min-width: 110px; }
.week__item { display: block; font-size: .8rem; padding: .2rem .4rem; margin-bottom: .25rem; border-radius: 6px; background: #e3ecff; color: #2a3fb8; text-decoration: none; }
.week__item--cancelled { background: #e9eaf2; color: var(--muted); text-decoration: line-through; }
.week__item--no_show { background: var(--warn-bg); color: var(--warn); }
.week__item--completed, .week__item--checked_in { background: var(--ok-bg); color: var(--ok); }

@media (max-width: 860px) {
    .timeline__row { grid-template-columns: 120px minmax(520px, 1fr); }
}
