/* Staff admin shell. Public customer pages use app.css only and are unchanged. */
body.staff-app {
  --staff-bg: #f3f4f6;
  --staff-panel: #ffffff;
  --staff-ink: #111827;
  --staff-muted: #6b7280;
  --staff-line: #e5e7eb;
  --staff-line-strong: #d1d5db;
  --staff-soft: #f9fafb;
  --staff-hover: #f3f4f6;
  --staff-sidebar: 244px;
  --staff-top: 56px;
  --staff-tabs: 60px;
  --staff-radius: 10px;
  --staff-shadow: 0 1px 2px rgba(17, 24, 39, 0.05), 0 8px 24px rgba(17, 24, 39, 0.06);
  --accent: var(--primary, #2563eb);
  --accent-ink: #ffffff;
  background: var(--staff-bg);
  color: var(--staff-ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color-scheme: light;
  -webkit-font-smoothing: antialiased;
}
body.staff-app, body.staff-app * { box-sizing: border-box; }
body.staff-app :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

body.staff-app a { color: var(--accent); }
body.staff-app { --staff-banner: 0px; }
body.staff-app:has(> .test-banner) { --staff-banner: 2.15rem; }
body.staff-app .test-banner { position: relative; z-index: 40; flex: 0 0 auto; }

/* ---- sidebar ---- */
.staff-shell { min-height: 100vh; }
.staff-sidebar {
  position: fixed;
  top: var(--staff-banner); left: 0; bottom: 0;
  width: var(--staff-sidebar);
  background: var(--staff-panel);
  border-right: 1px solid var(--staff-line);
  display: flex;
  flex-direction: column;
  z-index: 30;
  padding: 20px 14px 16px;
  overflow: visible;
}
.staff-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 20px;
  text-decoration: none;
  color: var(--staff-ink);
  font-weight: 650;
  font-size: 0.98rem;
  min-width: 0;
  overflow: visible;
}
.staff-brand img {
  height: auto;
  max-height: 40px;
  max-width: 100%;
  width: auto;
  object-fit: contain;
  object-position: left center;
  display: block;
  flex: 0 1 auto;
}
.staff-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.staff-nav a, .staff-nav .staff-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #374151;
  text-decoration: none;
  font-weight: 550;
  font-size: 0.94rem;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.staff-nav a:hover, .staff-nav .staff-nav-item:hover { background: var(--staff-hover); color: var(--staff-ink); }
.staff-nav a.on {
  background: color-mix(in srgb, var(--accent) 12%, white);
  color: var(--accent);
}
.staff-nav svg { width: 20px; height: 20px; flex: 0 0 20px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.staff-side-foot {
  border-top: 1px solid var(--staff-line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.staff-offices { display: flex; flex-direction: column; gap: 2px; }
.staff-offices form { margin: 0; }
.staff-offices button, .staff-offices .on-office {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.86rem;
  color: #374151;
  cursor: pointer;
}
.staff-offices button:hover { background: var(--staff-hover); }
.staff-offices .on-office {
  background: var(--staff-soft);
  color: var(--staff-ink);
  font-weight: 600;
  cursor: default;
}
.staff-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
}
.staff-user .meta { min-width: 0; flex: 1; }
.staff-user .meta strong { display: block; font-size: 0.86rem; line-height: 1.3; }
.staff-user .meta a, .staff-user .meta span { font-size: 0.78rem; color: var(--staff-muted); text-decoration: none; }
.staff-user .meta a:hover { color: var(--accent); }
.avatar {
  width: 32px; height: 32px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  background: color-mix(in srgb, var(--accent) 16%, white);
  color: var(--accent);
  flex: 0 0 32px;
}
.avatar.sm { width: 28px; height: 28px; font-size: 0.68rem; flex-basis: 28px; }

/* ---- main ---- */
.staff-main {
  margin-left: var(--staff-sidebar);
  min-height: 100vh;
  padding: 28px 32px 48px;
}
.staff-topbar { display: none; }
.staff-flash { margin: 0 0 16px; }
.staff-flash:empty { display: none; margin: 0; }
.staff-flash .pill { margin: 0 0 8px; }
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 22px;
}
.page-head h1 { font-size: 1.45rem; margin: 0 0 4px; letter-spacing: -0.02em; }
.page-head .sub { margin: 0; color: var(--staff-muted); font-size: 0.92rem; }
.page-head .actions { display: flex; gap: 8px; flex-shrink: 0; padding-top: 2px; }

/* panels and tables */
body.staff-app .card {
  background: var(--staff-panel);
  border: 1px solid var(--staff-line);
  border-radius: var(--staff-radius);
  box-shadow: none;
  padding: 18px 20px 14px;
  margin: 0 0 16px;
}
body.staff-app .btn {
  border-radius: 8px;
  padding: 8px 13px;
  font-size: 0.9rem;
  font-weight: 600;
}
body.staff-app .btn.primary { box-shadow: none; }
body.staff-app input, body.staff-app select, body.staff-app textarea {
  border-radius: 8px;
  background: var(--staff-panel);
  border: 1px solid var(--staff-line-strong);
  padding: 8px 10px;
}
body.staff-app .pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border: 0;
  background: #e5e7eb;
  color: #374151;
}
body.staff-app .pill.state.good { background: #dcfce7; color: #166534; }
body.staff-app .pill.state.bad { background: #fee2e2; color: #991b1b; }
body.staff-app .pill.state.wait { background: #fef3c7; color: #92400e; }
body.staff-app .pill.state.off { background: #f3f4f6; color: #6b7280; }

.panel {
  background: var(--staff-panel);
  border: 1px solid var(--staff-line);
  border-radius: var(--staff-radius);
  overflow: hidden;
  margin: 0 0 20px;
}
.table-wrap { overflow-x: auto; }
body.staff-app .table { margin: 0; font-size: 0.92rem; }
body.staff-app .table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--staff-muted);
  font-weight: 650;
  background: var(--staff-soft);
  padding: 10px 14px;
  border-bottom: 1px solid var(--staff-line);
  white-space: nowrap;
}
body.staff-app .table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--staff-line);
  vertical-align: middle;
}
body.staff-app .table tr:last-child td { border-bottom: 0; }
body.staff-app .table tbody tr:hover td { background: var(--staff-soft); }
body.staff-app .table a.row-link { color: inherit; text-decoration: none; font-weight: 600; }
body.staff-app .table a.row-link:hover { color: var(--accent); }
.who { display: flex; align-items: center; gap: 10px; }
.who .who-text { min-width: 0; }
.who .who-text strong, .who .who-text .name { display: block; font-weight: 600; }
.who .who-text .mut { display: block; font-size: 0.82rem; }

/* tabs */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0;
  background: var(--staff-soft);
  border: 1px solid var(--staff-line);
  border-radius: 9px;
  padding: 3px;
  margin: 0 0 16px;
}
.seg a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 7px;
  color: #374151;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}
