:root {
  --bg: #eef0f3;
  --surface: #ffffff;
  --ink: #1a1c1e;
  --muted: #5c6570;
  --line: #d5dae1;
  --brand: #c8102e;
  --brand-2: #a00d25;
  --brand-soft: #fce8eb;
  --header-bg: #121416;
  --header-ink: #f5f6f7;
  --chrome: #c5cbd3;
  --chrome-2: #8b939e;
  --accent: #c8102e;
  --accent-ink: #fff;
  --ok: #1f7a4d;
  --danger: #b42318;
  --shadow: 0 8px 24px rgba(18, 20, 22, 0.08);
  --radius: 16px;
  --tap: 48px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  background: var(--header-bg);
  color: var(--header-ink);
  z-index: 5;
  border-bottom: 1px solid rgba(197, 203, 211, 0.22);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-text { min-width: 0; }
.brand strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.2;
}
.company {
  display: block;
  color: var(--chrome);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tagline {
  display: block;
  color: rgba(245, 246, 247, 0.72);
  font-size: 0.78rem;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo-img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  object-position: center top;
  border-radius: 12px;
  flex-shrink: 0;
  background: #000;
  border: 1px solid rgba(197, 203, 211, 0.35);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(200, 16, 46, 0.18);
}

/* Legacy text logo fallback if ever used */
.logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700;
  box-shadow: var(--shadow);
}

main {
  flex: 1;
  padding: 16px 16px 20px;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--chrome);
  font-size: 0.78rem;
  padding: 12px 16px;
  background: var(--header-bg);
  border-top: 1px solid rgba(197, 203, 211, 0.18);
}
.linkish {
  background: none;
  border: none;
  color: #f0a3af;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 8px;
  min-height: var(--tap);
}
.linkish:hover { color: #fff; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.card h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.sub { color: var(--muted); margin: 0 0 16px; font-size: 0.92rem; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }

label.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 600;
}
label.field > :is(input, select, textarea) {
  min-height: var(--tap);
  border: 1.5px solid #c8ced6;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fafbfc;
  color: var(--ink);
  font-weight: 500;
}
label.field textarea { min-height: 88px; resize: vertical; }
label.field > :is(input, select, textarea):focus {
  outline: 2px solid rgba(200, 16, 46, 0.28);
  border-color: var(--brand);
  background: #fff;
}

.btn {
  min-height: var(--tap);
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 650;
  background: var(--brand);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: translateY(1px); }
.btn.secondary {
  background: #e8ebf0;
  color: #2a3038;
}
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost {
  background: transparent;
  color: var(--chrome);
  border: 1px solid rgba(197, 203, 211, 0.4);
}
.topbar .btn.ghost { color: var(--header-ink); border-color: rgba(197, 203, 211, 0.45); }
.topbar .btn.ghost:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--chrome); }
.btn.danger { background: #fdeceb; color: var(--danger); }
.btn.sm { min-height: 40px; padding: 8px 12px; font-size: 0.9rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.worker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.worker-chip {
  min-height: 64px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fafbfc;
  font-weight: 650;
  padding: 12px;
  text-align: left;
}
.worker-chip.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
  color: var(--brand-2);
}

.pin-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}
.pin-key {
  min-height: 56px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 1.25rem;
  font-weight: 700;
}
.pin-key.wide { grid-column: span 1; }
.pin-key.accent-key,
.pin-key[data-pin="ok"] {
  background: var(--brand) !important;
  color: #fff !important;
  border-color: var(--brand-2) !important;
}
.pin-display {
  letter-spacing: 0.35em;
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  padding: 10px;
  border-radius: 12px;
  background: #eef1f4;
  min-height: 52px;
  border: 1px solid var(--line);
}

.tabs {
  display: flex;
  gap: 6px;
  background: #e4e8ed;
  padding: 4px;
  border-radius: 14px;
  margin-bottom: 14px;
}
.tab {
  flex: 1;
  min-height: 42px;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}
