/* Layout: one working page with three views. Customer booking runs top to bottom in steps,
   the staff calendar is a docks-by-hours grid, and settings shows the rules as data. */
:root {
  --bg: #EEF3F6; --panel: #FFFFFF; --ink: #10222E; --muted: #5A6E7C; --line: #D3DEE5;
  --accent: #0B6E99; --accent-ink: #FFFFFF; --soft: #DDEEF5;
  --ok: #16794C; --warn: #A65F00; --bad: #B3362B; --closed: #E3E9ED;
  --side: 16px; --cell: 38px; --cellf: 13px; --panel-w: clamp(340px, 28vw, 420px);
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Barlow', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0D1820; --panel: #15242F; --ink: #E7EFF4; --muted: #94A9B8; --line: #2A3F4E;
  --accent: #58BEE6; --accent-ink: #06202C; --soft: #17394A;
  --ok: #62CF9B; --warn: #EDB463; --bad: #F58A7F; --closed: #1C2C37; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0D1820; --panel: #15242F; --ink: #E7EFF4; --muted: #94A9B8; --line: #2A3F4E;
  --accent: #58BEE6; --accent-ink: #06202C; --soft: #17394A;
  --ok: #62CF9B; --warn: #EDB463; --bad: #F58A7F; --closed: #1C2C37; color-scheme: dark; }
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.45; overflow-x: hidden; }
.wrap { margin: 0 auto; padding-block: 18px 32px; padding-left: max(var(--side), env(safe-area-inset-left, 0px)); padding-right: max(var(--side), env(safe-area-inset-right, 0px)); display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.wrap > * { min-width: 0; }
.sample { padding: 8px 12px; border: 1px dashed var(--warn); color: var(--warn); font-size: 14px; }
header { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: end; justify-content: space-between; }
h1 { margin: 0; font: 700 32px/1 var(--display); letter-spacing: 1px; }
.sub { color: var(--muted); font-size: 14px; }
nav { display: flex; border: 1px solid var(--line); background: var(--panel); max-width: 100%; overflow-x: auto; }
nav button { flex: none; white-space: nowrap; }
nav button { font: 600 15px var(--body); color: var(--muted); background: none; border: 0; padding: 0 16px; min-height: 44px; cursor: pointer; }
nav button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.card { background: var(--panel); border: 1px solid var(--line); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.card h2 { margin: 0; font: 700 22px var(--display); letter-spacing: .5px; }
.step { color: var(--muted); font: 500 12px var(--mono); }
.two { display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-w); gap: 14px; align-items: start; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field label, .lab { font-size: 13px; color: var(--muted); font-weight: 500; }
select, input { font: 400 15px var(--body); color: var(--ink); background: var(--panel); border: 1px solid var(--line); min-height: 44px; padding: 0 10px; width: 100%; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.chip { font: 500 15px var(--body); min-height: 44px; padding: 0 14px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip:disabled { color: var(--muted); background: var(--closed); cursor: not-allowed; text-decoration: line-through; }
.chip small { display: block; font-size: 11px; line-height: 1; opacity: .8; }
/* A day picker is one row that scrolls sideways, on every screen size. */
.row.days { position: relative; flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 4px; }
.days .chip { flex: none; min-width: 74px; padding-block: 5px; scroll-snap-align: center; }
.times { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.times .chip { padding: 0; font-family: var(--mono); }
.primary { font: 600 16px var(--body); min-height: 48px; padding: 0 22px; background: var(--accent); color: var(--accent-ink); border: 0; cursor: pointer; }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.ghost { font: 500 14px var(--body); min-height: 44px; padding: 0 14px; background: none; border: 1px solid var(--line); color: var(--ink); cursor: pointer; }
.err { color: var(--bad); font-size: 14px; margin: 0; }
.note { color: var(--muted); font-size: 14px; margin: 0; }
dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 14px; }
dt { color: var(--muted); font-size: 13px; } dd { margin: 0; overflow-wrap: anywhere; }
.pin { font: 500 40px var(--mono); letter-spacing: 8px; color: var(--accent); }
.mail { border: 1px solid var(--line); padding: 12px; font-size: 14px; display: grid; gap: 6px; }
.scroll { overflow-x: auto; }
table.cal { border-collapse: collapse; width: 100%; min-width: 620px; font-variant-numeric: tabular-nums; }
.cal th, .cal td { border: 1px solid var(--line); padding: 0; height: var(--cell); font-size: var(--cellf); text-align: center; }
.cal th { background: var(--soft); font: 600 15px var(--display); letter-spacing: .5px; padding: 0 8px; }
.cal th.h { font: 500 12px var(--mono); width: 62px; }
.cal td.closed { background: repeating-linear-gradient(135deg, var(--closed), var(--closed) 5px, transparent 5px, transparent 10px); }
.cal td.open { color: var(--muted); }
.slotb { width: 100%; height: 100%; min-height: var(--cell); border: 0; cursor: pointer; font: 500 var(--cellf) var(--body); background: var(--soft); color: var(--ink); padding: 2px 4px; }
.slotb.Arrived { box-shadow: inset 4px 0 0 var(--warn); } .slotb.Completed { box-shadow: inset 4px 0 0 var(--ok); opacity: .75; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 12px; vertical-align: -1px; margin-right: 5px; border: 1px solid var(--line); }
table.rules { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
.rules th, .rules td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: top; }
.rules th { color: var(--muted); font-weight: 500; font-size: 13px; }
@media (max-width: 900px) { .two { grid-template-columns: minmax(0, 1fr); } }

/* The real app: sign-in, role-based tabs and the views the prototype didn't have. */
/* No auto side margins here: on a grid item they stop it stretching, so the app shrank to its content on very wide screens. */
.inner { padding: 0; max-width: none; margin: 0; width: 100%; }
.narrow { max-width: 460px; }
.stack { display: grid; gap: 12px; align-content: start; }
.between { justify-content: space-between; align-items: center; }
.two.wide { grid-template-columns: minmax(0, 1fr) var(--panel-w); }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mono { font-family: var(--mono); }
.danger { color: var(--bad); }
nav { justify-self: start; }
@media (max-width: 900px) { .two.wide { grid-template-columns: minmax(0, 1fr); } }
[hidden] { display: none !important; }

.cal td.open .ghost.chosen { background: var(--ink); color: #fff; font-weight: 600; }
.cal td.open .ghost.cantuse { opacity: .35; text-decoration: line-through; }

/* Whole-screen layout: the grid fills the window and the booking panel keeps a steady width on the right. */
#login.narrow { width: 100%; margin-inline: auto; }
.card, .scroll { min-width: 0; }
/* Grids scroll inside their own box; the hour column and the header row stay put. */
.gridscroll { overflow: auto; max-height: calc(100vh - 230px); min-height: 320px; overscroll-behavior: contain; }
.cal thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 var(--line); }
.cal th.h { position: sticky; left: 0; z-index: 1; box-shadow: inset -1px 0 0 var(--line); }
.cal thead th.h { z-index: 3; }
.cal td.open .ghost { width: 100%; height: 100%; min-height: var(--cell); font-size: var(--cellf); }

/* Week view: days side by side, one shared hour column. */
.row.wkonly { display: none; }
table.cal.week { min-width: calc(64px + var(--n, 5) * 140px); table-layout: fixed; }
.cal.week th.h { width: 64px; }
.cal.week td { height: auto; min-height: var(--cell); vertical-align: top; text-align: left; }
.cal.week td.closed { height: var(--cell); }
.dayhead { display: block; width: 100%; min-height: 44px; font: inherit; letter-spacing: inherit; color: var(--ink); background: none; border: 0; cursor: pointer; padding: 2px 4px; }
.dayhead small { display: block; font: 500 12px var(--mono); color: var(--muted); }
.wkcell .slotb.wk { display: block; min-height: calc(var(--cell) * .62); height: auto; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 3px 6px; border-bottom: 1px solid var(--bg); }
.wkcell .slotb.wk b { font-family: var(--mono); font-weight: 500; }
.slotb.sel { outline: 2px solid var(--accent); outline-offset: -2px; }
.fr { display: block; color: var(--muted); font-size: calc(var(--cellf) - 2px); padding: 1px 6px; }

@media (min-width: 1200px) { .row.wkonly { display: flex; } }
@media (min-width: 1400px) {
  :root { --side: 32px; --cell: 46px; --cellf: 15px; }
  body { font-size: 16px; }
  .cal th { font-size: 17px; }
  .cal th.h { font-size: 13px; }
  .gridscroll { max-height: calc(100vh - 250px); }
  table.cal.week { min-width: calc(72px + var(--n, 5) * 150px); }
}
@media (min-width: 1900px) {
  :root { --side: 48px; --cell: 54px; --cellf: 17px; --panel-w: 420px; }
  body { font-size: 18px; }
  h1 { font-size: 38px; }
  .cal th { font-size: 20px; }
  .cal th.h { font-size: 15px; width: 78px; }
  .card h2 { font-size: 26px; }
  .sub, .note, .legend { font-size: 16px; }
  .chip, .ghost, select, input { font-size: 17px; }
  .dayhead small { font-size: 14px; }
}
@media (max-width: 600px) { .gridscroll { max-height: 70vh; } }

/* Calendar or Containers with no booking open: the grid takes the whole width. */
.one { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

/* "available" is longer than the old word: smaller text in open cells, and day/container grids are sized per dock column
   (they scroll inside their own box instead of squeezing the words). */
.cal td.open { font-size: calc(var(--cellf) - 2px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal td.open .ghost { padding: 0 2px; font-size: calc(var(--cellf) - 2px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.cal.dk { min-width: max(620px, calc(64px + var(--n, 5) * 76px)); }
.cal.week td.open { white-space: normal; }
.fr { overflow-wrap: anywhere; }

/* Calendar "Both": every customer-booked section side by side, a heavy divider between the groups, a heading row naming each. */
table.cal.both { table-layout: fixed; }
.cal.both th.h { width: 64px; }
.cal .gstart { border-left: 3px solid var(--ink); }
.cal thead tr.grp th { height: 34px; white-space: nowrap; font-size: 15px; background: var(--soft); }
.cal thead tr.grp th.grp { overflow: hidden; text-overflow: ellipsis; }
.cal.both thead tr.docks th { top: 34px; height: 34px; padding: 0 2px; font-size: 14px; white-space: nowrap; }
.cal.both .slotb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 3px; }
/* Week view with Both: each section's lines in a block with its short label, and a thin rule between the blocks. */
.wkpart + .wkpart { border-top: 2px solid var(--line); margin-top: 3px; padding-top: 3px; }
.wklab { display: block; font: 600 11px var(--mono); letter-spacing: .5px; text-transform: uppercase; color: var(--muted); padding: 0 6px; }
@media (min-width: 1400px) { .cal.both thead tr.docks th { top: 36px; } .cal thead tr.grp th { height: 36px; } }
