/* Buffie — Buffet Nails & Lashes staff app
   Brand: Terracotta Red + Cherry Red on Light Peach. Display type: Poppins. Body/UI type: Lora. */

:root {
  --cherry-red: #D90718;
  --ink-navy: #9C3B2E;
  --ink-navy-soft: #C1573F;
  --sunset-peach-1: #FDEBDD;
  --sunset-peach-2: #F0916E;
  --blush-pink: #FAE0E3;
  --warm-cream: var(--sunset-peach-1);
  --paper-white: #FFFDF7;
  --success: #2f8f4e;
  --danger: #b3121f;
  --warning: #c17d14;
  /* Subdued on/off colors just for the My Schedule calendar cells — softer than --success/--danger
     so the day number and location emoji stay easy to read against them. */
  --cal-on-bg: #5c9470;
  --cal-off-bg: #b2574e;

  --radius-pill: 999px;
  --radius-card: 18px;
  --shadow-soft: 0 2px 10px rgba(156, 59, 46, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--warm-cream);
  color: var(--ink-navy);
  font-family: 'Lora', Georgia, serif;
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: 'Poppins', 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink-navy);
  font-weight: 700;
  margin: 0 0 0.5em;
}

a { color: var(--ink-navy); }
.mt-0 { margin-top: 0 !important; }
.muted { color: rgba(156,59,46,0.55); font-size: 0.9em; }
.req { color: var(--cherry-red); font-size: 0.8em; font-weight: 500; }

#app { min-height: 100vh; }
.boot { padding: 60px 20px; text-align: center; color: var(--danger); font-family: 'Poppins', sans-serif; }

.container { max-width: 760px; margin: 0 auto; padding: 20px 16px 72px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; background: var(--paper-white); border-bottom: 1px solid rgba(156,59,46,0.08);
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  font-family: 'Poppins', sans-serif; font-weight: 700; color: var(--ink-navy);
  text-decoration: none; font-size: 1.05rem;
}
.logo-mark img { height: 32px; width: auto; display: block; flex-shrink: 0; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.version-badge {
  display: inline-block; padding: 1px 8px; border-radius: var(--radius-pill); background: rgba(217,7,24,0.1);
  color: var(--cherry-red); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em; vertical-align: middle;
  white-space: nowrap; flex-shrink: 0;
}
.login-wrap .version-badge { margin-top: 2px; }
@media (max-width: 480px) {
  .brand-name { display: none; }
  .topbar .actions { font-size: 0.78rem; gap: 6px; }
  .topbar .actions .btn-sm { padding: 6px 10px; }
}
.topbar .actions { display: flex; align-items: center; gap: 10px; font-family: 'Poppins', sans-serif; font-size: 0.85rem; flex-wrap: wrap; justify-content: flex-end; }
.topbar .actions a { text-decoration: none; }
.whoami { color: var(--ink-navy-soft); font-weight: 500; }
.lang-switch {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px;
  background: var(--blush-pink, rgba(217,7,24,0.08)); border-radius: var(--radius-pill); flex-shrink: 0;
}
.lang-opt {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: var(--radius-pill);
  color: var(--ink-navy-soft); font-weight: 600; font-size: 0.82rem; line-height: 1; white-space: nowrap;
}
.lang-opt.active { background: var(--paper-white); color: var(--ink-navy); box-shadow: var(--shadow-soft); }
.lang-flag { font-size: 0.95em; }
@media (max-width: 480px) {
  .lang-opt { padding: 5px 8px; }
}
/* Account group (name + logout) sits apart from the language switch, with a divider between the
 * two so "pick a language" and "your account" read as separate clusters. */
.account-group {
  display: flex; align-items: center; gap: 10px; padding-left: 12px; margin-left: 2px;
  border-left: 1px solid rgba(43,31,26,0.14); flex-wrap: wrap; row-gap: 6px;
}
.whoami { white-space: nowrap; flex-shrink: 0; }
@media (max-width: 480px) {
  .account-group { padding-left: 8px; gap: 6px; }
}

/* ---------- Nav pills, split into Staff / Admin groups (see navGroups() in app.js) ---------- */
.nav-group { margin-bottom: 16px; }
.nav-group-label {
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
  font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-navy-soft);
}
.nav-group-icon { font-size: 0.6rem; }
.nav-stack { display: flex; flex-wrap: wrap; gap: 8px; }
.nav-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-pill);
  background: var(--paper-white); color: var(--ink-navy);
  font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 0.85rem;
  text-decoration: none; box-shadow: var(--shadow-soft); border: 1px solid transparent;
}
.nav-pill.active { background: var(--ink-navy); color: var(--paper-white); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius-pill); border: 1px solid var(--ink-navy);
  background: var(--paper-white); color: var(--ink-navy);
  font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 0.9rem;
  text-decoration: none; cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-primary { background: var(--ink-navy); color: var(--paper-white); border-color: var(--ink-navy); }
