:root {
  --bg: #0f1115;
  --panel: #1a1d24;
  --panel-2: #232733;
  --ink: #f3f4f6;
  --muted: #9aa3b2;
  --accent: #e8b04b;
  --green: #36b37e;
  --red: #e0564b;
  --blue: #4b8fe8;
  --radius: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--panel); border-bottom: 1px solid #000;
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; font-size: 20px; color: var(--ink); }
.brand-hy { color: var(--accent); font-weight: 600; }

.container { max-width: 720px; margin: 0 auto; padding: 16px; }

h1, h2, h3 { line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.panel {
  background: var(--panel); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; background: var(--panel-2); }
.flash.error { background: #3a1f1d; color: #ffb3ac; }
.flash.success { background: #10261d; color: #8ce0bd; }

/* Buttons */
.btn {
  display: inline-block; border: none; border-radius: 10px;
  padding: 12px 16px; font-size: 15px; font-weight: 600;
  background: var(--panel-2); color: var(--ink); cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #1a1206; }
.btn-green { background: var(--green); color: #042016; }
.btn-red { background: var(--red); color: #2a0a08; }
.btn-blue { background: var(--blue); color: #04152b; }
.btn-sm { padding: 9px 12px; font-size: 13px; min-height: 38px; }
.btn-block { display: block; width: 100%; text-align: center; }

/* Upcoming appointment rows */
.plain-list { list-style: none; margin: 0; padding: 0; }
.appt-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel-2); border-radius: 10px; padding: 12px; margin-bottom: 8px;
}
.appt-when { min-width: 108px; display: flex; flex-direction: column; }
.appt-time { color: var(--accent); font-weight: 700; }
.appt-who { flex: 1; min-width: 0; }
.appt-who a { display: block; }
/* Keep the cancel button from stretching to the input width set in Forms. */
.appt-row form { flex: 0 0 auto; width: auto; }

/* Forms */
label { display: block; margin: 10px 0 4px; font-size: 14px; color: var(--muted); }
input, select {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid #2c3240;
  background: var(--panel-2); color: var(--ink); font-size: 16px;
}

/* Stats — wraps so four tiles stay readable on a phone. */
.stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stat {
  flex: 1 1 120px; background: var(--panel-2); border-radius: 10px;
  padding: 12px; text-align: center;
}
.stat .n { font-size: 26px; font-weight: 800; }
.stat .l { font-size: 12px; color: var(--muted); }

/* Now serving */
.serving-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }

/* Display / TV page */
.display { text-align: center; padding: 24px; }
.display .now-big {
  font-size: clamp(48px, 14vw, 160px); font-weight: 900; color: var(--accent);
  line-height: 1;
}
.display .label-big { font-size: clamp(20px, 4vw, 36px); color: var(--muted); }
.display .line-count { font-size: clamp(24px, 6vw, 56px); margin-top: 24px; }
.next-list { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.next-list .ticket { font-size: clamp(20px, 5vw, 40px); font-weight: 800; background: var(--panel); padding: 8px 16px; border-radius: 12px; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wa-btn { background: #25d366; color: #04331a; }
.lang-select { width: auto; padding: 6px 8px; font-size: 14px; }
.lang-form { margin: 0; }

/* ---------- Landing page ---------- */
.hero {
  position: relative;
  padding: 72px 20px 64px;
  text-align: center;
  background:
    radial-gradient(1200px 400px at 50% -10%, rgba(232,176,75,0.18), transparent 60%),
    linear-gradient(180deg, #12151c 0%, var(--bg) 100%);
  border-bottom: 1px solid #000;
  overflow: hidden;
}
.hero::before {
  /* subtle barber-pole stripe accent */
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg, transparent 0 22px, rgba(255,255,255,0.012) 22px 44px);
  pointer-events: none;
}
.hero-photo {
  background:
    linear-gradient(180deg, rgba(15,17,21,0.62) 0%, rgba(15,17,21,0.88) 100%),
    var(--hero-img) center/cover no-repeat;
}
.hero-inner { position: relative; max-width: 680px; margin: 0 auto; }
.hero-status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--muted);
  background: rgba(0,0,0,0.35); border: 1px solid #2c3240;
  padding: 6px 14px; border-radius: 999px; margin-bottom: 18px;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot-open { background: var(--green); box-shadow: 0 0 0 4px rgba(54,179,126,0.18); }
.hero-title {
  font-size: clamp(34px, 8vw, 60px); font-weight: 900; margin: 0 0 10px;
  letter-spacing: -0.02em; line-height: 1.05;
}
.hero-tagline { font-size: clamp(16px, 3.4vw, 20px); color: var(--muted); margin: 0 0 28px; }

.cta {
  display: inline-block; background: var(--accent); color: #1a1206;
  font-size: 19px; font-weight: 800; padding: 16px 38px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(232,176,75,0.28); transition: transform .08s ease;
}
.cta:active { transform: translateY(1px); }
.cta-disabled { background: var(--panel-2); color: var(--muted); box-shadow: none; }

.section { max-width: 680px; margin: 0 auto; padding: 36px 16px; }
.section-tight { padding: 18px 16px 0; }
.section-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--accent); margin: 0 0 16px;
}

.nowserving {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border-radius: var(--radius); padding: 12px 16px;
}
.ns-ticket { font-weight: 800; font-size: 20px; color: var(--green); }

.svc-list { display: flex; flex-direction: column; }
.svc {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding: 14px 2px; border-bottom: 1px solid #1f2430;
}
.svc:last-child { border-bottom: none; }
.svc-main { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.svc-name { font-weight: 600; font-size: 17px; }
.svc-dur { color: var(--muted); font-size: 13px; }
.svc-price { font-weight: 800; color: var(--accent); white-space: nowrap; }

.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.gallery-item { margin: 0; }
.gallery-item img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 12px; display: block; }
.gallery-item figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }

.join-card { background: var(--panel); border-radius: 16px; padding: 22px; border: 1px solid #1f2430; }

.info-grid { display: flex; flex-direction: column; gap: 10px; }
.info {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--panel); border-radius: 12px; padding: 14px 16px; color: var(--ink);
}
.info-icon { font-size: 20px; line-height: 1.3; }
.info-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }

/* sticky mobile join button */
.sticky-cta {
  display: none;
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 30;
  text-align: center; background: var(--accent); color: #1a1206;
  font-weight: 800; padding: 15px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
@media (max-width: 640px) {
  .sticky-cta { display: block; }
  .section { padding-bottom: 28px; }
  #visit { padding-bottom: 96px; }
}
html { scroll-behavior: smooth; }
.page-wide { width: 100%; max-width: none; padding: 0; }
hr.sep { border: none; border-top: 1px solid #2c3240; margin: 16px 0; }

/* ---------- Dashboard mobile polish ---------- */
html, body { max-width: 100%; overflow-x: hidden; }
.topbar nav { flex-wrap: wrap; justify-content: flex-end; row-gap: 8px; }

@media (max-width: 480px) {
  .topbar { padding: 10px 12px; gap: 10px; }
  .brand { font-size: 18px; }
  /* Stack each queue row's action buttons onto their own full-width line */
  .qrow { flex-wrap: wrap; }
  .qrow .who { flex-basis: calc(100% - 60px); }
  .qrow .actions { width: 100%; justify-content: flex-start; }
}

/* ---------- HQ (platform operator) ---------- */
.container-wide { max-width: 1180px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.hq-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.hq-table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid #2c3240; white-space: nowrap;
}
.hq-table td { padding: 10px; border-bottom: 1px solid #232733; vertical-align: top; }
.hq-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.text-red { color: var(--red); }
.url-cell { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; word-break: break-all; }
.copy-btn { min-height: 0; padding: 4px 10px; font-size: 12px; background: var(--panel-2); color: var(--ink); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

.month-bars { display: grid; gap: 6px; }
.month-row { display: grid; grid-template-columns: 72px 1fr 40px; align-items: center; gap: 10px; font-size: 13px; }
.month-label { color: var(--muted); }
.month-track { height: 14px; background: var(--panel); border-radius: 4px; overflow: hidden; }
.month-fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.month-n { text-align: right; font-variant-numeric: tabular-nums; }

.breakdowns { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 28px; }
.month-row-wide { grid-template-columns: 110px 1fr 40px; }
.month-row-wide .month-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--panel-2); color: var(--accent); }

/* ---------- Appointments chart (templates/_appointments_chart.html) ---------- */
/* Colours validated for the dark panel (#1a1d24): lightness band, CVD
   separation and contrast all pass. */
.ac { --ac-booked: #b8832a; --ac-walkin: #4b8fe8; margin: 0; background: var(--panel); border-radius: var(--radius); padding: 16px 14px 12px; }
.ac-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink); margin-bottom: 14px; }
.ac-legend span { display: inline-flex; align-items: center; gap: 7px; }
.ac-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.ac-key.ac-booked, .ac-seg.ac-booked { background: var(--ac-booked); }
.ac-key.ac-walkin, .ac-seg.ac-walkin { background: var(--ac-walkin); }
.ac-plot {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px;
  height: 200px; border-bottom: 1px solid #2c3240;
}
.ac-col { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; outline: none; }
.ac-total { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; height: 16px; }
.ac-bar { width: 100%; max-width: 28px; height: calc(100% - 16px); display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.ac-seg { display: block; width: 100%; min-height: 2px; }
.ac-seg:first-child { border-radius: 4px 4px 0 0; }
.ac-month { position: absolute; bottom: -20px; font-size: 11px; color: var(--muted); }
.ac-col:hover .ac-bar, .ac-col:focus .ac-bar { filter: brightness(1.15); }
.ac-tip {
  display: none; position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  z-index: 5; min-width: 150px; padding: 8px 10px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid #343a48; font-size: 12px; color: var(--ink);
  box-shadow: 0 6px 18px rgba(0,0,0,0.4); flex-direction: column; gap: 3px; pointer-events: none;
}
.ac-tip span { display: flex; align-items: center; gap: 6px; }
.ac-tip b { margin-left: auto; font-variant-numeric: tabular-nums; }
.ac-col:hover .ac-tip, .ac-col:focus .ac-tip { display: flex; }
/* Keep edge tooltips on screen. */
.ac-col:nth-child(-n+2) .ac-tip { left: 0; transform: none; }
.ac-col:nth-last-child(-n+2) .ac-tip { left: auto; right: 0; transform: none; }
.ac-table { margin-top: 30px; color: var(--muted); }
.ac-table summary { cursor: pointer; }
.ac-table table { margin-top: 8px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.stat .sub i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.stat .sub .b { background: #b8832a; }
.stat .sub .w { background: #4b8fe8; }
.hq-table .split { font-size: 11px; color: var(--muted); white-space: nowrap; }
.split i, .stat .sub i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin: 0 3px 0 6px; }
.split .b { background: #b8832a; }
.split .w { background: #4b8fe8; }

/* HQ onboarding */
.hours { margin-top: 16px; }
.hours summary { cursor: pointer; }
.hours-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 12px; }
.days ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.days li label { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--ink); }
.days input { width: auto; }
.pw { font-size: 18px; letter-spacing: 0.06em; background: var(--panel-2); padding: 3px 8px; border-radius: 6px; }

/* ---------- HQ: background photo picker (onboarding) ---------- */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.photo { position: relative; display: block; margin: 0; border: 2px solid var(--panel-2); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--panel-2); color: var(--ink); font-size: 14px; }
.photo input { position: absolute; opacity: 0; width: 0; height: 0; }
.photo img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.photo span { display: block; padding: 6px 8px; font-size: 13px; }
.photo small { color: var(--muted); }
.photo-text { display: flex; align-items: center; justify-content: center; min-height: 84px; text-align: center; }
.photo:has(input:checked) { border-color: #4b8fe8; }
.photo:has(input:focus-visible) { outline: 2px solid #4b8fe8; outline-offset: 2px; }

/* ---------- HQ: owner message language toggle ---------- */
.lang-toggle { margin-bottom: 8px; }
.lang-btn.active { outline: 2px solid #4b8fe8; }
