@import url('variables.css');

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}
input, select, textarea { font-family: inherit; }
/* One consistent dropdown arrow everywhere: the browser's own arrow sat
   tight against the right edge. The chevron is drawn in the background
   with room on the right; !important beats older inline padding. */
select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 12px;
  padding-right: 30px !important;
  text-overflow: ellipsis;
  cursor: pointer;
}
select:disabled { cursor: not-allowed; opacity: .6; }
/* Base look for text boxes that have no class styling of their own (a few
   Settings rows), so they follow Dark Mode instead of staying white.
   :where() keeps this at zero specificity so any existing rule wins. */
:where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]), textarea, select) {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
}
:where(input, textarea)::placeholder { color: var(--text-secondary); opacity: .8; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; }
select[multiple] { background-image: none; padding-right: 10px !important; }
[data-theme="dark"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
.hidden { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0);
}

/* ---------------------------------------------------------------- */
/* Header                                                          */
/* ---------------------------------------------------------------- */
/* ---------------------------------------------------------------- */
/* Left sidebar + slim top bar (desktop)                             */
/* ---------------------------------------------------------------- */
.app-shell.desktop-only {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Full-width header: brand block on the left, status/actions on the
   right. Fixed height (--topbar-h) rather than padding-driven, so
   .app-sidebar below can key its sticky offset off the same value and
   the two can never drift out of sync again. */
.app-topbar {
  background: var(--navy-dark);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: var(--topbar-h);
  border-bottom: 3px solid var(--red);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.sidebar-brand img { height: 28px; display: block; flex-shrink: 0; }
.sidebar-brand .titles h1 {
  font-size: 14.5px;
  margin: 0;
  letter-spacing: 0.4px;
  font-weight: 800;
  color: var(--white);
  line-height: 1.3;
}
.sidebar-brand .titles small {
  display: block;
  font-size: 9.5px;
  color: var(--gray-300);
  letter-spacing: 1px;
  font-weight: 600;
}

/* Row below the header: sidebar + main content, side by side. */
.app-body-row {
  display: flex;
  align-items: stretch;
  flex: 1 1 auto;
  min-width: 0;
}
.app-sidebar {
  flex: 0 0 220px;
  width: 220px;
  background: var(--navy-dark);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  z-index: 45;
}
.app-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 12px;
  flex: 1 1 auto;
  overflow-y: auto;
}
.app-nav button {
  width: 100%;
  text-align: left;
  color: var(--gray-200);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
}
.app-nav button.active { background: rgba(255,255,255,0.12); color: var(--white); }
.app-nav button:hover { background: rgba(255,255,255,0.08); }
.app-nav-sep { height: 1px; background: rgba(255,255,255,0.1); margin: 8px 4px; flex-shrink: 0; }
.app-nav button { display: flex; align-items: center; gap: 10px; white-space: nowrap; overflow: hidden; }
.nav-icon { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }
/* Collapsible sidebar: icons only, remembered per device. */
.sidebar-collapse-btn {
  margin: 0 12px 8px auto; width: 30px; height: 30px; border-radius: var(--radius-sm);
  color: var(--gray-200); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,0.08); }
.sidebar-collapse-btn svg { width: 16px; height: 16px; transition: transform 0.15s; }
.app-sidebar { transition: flex-basis 0.15s, width 0.15s; }
.app-sidebar.collapsed { flex-basis: 64px; width: 64px; }
.app-sidebar.collapsed .app-nav { padding: 8px 10px; }
.app-sidebar.collapsed .app-nav button { justify-content: center; padding: 8px 0; }
.app-sidebar.collapsed .nav-label { display: none; }
.app-sidebar.collapsed .sidebar-collapse-btn { margin: 0 auto 8px; }
.app-sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
.app-sidebar.collapsed .sidebar-footer { padding: 12px 6px 16px; }
.app-sidebar.collapsed .theme-toggle { flex-direction: column; }
.sidebar-footer {
  margin-top: auto;
  padding: 12px 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-footer .theme-toggle { width: 100%; justify-content: center; }

.app-content-col {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
}
.header-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--gray-200);
  white-space: nowrap;
}
.header-chip strong { color: var(--white); font-size: 13px; }
.shift-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  font-weight: 700;
  font-size: 12.5px;
}
.shift-dot {
  width: 10px; height: 10px; border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.35);
}
.btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
/* User menu: replaces the old separate name-chip + Log out button + always-
   visible "TV Mode" button with one collapsed avatar menu, so the header
   doesn't run four separate right-aligned elements together. "Open TV
   Display" lives inside it (any logged-in role can reach it, matching the
   old TV Mode button's reach) alongside Log out. Logged-out visitors keep
   a plain "Open TV Display" button next to Log In (#btn-tv-mode-anon)
   since TV setup shouldn't require signing in. */
.user-menu { position: relative; }
.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  color: var(--white);
  cursor: pointer;
}
.user-menu-trigger:hover { background: rgba(255,255,255,0.12); }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--red); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; flex-shrink: 0;
}
.user-menu-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.user-chip-name { font-size: 12.5px; font-weight: 700; color: var(--white); }
.user-chip-role { font-size: 10.5px; color: var(--gray-300); }
.user-menu-chevron { font-size: 10px; color: var(--gray-300); }
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  background: var(--navy-dark);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-md, 10px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
  padding: 6px;
  z-index: 60;
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 7px;
  background: transparent;
  color: var(--white);
  font-size: 13.5px;
  font-weight: 600;
}
.user-menu-item:hover { background: rgba(255,255,255,0.08); }
.user-menu-item.danger { color: #FF8A80; }
.user-menu-sep { height: 1px; background: rgba(255,255,255,0.1); margin: 4px 6px; }

.btn-primary { background: var(--red); color: var(--white); }
.btn-primary:hover { background: var(--red-dark); }
.btn-outline-light { border: 1px solid rgba(255,255,255,0.35); color: var(--white); }
.btn-outline-light:hover { background: rgba(255,255,255,0.1); }
.btn-ghost { background: transparent; color: var(--text-primary); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-secondary { background: var(--gray-100); color: var(--text-primary); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger { background: #B42318; color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---------------------------------------------------------------- */
/* Layout                                                           */
/* ---------------------------------------------------------------- */
.app-main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 20px 40px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr);
  gap: 18px;
}
@media (min-width: 1200px) {
  .dashboard-grid { grid-template-columns: minmax(0, 2.6fr) 340px; }
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}
.card-header h2 {
  font-size: 13px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 800;
}
.card-body { padding: 14px 16px; }

/* ---------------------------------------------------------------- */
/* Calendar                                                         */
/* ---------------------------------------------------------------- */
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-color);
}
.calendar-toolbar .nav-group { display: flex; align-items: center; gap: 6px; }
.calendar-toolbar .nav-btn {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-100); font-size: 15px; font-weight: 700; color: var(--accent-text);
}
.calendar-toolbar .nav-btn:hover { background: var(--gray-200); }
.calendar-toolbar .month-label { font-size: 17px; font-weight: 800; color: var(--accent-text); margin: 0 4px; min-width: 160px; }
.view-switch { display: flex; background: var(--gray-100); border-radius: var(--radius-sm); padding: 3px; }
.view-switch button { padding: 6px 12px; font-size: 12.5px; font-weight: 700; border-radius: var(--radius-sm); color: var(--text-secondary); }
.view-switch button.active { background: var(--navy); color: var(--white); }

