/* Booker Admin (FR-25): design "B" — the app's Toza tokens (docs/DESIGN.md) with a black admin bar.
   Phone first (rows, one column); from 900 px wide the lists become tables. */
:root {
  --bg: #ffffff;
  --surface: #f6f6f3;
  --surface-2: #ebebe7;
  --text: #0a0a0a;
  --muted: #525252;
  --subtle: #6b6b6b;
  --border: #d4d4d4;
  --divider: #e4e4df;
  --accent: #047857;
  --accent-bright: #34d399;
  --ok-bg: #d1fae5;
  --ok: #065f46;
  --warn-bg: #fef3c7;
  --warn: #92400e;
  --bad-bg: #fee2e2;
  --bad: #b91c1c;
  --bad-border: #fca5a5;
  --neutral-bg: #f0f0f0;
  --neutral: #404040;
  --scrim: rgba(10, 10, 10, 0.45);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
}
body.signed-out { background: var(--surface); }
a { color: var(--accent); }
h1 { margin: 0; font-size: 22px; line-height: 28px; font-weight: 700; overflow-wrap: anywhere; }
h2 { margin: 0; font-size: 13px; line-height: 18px; font-weight: 500; letter-spacing: 0.4px; text-transform: uppercase; color: var(--muted); }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
@media (max-width: 899px) { .only-wide { display: none !important; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- bar ------------------------------------------------------------------------------------- */
.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px;
  padding: 0 12px; background: #0a0a0a; color: #fff;
}
.brand { display: flex; align-items: center; gap: 8px; height: 52px; color: #fff; text-decoration: none; }
.logo {
  color: #fff;
  width: 28px; height: 28px; border-radius: 7px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
}
.brand-name { font-size: 16px; font-weight: 700; }
.tag { padding: 2px 6px; border-radius: 4px; background: var(--warn-bg); color: var(--warn); font-size: 11px; font-weight: 700; letter-spacing: 0.6px; }
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.me { font-size: 13px; color: #b5b5b5; display: none; }
.tabs { order: 3; flex-basis: 100%; display: flex; gap: 2px; overflow-x: auto; margin: 0 -12px; padding: 0 6px; scrollbar-width: none; }
.tab {
  display: flex; align-items: center; height: 44px; padding: 0 8px; white-space: nowrap;
  color: #b5b5b5; text-decoration: none; border-bottom: 3px solid transparent; font-size: 14px;
}
.tab.active { color: #fff; font-weight: 500; border-bottom-color: var(--accent-bright); }
.bar select, .bar .btn-bar {
  height: 36px; border: 1px solid #525252; border-radius: 8px; background: transparent; color: #fff; font: inherit; font-size: 13px;
}
.bar select { padding: 0 6px; width: auto; min-height: 0; }
.btn-bar { white-space: nowrap; }
.bar select option { color: var(--text); }
.btn-bar { padding: 0 12px; cursor: pointer; }

/* --- page --------------------------------------------------------------------------------------- */
main { padding: 16px; max-width: 1440px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.page-head .grow { flex: 1 1 auto; }
.back { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; text-decoration: none; font-weight: 500; }
.sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--muted); font-size: 14px; }
.card { border: 1px solid var(--divider); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.state { padding: 24px 0; color: var(--muted); display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.two-col { display: grid; gap: 16px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* On a phone the side column (a user's business and the actions) comes first */
.col.side { order: -1; }

/* --- controls ------------------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-size: 15px; font-weight: 500; text-decoration: none; cursor: pointer; text-align: center;
}
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--text); color: #fff; }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn.danger { background: #fff; color: var(--bad); border-color: var(--bad-border); }
.btn.ghost { background: transparent; color: var(--accent); padding: 0 4px; }
.btn.icon { width: 44px; padding: 0; font-size: 22px; line-height: 1; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: #fff;
  border: 1px solid var(--border); border-radius: 8px; min-height: 44px; padding: 0 12px; width: 100%;
}
textarea { padding: 10px 12px; min-height: 72px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible, .tab:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span:first-child, .label { font-size: 14px; font-weight: 500; }
.hint { font-size: 13px; color: var(--muted); }
.form { display: flex; flex-direction: column; gap: 12px; }
.form-grid { display: grid; gap: 12px; }
.phone { display: flex; }
.phone .prefix {
  display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--border); border-right: 0;
  border-radius: 8px 0 0 8px; background: var(--surface); font-size: 16px;
}
.phone input { border-radius: 0 8px 8px 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
.check input { width: 20px; height: 20px; min-height: 0; margin: 0; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch {
  appearance: none; -webkit-appearance: none; flex: 0 0 auto;
  width: 44px; min-height: 0; height: 26px; padding: 0; border: 0; border-radius: 13px; background: #6b6b6b;
  position: relative; cursor: pointer;
}
.switch::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  transition: transform 0.15s;
}
.switch:checked { background: var(--accent); }
.switch:checked::before { transform: translateX(18px); }
.msg { font-size: 14px; }
.msg:empty { display: none; }
.msg.error { color: var(--bad); }
.msg.ok { color: var(--ok); }
.msg.warn { color: var(--warn); }
.search { display: flex; gap: 8px; flex-wrap: wrap; }
.search:has(.field) { align-items: flex-end; }
.search > .hint, .search > .msg { flex-basis: 100%; }
.search .grow { flex: 1 1 200px; }
.seg { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button {
  border: 0; border-right: 1px solid var(--border); background: #fff; color: var(--text);
  font: inherit; font-size: 13px; padding: 0 12px; min-height: 40px; cursor: pointer; white-space: nowrap;
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--text); color: #fff; }

/* --- badges, setup bar ---------------------------------------------------------------------------- */
.badge { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 12px; line-height: 16px; font-weight: 500; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.neutral { background: var(--neutral-bg); color: var(--neutral); }
.segs { display: inline-flex; gap: 2px; flex: 0 0 auto; }
.segs i { width: 12px; height: 4px; border-radius: 2px; background: var(--border); }
.segs i.on { background: var(--text); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.steps li { display: flex; align-items: center; gap: 10px; min-height: 40px; border-top: 1px solid var(--divider); }
.steps li:first-child { border-top: 0; }
.tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); flex: 0 0 auto; position: relative; }
.tick.on { background: var(--accent); border-color: var(--accent); }
.tick.on::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.steps .next { font-weight: 500; }

/* --- lists: rows on a phone, tables on a computer ---------------------------------------------------- */
.rows { list-style: none; margin: 0 -16px; padding: 0; border-top: 1px solid var(--divider); }
.row { display: flex; flex-direction: column; gap: 4px; padding: 10px 16px; border-bottom: 1px solid var(--divider); color: inherit; text-decoration: none; }
a.row:active { background: var(--surface); }
.row-1 { display: flex; align-items: center; gap: 8px; }
.row-title { flex: 1 1 auto; min-width: 0; font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.row-2 { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 13px; color: var(--muted); }
.card .rows { margin: 0 -16px -16px; }
.card .rows li:last-child .row { border-bottom: 0; }
.table-wrap { border: 1px solid var(--divider); border-radius: 8px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.4px; padding: 10px 12px; white-space: nowrap;
}
td { padding: 10px 12px; border-top: 1px solid var(--divider); vertical-align: middle; }
td.right, th.right { text-align: right; }
tr[data-href] { cursor: pointer; }
tr[data-href]:hover { background: #fafaf8; }
td a { color: var(--text); font-weight: 500; text-decoration: none; }
td a:hover { text-decoration: underline; }
.more { align-self: center; }

/* --- overview ------------------------------------------------------------------------------------- */
.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stat { border: 1px solid var(--divider); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; color: inherit; text-decoration: none; }
a.stat:hover { border-color: var(--border); }
.stat b { font-size: 26px; line-height: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.bars { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; height: 170px; }
.bars li { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.bar-n { font-size: 12px; line-height: 16px; height: 16px; font-variant-numeric: tabular-nums; }
.bar-area { flex: 1 1 auto; width: 100%; display: flex; align-items: flex-end; border-bottom: 1px solid var(--border); }
.bar-fill { width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; }
.bar-d { font-size: 11px; line-height: 14px; color: var(--muted); white-space: nowrap; }
.bar-d.today { color: var(--text); font-weight: 500; }

/* --- business page ----------------------------------------------------------------------------------- */
.svc { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--divider); }
.svc:first-child { border-top: 0; }
.svc .grow { flex: 1 1 160px; min-width: 0; }
.svc-form { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 8px 0; border-top: 1px solid var(--divider); }
.svc-form .wide, .svc-form .svc-name { grid-column: 1 / -1; }
.day { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--divider); }
.day:first-child { border-top: 0; }
.day-name { font-weight: 500; display: flex; align-items: center; min-height: 32px; }
.ranges { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.range { display: flex; align-items: center; gap: 6px; }
input.time { width: 76px; padding: 0 8px; text-align: center; font-variant-numeric: tabular-nums; }
.every { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 8px; background: var(--surface); }
.every-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.note { padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.note.bad { background: var(--bad-bg); color: var(--bad); }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.neutral { background: var(--neutral-bg); color: var(--neutral); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* --- sign-in ----------------------------------------------------------------------------------------- */
#signin:empty { display: none; }
.signin { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.signin.overlay { position: fixed; inset: 0; background: var(--scrim); z-index: 10; min-height: 0; }
.signin-card {
  width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--divider); border-radius: 12px;
  padding: 24px; display: flex; flex-direction: column; gap: 16px;
}
.signin-brand { display: flex; align-items: center; gap: 8px; }
.signin-brand .brand-name { color: var(--text); }
.signin-langs { display: flex; gap: 4px; }
.signin-langs button { border: 0; background: none; font: inherit; font-size: 14px; color: var(--muted); min-height: 44px; padding: 0 8px; cursor: pointer; }
.signin-langs button[aria-pressed="true"] { color: var(--text); font-weight: 500; text-decoration: underline; }
.code-input { letter-spacing: 6px; font-size: 22px; text-align: center; }

/* --- a computer screen ---------------------------------------------------------------------------- */
@media (min-width: 900px) {
  .only-narrow { display: none !important; }
  .bar { padding: 0 24px; gap: 0 24px; flex-wrap: nowrap; }
  .brand { height: 56px; }
  .tabs { order: 0; flex-basis: auto; margin: 0; padding: 0; align-self: stretch; }
  .tab { height: 56px; font-size: 15px; }
  .me { display: inline; }
  main { padding: 20px 24px 32px; }
  .btn { min-height: 40px; }
  input, select, textarea { min-height: 40px; font-size: 15px; }
  .stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .stat-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .two-col { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
  .col.side { order: 0; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .wide { grid-column: 1 / -1; }
  .day { grid-template-columns: 130px 1fr; }
  .ranges { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .svc-form { grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); }
  .svc-form .svc-name { grid-column: auto; }
  .segs i { width: 14px; }
}
