#reload-banner{position:fixed;left:0;right:0;bottom:0;background:#1f6feb;color:#fff;padding:.6rem 1rem;display:flex;align-items:center;justify-content:space-between;font:14px system-ui,sans-serif;z-index:100;box-shadow:0 -4px 12px rgba(0,0,0,.4)}
#reload-banner button{background:#fff;color:#1f6feb;border:0;padding:.35rem .9rem;border-radius:6px;font-weight:600;cursor:pointer}

:root {
  --bg: #0b0d11;
  --panel: #14181f;
  --panel-2: #1b2129;
  --line: #242b35;
  --text: #e8edf2;
  --muted: #8a94a5;
  --accent: #1f6feb;
  --on:      #1f8b4c;
  --off:     #3b4250;
  --no_show: #c0392b;
  --swap:    #c9a227;
  --danger:  #c0392b;
  --warning: #c9a227;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; }
body { padding-bottom: env(safe-area-inset-bottom); }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: .5rem;
  padding: .55rem .8rem; background: var(--panel); border-bottom: 1px solid var(--line);
  padding-top: calc(.55rem + env(safe-area-inset-top));
}
.brand { font-weight: 700; letter-spacing: .04em; color: var(--accent); }
.meta { color: var(--muted); font-size: .85rem; text-align: center; }
.meta .sep { padding: 0 .35rem; }
.nav { background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  width: 2.1rem; height: 2.1rem; border-radius: .4rem; font-size: 1.1rem; cursor: pointer; }
.nav:active { background: var(--line); }

