/* TableManagement app-specific styles. The platform design system (tokens, cards,
   buttons, nav, hamburger, .field-group/.field-row forms, .badge, .section-title, .btn-*)
   lives in the shared style.css, copied on deploy. Reuse those; keep this file for genuinely
   app-local rules only. */

/* ---------- Public booking flow (Step 4) ---------- */

/* Centred venue title on public screens (guests have no hamburger). Matches SunbedManagement app.css. */
.public-header { text-align: center; padding: 24px 16px 16px; }
.public-header h1 { font-size: 1.5rem; font-weight: 800; }
.public-header p { color: var(--text2); font-size: 0.9rem; margin-top: 6px; }

/* Booking summary threaded through the steps (2 guests · Fri 8 Aug · 19:30 · Terrace). NEW. */
.summary-line { text-align: center; color: var(--text2); font-size: 0.85rem; margin: -6px 0 16px; }

/* Date field rendered as a button (opens the calendar popover) but reads like a .field-row control. NEW. */
.datebtn {
    flex: 1; background: transparent; border: none; color: var(--text); font-size: 0.95rem;
    font-family: inherit; text-align: left; padding: 4px 0; cursor: pointer;
    display: flex; align-items: center; justify-content: space-between;
}
.datebtn::after { content: "\25BE"; color: var(--text2); font-size: 0.8rem; }

/* Available-time chips. NEW component (no shared time-chip); state names follow the house
   convention used by Sunbed's .sunbed-slot (.available/.selected/.unavailable). */
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot { text-align: center; font-size: 0.95rem; font-weight: 600; padding: 11px 0; border-radius: 10px;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); cursor: pointer;
    font-variant-numeric: tabular-nums; }
.slot:hover { border-color: var(--accent); }
.slot.unavailable { color: var(--text3); opacity: 0.45; text-decoration: line-through; cursor: not-allowed;
    border-color: transparent; }
.slot.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.slot-msg { text-align: center; color: var(--text2); font-size: 0.85rem; margin: 14px 0 0; }
.slot-hint { text-align: center; color: var(--text2); font-size: 0.8rem; margin: 12px 2px 4px; }
.slot-hint a { color: var(--accent); text-decoration: underline; white-space: nowrap; }

/* Area option cards. NEW (no shared option-card). */
.radio-card { display: flex; gap: 12px; align-items: flex-start; background: var(--surface);
    border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 10px; cursor: pointer; }
.radio-card.on { border-color: var(--accent); }
.radio-card .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border);
    flex: 0 0 auto; margin-top: 1px; position: relative; }