.seg a:hover { color: var(--staff-ink); }
.seg a.on { background: var(--staff-panel); color: var(--staff-ink); box-shadow: 0 1px 2px rgba(17,24,39,0.06); }
.seg .count {
  font-size: 0.72rem;
  background: #e5e7eb;
  color: #374151;
  border-radius: 999px;
  padding: 0 6px;
  min-width: 1.3em;
  text-align: center;
  font-weight: 700;
}
.seg a.on .count { background: color-mix(in srgb, var(--accent) 16%, white); color: var(--accent); }

/* calendar day list */
.day-block { margin: 0 0 28px; }
.day-block h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--staff-muted); margin: 0 0 8px; }
.time-list { background: var(--staff-panel); border: 1px solid var(--staff-line); border-radius: var(--staff-radius); overflow: hidden; }
.time-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--staff-line);
}
.time-row:last-child { border-bottom: 0; }
.time-row .when { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--staff-ink); padding-top: 2px; }
.time-row .event h3 { margin: 0 0 2px; font-size: 0.98rem; }
.time-row .event p { margin: 0; }
.time-row .acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.empty { padding: 28px 16px; text-align: center; color: var(--staff-muted); }

/* week grid */
.week-grid { display: flex; flex-direction: column; gap: 0; }
.week-day {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--staff-line);
  align-items: start;
}
.week-day:last-child { border-bottom: 0; }
.week-day .day-label { display: flex; align-items: center; gap: 10px; font-weight: 650; padding-top: 6px; }
.hours-ranges { display: flex; flex-direction: column; gap: 8px; }
.hours-range, .hours-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.hours-range .times { font-variant-numeric: tabular-nums; font-weight: 550; }
.switch {
  appearance: none;
  width: 36px; height: 20px;
  border-radius: 999px;
  background: #d1d5db;
  border: 0;
  position: relative;
  cursor: pointer;
  flex: 0 0 36px;
  padding: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.switch.on { background: var(--accent); }
.switch.on::after { left: 18px; }
.switch-form { display: inline; margin: 0; }

/* settings */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 28px;
  align-items: start;
}
.settings-nav { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: #374151;
  text-decoration: none;
  font-weight: 550;
  font-size: 0.92rem;
}
.settings-nav a:hover { background: var(--staff-hover); }
.settings-nav a.on { background: color-mix(in srgb, var(--accent) 12%, white); color: var(--accent); }

/* drawer / dialog */
.drawer-back {
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, 0.35);
  z-index: 50;
}
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 100%);
  background: var(--staff-panel);
  z-index: 51;
  box-shadow: -8px 0 30px rgba(17,24,39,0.12);
  overflow: auto;
  padding: 24px 24px 40px;
}
.drawer h2 { margin-top: 0; }
.drawer[hidden], .drawer-back[hidden] { display: none !important; }
.password-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--staff-soft);
  border: 1px solid var(--staff-line);
  border-radius: 8px;
  padding: 10px 12px;
}
code.password-once {
  background: transparent;
  padding: 0;
  font-size: 1rem;
  flex: 1;
  word-break: break-all;
}

