/* Cuddle Kutz app UI — brand tokens */
:root {
  --turq: #00D1C1; --turq-dark: #007D74; --turq-soft: #DFF7F4; --turq-tint: #EFFBF9;
  --coral: #FF5E5B; --coral-dark: #C7382F; --coral-soft: #FFE9E8;
  --gray: #494949; --gray-soft: #F2F4F4; --ink: #1B1B1B; --white: #FFF;
  --bg: #FBFDFD; --border: #E4EAE9;
  --r-sm: 10px; --r-md: 16px; --r-lg: 24px;
  --sh-1: 0 2px 8px rgba(27,27,27,.06); --sh-2: 0 8px 28px rgba(27,27,27,.10);
  --font-display: "El Messiri", system-ui, serif;
  --font-body: "Roboto", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-body); font-size: 16px; line-height: 1.6;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.25; }
:focus-visible { outline: 3px solid var(--turq-dark); outline-offset: 2px; border-radius: 4px; }

.wrap { width: min(1100px, 100% - 32px); margin-inline: auto; }
.wrap-narrow { width: min(640px, 100% - 32px); margin-inline: auto; }

/* Top bar */
.topbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.brand .dot { width: 30px; height: 30px; border-radius: 9px; background: var(--turq); display: grid; place-items: center; }
.brand .dot svg { width: 16px; height: 16px; }
.brand em { font-style: normal; color: var(--coral-dark); }
.nav { display: flex; gap: 2px; flex-wrap: wrap; margin-left: auto; }
.nav a {
  padding: 8px 13px; border-radius: 999px; text-decoration: none;
  font-weight: 500; font-size: .92rem; color: var(--gray);
}
.nav a:hover { background: var(--turq-soft); color: var(--ink); }
.nav a.active { background: var(--ink); color: var(--white); }
.userbox { display: flex; align-items: center; gap: 10px; font-size: .88rem; color: var(--gray); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; min-height: 42px; border: 0; border-radius: 999px;
  font-family: var(--font-display); font-weight: 600; font-size: .95rem;
  text-decoration: none; transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--sh-2); }
.btn:active { transform: none; }
.btn-turq { background: var(--turq); color: var(--ink); box-shadow: var(--sh-1); }
.btn-coral { background: var(--coral); color: var(--white); box-shadow: var(--sh-1); }
.btn-dark { background: var(--ink); color: var(--white); box-shadow: var(--sh-1); }
.btn-ghost { background: var(--white); color: var(--ink); box-shadow: inset 0 0 0 2px var(--border); }
.btn-sm { padding: 8px 15px; min-height: 40px; font-size: .88rem; }
.btn-danger { background: var(--coral-soft); color: var(--coral-dark); }

/* Cards, forms, tables */
.card { background: var(--white); border-radius: var(--r-md); box-shadow: var(--sh-1); padding: 22px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

label { display: block; font-weight: 700; font-size: .82rem; letter-spacing: .04em; text-transform: uppercase; color: var(--gray); margin-bottom: 6px; }
label.choice { font-size: inherit; letter-spacing: normal; text-transform: none; color: inherit; margin-bottom: 0; font-weight: 400; }
input, select, textarea {
  width: 100%; padding: 11px 14px; min-height: 44px; font-size: 16px;
  border: 2px solid var(--border); border-radius: var(--r-sm);
  font: inherit; background: var(--white); color: var(--ink);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--turq); outline: 3px solid var(--turq-dark); outline-offset: 2px; }
.field { margin-bottom: 16px; }
.help { font-size: .82rem; color: var(--gray); margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--gray); padding: 10px 12px; border-bottom: 2px solid var(--gray-soft); }
td { padding: 11px 12px; border-bottom: 1px solid var(--gray-soft); vertical-align: middle; }
tr:hover td { background: var(--turq-tint); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; width: 1%; padding-left: 24px; }
.table-scroll { overflow-x: auto; }

