/* ------------------------------------------------------------------ tokens
   Sleek dark theme. Printing switches to a light, ink-friendly palette (see bottom). */

:root {
  --bg: #090c13;
  --surface: #11161f;
  --surface-2: #171d29;
  --surface-3: #1e2533;
  --input-bg: #0c1018;
  --text: #edf1f8;
  --muted: #a1abbd;
  --faint: #677187;
  --border: #2a3244;
  --border-soft: #1c2331;
  --primary: #5b8cff;
  --primary-2: #7b61ff;
  --primary-dark: #b3c8ff;
  --primary-soft: rgb(91 140 255 / 0.14);
  --on-primary: #ffffff;
  --grad: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  --danger: #ff6b6b;
  --danger-soft: rgb(255 107 107 / 0.12);
  --ok: #3ddc97;
  --ok-soft: rgb(61 220 151 / 0.11);
  --warn: #ffc14d;
  --warn-soft: rgb(255 193 77 / 0.11);
  --day-head: #161c28;
  --cook: #ff9b5c;
  --cook-soft: rgb(255 155 92 / 0.10);
  --manager: #6fa8ff;
  --manager-soft: rgb(111 168 255 / 0.10);
  --carhop: #3ddc97;
  --carhop-soft: rgb(61 220 151 / 0.10);
  --free: #b39bff;
  --free-soft: rgb(179 155 255 / 0.13);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgb(255 255 255 / 0.03) inset, 0 10px 30px -12px rgb(0 0 0 / 0.6);
  --shadow-pop: 0 24px 60px -12px rgb(0 0 0 / 0.7);
  --ring: 0 0 0 3px rgb(91 140 255 / 0.35);
  --nav-h: 66px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */

* { box-sizing: border-box; }

html { font-size: 18px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-feature-settings: "cv11", "ss01";
  background:
    radial-gradient(900px 500px at 0% -10%, rgb(91 140 255 / 0.10), transparent 60%),
    radial-gradient(800px 500px at 100% -5%, rgb(123 97 255 / 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 { letter-spacing: -0.015em; }
h1 { font-size: 1.6rem; font-weight: 800; margin: 0; }
h2 { font-size: 1.22rem; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 1.05rem; font-weight: 700; margin: 0 0 8px; }
p { margin: 0 0 12px; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.85rem; }
.big-text { font-size: 1.2rem; }
.icon { flex-shrink: 0; vertical-align: middle; }
.loading { color: var(--muted); font-size: 1.2rem; }
.print-only { display: none; }
.num, .shift-time, .emp-rate, .hours-total, .hours-mini { font-variant-numeric: tabular-nums; }

a { color: var(--primary); }

::selection { background: rgb(91 140 255 / 0.35); }
:focus-visible { outline: none; box-shadow: var(--ring); }

/* thin, dark scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-size: 0.97rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text);
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.08s, filter 0.15s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: var(--grad);
  color: var(--on-primary);
  box-shadow: 0 6px 18px -6px rgb(91 140 255 / 0.6), inset 0 1px 0 rgb(255 255 255 / 0.15);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 8px 22px -6px rgb(91 140 255 / 0.75), inset 0 1px 0 rgb(255 255 255 / 0.18); }
.btn-secondary { background: var(--primary-soft); color: var(--primary-dark); border-color: rgb(91 140 255 / 0.25); }
.btn-secondary:hover:not(:disabled) { background: rgb(91 140 255 / 0.22); }
.btn-light { background: var(--surface-2); border-color: var(--border); }
.btn-light:hover:not(:disabled) { background: var(--surface-3); border-color: #39435a; }
.btn-danger { background: linear-gradient(135deg, #ff6b6b, #e5484d); color: #fff; box-shadow: 0 6px 18px -8px rgb(255 107 107 / 0.6); }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn-small { min-height: 40px; padding: 6px 12px; font-size: 0.88rem; border-radius: 10px; }
.btn-big { min-height: 56px; font-size: 1.08rem; padding: 12px 22px; border-radius: 14px; }
.btn-icon {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.3rem;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.danger-text { color: var(--danger); }
.ok-text { color: var(--ok); }

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 4px;
}
.link-btn:hover { color: var(--primary-dark); }

.pill {
  display: inline-block;
  background: var(--grad);
  color: var(--on-primary);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 10px;
  border-radius: 999px;
}

/* ------------------------------------------------------------------ app shell */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 24px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgb(9 12 19 / 0.72);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--border-soft);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { border-radius: 10px; box-shadow: 0 4px 14px -4px rgb(91 140 255 / 0.55); }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-text strong { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.brand-text span { color: var(--muted); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 14px; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.active { background: var(--primary-soft); color: var(--primary-dark); box-shadow: inset 0 0 0 1px rgb(91 140 255 / 0.25); }

.admin-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 24px;
  background: var(--warn-soft);
  border-bottom: 1px solid rgb(255 193 77 / 0.2);
  color: var(--warn);
  font-weight: 600;
}

.view { max-width: 1440px; margin: 0 auto; padding: 24px; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.page-head p { margin: 4px 0 0; }

.card {
  background: linear-gradient(180deg, rgb(255 255 255 / 0.02), transparent 40%), var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.callout { border-left: 4px solid var(--primary); margin-bottom: 16px; }
.error-card { border-left: 4px solid var(--danger); }

/* ------------------------------------------------------------------ login */

.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(440px, 100%); padding: 32px 30px; box-shadow: var(--shadow-pop); }
.login-card h1, .login-card > p.muted { text-align: center; }
.login-card h1 { margin-bottom: 6px; }
.login-card > p.muted { margin-bottom: 22px; }
.login-logo { display: block; margin: 0 auto 14px; border-radius: 18px; box-shadow: 0 10px 30px -8px rgb(91 140 255 / 0.6); }
.login-card .btn-big { width: 100%; margin-top: 6px; }

/* ------------------------------------------------------------------ forms */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-label { font-weight: 600; font-size: 0.92rem; }
.field-hint { color: var(--muted); font-size: 0.82rem; }

input[type="text"], input[type="password"], input[type="tel"], input[type="email"], input[type="search"],
input[type="date"], input[type="time"], input[type="number"], select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: #39435a; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
select option { background: var(--surface); }

.check { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; cursor: pointer; }
.check input { width: 22px; height: 22px; flex-shrink: 0; accent-color: var(--primary); }

.two-col, .three-col { display: grid; gap: 0 14px; }
.two-col { grid-template-columns: 1fr 1fr; }
.three-col { grid-template-columns: 1fr 1fr 1fr; }

.form-error, .form-warn {
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
}
.form-error { background: var(--danger-soft); color: var(--danger); border: 1px solid rgb(255 107 107 / 0.25); }
.form-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid rgb(255 193 77 / 0.25); }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.push-left { margin-right: auto; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding: 4px; background: var(--input-bg); border: 1px solid var(--border); border-radius: 14px; }
.seg {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.seg:hover { color: var(--text); background: var(--surface-2); }
.seg.active { background: var(--grad); color: var(--on-primary); }
.seg-cook.active { background: var(--cook); color: #1a0e05; }
.seg-manager.active { background: var(--manager); color: #06142b; }
.seg-carhop.active { background: var(--carhop); color: #04200f; }

.money-input { position: relative; }
.money-input span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.money-input input { padding-left: 30px; }

.date-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.date-row input { flex: 1; min-width: 170px; width: auto; }

.subform { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin: 16px 0; background: rgb(255 255 255 / 0.015); }
.subform legend { font-weight: 700; padding: 0 6px; }

.inline-form { display: flex; gap: 10px; }
.inline-form input { flex: 1; }

/* ------------------------------------------------------------------ dialogs */

dialog.modal {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-pop);
}
dialog.modal[open] { display: flex; flex-direction: column; animation: pop-in 0.18s ease-out; }
dialog.modal-wide { width: min(780px, calc(100vw - 32px)); }
dialog.modal-small { width: min(460px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(3 5 10 / 0.65); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: none; } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px 12px 22px;
  border-bottom: 1px solid var(--border-soft);
}
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 22px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-soft);
  background: rgb(255 255 255 / 0.015);
}
.confirm-text { font-size: 1.05rem; }

/* ------------------------------------------------------------------ toast */

#toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 1000;
  max-width: calc(100vw - 32px);
  padding: 14px 20px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
  transition: opacity 0.2s, transform 0.2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: #3a1719; border-color: rgb(255 107 107 / 0.4); color: #ffd4d4; }

/* ------------------------------------------------------------------ schedule */

.week-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.week-title { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.week-title strong { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; white-space: nowrap; }
.week-of { color: var(--faint); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; }

.danger-zone { display: flex; justify-content: center; margin-top: 28px; }

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px 10px 18px;
  border-radius: 14px;
  font-weight: 600;
  border: 1px solid transparent;
}
.status-bar.ok { background: var(--ok-soft); color: var(--ok); border-color: rgb(61 220 151 / 0.22); }
.status-bar.warn { background: var(--warn-soft); color: var(--warn); border-color: rgb(255 193 77 / 0.22); }

.action-bar { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }

.schedule-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }

.week-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; }

.day-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.day-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(180deg, var(--surface-3), var(--day-head));
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
}
.day-card.today { border-color: rgb(91 140 255 / 0.45); box-shadow: 0 0 0 1px rgb(91 140 255 / 0.25), 0 14px 34px -14px rgb(91 140 255 / 0.45); }
.day-card.today .day-head { background: var(--grad); color: #fff; border-bottom-color: transparent; }
.day-card.today .day-head .pill { background: #fff; color: var(--primary); }
.day-name { font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.92rem; }
.day-date { color: var(--muted); font-weight: 500; }
.day-card.today .day-date { color: rgb(255 255 255 / 0.85); }

.day-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.col { display: flex; flex-direction: column; border-left: 1px solid var(--border-soft); min-width: 0; }
.col:first-child { border-left: none; }
.col-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 4px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-bottom: 2px solid;
}
.col-head::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.col-cook .col-head { color: var(--cook); background: var(--cook-soft); border-color: var(--cook); }
.col-manager .col-head { color: var(--manager); background: var(--manager-soft); border-color: var(--manager); }
.col-carhop .col-head { color: var(--carhop); background: var(--carhop-soft); border-color: var(--carhop); }

.shift {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: 10px 4px;
  border: none;
  border-bottom: 1px solid var(--border-soft);
  background: none;
  color: var(--text);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.12s;
}
.shift:hover { background: var(--surface-2); }
.shift-name { font-weight: 650; font-size: 0.95rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shift-time { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.shift.warn { background: var(--warn-soft); box-shadow: inset 3px 0 0 var(--warn); }
.shift-warn { color: var(--warn); font-size: 0.72rem; font-weight: 700; }

.add-shift {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 38px;
  margin: 8px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: none;
  color: var(--faint);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.add-shift:hover { border-color: var(--primary); border-style: solid; color: var(--primary-dark); background: var(--primary-soft); }

/* hours & pay */
.hours-panel { position: sticky; top: 88px; max-height: calc(100vh - 104px); overflow-y: auto; padding: 18px 18px 0; }
.hours-panel h2 { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; margin-bottom: 6px; }
.hours-panel h2 .icon { color: var(--primary); }
.hours-group h3 { display: flex; align-items: center; gap: 8px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; margin: 16px 0 4px; }
.hours-group h3::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.group-cook { color: var(--cook); }
.group-manager { color: var(--manager); }
.group-carhop { color: var(--carhop); }
.hours-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; table-layout: fixed; }
.hours-table td { padding: 8px 2px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.hours-table tr:last-child td { border-bottom: none; }
/* fixed widths so hours and pay line up across every group */
.hours-table td:nth-child(2) { width: 6.6rem; }
.hours-table td:nth-child(3) { width: 6.8rem; }
.hours-table .num { text-align: right; white-space: nowrap; padding-left: 8px; }
.hours-table td:nth-child(3).num { font-weight: 600; }
.emp-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emp-rate { display: block; color: var(--faint); font-size: 0.78rem; }
.hours-table tr.zero td { color: var(--faint); }
.hours-table tr.zero .emp-rate { color: var(--faint); }
.ot { display: block; width: max-content; margin: 3px 0 0 auto; padding: 1px 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 0.68rem; font-weight: 700; }
.hours-total {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6.6rem 6.8rem;
  align-items: baseline;
  margin: 10px -18px 0;
  padding: 14px 20px 14px 20px;
  font-size: 1rem;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border-top: 1px solid var(--border);
}
.hours-total span { color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.75rem; }
.hours-total strong { text-align: right; font-weight: 700; }
.hours-total strong:last-child {
  font-size: 1.15rem;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hours-panel > p.muted { margin: 0 -18px; padding: 0 20px 16px; background: var(--surface); font-size: 0.78rem; }

.hours-mini { display: none; }

/* shift dialog */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.chip:hover { border-color: #39435a; background: var(--surface-3); }
.chip.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); }

.day-chips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  min-height: 56px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.day-chip:hover { border-color: #39435a; }
.day-chip small { font-weight: 500; opacity: 0.75; }
.day-chip.active { background: var(--grad); border-color: transparent; color: var(--on-primary); }

.people-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.person {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  min-height: 56px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.person:hover { border-color: #39435a; background: var(--surface-3); }
.person .icon { grid-row: 1 / 3; grid-column: 2; color: var(--primary); }
.person-name { grid-column: 1; font-weight: 700; }
.person-hours { grid-column: 1; color: var(--muted); font-size: 0.82rem; }
.person.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.others { margin-top: 10px; }
.others summary { cursor: pointer; color: var(--primary); font-weight: 600; padding: 8px 0; }

.time-row { display: flex; align-items: flex-end; gap: 10px; }
.time-row label { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.time-row label span { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.time-to { padding-bottom: 12px; color: var(--muted); }
.shift-length { margin: 10px 0 0; font-weight: 700; color: var(--muted); }
.shift-length.bad { color: var(--danger); }

/* picture dialog */
.help-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid rgb(91 140 255 / 0.22);
  padding: 12px 14px;
  border-radius: 12px;
}
.picture-frame {
  max-height: 50vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.picture-preview { display: block; width: 100%; height: auto; }

/* ------------------------------------------------------------------ employees */

.roster-group { margin-bottom: 26px; }
.group-title { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; border-left: none; padding-left: 0; }
.group-title::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.roster-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.emp-card { display: flex; flex-direction: column; justify-content: space-between; transition: border-color 0.15s; }
.emp-card:hover { border-color: var(--border); }
.emp-info h3 { font-size: 1.15rem; margin: 0 0 4px; }
.emp-info p { margin: 2px 0; }
.emp-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.emp-actions .btn { padding: 8px 6px; }

.removed-list { margin-top: 10px; }
.removed-list summary { font-weight: 700; cursor: pointer; }
.removed-list p { margin-top: 10px; }
.removed-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid var(--border-soft); }

.login-slip { border: 1px dashed var(--border); border-radius: var(--radius); padding: 10px 16px; margin-bottom: 12px; background: var(--input-bg); }
.login-slip div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.login-slip span { color: var(--muted); }
.login-slip strong { font-size: 1.1rem; word-break: break-all; text-align: right; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

/* ------------------------------------------------------------------ settings */

.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.howto dt { font-weight: 700; margin-top: 12px; }
.howto dd { margin: 4px 0 0; color: var(--muted); }

/* ------------------------------------------------------------------ admin */

.search-row { margin-bottom: 16px; max-width: 520px; }
.store-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 16px; }
.store-card.is-blocked { border-left: 4px solid var(--danger); }
.store-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.store-top h2 { margin: 0; }
.store-name { display: block; font-size: 0.95rem; font-weight: 500; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.badge { padding: 4px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: rgb(61 220 151 / 0.25); }
.badge-bad { background: var(--danger-soft); color: var(--danger); border-color: rgb(255 107 107 / 0.25); }
.badge-paid { background: var(--primary-soft); color: var(--primary-dark); border-color: rgb(91 140 255 / 0.25); }
.badge-free { background: var(--free-soft); color: var(--free); border-color: rgb(179 155 255 / 0.25); }
.badge-trial { background: var(--warn-soft); color: var(--warn); border-color: rgb(255 193 77 / 0.25); }
.store-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 16px; font-size: 0.92rem; }
.store-facts dt { color: var(--faint); }
.store-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.store-facts .notes { white-space: pre-wrap; }
.store-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.contact-card { margin-top: 20px; max-width: 720px; }

.login-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.login-row.off, .manager-row.off { opacity: 0.55; }
.login-row.waiting, .manager-row.waiting {
  background: var(--warn-soft);
  border-radius: 10px;
  padding: 12px;
  margin: 6px 0;
  border-bottom: 0;
}
.login-row .badge, .manager-row .badge { margin-left: 8px; vertical-align: middle; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* managers card (store settings) */
.manager-list { list-style: none; margin: 0 0 12px; padding: 0; }
.manager-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; }
.manager-row .muted { font-size: 0.85rem; }
.managers-card h3 { margin: 12px 0 4px; font-size: 1rem; }
.managers-card details.subform summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.title-picker { display: flex; flex-direction: column; gap: 8px; }
.form-actions.wrap { justify-content: flex-start; }
.subform h3 { margin-top: 4px; }

/* ------------------------------------------------------------------ employee view */

.my-week { padding: 0; overflow: hidden; }
.my-week > .big-text { padding: 18px 22px 4px; }
.my-day {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-soft);
}
.my-day:last-child { border-bottom: none; }
.my-day.today { background: var(--primary-soft); box-shadow: inset 4px 0 0 var(--primary); }
.my-date { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.my-date strong { font-size: 1.12rem; }
.my-date span:not(.pill) { color: var(--muted); }
.my-shifts { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
.my-shift { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.my-shift strong { font-size: 1.12rem; font-variant-numeric: tabular-nums; }
.my-day.off .off-text { color: var(--faint); font-size: 1.05rem; font-weight: 600; }
.tag { padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.tag-cook { background: var(--cook-soft); color: var(--cook); }
.tag-manager { background: var(--manager-soft); color: var(--manager); }
.tag-carhop { background: var(--carhop-soft); color: var(--carhop); }

/* ------------------------------------------------------------------ small screens */

@media (max-width: 1100px) {
  .schedule-layout { grid-template-columns: minmax(0, 1fr); }
  .hours-panel { position: static; max-height: none; }
  .hours-total { position: static; }
}

@media (max-width: 760px) {
  html { font-size: 17px; }
  body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
  /* no blur here: a backdrop-filter would trap the fixed bottom tab bar inside the top bar */
  .topbar {
    padding: 8px 16px;
    padding-top: max(8px, env(safe-area-inset-top));
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 0;
    padding: 0 0 env(safe-area-inset-bottom);
    border: none;
    border-top: 1px solid var(--border-soft);
    border-radius: 0;
    background: rgb(9 12 19 / 0.85);
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    backdrop-filter: saturate(160%) blur(16px);
  }
  .tab {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-height: var(--nav-h);
    padding: 6px 2px;
    border-radius: 0;
    font-size: 0.72rem;
    text-align: center;
  }
  .tab.active { background: none; box-shadow: inset 0 2px 0 var(--primary); color: var(--primary-dark); }
  .view { padding: 16px 16px 96px; }
  .admin-banner { padding: 8px 16px; }
  .week-grid { grid-template-columns: minmax(0, 1fr); }
  .week-title strong { font-size: 1.2rem; }
  .shift-time { font-size: 0.8rem; }
  .shift-name { font-size: 0.93rem; }
  .roster-list, .store-list, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .two-col, .three-col { grid-template-columns: minmax(0, 1fr); }
  .action-bar .btn { flex: 1 1 auto; }
  .card { padding: 18px; }
  .hours-panel { padding: 18px 18px 0; }

  .hours-mini {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px);
    z-index: 35;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    min-height: 50px;
    border: 1px solid rgb(255 255 255 / 0.12);
    border-radius: 999px;
    background: var(--grad);
    color: #fff;
    font: inherit;
    font-weight: 700;
    box-shadow: 0 12px 30px -8px rgb(91 140 255 / 0.6);
    cursor: pointer;
  }
  .hours-mini .mini-link { margin-left: auto; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; font-size: 0.88rem; }

  #toast { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 70px); }
  dialog #toast, dialog.modal ~ #toast { bottom: 90px; }
}

@media (max-width: 600px) {
  .hide-small { display: none; }
  dialog.modal-small { width: calc(100vw - 24px); }
  dialog.modal:not(.modal-small) {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: none;
    border-radius: 0;
  }
  .modal-head { padding-top: max(12px, env(safe-area-inset-top)); }
  .people-list { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .day-chip { padding: 6px 0; font-size: 0.85rem; }
  .segmented .seg { min-height: 44px; }
  .store-top { flex-direction: column; }
  .badges { justify-content: flex-start; }
  .inline-form { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------------ notes card */
.notes-card { margin-top: 16px; }
.notes-card h2 { margin: 0 0 4px; font-size: 1.1rem; }
.notes-card textarea { width: 100%; margin-top: 8px; }
.notes-status { display: block; min-height: 1.2em; margin-top: 4px; }

/* ------------------------------------------------------------------ printing (one page, black & white, light on ink)
   Only the .print-sheet prints: 2 boxes across, 4 down (7 days + Notes), like the paper schedule.
   No filled backgrounds anywhere, just thin lines and black text. */

@media print {
  @page { size: letter portrait; margin: 0.35in; }
  html, body { background: #fff !important; color: #000 !important; padding: 0; margin: 0; }
  .topbar, .admin-banner, .no-print, .hours-mini, #toast, dialog { display: none !important; }
  .view > :not(.print-sheet) { display: none !important; }
  .view { padding: 0 !important; margin: 0 !important; max-width: none !important; }

  .print-sheet {
    display: flex !important; flex-direction: column;
    width: 100%; height: 10.25in;
    font-family: Arial, Helvetica, sans-serif; color: #000; font-weight: 600;
  }
  .ps-head { text-align: center; border: 1px solid #000; padding: 4px 8px 6px; margin-bottom: 8px; }
  .ps-store { font-size: 11pt; font-weight: 600; }
  .ps-range { font-size: 26pt; font-weight: 800; line-height: 1.1; }
  .ps-key { font-size: 7.5pt; font-weight: 400; }

  .ps-grid {
    flex: 1; min-height: 0; display: grid;
    grid-template-columns: 1fr 1fr; grid-template-rows: repeat(4, 1fr);
    border-top: 1px solid #000; border-left: 1px solid #000;
  }
  .ps-cell {
    display: grid; grid-template-columns: 1fr 0.8fr 1fr; gap: 4px;
    padding: 4px 6px; overflow: hidden; min-height: 0;
    border-right: 1px solid #000; border-bottom: 1px solid #000;
  }
  .ps-col { display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
  .ps-mid { text-align: center; justify-content: flex-start; }
  .ps-mgr { flex: 1; margin-top: 2px; }
  .ps-day { font-size: 8pt; font-weight: 400; }
  .ps-date { font-size: 12pt; font-weight: 700; }
  .ps-shift { line-height: 1.25; margin-bottom: 1px; overflow-wrap: anywhere; }
  .ps-name, .ps-time { white-space: nowrap; }
  .ps-size-1 .ps-shift { font-size: 10.5pt; }
  .ps-size-2 .ps-shift { font-size: 9pt; }
  .ps-size-3 .ps-shift { font-size: 7.5pt; line-height: 1.2; }

  .ps-notes { display: block; }
  .ps-notes .ps-day { text-align: center; font-size: 9pt; margin-bottom: 4px; }
  .ps-notes-text { white-space: pre-wrap; font-size: 10pt; line-height: 1.35; text-transform: uppercase; }
}

/* backups */
.backup-list { list-style: none; margin: 0 0 12px; padding: 0; max-height: 420px; overflow-y: auto; }
.backup-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; }
.backup-list .muted { font-size: 0.85rem; }
.backup-actions { display: flex; gap: 6px; }