.btn-danger { background: var(--paper-white); color: var(--danger); border-color: var(--danger); }
.btn-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card {
  background: var(--paper-white); border-radius: var(--radius-card); box-shadow: var(--shadow-soft);
  padding: 18px 18px 20px; margin-bottom: 18px;
}

/* ---------- Add New disclosure ---------- */
.add-new-toggle summary {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius-pill); border: 1px solid var(--ink-navy);
  background: var(--ink-navy); color: var(--paper-white);
  font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 0.9rem;
}
.add-new-toggle summary::-webkit-details-marker { display: none; }
.add-new-toggle summary::marker { content: ''; }
.add-new-toggle[open] summary { margin-bottom: 16px; background: var(--paper-white); color: var(--ink-navy); }
.add-new-toggle form { margin-top: 2px; }

/* ---------- Forms ---------- */
form label { display: block; font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 0.85rem; margin: 14px 0 6px; color: var(--ink-navy); }
form label.mt-0 { margin-top: 0; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="month"], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(156,59,46,0.2);
  background: var(--warm-cream); color: var(--ink-navy); font-family: 'Lora', serif; font-size: 1rem;
}
textarea { resize: vertical; }
.thb-field { position: relative; }
.thb-field .symbol { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-navy-soft); }
.thb-field input { padding-left: 28px; }
.checkbox-grid { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 4px; }
.checkbox-grid label { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; font-family: 'Lora', serif; }
.other-box { margin-top: 10px; }
.flex-between { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Alerts / badges ---------- */
.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-family: 'Poppins', sans-serif; font-size: 0.9rem; }
.alert-error { background: var(--blush-pink); color: var(--danger); }
.alert-success { background: #e4f3e8; color: var(--success); }
.badge { display: inline-block; padding: 2px 10px; border-radius: var(--radius-pill); background: rgba(156,59,46,0.1); font-size: 0.75rem; font-family: 'Poppins', sans-serif; }
.badge-on { background: var(--cherry-red); color: #fff; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid rgba(156,59,46,0.08); white-space: nowrap; }
th { font-family: 'Poppins', sans-serif; font-weight: 600; color: var(--ink-navy-soft); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.02em; }
th a { color: inherit; text-decoration: none; }
tr.totals-row td { border-top: 2px solid var(--ink-navy); border-bottom: none; }
tr.detail-row td { padding: 0; border-bottom: none; white-space: normal; }
tr.detail-row { display: none; }
tr.detail-row.open { display: table-row; }
.day-toggle { border: none; background: none; cursor: pointer; color: var(--ink-navy-soft); font-size: 0.9rem; }
.day-toggle.open { transform: rotate(180deg); display: inline-block; }

.txn-detail { padding: 10px 10px 4px; }
.txn-line { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed rgba(156,59,46,0.12); }
.txn-line:last-child { border-bottom: none; }
.txn-info { font-size: 0.88rem; }
.txn-amount { font-family: 'Poppins', sans-serif; font-weight: 700; white-space: nowrap; }
.txn-actions { margin-top: 6px; display: flex; gap: 8px; }

/* ---------- Stat tiles ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-tile { background: var(--warm-cream); border-radius: 12px; padding: 10px 12px; text-align: center; }
.stat-tile .label { font-family: 'Poppins', sans-serif; font-size: 0.72rem; color: var(--ink-navy-soft); text-transform: uppercase; letter-spacing: 0.02em; }
.stat-tile .value { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.1rem; margin-top: 4px; }
.stat-tile.positive .value { color: var(--success); }
.stat-tile.negative .value { color: var(--danger); }

/* ---------- Calendar ---------- */
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-family: 'Poppins', sans-serif; font-size: 0.72rem; color: var(--ink-navy-soft); margin-bottom: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  aspect-ratio: 0.8; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  border-radius: 10px; border: none; font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 0.78rem;
  background: var(--warm-cream); color: var(--ink-navy); cursor: pointer;
}
.cal-cell.is-empty { background: transparent; cursor: default; }
.cal-cell.is-off { background: var(--cal-off-bg); color: var(--paper-white); }
.cal-cell.is-on { background: var(--cal-on-bg); color: var(--paper-white); }
.cal-cell.is-today { box-shadow: 0 0 0 3px var(--ink-navy) inset; }
.cal-cell.is-past { cursor: default; opacity: 0.6; }
.cal-cell:focus-visible { outline: 2px solid var(--ink-navy); outline-offset: 2px; }
.cal-day-num { line-height: 1.2; }
.cal-cell-badge {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--paper-white); box-shadow: 0 1px 2px rgba(0,0,0,0.18);
}
.cal-cell-loc { font-size: 1.3rem; line-height: 1; }
.cal-legend {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; padding-bottom: 12px;
  border-bottom: 1px solid var(--warm-cream);
}
.cal-legend-title { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 2px; }
.cal-legend-row { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.cal-legend-badge {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 24px; height: 24px; border-radius: 50%; font-size: 1.05rem;
  background: var(--warm-cream); box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ---------- Team Calendar: a week-grouped day-card calendar, every location side by side ---------- */
.teamcal-weeks { display: flex; flex-direction: column; gap: 16px; }
.teamcal-week-label {
  font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 0.72rem; color: var(--ink-navy-soft);
  text-transform: uppercase; letter-spacing: 0.04em; padding-bottom: 6px; margin-bottom: 8px;
  border-bottom: 2px solid var(--warm-cream);
}
.teamcal-week-days { display: flex; flex-direction: column; gap: 10px; }
.teamcal-card {
  background: var(--paper-white); border-radius: var(--radius-card); box-shadow: var(--shadow-soft);
  padding: 12px 14px; border-left: 5px solid transparent;
}
.teamcal-card.status-full { border-left-color: var(--success); }
.teamcal-card.status-partial { border-left-color: var(--warning); }
.teamcal-card.status-none { border-left-color: var(--danger); }
.teamcal-card.is-today { box-shadow: 0 0 0 2px var(--ink-navy), var(--shadow-soft); }
.teamcal-card.is-past { opacity: 0.68; }
.teamcal-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.teamcal-date { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; gap: 1px; }
.teamcal-weekday { font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 0.66rem; color: var(--ink-navy-soft); text-transform: uppercase; letter-spacing: 0.03em; }
.teamcal-day { font-family: 'Poppins', sans-serif; font-weight: 700; color: var(--ink-navy); font-size: 0.95rem; white-space: nowrap; }
.teamcal-badge-full { background: var(--success); color: #fff; }
.teamcal-badge-partial { background: var(--warning); color: #fff; }
.teamcal-badge-none { background: var(--danger); color: #fff; }
.teamcal-loc-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 3px 0; font-size: 0.85rem; flex-wrap: wrap;
}
.teamcal-loc-label { font-weight: 600; color: var(--ink-navy-soft); flex-shrink: 0; white-space: nowrap; }
.teamcal-loc-names { text-align: right; color: var(--ink-navy); font-weight: 500; }
.teamcal-loc-names.muted { color: rgba(156,59,46,0.5); font-weight: 400; }

/* ---------- Check-in ---------- */
.checkin-status-line { font-family: 'Poppins', sans-serif; font-weight: 600; }
.day-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed rgba(156,59,46,0.12); flex-wrap: wrap; }
.day-row:last-child { border-bottom: none; }
.day-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.checkin-location-select { width: auto; }

/* ---------- Staff: location/role editor ----------
 * Each location is one compact row: the location checkbox+name on the left, Staff/Manager on
 * the right, pushed to opposite ends so they share a single line whenever there's room — only
 * wrapping to a second line on genuinely narrow screens or long location names. */
.location-roles { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.location-role-row {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap;
  padding: 7px 8px; background: var(--warm-cream); border-radius: 10px;
}
.location-role-row > label {
  margin: 0; font-weight: 600; font-size: 0.88rem; display: flex; align-items: center; gap: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1;
}
.role-choice { display: flex; gap: 8px; flex-shrink: 0; }
.role-choice label { display: flex; align-items: center; gap: 3px; font-weight: 500; font-size: 0.8rem; white-space: nowrap; }
.role-choice input[type="checkbox"], .location-role-row > label input[type="checkbox"] { width: 15px; height: 15px; flex-shrink: 0; }
@media (max-width: 420px) {
  .location-role-row > label { font-size: 0.82rem; }
  .role-choice label { font-size: 0.78rem; }
}

/* ---------- Login / minimal landing ---------- */
.login-wrap, .hero, .minimal-notice { max-width: 360px; margin: 40px auto; text-align: center; }
.login-wrap img, .hero img { width: 140px; height: auto; margin-bottom: 10px; }
.login-logo { width: 84px !important; height: auto; margin-bottom: 2px !important; }
.login-brand { font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 1.9rem; letter-spacing: 0.03em; color: var(--ink-navy); margin-bottom: 6px; }
.login-wrap form { margin-top: 10px; }

/* ---------- Modal ---------- */
#modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; overflow-y: auto; }
.modal-back { position: fixed; inset: 0; background: rgba(156,59,46,0.45); }
.modal-box { position: relative; background: var(--paper-white); border-radius: var(--radius-card); padding: 20px; max-width: 480px; width: 100%; box-shadow: var(--shadow-soft); }
body.noscroll { overflow: hidden; }

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; transition: all 0.2s ease; padding: 10px 18px; border-radius: var(--radius-pill); background: var(--ink-navy); color: var(--paper-white); font-family: 'Poppins', sans-serif; font-size: 0.85rem; z-index: 60; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.show.err { background: var(--danger); }

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  .stat-row { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .stat-tile { padding: 8px 6px; }
  .stat-tile .value { font-size: 0.95rem; }
  .cal-cell { font-size: 0.75rem; }
  th, td { padding: 6px 8px; font-size: 0.82rem; }
}