.calendar-body { padding: 10px 12px 16px; }
/* minmax(0, ...) on every track is deliberate: a bare `1fr` column's
   automatic minimum width is its content's min-content size, so one day
   with an unusually long/unbreakable event title can silently widen that
   whole weekday's column for the entire month. Wrapping each fraction in
   minmax(0, ...) makes the fraction the ONLY thing that decides width -
   event text always wraps/truncates inside whatever space it's given
   instead of resizing the grid. Sat/Sun get a smaller fraction than
   Mon-Fri since weekend cells carry far less. */
.cal-grid { display: grid; grid-template-columns: minmax(0, 0.82fr) repeat(5, minmax(0, 1fr)) minmax(0, 0.82fr); }
.cal-weekday {
  text-align: center; font-size: 11px; font-weight: 800; letter-spacing: 0.5px;
  color: var(--gray-500); padding: 6px 0 10px;
}
.cal-cell {
  border: 1px solid var(--border-color-soft);
  min-height: 108px;
  padding: 5px 6px 6px;
  position: relative;
  background: var(--bg-surface);
}
.cal-cell.outside { background: var(--bg-surface-alt); color: var(--gray-300); }
.cal-cell.today { background: var(--today-tint); }
.cal-cell .cal-date-row {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;
}
.cal-cell .cal-date-num { font-size: 12.5px; font-weight: 700; color: var(--text-primary); }
.cal-cell.outside .cal-date-num { color: var(--gray-300); }
.shift-tag {
  font-size: 9.5px; font-weight: 800; padding: 1px 5px; border-radius: 3px; color: white;
  letter-spacing: 0.3px;
}
.shift-bar { position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: 3px 3px 0 0; }
.cal-events { display: flex; flex-direction: column; gap: 2px; }
.cal-event-chip {
  font-size: 10.5px;
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--gray-100);
  border-left: 3px solid var(--gray-300);
  color: var(--text-primary);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cal-event-chip:hover { background: var(--gray-200); }
.cal-event-chip:focus-visible, .week-event-block:focus-visible, .agenda-event:focus-visible,
.today-item:focus-visible, .m-event-card:focus-visible, .cal-more-link:focus-visible, .week-more-link:focus-visible {
  outline: 2px solid var(--navy); outline-offset: 1px;
}
.cal-event-chip.cal-event-holiday { font-style: italic; opacity: 0.9; }
.cal-more-link { font-size: 10px; color: var(--accent-text); font-weight: 700; cursor: pointer; padding: 1px 4px; }

/* Personnel Off: one compact gray "OFF:" line at the top of a day (Month
   cells, Week/Day column headers, Agenda, Today panel, day pop-out)
   instead of a full event block. Each name is its own focusable button. */