/* login */
body.staff-auth { display: flex; flex-direction: column; min-height: 100vh; }
.staff-auth-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}
.staff-auth-card {
  width: min(420px, 100%);
  background: var(--staff-panel);
  border: 1px solid var(--staff-line);
  border-radius: 14px;
  padding: 28px 28px 24px;
  box-shadow: var(--staff-shadow);
}
.staff-auth-card .auth-logo { display: flex; justify-content: center; margin-bottom: 16px; }
.staff-auth-card .auth-logo img { height: 40px; width: auto; }

/* mobile chrome */
.staff-menu-btn, .staff-nav-toggle, .staff-tabs { display: none; }

@media (max-width: 900px) {
  .staff-sidebar {
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    top: calc(var(--staff-banner) + var(--staff-top));
    width: min(280px, 86vw);
    box-shadow: var(--staff-shadow);
  }
  .staff-nav-toggle:checked ~ .staff-shell .staff-sidebar { transform: translateX(0); }
  .staff-nav-toggle:checked ~ .staff-scrim { display: block; }
  .staff-scrim {
    display: none;
    position: fixed; inset: 0;
    background: rgba(17,24,39,0.35);
    z-index: 25;
  }
  .staff-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--staff-top);
    background: var(--staff-panel);
    border-bottom: 1px solid var(--staff-line);
    padding: 0 12px;
  }
  .staff-topbar .mark { display: flex; align-items: center; gap: 8px; font-weight: 650; color: inherit; text-decoration: none; }
  .staff-topbar img { height: 24px; width: auto; }
  .staff-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border: 0;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: var(--staff-ink);
  }
  .staff-main { margin-left: 0; padding: 20px 16px calc(var(--staff-tabs) + 24px); }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
  .week-day { grid-template-columns: 1fr; gap: 8px; }
  .time-row { grid-template-columns: 56px 1fr; }
  .time-row .acts { grid-column: 1 / -1; justify-content: flex-start; }
  .staff-tabs {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 20;
    height: var(--staff-tabs);
    background: var(--staff-panel);
    border-top: 1px solid var(--staff-line);
    padding: 0 2px env(safe-area-inset-bottom);
  }
  .staff-tabs a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.64rem;
    font-weight: 600;
    color: #6b7280;
    text-decoration: none;
    min-width: 0;
  }
  .staff-tabs a svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
  .staff-tabs a.on { color: var(--accent); }
  .page-head { flex-direction: column; align-items: stretch; }
}

@media (max-width: 600px) {
  body.staff-app { overflow-x: hidden; }
  body.staff-app .staff-main,
  body.staff-app .panel,
  body.staff-app .table-wrap { max-width: 100%; overflow-x: hidden; }
  body.staff-app .table .hide-sm { display: none; }
  body.staff-app .table thead { display: none; }
  body.staff-app .table,
  body.staff-app .table tbody { display: block; width: 100%; }
  body.staff-app .table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--staff-line);
    width: 100%;
    box-sizing: border-box;
  }
  body.staff-app .table tr:last-child { border-bottom: 0; }
  body.staff-app .table td {
    border: 0;
    padding: 0;
    min-width: 0;
    background: transparent;
  }
  body.staff-app .table tbody tr:hover td { background: transparent; }
  body.staff-app .table td[colspan] { flex: 1 0 100%; }
  body.staff-app .table td:first-child { flex: 1 1 8rem; }
  body.staff-app .table td:last-child {
    flex: 1 0 100%;
    display: flex;
    justify-content: flex-end;
    gap: 6px;
  }
  body.staff-app .table .acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
  body.staff-app .table .btn { padding: 7px 11px; }
  body.staff-app .who,
  body.staff-app .who-text { min-width: 0; max-width: 100%; }
  body.staff-app .who-text,
  body.staff-app .who-text .mut { overflow-wrap: anywhere; word-break: break-word; }
}

@media (min-width: 1200px) {
  .staff-main { padding: 32px 40px 56px; max-width: 1280px; }
}
body.staff-app h2 { font-size: 1.05rem; letter-spacing: -0.01em; }
body.staff-app .mut { color: var(--staff-muted); }

body.staff-app .hours-add input[type="time"],
body.staff-app .hours-range input[type="time"] {
  width: auto;
  max-width: 10.5rem;
  flex: 0 0 auto;
}
.hours-add { margin: 0; }
.offices-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--staff-muted);
  margin: 0 0 4px;
  padding: 0 10px;
  font-weight: 650;
}
.staff-offices { margin-bottom: 4px; }
body.staff-auth .staff-auth-card .card {
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 0;
  margin: 0;
}
body.staff-auth .staff-auth-card h1 { margin: 0 0 4px; font-size: 1.35rem; }