/* Phase 2.14 — Tyler 5/12 — explicit week nav: bigger, labeled, mobile-tappable */
.weeknav {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .5rem .8rem; background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.weeknav-btn {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  padding: .55rem .9rem; border-radius: .45rem; font: 600 .85rem/1 system-ui, sans-serif;
  cursor: pointer; min-height: 2.3rem;
}
.weeknav-btn:active { background: var(--line); }
.weeknav-btn:hover { border-color: var(--accent); }
.weeknav-jump { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .8rem; margin-left: auto; }
.weeknav-date {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  padding: .35rem .5rem; border-radius: .4rem; font-size: .85rem; min-height: 2.3rem;
}
@media (max-width: 600px) {
  .weeknav-jump { margin-left: 0; width: 100%; justify-content: flex-end; }
}

.tabs {
  position: sticky; top: 3.2rem; z-index: 4;
  display: flex; background: var(--panel-2); border-bottom: 1px solid var(--line);
}
.tab {
  flex: 1; background: transparent; color: var(--muted); border: 0;
  padding: .9rem .8rem; font: 600 .85rem/1 system-ui, sans-serif;
  letter-spacing: .04em; text-transform: uppercase; cursor: pointer;
  border-bottom: 2px solid transparent; position: relative;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab .badge {
  display: inline-block; min-width: 1.2rem; padding: 0 .35rem;
  margin-left: .3rem; background: var(--accent); color: #fff;
  border-radius: 999px; font-size: .7rem; font-weight: 700; line-height: 1.2rem;
}

.view { display: none; }
.view.active { display: block; }

main { padding: .8rem; max-width: 1100px; margin: 0 auto; }
.status { padding: 1rem; text-align: center; color: var(--muted); }
.shift-block { margin-bottom: 1.2rem; }
.shift-block h2 { font-size: .9rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: .3rem 0 .5rem; }

.grid {
  display: grid; gap: 2px; background: var(--line);
  border: 1px solid var(--line); border-radius: .5rem; overflow: hidden;
  grid-template-columns: 6.5rem repeat(7, minmax(2.4rem, 1fr));
}
.cell, .head {
  background: var(--panel); padding: .35rem .35rem; font-size: .78rem;
  display: flex; align-items: center; justify-content: center; min-height: 2.1rem;
}
.cell.tappable { cursor: pointer; }
.cell.tappable:active { filter: brightness(1.15); }
.head { background: var(--panel-2); font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; font-size: .68rem; flex-direction: column; }
.head .dow  { color: var(--text); }
.head .date { font-size: .65rem; opacity: .65; }
.cell.name { background: var(--panel-2); justify-content: flex-start;
  font-weight: 600; padding-left: .55rem; font-size: .82rem; }
.cell.name .role { font-size: .62rem; color: var(--muted); font-weight: 400; margin-left: .3rem; }

.cell.status-on      { background: var(--on); color: #eafbe7; }
.cell.status-off     { background: var(--off); color: var(--muted); }
.cell.status-no_show { background: var(--no_show); color: #fff; }
.cell.status-vacation{ background: #2c4a8b; color: #cfe0ff; }
.cell.status-sick    { background: #6a3b9a; color: #f0e0ff; }
.cell.status-swap_pending,
.cell.swap           { background: var(--swap); color: #2a1f00; }
/* Item 6 (5/12): empty cells render as the panel background -- visually invisible vs the OFF panel. */
.cell.empty          { background: var(--bg); color: transparent; }

/* Item 4 (5/12): legend moved above grid, larger text + words. */
.legend-top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem .9rem; margin: 0 0 .6rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: .5rem;
  color: var(--text); font-size: .92rem; flex-wrap: wrap;
}
.legend-top .legend-items {
  display: flex; gap: 1rem; flex-wrap: wrap;
}
.legend-top .legend-item {
  display: inline-flex; align-items: center; font-weight: 600; font-size: .88rem; letter-spacing: .03em;
}
.legend i.dot { display: inline-block; width: .85rem; height: .85rem; border-radius: 3px;
  vertical-align: middle; margin-right: .4rem; border: 1px solid var(--line); }
.legend .on { background: var(--on); }
.legend .off { background: var(--off); }
.legend .no_show { background: var(--no_show); }
.legend .vacation { background: #2c4a8b; }
.legend .sick { background: #6a3b9a; }
.legend .swap { background: var(--swap); }
.legend .light-duty { background: #fff3a3; border-color: #e6c200; }
.legend-hide, .legend-show {
  color: var(--accent); font-size: .82rem; text-decoration: underline; cursor: pointer;
  white-space: nowrap;
}
.legend-show { display: inline-block; padding: .35rem .6rem; margin: 0 0 .6rem; }

/* Item 1 + 3 (5/12): TODAY column highlight + past-day dim. */
.head.is-today {
  border-top: 3px solid #f5c542;
  background: linear-gradient(180deg, #2a2510 0%, var(--panel-2) 25%);
  position: relative;
}
.head.is-today .today-tag {
  display: block; font-size: .58rem; font-weight: 700; color: #f5c542;
  letter-spacing: .08em; margin-bottom: .15rem;
}
.cell.is-today {
  box-shadow: inset 0 2px 0 0 #f5c542;
}
.head.is-past, .cell.is-past { opacity: .5; }

.status.error { color: var(--no_show); }

/* ===== Requests list ===== */
.req-list { list-style: none; padding: 0; margin: 0; }
.req-item {
  background: var(--panel); border: 1px solid var(--line); border-radius: .5rem;
  padding: .75rem .9rem; margin-bottom: .6rem;
}
.req-item .row1 { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.req-item .who { font-weight: 600; }
.req-item .meta-line { color: var(--muted); font-size: .8rem; margin-top: .15rem; }
.req-item .state-pill {
  display: inline-block; padding: .12rem .55rem; border-radius: 999px;
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.state-requested        { background: #2c4a8b; color: #cfe0ff; }
.state-paperwork_signed { background: #6a3b9a; color: #f0e0ff; }
.state-approved         { background: var(--on); color: #eafbe7; }
.state-applied          { background: #1b3a5e; color: #cfe0ff; }
.state-rejected         { background: var(--danger); color: #fff; }
.state-cancelled        { background: var(--off); color: var(--muted); }

.req-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }

/* ===== Buttons ===== */
.btn {
  appearance: none; border: 0; padding: .65rem 1rem;
  font: 600 .85rem/1 system-ui, sans-serif; cursor: pointer;
  border-radius: .45rem; min-height: 2.6rem; min-width: 2.6rem;
}
.btn-primary    { background: var(--accent); color: #fff; }
.btn-secondary  { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn-danger     { background: var(--danger); color: #fff; }
.btn-warning    { background: var(--warning); color: #2a1f00; }
.btn-success    { background: var(--on); color: #eafbe7; }
.btn:active     { filter: brightness(1.1); }
.btn:disabled   { opacity: .5; cursor: not-allowed; }

/* ===== Bottom sheet ===== */
.sheet-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50;
  animation: fadein .15s ease;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  background: var(--panel); border-top: 1px solid var(--line);
  border-radius: 1rem 1rem 0 0; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  max-height: 75vh; overflow-y: auto;
  animation: slideup .2s ease;
  box-shadow: 0 -8px 24px rgba(0,0,0,.5);
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .8rem; border-bottom: 1px solid var(--line); padding-bottom: .6rem;
}
.sheet-head h3 { margin: 0; font-size: 1rem; }
.sheet-close {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  width: 2.4rem; height: 2.4rem; border-radius: .4rem; font-size: 1.4rem; cursor: pointer; line-height: 1;
}
.sheet-body { display: flex; flex-direction: column; gap: .5rem; }
.sheet-body .info { color: var(--muted); font-size: .85rem; margin-bottom: .4rem; }

@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fadein  { from { opacity: 0; } to { opacity: 1; } }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 60; }
.modal {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); z-index: 61;
  background: var(--panel); border: 1px solid var(--line); border-radius: .6rem;
  padding: 1.2rem; min-width: 18rem; max-width: 90vw;
  box-shadow: 0 12px 36px rgba(0,0,0,.6);
}
.modal h3 { margin: 0 0 .5rem; }
.modal p { margin: 0 0 1rem; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 5rem; transform: translateX(-50%); z-index: 70;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); padding: .65rem 1rem; border-radius: .45rem;
  box-shadow: 0 6px 18px rgba(0,0,0,.5); font-size: .85rem;
  animation: fadein .15s ease;
}
.toast.error { border-color: var(--danger); color: #ffd8d2; }
.toast.warn  { border-color: var(--warning); color: #ffe9a8; }

@media (max-width: 520px) {
  .grid { grid-template-columns: 4.6rem repeat(7, minmax(1.8rem, 1fr)); }
  .cell, .head { font-size: .7rem; padding: .25rem .15rem; }
  .cell.name { font-size: .72rem; padding-left: .35rem; }
  .cell.name .role { display: none; }
}

/* ===== Phase 2.15 time-off intake form ===== */
.timeoff-form {
  display: grid; gap: .55rem; max-width: 32rem; margin: .5rem 0 1.25rem;
}
.timeoff-form label {
  display: flex; flex-direction: column; gap: .15rem;
  font-size: .85rem; color: var(--muted);
}
.timeoff-form select,
.timeoff-form input[type="date"],
.timeoff-form textarea {
  font: inherit; padding: .45rem .55rem; border-radius: .4rem;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
}
.timeoff-form textarea { resize: vertical; }
.timeoff-actions {
  display: flex; gap: .75rem; align-items: center; margin-top: .35rem;
}
.to-entry { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.to-entry.cancelled { opacity: .55; }
#view-timeoff h2 { font-size: 1rem; margin: 1rem 0 .4rem; }

/* Phase 2.17 -- Draft pill + tinted draft cells. Admin/manager/kelly only. */
.drafts-bar {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .55rem .8rem;
  background: #fff7cc; color: #6b5200;
  border-bottom: 1px solid #e6c200;
  font: 600 .85rem/1.2 system-ui, sans-serif;
}
.drafts-bar-actions { display: flex; gap: .4rem; }
.drafts-bar .btn { min-height: 2.2rem; padding: .45rem .8rem; font-size: .8rem; }
.cell.has-draft {
  background: #fff3a3 !important;
  color: #2a1f00 !important;
  border: 1px dashed #b58900;
}
.cell.has-draft::after {
  content: "draft";
  position: absolute; bottom: 1px; right: 3px;
  font-size: 0.55rem; font-weight: 700;
  color: #6b5200; letter-spacing: .03em;
  pointer-events: none;
}

/* Phase 2.16 -- Light Duty L badge overlay on schedule cells. */
.cell { position: relative; }
.cell .light-duty-badge {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  padding: 1px 4px;
  border-radius: 3px;
  background: #fff3a3;
  color: #6b5200;
  border: 1px solid #e6c200;
  pointer-events: none;
}

/* Phase 2.18 -- Crew Roster admin UI */
.roster-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}
@media (max-width: 640px) {
  .roster-wrap { grid-template-columns: 1fr; }
}
.roster-col h3 {
  margin: 4px 0 8px;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 600;
}
.roster-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.roster-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.roster-meta { min-width: 0; flex: 1; }
.roster-name { font-size: 0.95rem; }
.roster-name .muted { color: var(--muted); font-weight: 400; margin-left: 4px; }
.roster-actions { flex-shrink: 0; }
.roster-list li.muted {
  padding: 8px;
  color: var(--muted);
  font-style: italic;
}