.radio-card.on .dot { border-color: var(--accent); }
.radio-card.on .dot::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); }
.radio-card .rc-title { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.radio-card .rc-note { font-size: 0.8rem; color: var(--text2); margin-top: 2px; }

.privacy { text-align: center; color: var(--text2); font-size: 0.8rem; margin: 4px 0 16px; }

/* Phone field: country dialling-code select + national number, side by side under one label. NEW. */
.phone-input { display: flex; gap: 10px; align-items: center; }
/* The select shows only the dialling code (e.g. +34) once chosen - see the collapse script on each form
   that swaps the selected option's text to its code - so it is sized to a code, not the country name. */
.phone-input select { flex: 0 0 auto; width: 6em; }
.phone-input input { flex: 1; }

/* Sticky bottom action bar. Matches SunbedManagement app.css; a lone button/btn-row fills the width. */
.booking-bar {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.booking-bar > .btn, .booking-bar > .btn-row { flex: 1; }

/* Month calendar popover (guest date picker). NEW component (you signed this off as new). */
.pcal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 50;
    width: min(360px, 92vw); background: var(--surface2); border: 1px solid var(--border);
    border-radius: 16px; padding: 16px; box-shadow: 0 24px 60px rgba(0,0,0,0.5); }
.pcal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pcal-head b { font-size: 0.95rem; }
.pcal-nav { background: none; border: none; color: var(--accent); font-size: 1.4rem; cursor: pointer; width: 36px; }
.pcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.pcal-grid > span { text-align: center; font-size: 0.65rem; color: var(--text2); text-transform: uppercase; padding: 2px 0; }
.pcal-day { text-align: center; font-size: 0.9rem; padding: 9px 0; border-radius: 8px; color: var(--text);
    background: transparent; border: none; cursor: pointer; font-variant-numeric: tabular-nums; font-family: inherit; }
.pcal-day:hover { background: var(--surface); }
.pcal-day.off { color: var(--text3); opacity: 0.3; cursor: not-allowed; }
.pcal-day.sel { background: var(--accent); color: #fff; }
.pcal-day.empty { visibility: hidden; }

/* Confirmation block — copied verbatim from EventManagement app.css (the established house pattern). */
.confirmation-box { background: var(--surface); border-radius: 14px; padding: 24px; text-align: center; margin: 20px 0; }
.confirmation-ref { font-size: 2rem; font-weight: 700; color: var(--accent); letter-spacing: 2px; margin: 16px 0; }
.confirmation-detail { font-size: 0.9rem; color: var(--text2); margin: 6px 0; }

/* Embed mode (iframe on the venue website) — no header, full-height content. Mirrors the established
   EventManagement app.css convention. */
.embed-mode #header { display: none; }
.embed-mode #content { min-height: 100dvh; }

/* ---- Diary / run sheet (backlog 97/98/101/102) ---- */
.print-only{display:none;}
.tm-datenav{display:flex;align-items:center;gap:8px;margin-bottom:10px;}
.tm-navbtn{width:34px;height:34px;display:grid;place-items:center;border:1px solid var(--border);border-radius:8px;background:var(--surface);color:var(--text);text-decoration:none;font-size:18px;}
.tm-navbtn:hover{background:var(--border);}
.tm-curdate{font-weight:600;font-variant-numeric:tabular-nums;min-width:9.5em;text-align:center;}
.tm-tabs{display:flex;gap:4px;background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:4px;flex-wrap:wrap;margin-bottom:14px;}
.tm-tab{background:none;border:0;color:var(--text2);font:inherit;font-weight:600;padding:7px 14px;border-radius:7px;cursor:pointer;}
.tm-tab:hover{color:var(--text);}
.tm-tab.active{background:var(--border);color:var(--text);}
.tm-panel{display:none;}
.tm-panel.active{display:block;}
.tm-totstrip{color:var(--text2);font-size:13px;margin-bottom:12px;}
.tm-totstrip b{color:var(--text);font-variant-numeric:tabular-nums;}
.tm-toolbar{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-bottom:14px;}
.tm-search,.tm-select{background:var(--surface);border:1px solid var(--border);border-radius:9px;color:var(--text);font:inherit;padding:8px 12px;}
.tm-search{min-width:210px;flex:1;}
.tm-sheet{border:1px solid var(--border);border-radius:12px;overflow:hidden;margin-bottom:12px;}
.tm-band{display:flex;align-items:center;gap:10px;padding:10px 14px;background:var(--surface);border-bottom:1px solid var(--border);font-weight:650;}
.tm-band-tot{margin-left:auto;font-size:12px;color:var(--text2);font-weight:500;font-variant-numeric:tabular-nums;}
table.tm-run{width:100%;border-collapse:collapse;}
table.tm-run th{text-align:left;font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--text2);font-weight:650;padding:9px 12px;border-bottom:1px solid var(--border);}
table.tm-run td{padding:11px 12px;border-bottom:1px solid var(--border);vertical-align:middle;}
table.tm-run tr:last-child td{border-bottom:0;}
.tm-runrow{cursor:pointer;}
.tm-runrow:hover{background:var(--surface);}
.tm-rtime{font-variant-numeric:tabular-nums;font-weight:600;white-space:nowrap;}
.tm-end{color:var(--text2);font-weight:400;}
.tm-rname{font-weight:600;}
.tm-rcov{text-align:center;font-weight:700;font-variant-numeric:tabular-nums;}
.tm-rnote{color:var(--accent);}
.src{color:var(--text2);}
.src svg{width:24px;height:24px;display:block;}
.tm-soon{color:var(--text2);padding:24px;text-align:center;border:1px dashed var(--border);border-radius:12px;}

@media print{
  #header,.nav-links,.no-print,.tm-tabs,.tm-datenav,.tm-toolbar,.flash{display:none !important;}
  .print-only{display:block;}
  body,#app,#content{background:#fff !important;color:#111 !important;}
  .tm-printhead h2{color:#111;margin:0 0 2px;}
  .tm-pmeta{color:#555;font-size:12px;margin-bottom:14px;}
  .tm-sheet{border:1px solid #ccc;margin-bottom:14px;page-break-inside:avoid;}
  .tm-band{background:#eee !important;color:#111 !important;border-bottom:1px solid #ccc;}
  .tm-band-tot{color:#555;}
  table.tm-run th{color:#fff;background:#333;}
  table.tm-run td{color:#222;border-bottom:1px solid #ddd;}
  .tm-end{color:#777;}
  .badge{border:1px solid #bbb;color:#222 !important;background:#f3f3f3 !important;}
  .src{color:#555;}
}

/* run-sheet: FIXED column layout so every service band and day group lines up on one grid (a report is
   viewed on a wide 27" restaurant touchscreen; auto-width tables drift band to band). Guest column has
   no width so it absorbs the remaining space; all others are explicit and identical on every table. */
table.tm-run{table-layout:fixed;min-width:760px;}
table.tm-run th,table.tm-run td{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
table.tm-run th:nth-child(1),table.tm-run td:nth-child(1){width:130px;}                     /* Time */
table.tm-run th:nth-child(2),table.tm-run td:nth-child(2){width:40px;text-align:center;padding-left:4px;padding-right:4px;} /* Source */
table.tm-run th:nth-child(4),table.tm-run td:nth-child(4){width:90px;text-align:center;}    /* People */
table.tm-run th:nth-child(5),table.tm-run td:nth-child(5){width:220px;white-space:normal;}  /* Table */
table.tm-run th:nth-child(6),table.tm-run td:nth-child(6){width:150px;white-space:normal;} /* Notes */
.tm-rnotes{display:flex;flex-wrap:wrap;gap:4px;}
table.tm-run th:nth-child(7),table.tm-run td:nth-child(7){width:150px;}                      /* Status */
.tm-run .src{display:inline-flex;}
.tm-tablescroll{overflow-x:auto;}

/* ---- Current service board (Phase 3a) ---- */
.tm-svchead{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap;margin-bottom:14px;}
.tm-svchead h2{font-size:20px;margin:0;}
.tm-svcwin{color:var(--text2);font-variant-numeric:tabular-nums;}
.tm-metrics{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:16px;}
@media (max-width:900px){.tm-metrics{grid-template-columns:repeat(2,1fr);}}
.tm-metric{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:14px 16px;}
.tm-metric .lbl{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--text2);font-weight:600;}
.tm-metric .big{font-size:30px;font-weight:680;margin-top:4px;font-variant-numeric:tabular-nums;}
.tm-metric .big small{font-size:15px;color:var(--text2);font-weight:500;}
.tm-metric .sub{font-size:12px;color:var(--text2);margin-top:2px;min-height:1.2em;}
.tm-bar{height:6px;border-radius:999px;background:var(--border);margin-top:10px;overflow:hidden;}
.tm-bar>span{display:block;height:100%;}
.tm-cardhead{padding:12px 16px;border-bottom:1px solid var(--border);font-weight:650;}
.tm-arr{display:flex;gap:12px;padding:12px 14px;border-bottom:1px solid var(--border);align-items:center;cursor:pointer;}
.tm-arr:last-child{border-bottom:0;}
.tm-arr:hover{background:var(--bg);}
.tm-arr-t{font-weight:600;min-width:46px;font-variant-numeric:tabular-nums;}
.tm-arr-who{flex:1;min-width:0;}
.tm-arr-nm{font-weight:600;}
.tm-arr-meta{margin-top:2px;}
.tm-arr-cov{font-weight:700;font-variant-numeric:tabular-nums;min-width:1.6em;text-align:center;}
.tm-arr-due{background:color-mix(in srgb,var(--warning) 10%,transparent);}

/* ---- Month calendar (Phase 4) ---- */
.tm-monthnav{display:flex;align-items:center;gap:8px;margin-bottom:10px;}
.tm-cal{border:1px solid var(--border);border-radius:12px;overflow:hidden;}
.tm-cal-head,.tm-cal-row{display:grid;grid-template-columns:repeat(7,1fr);}
.tm-cal-head div{padding:8px 10px;font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--text2);font-weight:650;border-bottom:1px solid var(--border);}
.tm-cell{min-height:92px;border-right:1px solid var(--border);border-bottom:1px solid var(--border);padding:7px 8px;display:flex;flex-direction:column;gap:5px;}
.tm-cell:nth-child(7n){border-right:0;}
.tm-cell.out{background:color-mix(in srgb,var(--bg) 45%,transparent);}
.tm-cell.out .tm-dn{color:var(--text3, var(--text2));opacity:.5;}
.tm-cell.closed{background:repeating-linear-gradient(135deg,transparent 0 7px,color-mix(in srgb,var(--border) 45%,transparent) 7px 8px);}
.tm-cell[onclick]{cursor:pointer;}
.tm-cell[onclick]:hover{background:var(--surface);}
.tm-dn{font-weight:650;font-variant-numeric:tabular-nums;}
.tm-cell.today .num{background:var(--text);color:var(--bg);width:22px;height:22px;border-radius:50%;display:inline-grid;place-items:center;}
.tm-daytot{font-variant-numeric:tabular-nums;font-size:13px;}
.tm-daytot b{font-weight:700;}
.tm-split{display:flex;flex-wrap:wrap;gap:8px;margin-top:auto;font-size:11px;color:var(--text2);}
.tm-split span{display:inline-flex;align-items:center;gap:4px;font-variant-numeric:tabular-nums;}
.tm-split i{width:8px;height:8px;border-radius:2px;}
.tm-closed{font-size:11px;color:var(--warning);font-weight:600;align-self:flex-start;}
@media (max-width:700px){.tm-cell{min-height:64px;font-size:12px;}.tm-split{display:none;}}

/* ---- Schedule timeline (Phase 5) ---- */
.tm-tlscroll{overflow-x:auto;border:1px solid var(--border);border-radius:12px;}
.tm-tl{min-width:900px;position:relative;}
.tm-tl-head,.tm-tl-heat,.tm-tl-row{display:grid;grid-template-columns:120px 1fr;}
.tm-tl-head{border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--surface);z-index:3;}
.tm-tl-lbl{padding:8px 10px;border-right:1px solid var(--border);display:flex;align-items:center;gap:8px;}
.tm-rn{font-weight:700;font-variant-numeric:tabular-nums;}
.tm-cap{font-size:10.5px;color:var(--text2);}
.tm-tl-axis{position:relative;height:32px;}
.tm-tk{position:absolute;top:0;bottom:0;border-left:1px solid var(--border);padding-left:4px;font-size:10.5px;color:var(--text2);display:flex;align-items:center;font-variant-numeric:tabular-nums;}
.tm-tl-heat{background:var(--surface);border-bottom:1px solid var(--border);}
.tm-tl-heat .tm-tl-lbl{font-size:10.5px;color:var(--text2);text-transform:uppercase;}
.tm-heat{position:relative;height:26px;display:flex;align-items:flex-end;}
.tm-hc{flex:1;display:flex;align-items:flex-end;justify-content:center;border-left:1px solid color-mix(in srgb,var(--border) 40%,transparent);}
.tm-hc>i{display:block;width:66%;border-radius:2px 2px 0 0;background:var(--accent);opacity:.85;min-height:1px;}
.tm-tl-zone{background:var(--surface);padding:6px 12px;font-size:11px;letter-spacing:.05em;text-transform:uppercase;color:var(--text2);font-weight:650;border-top:1px solid var(--border);border-bottom:1px solid var(--border);}
.tm-tl-row{border-bottom:1px solid var(--border);}
.tm-tl-row:hover{background:color-mix(in srgb,var(--surface) 50%,transparent);}
.tm-lane{position:relative;height:42px;}
.tm-gl{position:absolute;top:0;bottom:0;border-left:1px solid color-mix(in srgb,var(--border) 45%,transparent);}
.tm-blk{position:absolute;top:6px;height:30px;border-radius:7px;padding:0 8px;display:flex;align-items:center;gap:6px;font-size:12px;overflow:hidden;white-space:nowrap;cursor:pointer;}
.tm-blk .tm-bn{font-weight:600;overflow:hidden;text-overflow:ellipsis;}
.tm-blk .tm-bc{font-weight:700;opacity:.9;margin-left:auto;}
.tm-blk.svc-lunch{background:color-mix(in srgb,var(--accent2) 22%,var(--surface));border:1px solid color-mix(in srgb,var(--accent2) 55%,transparent);}
.tm-blk.svc-dinner{background:color-mix(in srgb,var(--accent) 22%,var(--surface));border:1px solid color-mix(in srgb,var(--accent) 55%,transparent);}
.tm-blk.svc-other{background:var(--surface);border:1px solid var(--border2, var(--border));}
.tm-blk.seated{box-shadow:inset 3px 0 0 var(--accent2);}
.tm-nowline{position:absolute;top:0;bottom:0;width:2px;background:var(--warning);z-index:4;pointer-events:none;}
.tm-nowline::before{content:attr(data-now);position:absolute;top:0;left:2px;font-size:10px;color:var(--bg);background:var(--warning);padding:1px 4px;border-radius:0 4px 4px 0;font-weight:700;font-variant-numeric:tabular-nums;}

/* ---- Week view (per-service detail for rota planning) ---- */
.tm-week{display:grid;grid-template-columns:repeat(7,1fr);gap:8px;}
@media (max-width:1100px){.tm-week{grid-template-columns:repeat(4,1fr);}}
@media (max-width:760px){.tm-week{grid-template-columns:repeat(2,1fr);}}
@media (max-width:460px){.tm-week{grid-template-columns:1fr;}}
.tm-wday{border:1px solid var(--border);border-radius:10px;padding:9px 10px;display:flex;flex-direction:column;gap:7px;min-height:120px;background:var(--surface);}
.tm-wday.closed{background:repeating-linear-gradient(135deg,transparent 0 7px,color-mix(in srgb,var(--border) 45%,transparent) 7px 8px);}
.tm-wday[onclick]{cursor:pointer;}
.tm-wday[onclick]:hover{border-color:var(--accent);}
.tm-wday.today{border-color:var(--accent);}
.tm-wdate{display:flex;align-items:baseline;justify-content:space-between;gap:6px;border-bottom:1px solid var(--border);padding-bottom:5px;}
.tm-wdate .num{font-weight:650;font-variant-numeric:tabular-nums;}
.tm-wtot{font-size:11px;color:var(--text2);font-variant-numeric:tabular-nums;}
.tm-wsvc{background:var(--bg);border-radius:7px;padding:5px 7px;}
.tm-wsvc-top{display:flex;align-items:baseline;justify-content:space-between;gap:6px;}
.tm-wsvc-n{font-weight:600;font-size:12.5px;}
.tm-wsvc-w{font-size:10.5px;color:var(--text2);font-variant-numeric:tabular-nums;}
.tm-wsvc-c{font-size:12px;color:var(--text2);font-variant-numeric:tabular-nums;margin-top:1px;}
.tm-wsvc-c b{color:var(--text);font-weight:700;}
.tm-wempty{color:var(--text2);}

/* Week view: published-rota staff under each service */
.tm-wstaff{margin-top:5px;border-top:1px dashed var(--border);padding-top:5px;display:flex;flex-direction:column;gap:3px;}
.tm-wperson{display:flex;align-items:baseline;justify-content:space-between;gap:6px;font-size:11.5px;}
.tm-wp-n{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.tm-wp-r{color:var(--text2);font-size:10.5px;white-space:nowrap;flex:none;}

/* Week view: keytag scan status dot behind each staff name */
.tm-scan{width:9px;height:9px;border-radius:50%;display:inline-block;margin-right:5px;flex:none;vertical-align:middle;}
.tm-scan-grey{background:var(--text2);}
.tm-scan-green{background:var(--accent2);}
.tm-scan-amber{background:var(--warning);}
.tm-scan-red{background:var(--danger);}
