:root {
  --bg: #F7F5EF;
  --surface: #FFFFFF;
  --soft: #FBF9F5;
  --ink: #1F1D1A;
  --ink-2: #4A453D;
  --muted: #6B655B;
  --line: #E7E2D8;
  --line-2: #F1ECE4;
  --chip: #EFEBE2;
  --accent: #B4532F;
  --accent-ink: #8E3F22;
  --accent-soft: #FBF3EE;
  --ok: #2F6B4F;
  --ok-soft: #E4EFE8;
  --warn: #7A4E0E;
  --warn-soft: #F6ECD8;
  --bad: #8E3F22;
  --bad-soft: #F6E7DF;
  --info: #2B3F56;
  --info-soft: #E7EDF4;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1A1917; --surface: #23211E; --soft: #282622; --ink: #F3EEE5; --ink-2: #D6CFC3; --muted: #A79F92;
    --line: #36332E; --line-2: #2E2B27; --chip: #312E29; --accent: #D9774F; --accent-ink: #E8A07F; --accent-soft: #3A2A22;
    --ok: #7CC4A0; --ok-soft: #1F3329; --warn: #E2B66B; --warn-soft: #3A2F1C; --bad: #EE9A7C; --bad-soft: #3D261D;
    --info: #A9C2DE; --info-soft: #1F2A36; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
h1, h2, h3 { margin: 0; }
h1 { font-family: var(--serif); font-weight: 500; font-size: 30px; letter-spacing: -0.4px; }
h2 { font-size: 16px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* layout */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 200px; max-width: 230px; min-width: 190px; border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 2px; }
.brand { font-family: var(--serif); font-size: 22px; font-weight: 600; padding: 0 10px 18px; letter-spacing: -0.2px; color: var(--ink); text-decoration: none; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none; min-height: 42px; }
.nav-link:hover { background: var(--chip); color: var(--ink); }
.nav-link.active { background: var(--chip); color: var(--ink); font-weight: 600; }
.nav-link.soon { color: var(--muted); }
.nav-link .tag { margin-left: auto; font-size: 10.5px; font-weight: 600; letter-spacing: .3px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 8px; }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); }
.side-foot .who { font-weight: 600; }
.main { flex: 999 1 560px; min-width: 0; padding: 30px 34px 48px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 4px; }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.card.flush { padding: 0; overflow: hidden; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-family: var(--serif); font-size: 26px; font-weight: 600; margin-top: 4px; }

/* forms */
form { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
.hint { font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=tel], select {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  min-height: 46px; padding: 0 13px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 200px; }

.btn { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; transition: transform .08s, background .15s; }
.btn:hover { background: var(--soft); color: var(--ink); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 600; }
.btn.block { width: 100%; min-height: 52px; font-size: 16px; border-radius: 12px; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--bad); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; padding: 12px 18px; border-bottom: 1px solid var(--line); }
td { padding: 12px 18px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

/* chips & notices */
.chip { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 3px 8px; background: var(--chip); color: var(--ink-2); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.dark { background: var(--ink); color: var(--bg); }
.notice { border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.info { background: var(--info-soft); color: var(--info); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.flash { animation: flash-in .35s ease-out; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* auth pages */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 420px; animation: rise .4s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.auth-brand { font-family: var(--serif); font-size: 28px; font-weight: 600; text-align: center; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: 22px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--chip); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.tab { text-align: center; padding: 10px; border-radius: 9px; text-decoration: none; color: var(--ink-2); font-weight: 500; min-height: 42px; }
.tab.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

/* PIN pad */
.staff-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.staff-pick { display: none; }
.staff-label { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; text-align: center; }
.staff-label .av { width: 44px; height: 44px; border-radius: 50%; background: var(--chip); display: flex; align-items: center; justify-content: center; font-weight: 600; }
.staff-pick:checked + .staff-label { border: 1.5px solid var(--accent); background: var(--accent-soft); }
.pin-input { text-align: center; font-size: 28px !important; letter-spacing: 14px; font-weight: 600; min-height: 60px !important; }

.av-sm { width: 32px; height: 32px; border-radius: 50%; background: var(--chip); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; flex-shrink: 0; }
.person { display: flex; align-items: center; gap: 10px; }

@media (max-width: 760px) {
  .side { max-width: none; flex-basis: 100%; border-right: none; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; }
  .brand { padding: 0 10px; flex-basis: 100%; margin-bottom: 6px; }
  .nav-link { min-height: 40px; padding: 8px 10px; }
  .nav-link .tag, .nav-sep, .nav-link.soon { display: none; }
  .side-foot { margin-top: 0; border-top: none; padding: 0 10px; flex-basis: 100%; display: flex; gap: 10px; align-items: center; }
  .main { padding: 22px 16px 40px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