/* KPI tiles */
.kpi { background: var(--white); border-radius: var(--r-md); box-shadow: var(--sh-1); padding: 18px 20px; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--accent, var(--turq)); }
.kpi .label { font-size: .78rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--gray); }
.kpi .value { font-family: var(--font-display); font-weight: 700; font-size: 1.9rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .82rem; color: var(--gray); }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 999px; font-size: .76rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.pill-booked { background: var(--turq-soft); color: var(--turq-dark); }
.pill-completed { background: var(--gray-soft); color: var(--gray); }
.pill-checked_in { background: #FFF3D6; color: #8A5A00; }
.pill-cancelled, .pill-no_show { background: var(--coral-soft); color: var(--coral-dark); }
.pill-male { background: #E1EEF9; color: #2B5E8C; }
.pill-female { background: var(--coral-soft); color: var(--coral-dark); }
.pill-cash { background: var(--turq-soft); color: var(--turq-dark); }
.pill-card { background: #E1EEF9; color: #2B5E8C; }

/* Slot grid */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.slot {
  padding: 10px 6px; text-align: center; border-radius: var(--r-sm);
  border: 2px solid var(--border); background: var(--white);
  font-weight: 700; font-size: .9rem; cursor: pointer; font-variant-numeric: tabular-nums;
}
.slot:hover { border-color: var(--turq); }
.slot.selected { background: var(--turq); border-color: var(--turq); color: var(--ink); }

/* Choice chips (gender / service) */
.choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.choice { position: relative; display: block; height: 100%; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.choice .box {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: 100%; min-height: 62px; padding: 14px 12px;
  border-radius: var(--r-md); border: 2px solid var(--border);
  background: var(--white); text-align: center;
  font-weight: 600; font-family: var(--font-display); font-size: 1rem;
  text-transform: none; letter-spacing: normal; color: var(--ink);
  transition: border-color .2s, background .2s;
}
.choice .box small { font-family: var(--font-body); font-weight: 500; color: var(--gray); font-size: .84rem; }
.choice input:checked + .box { border-color: var(--turq); background: var(--turq-soft); }
.choice input:focus-visible + .box { outline: 3px solid var(--turq-dark); outline-offset: 2px; }

/* Day calendar */
.cal { display: grid; grid-template-columns: 64px 1fr 1fr; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--white); }
.cal > div { padding: 8px 10px; border-bottom: 1px solid var(--gray-soft); border-left: 1px solid var(--gray-soft); min-height: 52px; }
.cal .h { background: var(--gray-soft); font-weight: 700; font-size: .8rem; letter-spacing: .05em; text-transform: uppercase; color: var(--gray); min-height: 0; }
.cal .t { font-size: .8rem; font-weight: 700; color: var(--gray); font-variant-numeric: tabular-nums; background: var(--bg); }
.cal .free a { display: block; text-align: center; padding: 8px; border: 2px dashed var(--border); border-radius: var(--r-sm); color: var(--gray); text-decoration: none; font-size: .82rem; font-weight: 600; }
.cal .free a:hover { border-color: var(--turq); color: var(--turq-dark); background: var(--turq-tint); }
.chip-booking { display: block; border-radius: var(--r-sm); padding: 7px 10px; font-size: .84rem; text-decoration: none; background: var(--turq-soft); border-left: 4px solid var(--turq); }
.chip-booking.completed { background: var(--gray-soft); border-left-color: var(--gray); opacity: .75; }
.chip-booking.checked_in { background: #FFF3D6; border-left-color: #E8A33D; }
.cal > div { min-height: 62px; }
.chip-booking b { font-family: var(--font-display); }
.chip-booking small { color: var(--gray); display: block; }

/* Misc */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 26px 0 18px; }
.page-head h1 { font-size: 1.6rem; }
.muted { color: var(--gray); }
.error-box { background: var(--coral-soft); color: var(--coral-dark); border-radius: var(--r-sm); padding: 12px 16px; margin-bottom: 16px; font-weight: 500; }
.ok-box { background: var(--turq-soft); color: var(--turq-dark); border-radius: var(--r-sm); padding: 12px 16px; margin-bottom: 16px; font-weight: 500; }
.steps-nav { display: flex; gap: 6px; margin-bottom: 8px; }
.steps-nav span { flex: 1; height: 6px; border-radius: 3px; background: var(--gray-soft); transition: background .25s; }
.steps-nav span.on { background: var(--turq); }
.steps-labels {
  display: flex; gap: 6px; margin-bottom: 22px;
  font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gray);
}
.steps-labels span { flex: 1; text-align: center; }
@media (max-width: 420px) { .steps-labels { font-size: .66rem; letter-spacing: .02em; } }
.hidden { display: none !important; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
footer.app-foot {
  padding: 34px 20px; text-align: center; color: var(--gray); font-size: .85rem;
  margin-top: auto;   /* keep it at the bottom on short pages */
}
/* Push the footer down instead of leaving a dead gap under a short form */
body { display: flex; flex-direction: column; min-height: 100vh; }
body > main { flex: 1 0 auto; }

/* ---- Small screens: the desk is often run from a phone ---- */
/* Grid children default to min-width:auto, so a wide table inside one pushes
   the whole page sideways instead of scrolling within its own wrapper. */
.grid > * { min-width: 0; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 860px) {
  .dash-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 720px) {
  /* Two 1fr slot columns can't fit a phone — let the calendar scroll sideways
     inside its own frame so the Female column stays reachable. */
  .cal-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cal { min-width: 560px; }
  .page-head { margin: 18px 0 14px; }
  .page-head h1 { font-size: 1.3rem; }
  .topbar-row { flex-wrap: wrap; row-gap: 8px; }
  .nav { order: 3; width: 100%; overflow-x: auto; white-space: nowrap; }
}

@media (max-width: 480px) {
  .wrap, .wrap-narrow { padding-left: 16px; padding-right: 16px; }
  .card { padding: 16px; }
  .btn-row, .btn-row .btn { width: 100%; }
}

/* On a phone a wide admin table is better read as one card per row than as a
   sideways scroll — the stock level was the first thing pushed off-screen. */
@media (max-width: 760px) {
  .stack-sm, .stack-sm tbody, .stack-sm tr, .stack-sm td { display: block; width: 100%; }
  .stack-sm tr:first-child { display: none; }          /* header row */
  .stack-sm tr {
    border: 1px solid var(--border); border-radius: var(--r-md);
    padding: 14px; margin-bottom: 12px; background: var(--white);
  }
  .stack-sm td { border: 0; padding: 7px 0; text-align: left !important; width: auto; }
  .stack-sm td::before {
    content: attr(data-label); display: block;
    font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    color: var(--gray); margin-bottom: 5px;
  }
  .stack-sm td:empty { display: none; }
  .stack-sm td[data-label=""]::before { display: none; }
  /* beats the inline flex-wrap:nowrap the desktop rows need */
  .stack-sm .row { flex-wrap: wrap !important; }
}