.tab.active {
  background: #fff;
  color: var(--brand);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.entry:last-child { border-bottom: none; }
.entry .title { font-weight: 650; }
.entry .meta { color: var(--muted); font-size: 0.85rem; }
.entry .hours {
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
  font-size: 1.05rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-2);
  font-size: 0.75rem;
  font-weight: 700;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.stat {
  background: linear-gradient(145deg, #1c1f24 0%, #2a2f36 100%);
  color: #f0f2f5;
  border-radius: 14px;
  padding: 14px;
  border: 1px solid rgba(197, 203, 211, 0.18);
}
.stat.alt {
  background: linear-gradient(145deg, #c8102e 0%, #8e0c20 100%);
  color: #fff;
}
.stat .label { opacity: 0.8; font-size: 0.8rem; }
.stat .value {
  font-size: 1.45rem;
  font-weight: 750;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--header-bg);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 50;
  max-width: calc(100% - 32px);
  border: 1px solid rgba(197, 203, 211, 0.25);
}
.toast.error { background: var(--danger); border-color: transparent; }
.toast.ok { background: var(--ok); border-color: transparent; }

.filters { display: grid; gap: 10px; margin-bottom: 12px; }
.filters .row { margin: 0; }

@media (min-width: 480px) {
  .worker-grid { grid-template-columns: 1fr 1fr; }
}

/* --- Technician form upgrades --- */
.hint {
  display: block;
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: -2px;
  margin-bottom: 2px;
  line-height: 1.35;
}
.hint.tight { margin: 0 0 8px; }
.optional {
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}
.req { color: var(--danger); }

label.field > input.readonly {
  background: #eef1f4;
  color: var(--ink);
  font-weight: 650;
}

.check-group {
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px 14px;
  margin: 0;
  background: #fafbfc;
}
.check-group legend {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0 4px;
}
.check.big {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: var(--tap);
  padding: 10px 4px;
  font-weight: 650;
  color: var(--ink);
  cursor: pointer;
}
.check.big input {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--brand);
}
.injury-box {
  border-color: #f0c4c0;
  background: #fff8f7;
}
.injury-box legend { color: var(--danger); }

.receipt-box {
  border: 1.5px solid #c5d4e8;
  background: #f5f8fc;
  border-radius: 14px;
  padding: 12px 14px 14px;
  margin: 0;
}
.receipt-box legend {
  color: #2a4a72;
  font-weight: 750;
  padding: 0 6px;
}
.receipt-box input[type="file"] {
  width: 100%;
  padding: 10px 0;
  font-size: 0.9rem;
}
.badge.receipt {
  background: #e3eefc;
  color: #1a4a7a;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 750;
  vertical-align: middle;
}
.receipt-meta {
  margin-top: 4px;
  color: #2a4a72;
}
.receipt-link {
  color: var(--brand);
  font-weight: 650;
  text-decoration: underline;
}
.receipt-link:hover { color: var(--brand-2); }

.purchases-card .purchases-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.purchases-card .purchases-head h2 {
  margin: 0;
}
.purchases-total {
  margin: 10px 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #eef5ff;
  border: 1px solid #c5d4e8;
}
.purchases-total .label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #2a4a72;
  font-weight: 700;
}
.purchases-total .value {
  font-size: 1.45rem;
  font-weight: 800;
  color: #12345a;
}
.purchases-table td.receipt-actions {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.purchases-table .muted,
.muted {
  color: var(--muted, #6b7280);
  font-size: 0.9em;
}

.optional {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.85em;
}

.hours-preview {
  border-radius: 12px;
  padding: 12px 14px;
  background: #eef1f4;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
  border: 1px solid var(--line);
}
.hours-preview.ok {
  background: var(--brand-soft);
  color: var(--brand-2);
  border-color: #f0b8c0;
}
.hours-preview.error {
  background: #fdeceb;
  color: var(--danger);
  font-weight: 650;
  border-color: #f0c4c0;
}

.badge.ot {
  background: #fff1e0;
  color: #9a4e0e;
}
.badge.injury {
  background: #fdeceb;
  color: var(--danger);
}
.badge.warn {
  background: #fff1e0;
  color: #9a4e0e;
}

.entry-injury {
  background: #fff5f4;
  border: 1px solid #f0c4c0;
  border-radius: 12px;
  padding: 12px !important;
  margin: 8px 0;
  border-bottom: 1px solid #f0c4c0 !important;
}

.stat-grid.three {
  grid-template-columns: 1fr 1fr;
}
.stat-grid.three .stat:last-child {
  grid-column: 1 / -1;
}
@media (min-width: 420px) {
  .stat-grid.three { grid-template-columns: 1fr 1fr 1fr; }
  .stat-grid.three .stat:last-child { grid-column: auto; }
}
.stat.vac {
  background: linear-gradient(145deg, #2a3544 0%, #3a4a5c 100%);
  color: #e8eef5;
}
.stat.danger-stat { background: var(--danger); color: #fff; }

.vac-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.vac-row:last-child { border-bottom: none; }
.vac-name { flex: 1 1 120px; font-weight: 650; }
.field.inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.field.inline input {
  width: 100px;
  min-height: 40px;
}
.field.inline .unit { color: var(--muted); font-weight: 600; }
.sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  border: 0;
}

.account-home .stat-grid { margin-bottom: 0; }

.account-home .account-action {
  margin-top: 14px;
}
.page-nav {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-nav .btn {
  min-height: 40px;
}

.tabs { flex-wrap: wrap; }
.tab { min-width: 0; font-size: 0.85rem; }

.stat-grid.four {
  grid-template-columns: 1fr 1fr;
}
.stat.banked {
  background: linear-gradient(145deg, #3d2f48 0%, #5a3d6e 100%);
  color: #f3eaf7;
}
.badge.banked {
  background: #5a3d6e;
  color: #f3eaf7;
}
.bank-ot-opt {
  margin-top: -4px;
  margin-bottom: 4px;
}
.hint-inline {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.85em;
}
.crew-balances {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.crew-balances:last-child { border-bottom: none; }
.crew-balances .vac-name { margin-bottom: 6px; }
.crew-balances .vac-row {
  border-bottom: none;
  padding: 4px 0;
}
.unit-label {
  min-width: 72px;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.82rem;
}

/* Soft red accent stripe under header for brand polish */
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, #8e0c20 0%, #c8102e 40%, #e85a6a 70%, #c5cbd3 100%);
}


/* Did not work + reminder banners */
.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  border: 1.5px solid var(--line);
  background: #fff8e8;
  box-shadow: var(--shadow);
}
.banner.warn {
  border-color: #e6b84d;
  background: #fff6e0;
}
.banner-text {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 600;
  color: #5c4810;
  line-height: 1.35;
}
.dnw-row {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}
.dnw-row .btn {
  margin-bottom: 8px;
}
.entry-dnw .title { color: var(--muted); }
.muted-hours {
  color: var(--muted) !important;
  font-weight: 600 !important;
}
.badge.dnw {
  background: #e8ebf0;
  color: #3a4250;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 750;
  vertical-align: middle;
}
.missing-card.missing-alert {
  border-color: #e6b84d;
  background: #fffaf0;
}
.missing-list {
  margin: 0;
  padding-left: 1.2rem;
  font-weight: 650;
}
.missing-list li { margin: 4px 0; }
.hint.tight { margin: 0; }

/* Time off requests */
.time-off-card .sub { margin-bottom: 10px; }
.badge.to-pending { background: #e6b84d; color: #3a2e08; }
.badge.to-approved { background: #1f7a4d; color: #fff; }
.badge.to-denied { background: #b42318; color: #fff; }
.badge.to-vac { background: #2a3544; color: #e8eef5; }
.badge.to-banked { background: #5a3d6e; color: #f3eaf7; }
.badge.to-dayoff { background: #5c6570; color: #fff; }
.time-off-req {
  align-items: flex-start;
  gap: 10px;
}
.time-off-req .to-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.time-off-req.status-pending {
  border-left: 3px solid #e6b84d;
  padding-left: 10px;
}
.deny-reason { color: var(--danger); font-weight: 600; }
.entry-timeoff .title { color: var(--muted); }

.ot-period-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px 8px;
  margin: 0 0 12px;
  background: rgba(90, 61, 110, 0.12);
}
.ot-period-box legend {
  font-weight: 700;
  padding: 0 6px;
}
.ot-period-box .bank-ot-opt {
  margin-top: 8px;
  margin-bottom: 4px;
}
