:root {
  --bg:         #0f1115;
  --bg2:        #1a1d24;
  --border:     #2a2f3a;
  --text:       #e5e7eb;
  --text-dim:   #9ca3af;
  --text-muted: #6b7280;
  --accent:     #6366f1;
  --ok:         #22c55e;
  --warn:       #f59e0b;
  --bad:        #ef4444;
  --radius:     6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.5; overflow-x: hidden; }

.sch_topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; background: var(--bg2); border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 0.5rem; }
.sch_brand { color: var(--text); text-decoration: none; font-weight: 700; }
.sch_nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; row-gap: 0.5rem; }
.sch_nav a { color: var(--text-dim); text-decoration: none; }
.sch_nav a:hover { color: var(--text); }
.sch_logout { color: var(--bad); }

/* Manager mode — purple takeover nav */
.sch_topbar_mgr { background: linear-gradient(90deg, #4c1d95, #6d28d9);
  border-bottom: 1px solid #7c3aed; }
.sch_topbar_mgr .sch_brand { color: #fff; }
.sch_nav_mgr a { color: rgba(255,255,255,0.85); }
.sch_nav_mgr a:hover { color: #fff; }
.sch_nav_mgr a.sch_nav_active { color: #fff; font-weight: 700; box-shadow: inset 0 -2px 0 #fff; }
.sch_exit { color: #fde68a; font-weight: 600; }
.sch_exit:hover { color: #fff; }

/* Manager dashboard summary boxes */
.sch_dash_boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem; margin-bottom: 1.25rem; }
.sch_dash_box { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.9rem 1rem;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text); }
a.sch_dash_box:hover { border-color: var(--accent); }
.sch_dash_num { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.sch_dash_label { color: var(--text-dim); font-size: 0.85rem; }
.sch_dash_label small { color: var(--text-muted); }
.sch_dash_box_warn { border-left: 3px solid var(--warn); }

.sch_main { max-width: 720px; margin: 0 auto; padding: 1.25rem 1rem; }

.sch_home h1 { margin-top: 0; }
.sch_conv_list { list-style: none; padding: 0; }
.sch_conv_list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.sch_conv_name { font-weight: 600; }
.sch_conv_alias { color: var(--text-muted); font-size: 0.9rem; margin-left: 0.5rem; }
.sch_badge { background: var(--accent); color: white; padding: 0.1rem 0.4rem;
  border-radius: 4px; font-size: 0.75rem; margin-left: 0.5rem; text-transform: uppercase; }

.sch_empty, .sch_placeholder { color: var(--text-muted); font-style: italic; }

/* Login page (no chrome) */
.sch_login_page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 1rem; }
.sch_login_card { background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; max-width: 420px; width: 100%; }
.sch_login_card h1 { margin-top: 0; }
.sch_login_card code { background: var(--bg); padding: 0.1rem 0.4rem; border-radius: 4px;
  color: var(--accent); }
.sch_flash { background: var(--bg); padding: 0.75rem; border-radius: var(--radius);
  border-left: 3px solid var(--warn); color: var(--text-dim); }
.sch_login_form { margin: 1.25rem 0 0.5rem; display: flex; flex-direction: column; gap: 0.6rem; }
.sch_btn_lg { padding: 0.7rem 1.5rem; font-size: 1rem; width: 100%; cursor: pointer; }
.sch_hint { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.5rem; }
.sch_input_lg { width: 100%; padding: 0.7rem 0.8rem; font-size: 1rem;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); }
.sch_pair_status { margin-top: 0.5rem; color: var(--text-dim); font-size: 0.9rem; }
.sch_pair_status.sch_form_errors { color: var(--bad); background: rgba(239,68,68,0.10);
  border: 1px solid var(--bad); padding: 0.5rem 0.6rem; border-radius: var(--radius); }

/* Home action list */
.sch_action_list { list-style: none; padding: 0; }
.sch_action_list li { padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.sch_action_list a { color: var(--text); font-weight: 600; text-decoration: none; }
.sch_action_list a:hover { color: var(--accent); }
.sch_action_hint { display: block; color: var(--text-muted); font-size: 0.85rem; font-weight: 400; }

/* Buttons */
.sch_btn { display: inline-block; padding: 0.4rem 0.75rem; background: var(--accent);
  color: white; border: 1px solid var(--accent); border-radius: var(--radius);
  text-decoration: none; font-size: 0.9rem; cursor: pointer; }
.sch_btn:hover { opacity: 0.9; }
.sch_btn_outline { background: transparent; color: var(--text); border-color: var(--border); }
.sch_btn_outline:hover { background: var(--bg2); }
.sch_btn_danger { background: var(--bad); border-color: var(--bad); }

/* Slots page */
.sch_subtitle { color: var(--text-muted); margin: 0.25rem 0 1rem; }
.sch_slots_head { margin-bottom: 1rem; }
.sch_slots_toggle { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.sch_week_nav { display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; gap: 0.5rem; }
.sch_week_label { color: var(--text-dim); font-size: 0.9rem; }

.sch_grid { display: flex; flex-direction: column; gap: 0.5rem; }
.sch_day { background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.45rem 0.6rem;
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0.6rem; }
.sch_day_label { display: grid; grid-template-columns: 2.4rem 5rem 22px; align-items: center; gap: 0.4rem; }
.sch_day_dow { font-weight: 700; }
.sch_day_date { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; }

/* Mini calendar-style icon mirroring how this cell paints on the
   monthly calendar. Split diagonally bottom-left -> top-right:
   top-left triangle = AM, bottom-right triangle = PM.
   Green where the period is workable, light red where it's not. */
.sch_day_preview { display: inline-block; width: 22px; height: 22px; flex: 0 0 auto;
  border: 1px solid var(--border); border-radius: 3px; overflow: hidden;
  vertical-align: middle; margin: 0; background: var(--bg); position: relative; }
.sch_day_preview_am, .sch_day_preview_pm { position: absolute; inset: 0; }
.sch_day_preview_am { clip-path: polygon(0 0, 100% 0, 0 100%); }       /* AM = top-left */
.sch_day_preview_pm { clip-path: polygon(100% 0, 100% 100%, 0 100%); } /* PM = bottom-right */

.sch_day[data-current="none"]    .sch_day_preview_am,
.sch_day[data-current="none"]    .sch_day_preview_pm { background: #ef444466; }
.sch_day[data-current="ask"]     .sch_day_preview_am,
.sch_day[data-current="ask"]     .sch_day_preview_pm { background: #eab308; }
.sch_day[data-current="morning"] .sch_day_preview_am { background: #22c55e; }
.sch_day[data-current="morning"] .sch_day_preview_pm { background: #ef444466; }
.sch_day[data-current="night"]   .sch_day_preview_am { background: #ef444466; }
.sch_day[data-current="night"]   .sch_day_preview_pm { background: #22c55e; }
.sch_day[data-current="any"]     .sch_day_preview_am,
.sch_day[data-current="any"]     .sch_day_preview_pm { background: #22c55e; }
.sch_day_today { border-color: var(--accent); }
.sch_day_past { opacity: 0.55; }
.sch_day_buttons { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.25rem; }

.sch_slot_btn { padding: 0.4rem 0.3rem; border: 1px solid var(--border);
  background: var(--bg); color: var(--text-dim); border-radius: var(--radius);
  font-size: 0.85rem; cursor: pointer; min-width: 0; }
.sch_slot_btn:hover:not(:disabled) { background: var(--bg2); color: var(--text); }
.sch_slot_btn:disabled { cursor: not-allowed; opacity: 0.5; }

.sch_slot_active.sch_slot_none    { background: #4b5563; border-color: #4b5563; color: white; }
.sch_slot_active.sch_slot_ask     { background: #eab308; border-color: #eab308; color: #1a1d24; font-weight: 600; }
.sch_slot_active.sch_slot_morning { background: #f59e0b; border-color: #f59e0b; color: #1a1d24; font-weight: 600; }
.sch_slot_active.sch_slot_night   { background: #6366f1; border-color: #6366f1; color: white; font-weight: 600; }
.sch_slot_active.sch_slot_any     { background: var(--ok);  border-color: var(--ok);  color: white; font-weight: 600; }

.sch_banner { padding: 0.6rem 0.8rem; border-radius: var(--radius); margin: 0.5rem 0;
  font-size: 0.9rem; background: var(--bg2); border-left: 3px solid var(--accent); }
.sch_banner_info { color: var(--text); }
.sch_banner_pending { background: rgba(245,158,11,0.10); border-left-color: var(--warn); }
.sch_banner_denied  { background: rgba(239,68,68,0.10);  border-left-color: var(--bad); }
.sch_save_bar { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* Read-only "currently in effect" mini-grid above the editor */
.sch_current_eff { background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.6rem 0.75rem; margin: 0.5rem 0 1rem; }
.sch_current_eff_head { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 0.4rem;
  font-weight: 600; }
.sch_current_eff_head .sch_hint { font-weight: 400; color: var(--text-muted); }
.sch_current_eff_row { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.sch_current_eff_cell { flex: 1 1 0; min-width: 50px;
  display: flex; flex-direction: column; align-items: center;
  padding: 0.35rem 0.25rem; border-radius: 4px; background: var(--bg);
  border: 1px solid var(--border); }
.sch_current_eff_dow { font-size: 0.7rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em; }
.sch_current_eff_slot { font-size: 0.85rem; font-weight: 600; margin-top: 0.1rem; }
.sch_current_eff_cell.sch_slot_none    .sch_current_eff_slot { color: var(--text-muted); font-weight: 400; }
.sch_current_eff_cell.sch_slot_morning .sch_current_eff_slot { color: #f59e0b; }
.sch_current_eff_cell.sch_slot_night   .sch_current_eff_slot { color: #6366f1; }
.sch_current_eff_cell.sch_slot_any     .sch_current_eff_slot { color: var(--ok); }

/* ─── Read-only mini preview box (diagonal AM/PM) ──────────────────────── */
.sch_mini_prev { display: block; width: 26px; height: 26px; margin: 0 auto 0.25rem;
  border: 1px solid var(--border); border-radius: 3px; overflow: hidden;
  position: relative; background: var(--bg); }
.sch_mini_prev .am, .sch_mini_prev .pm { position: absolute; inset: 0; }
.sch_mini_prev .am { clip-path: polygon(0 0, 100% 0, 0 100%); }
.sch_mini_prev .pm { clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.sch_mini_prev.sch_slot_none .am, .sch_mini_prev.sch_slot_none .pm { background: #ef444466; }
.sch_mini_prev.sch_slot_ask .am, .sch_mini_prev.sch_slot_ask .pm { background: #eab308; }
.sch_mini_prev.sch_slot_morning .am { background: #22c55e; }
.sch_mini_prev.sch_slot_morning .pm { background: #ef444466; }
.sch_mini_prev.sch_slot_night .am { background: #ef444466; }
.sch_mini_prev.sch_slot_night .pm { background: #22c55e; }
.sch_mini_prev.sch_slot_any .am, .sch_mini_prev.sch_slot_any .pm { background: #22c55e; }

/* ─── Availability: "set all to" control ───────────────────────────────── */
.sch_set_all { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem;
  flex-wrap: wrap; color: var(--text-dim); font-size: 0.9rem; }
.sch_set_all_group { display: inline-flex; }
.sch_set_all select { background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); padding: 0.35rem 0.5rem; font: inherit; }
.sch_set_all_group .js_set_all_slot { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none; }
.sch_set_all_btn { background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 0.35rem 0.7rem; font: inherit; cursor: pointer;
  border-top-left-radius: 0; border-bottom-left-radius: 0;
  border-top-right-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.sch_set_all_btn:hover { background: var(--bg2); }

/* ─── Availability: change bar + collapsible editor ────────────────────── */
.sch_change_bar { margin: 1rem 0; }
.sch_change_bar[hidden] { display: none; }
.sch_avail_editor[hidden] { display: none; }

/* ─── Preferences ──────────────────────────────────────────────────────── */
.sch_prefs_titlerow { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.sch_pref_dept { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.sch_pref_dept_head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.sch_pref_dept h2 { margin-bottom: 0.5rem; }
.sch_pref_shifts label { display: flex; flex-direction: column; gap: 0.25rem; max-width: 240px;
  color: var(--text-dim); font-size: 0.85rem; margin-bottom: 0.75rem; }
.sch_pref_shifts input { background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); padding: 0.5rem; font: inherit; width: 100%; }
.sch_pref_grid { display: flex; flex-direction: column; gap: 0.4rem; }
.sch_pref_row { display: flex; align-items: center; gap: 0.75rem; }
.sch_pref_dow { min-width: 48px; font-weight: 700; }
.sch_pref_select { flex: 1; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); padding: 0.5rem; font: inherit; }

/* ─── Calendar ─────────────────────────────────────────────────────────── */
.sch_calendar_head { margin-bottom: 1rem; }
.sch_calendar_nav { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 0.5rem 0; }
.sch_calendar_label { font-weight: 700; font-size: 1.05rem; min-width: 11ch; text-align: center; }
.sch_calendar_legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--text-dim); margin-top: 0.4rem; }
.sch_legend { display: inline-flex; align-items: center; gap: 0.35rem; }
.sch_swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--border); }
.sch_sw_approved  { background: #ef4444; }
.sch_sw_pending   { background: #f59e0b; }
.sch_sw_avail_off { background: #ef444466; }

.sch_cal_grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.sch_cal_dow { background: var(--bg2); color: var(--text-dim); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.05em; text-align: center; padding: 0.4rem 0;
  font-weight: 600; }

.sch_cal_day { position: relative; background: var(--bg); aspect-ratio: 1;
  display: flex; align-items: flex-start; justify-content: flex-start; min-height: 56px;
  overflow: hidden; }
.sch_cal_day_other     { opacity: 0.45; }
.sch_cal_day_today     { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Split diagonally bottom-left -> top-right: AM = top-left triangle,
   PM = bottom-right triangle. Matches the editor preview icon. */
.sch_cal_paint { position: absolute; inset: 0; pointer-events: none; }
.sch_cal_paint_am { clip-path: polygon(0 0, 100% 0, 0 100%); }
.sch_cal_paint_pm { clip-path: polygon(100% 0, 100% 100%, 0 100%); }

.sch_cal_am_approved, .sch_cal_pm_approved { background: #ef4444; }
.sch_cal_am_pending,  .sch_cal_pm_pending  { background: #f59e0b; }
.sch_cal_am_avail_off, .sch_cal_pm_avail_off { background: #ef444466; }

.sch_cal_num { position: relative; z-index: 2; padding: 4px 6px; font-size: 0.85rem;
  color: var(--text); text-shadow: 0 1px 2px rgba(0,0,0,0.4); font-weight: 600; }

/* ─── Manager availability snapshot ────────────────────────────────────── */
.sch_avail_snapshot { display: flex; gap: 0.3rem; flex-wrap: wrap; margin: 0.5rem 0; }
.sch_avail_cell { flex: 1 1 0; min-width: 50px;
  display: flex; flex-direction: column; align-items: center;
  padding: 0.35rem 0.25rem; border-radius: 4px; background: var(--bg);
  border: 1px solid var(--border); }
.sch_avail_dow { font-size: 0.7rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em; }
.sch_avail_slot { font-size: 0.85rem; font-weight: 600; margin-top: 0.1rem; }
.sch_avail_cell.sch_slot_none    .sch_avail_slot { color: var(--text-muted); font-weight: 400; }
.sch_avail_cell.sch_slot_morning .sch_avail_slot { color: #f59e0b; }
.sch_avail_cell.sch_slot_night   .sch_avail_slot { color: #6366f1; }
.sch_avail_cell.sch_slot_any     .sch_avail_slot { color: var(--ok); }

@media (max-width: 600px) {
  .sch_cal_day { min-height: 44px; }
  .sch_cal_num { padding: 2px 4px; font-size: 0.75rem; }
  .sch_calendar_legend { font-size: 0.72rem; }
}

/* ─── Heat map ─────────────────────────────────────────────────────────── */
.sch_manager_titlerow { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.sch_heat_filters { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin: 0.6rem 0; }
.sch_heat_filter_label { color: var(--text-dim); font-size: 0.85rem; }
.sch_heat_filter { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; cursor: pointer; }
.sch_heat_scale { display: flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; color: var(--text-muted); flex-wrap: wrap; }
.sch_heat_scaleopts { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; font-size: 0.85rem; color: var(--text-dim); }
.sch_heat_absbox[hidden] { display: none; }
.sch_heat_absbox input { width: 56px; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius); padding: 0.25rem 0.4rem; font: inherit; }
.sch_heat_sw { display: inline-block; width: 16px; height: 16px; border-radius: 3px; border: 1px solid var(--border); }

/* Heat buckets 0..7: green -> yellow -> orange -> red -> bright red. */
.sch_heat_l0 { background: transparent; }
.sch_heat_l1 { background: #22c55e; }
.sch_heat_l2 { background: #84cc16; }
.sch_heat_l3 { background: #eab308; }
.sch_heat_l4 { background: #f59e0b; }
.sch_heat_l5 { background: #f97316; }
.sch_heat_l6 { background: #ef4444; }
.sch_heat_l7 { background: #dc2626; }

/* Heat cells: paint the whole day cell, keep number legible. */
.sch_heatmap .sch_cal_day.sch_heat_l1,
.sch_heatmap .sch_cal_day.sch_heat_l2,
.sch_heatmap .sch_cal_day.sch_heat_l3 { color: #1a1d24; }
.sch_heatmap .sch_cal_day.sch_heat_l4,
.sch_heatmap .sch_cal_day.sch_heat_l5,
.sch_heatmap .sch_cal_day.sch_heat_l6,
.sch_heatmap .sch_cal_day.sch_heat_l7 { color: #ffffff; }
.sch_heatmap .sch_cal_day { flex-direction: column; align-items: flex-start; }
.sch_heatmap .sch_cal_num { text-shadow: none; }
.sch_heat_count { position: relative; z-index: 2; align-self: flex-end; margin: 0 6px 4px auto;
  font-weight: 700; font-size: 0.95rem; }
.sch_heatmap .sch_cal_day { cursor: pointer; }

/* Heat day-detail modal */
.sch_heat_dept { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 0.5rem; overflow: hidden; }
.sch_heat_dept_head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  width: 100%; background: var(--bg2); border: none; color: var(--text); cursor: pointer;
  padding: 0.55rem 0.7rem; font: inherit; font-weight: 600; }
.sch_heat_dept_head:hover { background: var(--bg); }
.sch_heat_people { list-style: none; margin: 0; padding: 0.25rem 0.7rem 0.5rem; }
.sch_heat_people[hidden] { display: none; }
.sch_heat_people li { padding: 0.3rem 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.5rem; }
.sch_heat_people li:last-child { border-bottom: none; }

/* ─── Notes ────────────────────────────────────────────────────────────── */
.sch_note_block { margin: 1.25rem 0; }
.sch_note_textarea { width: 100%; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius); padding: 0.6rem; font: inherit;
  margin-bottom: 0.5rem; resize: vertical; }
.sch_note_readonly { background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.6rem 0.75rem; color: var(--text); white-space: pre-wrap; }

/* ─── Manager: availability board ──────────────────────────────────────── */
.sch_board_scroll { overflow-x: auto; }
.sch_board { border-collapse: collapse; width: 100%; }
.sch_board th, .sch_board td { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); text-align: left; }
.sch_board thead th { background: var(--bg2); font-size: 0.8rem; }
.sch_board th:nth-child(n+3), .sch_board td:nth-child(n+3) { text-align: center; }
.sch_board_name { white-space: nowrap; font-weight: 600; }
.sch_board_depts { color: var(--text-dim); font-size: 0.85rem; }
.sch_board_cell .sch_mini_prev { margin: 0 auto; }
.sch_board_group { margin-bottom: 1.5rem; }
.sch_board_group h3 { margin-bottom: 0.4rem; }

/* ─── Manager: upcoming availability changes ───────────────────────────── */
.sch_future_ver { background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.6rem 0.75rem; margin-bottom: 0.6rem; }
.sch_future_head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.sch_future_actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.5rem; }

/* ─── Manager: preferred shifts per week ───────────────────────────────── */
.sch_mgr_shifts { display: flex; flex-direction: column; gap: 0.4rem; max-width: 360px; }
.sch_mgr_shift_row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.sch_mgr_shift_dept { font-weight: 600; }
.sch_mgr_shift_row input { width: 80px; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius); padding: 0.4rem; font: inherit; }

/* ─── Manager: manage staff ────────────────────────────────────────────── */
.sch_back_link { color: var(--text-dim); text-decoration: none; }
.sch_back_link:hover { color: var(--text); }

/* Person switcher */
.sch_staff_switcher { position: relative; display: inline-block; }
.sch_staff_current { display: inline-flex; align-items: center; gap: 0.5rem;
  background: transparent; border: none; color: var(--text); cursor: pointer;
  font-size: 1.5rem; font-weight: 700; padding: 0; }
.sch_caret { font-size: 0.8rem; color: var(--text-dim); }
.sch_staff_menu { position: absolute; top: 100%; left: 0; z-index: 60; margin-top: 0.4rem;
  width: 300px; max-width: 88vw; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.45); padding: 0.5rem; }
.sch_staff_menu[hidden] { display: none; }
.js_staff_search { width: 100%; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius); padding: 0.5rem; font: inherit; margin-bottom: 0.4rem; }
.sch_staff_list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.sch_staff_item a { display: flex; justify-content: space-between; gap: 0.5rem;
  padding: 0.45rem 0.5rem; border-radius: var(--radius); color: var(--text); text-decoration: none; }
.sch_staff_item a:hover { background: var(--bg); }
.sch_staff_phone { color: var(--text-muted); font-size: 0.8rem; }
.sch_mgr_avail_bar { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.sch_inline_eff { display: inline-flex; flex-direction: column; gap: 0.2rem; color: var(--text-dim); font-size: 0.85rem; }
.sch_inline_eff input { background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); padding: 0.4rem; font: inherit; }
.sch_mgr_timeoff { display: flex; flex-direction: column; gap: 0.75rem; max-width: 520px; }
.sch_mgr_timeoff .sch_field_row { display: flex; gap: 1rem; flex-wrap: wrap; }
.sch_mgr_timeoff label { display: flex; flex-direction: column; gap: 0.25rem; color: var(--text-dim); font-size: 0.85rem; }
.sch_mgr_timeoff input, .sch_mgr_timeoff textarea { background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius); padding: 0.5rem; font: inherit; }

/* History page */
.sch_history h2 { margin-bottom: 0.4rem; }
.sch_history_table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.sch_history_table th, .sch_history_table td {
  padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); text-align: left;
}
.sch_history_table thead th { background: var(--bg2); color: var(--text-dim); font-weight: 600; }
.sch_history_row_latest { background: rgba(99,102,241,0.06); }
.sch_history_cell { text-align: center; font-weight: 600; }
.sch_history_cell.sch_slot_none    { color: var(--text-muted); font-weight: 400; }
.sch_history_cell.sch_slot_morning { color: #f59e0b; }
.sch_history_cell.sch_slot_night   { color: #6366f1; }
.sch_history_cell.sch_slot_any     { color: var(--ok); }
.sch_pill_future { background: rgba(245,158,11,0.18); color: var(--warn); margin-left: 0.35rem; }
.sch_history_action_cell { text-align: right; white-space: nowrap; }
.sch_pill_annual { background: rgba(99,102,241,0.20); color: var(--accent); margin-left: 0.35rem;
  text-transform: uppercase; font-size: 0.7rem; padding: 0.1rem 0.45rem; letter-spacing: 0.05em; }
.sch_inline_check { flex-direction: row !important; align-items: center; gap: 0.5rem !important;
  cursor: pointer; font-weight: 500; color: var(--text); }
.sch_inline_check input { width: auto !important; }
.sch_hint_inline { font-weight: 400; color: var(--text-muted); font-size: 0.78rem;
  flex: 1 1 100%; margin-left: 1.6rem; }
.sch_history_scroll { overflow-x: auto; }

@media (max-width: 600px) {
  /* History tables: collapse to card-per-row layout. data-label on each
     <td> in the view labels the value beside it. The 9 wide-table
     columns no longer fit a phone, so this rebuilds them as stacked
     key/value pairs with the action button at the bottom. */
  .sch_history_table { display: block; font-size: 0.9rem; }
  .sch_history_table thead { display: none; }
  .sch_history_table tbody { display: block; }
  .sch_history_table tr {
    display: block;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.6rem;
    padding: 0.6rem 0.75rem;
  }
  .sch_history_table.sch_history_table_avail tr { padding-bottom: 0.4rem; }
  .sch_history_table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    padding: 0.2rem 0;
    text-align: left;
    gap: 0.6rem;
  }
  .sch_history_table td:before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-dim);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex: 0 0 auto;
  }
  .sch_history_table td[data-label=""]:before { content: none; }
  .sch_history_table td.sch_history_action_cell {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    justify-content: stretch;
  }
  .sch_history_table td.sch_history_action_cell button { width: 100%; }
  .sch_history_row_latest { box-shadow: 0 0 0 2px rgba(99,102,241,0.45); }
}

/* Request list */
.sch_requests_head { margin-bottom: 1rem; }
.sch_req_list { list-style: none; padding: 0; }
.sch_req { background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem; margin-bottom: 0.5rem; }
.sch_req_head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.sch_req_status { font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 4px; font-size: 0.8rem; text-transform: uppercase; }
.sch_status_pending   { background: #f59e0b; color: #1a1d24; }
.sch_status_approved  { background: var(--ok); color: white; }
.sch_status_denied    { background: var(--bad); color: white; }
.sch_status_withdrawn { background: #4b5563; color: white; }
.sch_status_held      { background: #a855f7; color: white; }
.sch_req_created { color: var(--text-muted); font-size: 0.85rem; }
.sch_req_days { list-style: none; padding: 0; margin: 0.3rem 0; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.sch_req_days li { background: var(--bg); padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.85rem; }
.sch_req_period { color: var(--text-muted); margin-left: 0.4rem; font-size: 0.75rem; text-transform: uppercase; }
.sch_rank_badge { display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.4rem; height: 1.4rem; padding: 0 0.35rem; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 0.72rem; font-weight: 700;
  margin-right: 0.4rem; vertical-align: middle; }
.sch_req_note, .sch_req_review { color: var(--text-dim); margin: 0.4rem 0 0; font-style: italic; font-size: 0.9rem; }
.sch_req_review { color: var(--text); border-left: 3px solid var(--accent); padding-left: 0.6rem; }
.sch_btn_sm { padding: 0.2rem 0.5rem; font-size: 0.75rem; margin-left: auto; }

/* Modal */
.sch_modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem; }
.sch_modal[hidden] { display: none; }
.sch_modal_inner { background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.sch_modal_head { display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
.sch_modal_head h2 { margin: 0; }
.sch_modal_close { background: transparent; border: none; color: var(--text);
  font-size: 1.5rem; line-height: 1; cursor: pointer; }
.sch_modal_body { padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.sch_modal_body label { display: flex; flex-direction: column; gap: 0.25rem;
  color: var(--text-dim); font-size: 0.85rem; }
.sch_modal_body input, .sch_modal_body textarea { background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem;
  color: var(--text); font: inherit; }
.sch_modal_foot { display: flex; justify-content: flex-end; gap: 0.5rem;
  padding: 0.75rem 1rem; border-top: 1px solid var(--border); }

.sch_daterange { display: flex; gap: 0.75rem; }
.sch_daterange label { flex: 1; }
.sch_day_rows { display: flex; flex-direction: column; gap: 0.4rem; max-height: 240px; overflow-y: auto; }
.sch_day_row { display: flex; align-items: center; justify-content: space-between;
  padding: 0.4rem 0.6rem; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); }
.sch_day_row_label { font-size: 0.9rem; }
.sch_day_row_buttons { display: flex; gap: 0.25rem; }
.sch_day_row_buttons button { padding: 0.2rem 0.5rem; background: var(--bg2);
  border: 1px solid var(--border); color: var(--text-dim); border-radius: 4px;
  font-size: 0.75rem; cursor: pointer; }
.sch_day_row_buttons button.sch_active { background: var(--accent); border-color: var(--accent); color: white; }

.sch_form_errors, .sch_form_warnings { padding: 0.5rem 0.75rem; border-radius: var(--radius); font-size: 0.85rem; }
.sch_form_errors   { background: rgba(239,68,68,0.12); border: 1px solid var(--bad); color: var(--bad); }
.sch_form_warnings { background: rgba(245,158,11,0.12); border: 1px solid var(--warn); color: var(--warn); }

/* Manager view */
.sch_manager_head h1 { margin-bottom: 0.5rem; }
.sch_tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.sch_tab { padding: 0.5rem 1rem; color: var(--text-dim); text-decoration: none; border-bottom: 2px solid transparent; }
.sch_tab:hover { color: var(--text); }
.sch_tab_active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.sch_pill { background: var(--bg2); padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.75rem; color: var(--text-dim); }

.sch_req_who { font-weight: 600; }
.sch_req_actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; align-items: center; flex-wrap: wrap; }
.sch_review_note { flex: 1; min-width: 180px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0.4rem 0.5rem; font: inherit; }

.sch_cap_scroll { overflow-x: auto; }
.sch_cap_table { border-collapse: collapse; width: 100%; min-width: 700px; }
.sch_cap_table th, .sch_cap_table td { padding: 0.4rem 0.5rem; border: 1px solid var(--border);
  text-align: center; font-size: 0.85rem; }
.sch_cap_table thead th { background: var(--bg2); position: sticky; top: 0; }
.sch_cap_date small { color: var(--text-muted); font-weight: 400; }
.sch_cap_ok   { background: rgba(34,197,94,0.10);  color: var(--text); }
.sch_cap_soft { background: rgba(245,158,11,0.20); color: var(--text); font-weight: 600; }
.sch_cap_hard { background: rgba(239,68,68,0.25);  color: white; font-weight: 700; }

.sch_roster { border-collapse: collapse; width: 100%; }
.sch_roster th, .sch_roster td { padding: 0.5rem; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.9rem; }
.sch_roster thead th { background: var(--bg2); }
.sch_muted { color: var(--text-muted); }
.sch_warn  { color: var(--warn); font-weight: 600; }

.sch_thr { border-collapse: collapse; width: 100%; max-width: 600px; }
.sch_thr th, .sch_thr td { padding: 0.5rem; border-bottom: 1px solid var(--border); text-align: left; }
.sch_thr thead th { background: var(--bg2); }
.sch_thr input[type=number] { width: 72px; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius); padding: 0.3rem; font: inherit; }

.sch_toggle { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; user-select: none; }
.sch_toggle input { transform: scale(1.2); }

/* Toast (used by JS for AJAX feedback) */
.sch_toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%);
  background: var(--bg2); border: 1px solid var(--border); padding: 0.75rem 1.25rem;
  border-radius: var(--radius); color: var(--text); box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 50; }
.sch_toast.sch_toast_show { opacity: 1; }
.sch_toast_ok  { border-left: 3px solid var(--ok); }
.sch_toast_err { border-left: 3px solid var(--bad); }

/* ─── Modal sizing safety: inputs full-width inside body ──────────────── */
.sch_modal_inner { width: 100%; }
.sch_modal_body input,
.sch_modal_body textarea,
.sch_modal_body select { width: 100%; max-width: 100%; }
.sch_modal_foot { flex-wrap: wrap; }

/* ─── Handheld (< 600px) ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .sch_brand                  { display: none; }            /* hide brand to save room */
  .sch_topbar                 { padding: 0.5rem 0.75rem; justify-content: flex-end; }
  .sch_nav                    { gap: 0.75rem; row-gap: 0.4rem; font-size: 0.95rem; }
  .sch_main                   { padding: 1rem 0.6rem; }

  /* Slot grid: keep label + square + buttons on a single line, tighter. */
  .sch_day                    { padding: 0.4rem 0.45rem; gap: 0.4rem; }
  .sch_day_date               { display: none; }            /* drop "every week" on narrow */
  .sch_day_label              { grid-template-columns: 2rem 20px; }
  .sch_slot_btn               { min-width: 0; padding: 0.45rem 0.2rem; font-size: 0.8rem; }

  /* Request-off modal day rows: label on its own line on narrow */
  /* Keep each day on one line: label + AM/PM/Full buttons. */
  .sch_day_row                { flex-wrap: nowrap; gap: 0.35rem; }
  .sch_day_row_label          { flex: 1 1 auto; min-width: 0; font-size: 0.85rem; }
  .sch_day_row_buttons        { flex: 0 0 auto; }
  .sch_day_row_buttons button { padding: 0.25rem 0.45rem; font-size: 0.78rem; }

  /* Modal padding tighter */
  .sch_modal                  { padding: 0.4rem; }
  .sch_modal_body             { padding: 0.75rem; gap: 0.6rem; }
  .sch_modal_head             { padding: 0.5rem 0.75rem; }
  .sch_modal_foot             { padding: 0.5rem 0.75rem; }
}