.off-line {
  font-size: 10px; line-height: 1.3; color: var(--text-secondary);
  background: var(--border-color-soft); border-radius: 3px;
  padding: 1px 4px; margin-bottom: 2px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.off-line .off-tag { font-weight: 800; letter-spacing: 0.3px; }
.off-line .off-name { cursor: pointer; }
.off-line .off-name:hover { text-decoration: underline; }
.off-line .off-name:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
.week-day-head .off-line { margin: 4px 0 0; text-align: left; white-space: normal; }
/* Month cells: wrap to at most two lines; the full list is in the tooltip
   and the day pop-out. */
.cal-cell .off-line {
  white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.agenda-day-events .off-line, #today-list .off-line, #m-today-list .off-line, #event-modal-body .off-line {
  font-size: 12px; padding: 4px 8px; margin-bottom: 6px; white-space: normal;
}

/* Week / day view */
.agenda-list { display: flex; flex-direction: column; gap: 8px; }
.agenda-day {
  border: 1px solid var(--border-color); border-radius: var(--radius-md); overflow: hidden; background: var(--bg-surface);
}
.agenda-day-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: var(--bg-surface-alt); font-weight: 800; font-size: 13px; color: var(--text-primary);
}
.agenda-day-events { padding: 6px 10px; }
.agenda-event {
  display: flex; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border-color-soft); cursor: pointer;
}
.agenda-event:last-child { border-bottom: none; }
.agenda-event:hover { background: var(--bg-surface-alt); }
.agenda-event .time { width: 84px; flex-shrink: 0; font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.agenda-event .info .title { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.agenda-event .info .loc { font-size: 12px; color: var(--text-secondary); }
.cat-swatch { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; }

.legend-row { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 16px 14px; font-size: 11.5px; color: var(--text-secondary); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
/* Category legend doubles as the calendar filter - each category is a
   toggle button; a hidden category dims AND gets struck through so the
   state is never conveyed by color/opacity alone. */
.legend-filter {
  background: none; border: none; padding: 2px 4px; border-radius: 4px; font: inherit; color: var(--text-secondary);
  cursor: pointer;
}
.legend-filter:hover { background: var(--bg-surface-hover); }
.legend-filter.is-hidden { opacity: 0.45; text-decoration: line-through; }
.legend-filter:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
/* Compact legend: never wrap a label onto two lines; categories flow as
   one group after a thin divider and wrap as whole items. */
.legend-row { align-items: center; gap: 4px 14px; }
.legend-item, .legend-filter { white-space: nowrap; }
.legend-cats { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; }
.legend-sep { width: 1px; align-self: stretch; min-height: 14px; background: var(--border-color); }

/* ---------------------------------------------------------------- */
/* Sidebar                                                          */
/* ---------------------------------------------------------------- */
.sidebar-col { display: flex; flex-direction: column; gap: 14px; }
.today-panel .date-heading { font-size: 14.5px; font-weight: 800; color: var(--accent-text); }
.today-panel .shift-line { margin-top: 4px; font-size: 12.5px; font-weight: 700; }
.today-panel .count-line { margin-top: 2px; font-size: 11.5px; color: var(--text-secondary); }
.today-time-group { margin-bottom: 4px; }
.today-time-heading {
  font-size: 11px; font-weight: 800; letter-spacing: 0.3px; text-transform: uppercase; color: var(--accent-text);
  padding: 8px 0 4px; border-top: 1px solid var(--border-color-soft);
}
.today-time-group:first-child .today-time-heading { border-top: none; padding-top: 0; }
.today-item {
  display: flex; gap: 10px; padding: 8px 0 8px 10px; border-left: 3px solid var(--gray-300); margin-bottom: 4px; cursor: pointer;
}
.today-item:hover .today-item-title { color: var(--red); }
.today-item-title { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.today-item-loc { font-size: 11.5px; color: var(--text-secondary); }
.empty-note { font-size: 12.5px; color: var(--text-secondary); padding: 6px 0; }

.oncall-card .oncall-person { font-size: 20px; font-weight: 800; color: var(--accent-text); }
.oncall-card .oncall-source-note { margin-top: 3px; font-size: 11.5px; font-weight: 700; color: #B45309; }
.oncall-card .oncall-week-range { margin-top: 4px; font-size: 11.5px; color: var(--text-secondary); }

.wx-temp { font-size: 34px; font-weight: 800; color: var(--accent-text); }
.wx-cond { font-size: 12.5px; color: var(--text-secondary); }
.wx-hilo { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* "Now" tile - a soft gradient that shifts tone with the conditions, so
   the card reads at a glance rather than being flat white/gray always. */
.wx-tile {
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.wx-tile.clear { background: linear-gradient(135deg, #FFF6E9 0%, #FFEACD 100%); }
.wx-tile.cloud { background: linear-gradient(135deg, #F2F4F7 0%, #E7EAF0 100%); }
.wx-tile.rain  { background: linear-gradient(135deg, #E9F1FB 0%, #D7E6F7 100%); }
.wx-tile.storm { background: linear-gradient(135deg, #E7E9F5 0%, #D2D6EC 100%); }
.wx-tile.snow  { background: linear-gradient(135deg, #EFF6FB 0%, #E1EEF7 100%); }
[data-theme='dark'] .wx-tile.clear { background: linear-gradient(135deg, #2E2411 0%, #3A2C0F 100%); }
[data-theme='dark'] .wx-tile.cloud { background: linear-gradient(135deg, #1D2333 0%, #232A3D 100%); }
[data-theme='dark'] .wx-tile.rain  { background: linear-gradient(135deg, #172233 0%, #1B2A40 100%); }
[data-theme='dark'] .wx-tile.storm { background: linear-gradient(135deg, #1C1F30 0%, #23273C 100%); }
[data-theme='dark'] .wx-tile.snow  { background: linear-gradient(135deg, #182430 0%, #1C2C3A 100%); }

.wx-icon-svg { width: 40px; height: 40px; flex-shrink: 0; }
.wx-icon-svg.clear { color: #D97706; }
.wx-icon-svg.cloud { color: #6B7280; }
.wx-icon-svg.rain { color: #2563EB; }
.wx-icon-svg.storm { color: #4C1D95; }
.wx-icon-svg.snow { color: #0EA5E9; }
[data-theme='dark'] .wx-icon-svg.clear { color: #FBBF24; }
[data-theme='dark'] .wx-icon-svg.cloud { color: #9AA5BD; }
[data-theme='dark'] .wx-icon-svg.rain { color: #60A5FA; }
[data-theme='dark'] .wx-icon-svg.storm { color: #A78BFA; }
[data-theme='dark'] .wx-icon-svg.snow { color: #38BDF8; }

/* Wind / rain-chance stats - already fetched from Open-Meteo, now shown. */
.wx-stats-row { display: flex; gap: 14px; margin-top: 10px; }
.wx-stat { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.wx-stat svg { width: 14px; height: 14px; opacity: 0.75; flex-shrink: 0; }

/* Forecast strip - day-of-week labels, today outlined for orientation. */
.wx-forecast { display: flex; gap: 6px; margin-top: 12px; }
.wx-day {
  flex: 1; text-align: center; border-radius: var(--radius-sm); padding: 7px 4px;
  background: var(--bg-surface-alt); border: 1px solid transparent;
}
.wx-day.today { border-color: var(--red); background: var(--bg-surface); }
.wx-day .dow { font-size: 10px; font-weight: 800; letter-spacing: 0.3px; color: var(--gray-500); text-transform: uppercase; }
.wx-day.today .dow { color: var(--red); }
.wx-day svg { width: 20px; height: 20px; margin: 4px 0; }
.wx-day .t { font-size: 11.5px; font-weight: 700; color: var(--text-primary); }
.wx-day .t .lo { color: var(--text-secondary); font-weight: 500; }

.announcement-item { padding: 8px 0; border-bottom: 1px solid var(--border-color-soft); }
.announcement-item:last-child { border-bottom: none; }
.announcement-item.important { border-left: 3px solid var(--red); padding-left: 8px; }
.announcement-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.announcement-msg { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.subscribe-links { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.subscribe-row { display:flex; gap:8px; }
.copy-input { flex: 1; font-size: 11.5px; padding: 6px 8px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-surface-alt); color: var(--text-secondary); }

/* ---------------------------------------------------------------- */
/* Files strip                                                      */
/* ---------------------------------------------------------------- */
.files-strip { margin-top: 16px; }
.files-strip .card-body { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.file-chip { display: flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--bg-surface-alt); border: 1px solid var(--border-color); cursor: pointer; color: var(--text-primary); }
.file-chip:hover { background: var(--gray-100); }

/* ---------------------------------------------------------------- */
/* Modals                                                           */
/* ---------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11,30,61,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: var(--bg-surface); border-radius: var(--radius-lg); width: 100%; max-width: 480px; color: var(--text-primary);
  max-height: calc(90vh / var(--ui-zoom, 1)); overflow-y: auto; box-shadow: var(--shadow-md);
}
.modal.modal-lg { max-width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border-color); border-top: 3px solid transparent; }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--accent-text); }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border-color); }
.close-x { font-size: 20px; color: var(--gray-500); line-height: 1; }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--text-secondary); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 13.5px;
  background-color: var(--bg-surface); color: var(--text-primary);
}
/* Checkboxes and radios inside a form field keep their natural size
   (the full-width rule above is meant for text boxes and selects). */
.field input[type="checkbox"], .field input[type="radio"] { width: auto; padding: 0; flex: none; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.chip-select { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-toggle {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--gray-300); font-size: 12px; font-weight: 700; color: var(--text-secondary); background: var(--bg-surface);
}
.chip-toggle.active { background: var(--navy); color: white; border-color: var(--navy); }
.error-text { color: #B42318; font-size: 12.5px; margin-top: 6px; }

.new-entry-choices { display: flex; flex-direction: column; gap: 10px; }
.new-entry-choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left;
  padding: 12px 14px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); background: var(--bg-surface); cursor: pointer;
}
.new-entry-choice:hover { border-color: var(--navy); background: var(--bg-surface-alt); }
.new-entry-choice strong { font-size: 14px; color: var(--text-primary); }
.new-entry-choice span { font-size: 12px; color: var(--text-secondary); }

.truck-chip-list { display: flex; flex-wrap: wrap; gap: 4px; }
.truck-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 999px;
  background: var(--gray-100); border: 1px solid var(--gray-300); font-size: 11px; font-weight: 700; color: var(--text-primary); white-space: nowrap;
}
.truck-chip button { color: var(--text-secondary); font-size: 12px; line-height: 1; }
.truck-chip button:hover { color: #B42318; }
.truck-chip-empty { font-size: 11.5px; color: var(--text-secondary); }
.truck-chip-add-row { display: flex; margin-top: 4px; }
.truck-chip-add-row input { width: 100%; padding: 3px 6px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 11.5px; background: var(--bg-surface); color: var(--text-primary); }


/* ---------------------------------------------------------------- */
/* Files page (full library)                                        */
/* ---------------------------------------------------------------- */
.files-page { display: grid; grid-template-columns: 240px minmax(0,1fr); gap: 16px; }
.folder-tree-item { padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; display:flex; align-items:center; justify-content:space-between; color: var(--text-primary); }
.folder-tree-item:hover { background: var(--gray-100); }
.folder-tree-item.active { background: var(--navy); color: white; }
.file-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.file-table th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--text-secondary); padding: 8px; border-bottom: 1px solid var(--border-color); }
.file-table td { padding: 8px; border-bottom: 1px solid var(--border-color-soft); color: var(--text-primary); }
.file-table tr:hover { background: var(--bg-surface-alt); }
.pin-star { color: var(--gray-300); cursor: pointer; }
.pin-star.pinned { color: var(--red); }

/* ---------------------------------------------------------------- */
/* Settings page                                                    */
/* ---------------------------------------------------------------- */
.settings-page { display: flex; flex-direction: column; gap: 16px; max-width: 780px; }
.settings-section h2 { font-size: 14px; color: var(--text-primary); }
.settings-hint { font-size: 12px; color: var(--text-secondary); margin-top: -4px; margin-bottom: 10px; }
.shift-color-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.shift-color-row input[type=color] { width: 40px; height: 32px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); padding: 2px; }
.user-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border-color-soft); color: var(--text-primary); }

/* ---------------------------------------------------------------- */
/* Mobile-only vs Desktop-only                                      */
/* ---------------------------------------------------------------- */
.mobile-only { display: none; }
.desktop-only { display: block; }

.mobile-shell { padding-bottom: 70px; }
.m-header { background: var(--navy); color: white; padding: 12px 16px 14px; border-bottom: 3px solid var(--red); }
.m-header-top { display: flex; align-items: center; justify-content: space-between; }
.m-header-top .brand { display:flex; align-items:center; gap:8px; }
.m-header-top .brand img { height: 22px; }
.m-header-top .brand span { font-weight: 800; font-size: 14px; }
.m-status-line { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; }
.m-status-line .shift-line { font-weight: 800; font-size: 13.5px; }
.m-status-line .wx { display: flex; align-items: center; gap: 6px; font-size: 13px; }

.m-section { padding: 14px 16px 4px; }
.m-section h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-secondary); margin: 0 0 10px; font-weight: 800; }
.m-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 10px; color: var(--text-primary); }
.m-event-card { display: flex; gap: 10px; }
.m-event-card .time-col { width: 56px; font-weight: 800; font-size: 12.5px; color: var(--accent-text); flex-shrink: 0; }
.m-event-card .cat-bar { width: 4px; border-radius: 2px; margin-right: 4px; }
.m-event-title { font-weight: 700; font-size: 13.5px; }
.m-event-loc { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }

.m-cal-toggle { display: flex; background: var(--gray-100); border-radius: var(--radius-sm); padding: 3px; margin-bottom: 10px; width: fit-content; }
.m-cal-toggle button { padding: 6px 14px; font-size: 12px; font-weight: 700; border-radius: var(--radius-sm); }
.m-cal-toggle button.active { background: var(--navy); color: white; }
.m-mini-cal { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; }
.m-mini-weekday { text-align: center; font-size: 9.5px; font-weight: 700; color: var(--gray-500); padding-bottom: 4px; }
.m-mini-cell { aspect-ratio: 1; border-radius: 6px; background: var(--bg-surface-alt); display:flex; flex-direction:column; align-items:center; justify-content:center; position:relative; font-size: 11px; font-weight:700; color: var(--text-primary); }
.m-mini-cell.today { outline: 2px solid var(--red); }
.m-mini-cell .dot-row { display:flex; gap:2px; margin-top:2px; }
.m-mini-cell .evt-dot { width:4px; height:4px; border-radius:50%; background: var(--gray-300); }
.m-mini-cell .shift-chip { position:absolute; top:2px; right:2px; font-size:7px; font-weight:800; color:white; border-radius:2px; padding:0 2px; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: 62px;
  background: var(--bg-surface); border-top: 1px solid var(--border-color);
  display: flex; z-index: 50;
}
.bottom-nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 10.5px; font-weight: 700; color: var(--gray-500);
}
.bottom-nav button.active { color: var(--red); }
.bottom-nav .icon { width: 22px; height: 22px; display: block; margin: 0 auto 2px; }

@media (max-width: 900px) {
  .desktop-only { display: none; }
  .app-shell.desktop-only { display: none; }
  .mobile-only { display: block; }
  .app-main { padding: 0; }
}

/* ---------------------------------------------------------------- */
/* Dark-mode-safe Suppression indicators                            */
/* B Shift = Black. A plain black bar/chip can vanish into a dark    */
/* card or dark page background, so every shift indicator gets a     */
/* subtle light ring in Dark Mode - harmless for Red/Green, and it's */
/* what keeps Black visible. Never remove this without another way   */
/* of guaranteeing B Shift stays distinguishable in Dark Mode.        */
/* ---------------------------------------------------------------- */
[data-theme='dark'] .shift-tag,
[data-theme='dark'] .shift-badge-solid {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
}
[data-theme='dark'] .shift-bar {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
[data-theme='dark'] .legend-dot,
[data-theme='dark'] .cat-swatch {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
}

/* A small solid color chip w/ guaranteed-readable white text - the
   standard way this app shows "shift + color" together (never color
   alone). Used in modal headers, week-grid columns, event detail. */
.shift-badge-solid {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 800;
  color: #fff; letter-spacing: 0.3px;
}

/* ---------------------------------------------------------------- */
/* Theme toggle                                                     */
/* ---------------------------------------------------------------- */
.theme-toggle {
  display: flex; align-items: center; gap: 2px;
  background: rgba(255,255,255,0.08); border-radius: 999px; padding: 3px;
}
.theme-toggle button {
  width: 28px; height: 24px; display: flex; align-items: center; justify-content: center;
  border-radius: 999px; font-size: 13px; color: var(--gray-300);
}
.theme-toggle button.active { background: rgba(255,255,255,0.22); color: #fff; }

/* Variant for placement on a normal card/page surface (e.g. mobile "More"
   tab) rather than the navy header bar - text labels instead of icons,
   auto width, and colors that read against --bg-surface in either theme. */
.theme-toggle.on-surface {
  background: var(--bg-surface-alt); border: 1px solid var(--border-color);
}
.theme-toggle.on-surface button {
  width: auto; height: auto; padding: 8px 14px; font-size: 12.5px; font-weight: 700;
  color: var(--text-secondary);
}
.theme-toggle.on-surface button.active { background: var(--navy); color: #fff; }

/* ---------------------------------------------------------------- */
/* Shift-color accent on calendar pop-outs / event detail modal      */
/* Restrained treatment: colored top border + a solid shift badge -  */
/* never a fully-colored, hard-to-read background.                   */
/* ---------------------------------------------------------------- */
.modal-shift-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; margin-bottom: 12px; border-radius: var(--radius-md);
  background: var(--bg-surface-alt);
  border-left: 4px solid transparent;
}
.modal-shift-banner strong { color: var(--text-primary); font-size: 13px; }
.modal-shift-banner .dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
[data-theme='dark'] .modal-shift-banner .dot { box-shadow: 0 0 0 1px rgba(255,255,255,0.4); }

/* ---------------------------------------------------------------- */
/* Week view - hourly grid, 6 AM-10 PM                               */
/* ---------------------------------------------------------------- */
.week-grid-v2 {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.week-grid-head {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
}
.week-time-gutter-head { border-right: 1px solid var(--border-color-soft); }
.week-day-head {
  padding: 8px 6px 6px;
  text-align: center;
  border-left: 1px solid var(--border-color-soft);
}
.week-day-head.is-today { background: var(--today-tint); }
.week-day-head .dow { font-size: 10.5px; font-weight: 800; letter-spacing: 0.4px; color: var(--text-secondary); }
.week-day-head .dnum { font-size: 16px; font-weight: 800; color: var(--text-primary); margin: 1px 0 4px; }

.week-grid-body {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(0, 1fr));
  overflow-y: auto;
  max-height: calc(70vh / var(--ui-zoom, 1));
  position: relative;
  background: var(--bg-surface);
}
.week-time-gutter {
  position: relative;
  border-right: 1px solid var(--border-color-soft);
}
.week-hour-label {
  position: absolute;
  left: 0; right: 4px;
  transform: translateY(-6px);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: right;
}
.week-day-col {
  position: relative;
  border-left: 1px solid var(--border-color-soft);
  /* Hour gridlines drawn as a repeating background - no extra DOM per line. */
  background-image: repeating-linear-gradient(to bottom, var(--border-color-soft) 0, var(--border-color-soft) 1px, transparent 1px, transparent 100%);
  background-repeat: repeat-y;
}
.week-day-col.is-today { background-color: var(--today-tint); }
.week-event-block {
  position: absolute;
  box-sizing: border-box;
  overflow: hidden;
  font-size: 10.5px;
  line-height: 1.25;
  padding: 3px 5px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
  border-left: 3px solid var(--gray-300);
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.week-event-block:hover { background: var(--bg-surface-hover); z-index: 2; }
.week-event-block.is-editable { cursor: grab; }
.week-event-block.time-dragging { cursor: grabbing; opacity: 0.85; z-index: 5; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
body.time-dragging-active { user-select: none; cursor: grabbing; }
.wk-resize { position: absolute; left: 0; right: 0; height: 6px; cursor: ns-resize; z-index: 3; }
.wk-resize-top { top: 0; }
.wk-resize-bottom { bottom: 0; }
.week-event-block.is-editable:hover .wk-resize-bottom { border-bottom: 2px solid rgba(0,0,0,.25); }
.week-event-block .wt { font-weight: 800; }
.week-event-block .wtitle { font-weight: 600; }
.week-event-block.week-event-holiday { font-style: italic; }
/* Beyond MAX_OVERLAP_COLUMNS simultaneous events, the extras collapse
   into one "+N more" control (never shrunk text) that opens the day's
   full agenda - see calendar.js assignOverlapColumns. */
.week-more-link {
  position: absolute; box-sizing: border-box; font-size: 10.5px; font-weight: 700; text-align: center;
  padding: 4px 3px; border-radius: var(--radius-sm); background: var(--accent-text); color: var(--bg-surface);
  cursor: pointer;
}

/* Day view (calendar.js#renderDay) reuses this same .week-grid-head /
   .week-grid-body markup but with a single day column instead of 7. The
   base grid-template-columns above still reserves 7 day tracks, so
   without this override the one real column - and every event in it -
   sat in a strip roughly 1/7 as wide as the panel, with blank grid space
   to its right. Overriding it here lets that single column take up all
   the remaining width instead. */
.day-grid-v2 .week-grid-head,
.day-grid-v2 .week-grid-body {
  grid-template-columns: 56px minmax(0, 1fr);
}

@media (max-width: 900px) {
  .week-grid-v2 { display: none; } /* mobile uses the Agenda/Month toggle instead */
}

/* ---------------------------------------------------------------- */
/* Instructors                                                      */
/* ---------------------------------------------------------------- */
.instructor-chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.instructor-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 10px; border-radius: 999px; background: var(--bg-surface-alt);
  border: 1px solid var(--border-color); font-size: 12px; color: var(--text-primary);
}
.instructor-chip button { color: var(--text-secondary); font-size: 13px; line-height: 1; }
.instructor-chip button:hover { color: #B42318; }
.instructor-add-row { display: flex; gap: 6px; margin-top: 6px; }
.instructor-add-row input { flex: 1; }
.instructor-detail-line { font-size: 13px; margin-top: 4px; color: var(--text-primary); }

/* ---------------------------------------------------------------- */
/* Multi-select, shift-colored date picker (event form)             */
/* ---------------------------------------------------------------- */
.dp-widget {
  border: 1px solid var(--border-color); border-radius: var(--radius-md);
  background: var(--bg-surface-alt); padding: 10px 10px 6px;
}
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dp-month-label { font-size: 13px; font-weight: 800; color: var(--accent-text); }
.dp-nav {
  background: transparent; border: none; cursor: pointer; line-height: 1;
  font-size: 18px; padding: 2px 10px; border-radius: var(--radius-sm); color: var(--text-primary);
}
.dp-nav:hover { background: var(--bg-surface-hover); }
.dp-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr); text-align: center;
  font-size: 10px; font-weight: 700; letter-spacing: 0.02em; color: var(--text-secondary); margin-bottom: 4px;
}
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.dp-day {
  position: relative; height: 34px; border: none; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; color: var(--text-primary); cursor: pointer;
  background: color-mix(in srgb, var(--dp-shift, transparent) 26%, var(--bg-surface));
}
.dp-day:hover { filter: brightness(0.96); }
[data-theme="dark"] .dp-day:hover { filter: brightness(1.25); }
.dp-day.dp-outside { opacity: 0.4; }
.dp-day.is-today { box-shadow: inset 0 0 0 1px var(--accent-text); }
.dp-day.is-selected {
  background: var(--dp-shift, var(--navy)); color: #FFFFFF; font-weight: 800;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.65);
}
.dp-day .dp-daynum { position: relative; z-index: 1; }
.dp-day:disabled { cursor: not-allowed; opacity: 0.3; }
.dp-day:disabled:hover { filter: none; }
.dp-hint { font-size: 11.5px; color: var(--text-secondary); margin: 6px 0; }
.dp-selected-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.dp-selected-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 10px; border-radius: 999px; background: var(--bg-surface-alt);
  border: 1px solid var(--border-color); font-size: 12px; color: var(--text-primary);
}
.dp-selected-chip button { color: var(--text-secondary); font-size: 13px; line-height: 1; }
.dp-selected-chip button:hover { color: #B42318; }

/* Floating single-date popup (drill session rows). Reuses .dp-widget's
   day-cell markup/colors (calendar.js#renderDatePicker is shared with the
   event form's inline picker above) - this just adds the positioning and
   elevation needed for a version that floats over the page instead of
   sitting inline in a form. */
.dp-popup {
  position: fixed; z-index: 1200; width: 232px;
  box-shadow: var(--shadow-md); border-radius: var(--radius-md);
}
.dp-popup .dp-widget { background: var(--bg-surface); }
.instructor-detail-line strong { color: var(--text-secondary); font-weight: 700; }

/* Read-only "Entered By" audit line - set once by the server at event
   creation and never exposed as an editable input anywhere in the UI. */
.audit-field { margin-top: 4px; }
.audit-readonly {
  font-size: 12.5px; color: var(--text-secondary); font-style: italic;
  padding: 6px 0; border-top: 1px solid var(--border-color-soft);
}

/* ---------------------------------------------------------------- */
/* Event Edit Log / History                                         */
/* ---------------------------------------------------------------- */
.history-toggle {
  font-size: 12.5px; font-weight: 700; color: var(--accent-text); cursor: pointer;
  display: flex; align-items: center; gap: 6px; margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--border-color);
}
.history-list { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; max-height: 260px; overflow-y: auto; }
.history-entry { font-size: 12.5px; padding-bottom: 8px; border-bottom: 1px solid var(--border-color-soft); }
.history-entry:last-child { border-bottom: none; }
.history-entry .when { color: var(--text-secondary); font-size: 11.5px; }
.history-entry .what { margin-top: 2px; color: var(--text-primary); }
.history-entry .what b { font-weight: 700; }

/* ---------------------------------------------------------------- */
/* Deleted / cancelled event indicator                               */
/* ---------------------------------------------------------------- */
.event-cancelled-badge {
  display: inline-block; font-size: 11px; font-weight: 800; color: #B42318;
  background: rgba(180,35,24,0.12); padding: 2px 8px; border-radius: 999px; margin-left: 8px;
}

/* ---------------------------------------------------------------- */
/* Federal Holiday read-only detail                                  */
/* ---------------------------------------------------------------- */
.holiday-note {
  font-size: 12.5px; color: var(--text-secondary); margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border-color-soft); line-height: 1.5;
}

/* ---------------------------------------------------------------- */
/* Real resource conflicts (instructor / location / equipment)       */
/* Overlapping events are normal and are never flagged - this only   */
/* appears for an actual shared-resource conflict, see lib/conflicts.js */
/* ---------------------------------------------------------------- */
.conflict-banner {
  background: rgba(180,35,24,0.08); border: 1px solid rgba(180,35,24,0.3); border-radius: var(--radius-md);
  padding: 10px 12px; margin-bottom: 14px; font-size: 12.5px; color: var(--text-primary);
}
.conflict-banner strong { color: #B42318; }
.conflict-banner ul { margin: 6px 0 0; padding-left: 18px; }
.conflict-banner li { margin-bottom: 2px; }
.conflict-ack-note { margin-top: 8px; font-style: italic; color: var(--text-secondary); }
.conflict-list { margin: 8px 0; padding-left: 20px; font-size: 13px; }
.conflict-list li { margin-bottom: 6px; }

/* ---------------------------------------------------------------- */
/* Event hover / keyboard-focus preview popover (never shown on TV)  */
/* ---------------------------------------------------------------- */
.event-preview-popover {
  position: fixed; z-index: 500; width: 300px; max-width: calc(100vw - 16px);
  background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); padding: 12px 14px; font-size: 12.5px; color: var(--text-primary);
}
.event-preview-popover.hidden { display: none; }
.epp-title { font-size: 14px; font-weight: 800; color: var(--accent-text); margin-bottom: 6px; }
.epp-row { margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.epp-cat-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.epp-audit { color: var(--text-secondary); font-style: italic; margin-top: 4px; }
.epp-warning {
  margin-top: 8px; padding: 6px 8px; border-radius: var(--radius-sm); background: rgba(180,35,24,0.1);
  color: #B42318; font-weight: 600; font-size: 12px;
}
.epp-holiday-note { color: var(--text-secondary); font-size: 11.5px; margin-top: 6px; }

/* ---------------------------------------------------------------- */
/* Drill Rotation Scheduler                                          */
/* ---------------------------------------------------------------- */
.modal.modal-xl { max-width: 920px; }

.drills-table td { vertical-align: middle; }
.drill-status-badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.drill-status-badge.status-draft { background: var(--gray-200); color: var(--text-secondary); }
.drill-status-badge.status-published { background: rgba(46,125,50,0.14); color: #2E7D32; }
.drill-status-badge.status-canceled { background: rgba(180,35,24,0.12); color: #B42318; }
.drill-status-badge.status-completed { background: rgba(11,30,61,0.1); color: var(--accent-text); }
[data-theme='dark'] .drill-status-badge.status-published { background: rgba(46,125,50,0.22); color: #6FCF73; }
[data-theme='dark'] .drill-status-badge.status-canceled { background: rgba(180,35,24,0.22); color: #FF8A80; }

.drill-memo-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 16px; margin-bottom: 6px; }
.drill-memo-grid .field { margin-bottom: 10px; }
.drill-memo-readonly { font-size: 13.5px; color: var(--text-primary); padding: 7px 0 3px; }
.drill-memo-readonly-label { font-size: 12px; font-weight: 700; color: var(--text-secondary); margin-bottom: 2px; }

.drill-validation-panel { margin: 4px 0 14px; }
.drill-validation-group { margin-bottom: 8px; }
.drill-validation-group ul { margin: 4px 0 0; padding-left: 20px; font-size: 12.5px; }
.drill-validation-group li { margin-bottom: 3px; }
.drill-validation-group.errors { color: #B42318; }
.drill-validation-group.warnings { color: #B4740E; }
.drill-validation-group.info { color: var(--text-secondary); }
.drill-validation-group .group-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.3px; }

.drill-shift-block { margin-bottom: 16px; }
.drill-shift-block h4 { font-size: 13px; font-weight: 800; color: var(--red); margin: 0 0 6px; }
.drill-session-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.drill-session-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; color: var(--text-secondary); padding: 5px 6px; border-bottom: 1px solid var(--border-color); }
.drill-session-table td { padding: 4px 6px; border-bottom: 1px solid var(--border-color-soft); vertical-align: middle; }
.drill-session-table input, .drill-session-table select { width: 100%; padding: 5px 6px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 12.5px; background-color: var(--bg-surface); color: var(--text-primary); }
.drill-session-table tr.session-canceled td { color: var(--text-secondary); text-decoration: line-through; }
.drill-session-table tr.session-canceled input, .drill-session-table tr.session-canceled select { text-decoration: none; }
.drill-session-table input.sf-date:not(:disabled) { cursor: pointer; }
input.sf-date:not(:disabled) { cursor: pointer; } /* also used standalone: cancel/reschedule New Date, and drill Window Start/End */
.drill-session-truck-list { font-size: 11.5px; color: var(--text-secondary); padding-top: 2px; }

.drill-version-row { padding: 10px 0; border-bottom: 1px solid var(--border-color-soft); }
.drill-version-row .version-head { display: flex; align-items: center; justify-content: space-between; }
.drill-version-row .version-label { font-weight: 800; font-size: 13px; color: var(--accent-text); }
.drill-version-row .superseded-tag { font-size: 10.5px; font-weight: 800; color: var(--text-secondary); text-transform: uppercase; margin-left: 6px; }
.drill-version-row .version-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.epp-actions { margin-top: 10px; text-align: right; }

/* ---------------------------------------------------------------- */
/* Changelog page                                                    */
/* ---------------------------------------------------------------- */
/* ---- Home hub ---- */
.hub { max-width: 1100px; margin: 0 auto; }
.hub-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.hub-title { margin: 0; font-size: 26px; font-weight: 800; color: var(--text-primary); }
.hub-sub { color: var(--text-secondary); font-size: 14px; margin-top: 2px; }
.hub-today { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 12px 16px; min-width: 280px; max-width: 520px; font-size: 13px; color: var(--text-primary); }
.hub-today:empty { display: none; }
.hub-today-row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.hub-wx { font-weight: 700; }
.hub-today-line { color: var(--text-secondary); line-height: 1.45; }
.hub-today-line + .hub-today-line { margin-top: 4px; }
.hub-off { font-weight: 600; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.hub-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-lg);
  padding: 18px; min-height: 140px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s; font: inherit; color: var(--text-primary);
}
.hub-tile:hover:not(:disabled) { border-color: var(--navy); transform: translateY(-1px); box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.08)); }
.hub-tile:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.hub-tile-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; }
.hub-tile-icon svg { width: 20px; height: 20px; }
.hub-tile-title { font-weight: 800; font-size: 15.5px; }
.hub-tile-desc { color: var(--text-secondary); font-size: 13px; line-height: 1.4; }
.hub-tile.is-soon { cursor: default; opacity: 0.6; box-shadow: none; }
.hub-soon { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-secondary); background: var(--border-color-soft); border-radius: 4px; padding: 1px 6px; margin-left: 4px; vertical-align: 2px; }
[data-theme='dark'] .hub-tile-icon { background: #1E2A44; }

.settings-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border-color); }
.settings-tabs button {
  padding: 8px 14px; font-weight: 700; font-size: 13.5px; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -1px; background: none;
}
.settings-tabs button:hover { color: var(--text-primary); }
.settings-tabs button.active { color: var(--text-primary); border-bottom-color: var(--accent, #C8102E); }
.changelog-page { padding: 22px 26px 30px; }
.changelog-head { margin-bottom: 22px; }
.changelog-head h2 { margin: 0 0 4px; font-size: 22px; font-weight: 800; color: var(--text-primary); }
.changelog-sub { margin: 0; font-size: 13.5px; color: var(--text-secondary); }
.changelog-timeline { display: flex; flex-direction: column; gap: 26px; }
.changelog-entry {
  position: relative;
  padding-left: 22px;
  border-left: 2px solid var(--border-color);
}
.changelog-entry::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--red);
}
.changelog-date {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.changelog-items { display: flex; flex-direction: column; gap: 9px; }
.changelog-item { display: flex; align-items: baseline; gap: 10px; font-size: 13.5px; color: var(--text-primary); }
.changelog-item-text { line-height: 1.4; }
.tag {
  flex-shrink: 0;
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.tag-feature {
  background: rgba(46, 125, 50, 0.12);
  color: #2E7D32;
  border: 1px solid rgba(46, 125, 50, 0.35);
}
[data-theme='dark'] .tag-feature { color: #6FCF7A; border-color: rgba(111, 207, 122, 0.4); }
.tag-improvement {
  background: rgba(11, 30, 61, 0.08);
  color: var(--navy);
  border: 1px solid rgba(11, 30, 61, 0.25);
}
[data-theme='dark'] .tag-improvement { background: rgba(255,255,255,0.08); color: var(--text-primary); border-color: rgba(255,255,255,0.2); }
.tag-fix {
  background: rgba(200, 16, 46, 0.1);
  color: var(--red);
  border: 1px solid rgba(200, 16, 46, 0.3);
}
[data-theme='dark'] .tag-fix { color: #FF8A80; border-color: rgba(255, 138, 128, 0.35); }

/* Event form time sliders (15-minute steps) */
.time-sliders { display: grid; gap: 6px; margin: -4px 0 10px; }
.time-slider-row { display: grid; grid-template-columns: 56px 1fr minmax(120px, auto); align-items: center; gap: 10px; }
.time-slider-row label { margin: 0; font-size: 12px; color: var(--text-secondary); }
.time-slider-row input[type="range"] { width: 100%; accent-color: var(--red); }
.time-slider-row output { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .time-slider-row { grid-template-columns: 52px 1fr; } .time-slider-row output { grid-column: 2; } }

/* Toast */
.app-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #0B1F3A; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 2000; }
.app-toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 768px) { .app-toast { bottom: 84px; } }

/* Template picker in the New Event form */
.template-picker { background: var(--bg-surface-alt); border-radius: var(--radius-sm); padding: 10px 12px; }
.template-picker-row { display: flex; gap: 8px; align-items: center; }
.template-picker-row select { flex: 1; min-width: 0; }

/* Shift filter (All / A / B / C) in the calendar legend row */
.shift-filter { display: inline-flex; border: 1px solid var(--border-color); border-radius: 999px; overflow: hidden; }
.shift-filter button { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: var(--text-secondary); font: inherit; font-weight: 600; padding: 3px 10px; cursor: pointer; }
.shift-filter button + button { border-left: 1px solid var(--border-color); }
.shift-filter button:hover { background: var(--bg-surface-hover); }
.shift-filter button.active { background: var(--navy); color: #fff; }
.shift-filter button:focus-visible { outline: 2px solid var(--navy); outline-offset: -2px; }
.legend-showall { border: 0; background: transparent; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 2px 4px; }

/* Keyboard focus rings: navy disappears on Dark Mode surfaces. */
[data-theme='dark'] :focus-visible { outline-color: #8AB4F8; }

/* ---- Department roster (Phase 2) ---- */
.roster-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.roster-tools input[type="search"], .roster-tools select { padding: 7px 10px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 13px; background-color: var(--bg-surface); color: var(--text-primary); }
.roster-tools input[type="search"] { min-width: 200px; }
.roster-count { font-weight: 400; font-size: 13px; color: var(--text-secondary); }
.roster-inactive-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.roster-table-wrap { overflow-x: auto; }
.roster-table td { white-space: nowrap; }
.roster-table tr.roster-inactive td { opacity: 0.55; }
.form-error { margin-top: 10px; padding: 8px 10px; border-radius: 6px; background: rgba(185, 28, 28, 0.1); color: #b91c1c; font-size: 13px; }
.roster-import-summary { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 12px 0; font-size: 13px; }
.roster-import-warn { margin: 8px 0; padding: 8px 10px; border-radius: 6px; background: rgba(217, 119, 6, 0.12); font-size: 13px; }
.roster-import-list { margin: 6px 0 6px 18px; font-size: 12.5px; max-height: 180px; overflow-y: auto; }
.roster-import-summary + details, .roster-import-warn + details, details + details { margin-top: 6px; }
details summary { cursor: pointer; font-size: 13px; }
@media (max-width: 760px) {
  .roster-tools { justify-content: flex-start; }
  .roster-tools input[type="search"] { min-width: 0; flex: 1 1 100%; }
}

/* ---- Training Memos (2026-10-11) ---- */
.memo-table td { vertical-align: middle; }
.memo-row { cursor: pointer; }
.memo-no { font-weight: 600; white-space: nowrap; }
.memo-rev { font-size: 11px; font-weight: 600; color: var(--text-secondary); margin-left: 4px; }
.memo-status { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-color); white-space: nowrap; }
.memo-status.memo-published { color: #166534; border-color: #86efac; background: rgba(34,197,94,.08); }
.memo-status.memo-draft { color: var(--text-secondary); }
.memo-status.memo-rescinded { color: #8C1D24; border-color: #f0b4b8; background: rgba(140,29,36,.06); }
.memo-textarea { font-family: inherit; line-height: 1.5; min-height: 260px; }
.memo-head-line { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.memo-big { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.memo-detail th { width: 110px; text-transform: none; font-size: 12px; }
#view-memos .table-scroll { overflow-x: auto; }
#view-memos .muted { color: var(--text-secondary); font-weight: 400; }
#memo-search { min-width: 200px; }
.memo-att { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; color: var(--text-secondary); margin-left: 6px; white-space: nowrap; }
.memo-att-list { list-style: none; margin: 4px 0 8px; padding: 0; }
.memo-att-list li { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border-color-soft); font-size: 13px; }
.memo-att-list li:last-child { border-bottom: 0; }
.memo-att-list a { color: var(--text-primary); }
.memo-att-n { font-weight: 600; color: #8C1D24; min-width: 18px; }
.memo-att-add { cursor: pointer; margin-right: 8px; display: inline-flex !important; width: auto !important; align-self: flex-start; }

/* ---------------------------------------------------------------- */
/* Text size (A- / A+), per device                                  */
/* ---------------------------------------------------------------- */
/* app.js sets --ui-zoom on <html> from the saved choice. Only page
   content and modals are scaled; the header and sidebar stay fixed so
   the controls never move. Heights given in vh above are divided by
   --ui-zoom so a zoomed modal or week grid still fits the screen. */
:root { --ui-zoom: 1; }
#desktop-main, #mobile-main, .modal { zoom: var(--ui-zoom); }

.text-size-ctl {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.08); border-radius: 999px; padding: 3px;
}
.text-size-ctl button {
  min-width: 34px; height: 26px; padding: 0 8px; border-radius: 999px;
  font-size: 13px; font-weight: 800; color: var(--gray-200);
}
.text-size-ctl button:hover:not(:disabled) { background: rgba(255,255,255,0.18); color: #fff; }
.text-size-ctl button:disabled { opacity: 0.35; cursor: default; }
.text-size-ctl.on-surface {
  width: 100%; justify-content: center; gap: 8px;
  background: var(--bg-surface-alt); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 6px;
}
.text-size-ctl.on-surface button { color: var(--text-primary); font-size: 15px; min-width: 44px; height: 34px; }
.text-size-ctl.on-surface button:hover:not(:disabled) { background: var(--bg-surface); color: var(--text-primary); }
.text-size-ctl.on-surface .text-size-reset { font-size: 12.5px; font-weight: 700; color: var(--text-secondary); }
.text-size-value { min-width: 48px; text-align: center; font-weight: 800; font-size: 13.5px; color: var(--text-primary); }
