/* ── Reset ────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens — mirrors relics2026.atimo.us ─────────────── */
:root {
  /* Primary navy (site --color_p / --color_pd3) */
  --primary:       #1d333c;
  --primary-mid:   #314690;   /* header blue — rgba(49,70,144) */
  --primary-light: #3b5384;   /* --color_pl1 */

  /* Teal accent — matches logo and --color_pl3 */
  --teal:          #007a9e;
  --teal-light:    #009fb8;

  /* Gold/bronze accent — site --color_a / --color_al1 */
  --gold:          #997d4c;
  --gold-light:    #e5b966;

  /* Stop-type colors */
  --parish:        #2563eb;   /* vivid blue */
  --hospital:      #b91c1c;   /* brick red */
  --university:    #15803d;   /* forest green */
  --other:         #a855f7;   /* light purple */

  /* Layout */
  --sidebar-w:     340px;
  --header-h:      58px;

  /* Neutrals */
  --border:        #dde3ea;
  --text:          #1d333c;
  --text-muted:    #5a6a74;
  --bg:            #f4f7fb;   /* --color_pl5 tone */
  --surface:       #ffffff;
}

html, body { height: 100%; font-family: 'Barlow', 'Segoe UI', system-ui, sans-serif; color: var(--text); }

/* ── Google Font import (Barlow + Playfair Display — same as site) */
@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&family=Playfair+Display:wght@600&display=swap');

/* ── Layout ───────────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── Header ───────────────────────────────────────────────────── */
#header {
  height: var(--header-h);
  background: linear-gradient(120deg, var(--primary) 0%, var(--primary-mid) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,.4);
  z-index: 200;
}

/* Logo — white pill background so it reads on dark header */
#header-logo {
  height: 42px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  margin-right: 8px;
}

#header-title { min-width: 0; }

#header-title h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}

#header-subtitle {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-top: 1px;
}

#header-controls { display: flex; align-items: center; gap: 6px; flex: 1; justify-content: flex-end; }

/* ── Map toggle checkboxes (Route / Bubbles) ──────────────────── */
.map-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 5px;
  background: rgba(255,255,255,.15); color: rgba(255,255,255,.75);
  font-size: 12px; font-weight: 600; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background .15s, color .15s, opacity .15s;
}
.map-toggle:hover { background: rgba(255,255,255,.25); color: #fff; }
.map-toggle.active { background: rgba(255,255,255,.25); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }
.map-toggle.disabled { opacity: .4; pointer-events: none; }
.map-toggle input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.toggle-box {
  width: 13px; height: 13px; flex-shrink: 0; border-radius: 3px;
  border: 1.5px solid rgba(255,255,255,.5);
  position: relative; transition: background .15s, border-color .15s;
}
.map-toggle.active .toggle-box {
  background: #fff; border-color: #fff;
}
.map-toggle.active .toggle-box::after {
  content: ''; position: absolute;
  left: 3px; top: 0px; width: 4px; height: 7px;
  border: 2px solid var(--primary-mid);
  border-top: none; border-left: none;
  transform: rotate(45deg);
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  padding: 6px 13px;
  border: none; border-radius: 5px;
  cursor: pointer; font-size: 12px; font-weight: 600;
  font-family: inherit;
  transition: filter .15s, opacity .15s;
  white-space: nowrap; line-height: 1.5;
}
.btn:hover   { filter: brightness(1.12); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-ghost  { background: rgba(255,255,255,.15); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.25); filter: none; }
.btn-ghost.active { background: rgba(255,255,255,.3); box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }

/* Gold/teal primary action buttons */
.btn-primary { background: var(--teal);    color: #fff; }
.btn-success { background: var(--gold);    color: #fff; }
.btn-danger  { background: #b23b2a;        color: #fff; }
.btn-outline {
  background: #fff; color: var(--primary-mid);
  border: 1.5px solid var(--primary-mid);
}
.btn-sm { padding: 4px 8px; font-size: 11px; }

.icon-btn {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.8); font-size: 20px;
  padding: 4px 7px; border-radius: 4px; line-height: 1;
}
.icon-btn:hover { background: rgba(255,255,255,.15); }
.icon-btn.dark  { color: var(--text-muted); font-size: 16px; }
.icon-btn.dark:hover { background: var(--border); color: var(--text); }

/* ── Main layout ──────────────────────────────────────────────── */
#main { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar ──────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  flex-shrink: 0; overflow: hidden;
  transition: width .25s ease, opacity .25s ease;
}
#sidebar.collapsed          { width: 0; opacity: 0; pointer-events: none; }
#timeline-sidebar.collapsed { width: 0; opacity: 0; pointer-events: none; padding: 0; overflow: hidden; }

#sidebar-head {
  padding: 8px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
#stops-count { font-size: 11px; font-weight: 600; color: var(--text-muted); flex: 1; }
#filter-status {
  font-size: 11px; border: 1px solid var(--border);
  border-radius: 4px; padding: 3px 6px; background: #fff;
  cursor: pointer; color: var(--text);
}

#stops-list { flex: 1; overflow-y: auto; list-style: none; }

#sidebar-foot {
  padding: 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
#sidebar-foot .btn { width: 100%; justify-content: center; }
#stops-list::-webkit-scrollbar { width: 4px; }
#stops-list::-webkit-scrollbar-thumb { background: #c5cdd5; border-radius: 2px; }

/* ── Stop list items ──────────────────────────────────────────── */
.stop-item {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
  user-select: none;
}
.stop-item:hover  { background: #eef3fb; }
.stop-item.active { background: #dde8f5; border-left: 3px solid var(--teal); }
.stop-item.sortable-ghost { opacity: .3; background: #c9d9ee; }
.stop-item.sortable-drag  { box-shadow: 0 4px 16px rgba(0,0,0,.18); background: #fff; }

.drag-handle {
  color: #b0bec5; cursor: grab; font-size: 15px;
  flex-shrink: 0; line-height: 1; padding: 2px;
}
.drag-handle:active { cursor: grabbing; }

/* Numbered badge — uses status color */
.stop-badge {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.stop-badge.parish     { background: var(--parish); }
.stop-badge.hospital   { background: var(--hospital); }
.stop-badge.university { background: var(--university); }
.stop-badge.other      { background: var(--other); }

.stop-info { flex: 1; min-width: 0; }
.stop-name     { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop-location { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.stop-dates    { font-size: 10px; color: var(--teal); margin-top: 1px; }

.stop-warn { font-size: 11px; color: var(--gold); flex-shrink: 0; }

.stop-edit {
  background: none; border: 1px solid transparent;
  border-radius: 4px; padding: 3px 6px;
  font-size: 12px; cursor: pointer; color: var(--text-muted);
  opacity: 0; transition: opacity .15s; flex-shrink: 0;
}
.stop-item:hover .stop-edit { opacity: 1; }
.stop-edit:hover { background: var(--teal); color: #fff; border-color: var(--teal); }

/* ── Map ──────────────────────────────────────────────────────── */
#map-wrap { flex: 1; position: relative; }
#map      { width: 100%; height: 100%; }

#geocode-status {
  position: absolute; bottom: 36px; left: 50%; transform: translateX(-50%);
  background: rgba(29,51,60,.92); color: #fff;
  padding: 8px 18px; border-radius: 20px; font-size: 12px;
  white-space: nowrap; pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

/* ── Directions Panel ─────────────────────────────────────────── */
#dir-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 4px solid var(--teal);
  box-shadow: 0 -3px 16px rgba(0,0,0,.18);
  z-index: 60;
  max-height: 38vh;
  display: flex; flex-direction: column;
  animation: slideUp .25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

#dir-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#dir-title { font-weight: 700; font-size: 13px; color: var(--primary); }
#dir-stats {
  flex: 1; font-size: 12px; color: var(--teal); font-weight: 600;
}

#dir-route-label {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  font-size: 12px; font-weight: 600;
  background: #eef6f9;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
#dir-from-label { color: var(--parish); }
#dir-to-label   { color: var(--primary); }
#dir-arrow      { color: var(--teal); font-size: 16px; }

#dir-steps {
  flex: 1; overflow-y: auto;
  padding: 8px 14px;
  list-style: none;
  counter-reset: step-counter;
}
#dir-steps li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text);
  line-height: 1.4;
}
#dir-steps li:last-child { border-bottom: none; }
#dir-steps li .step-num {
  background: var(--teal); color: #fff;
  border-radius: 50%; width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; flex-shrink: 0;
}
#dir-steps li .step-dist {
  color: var(--text-muted); font-size: 11px; white-space: nowrap;
}

/* ── Legend (map + stats) ─────────────────────────────────────── */
#legend, #stats-legend {
  position: absolute; top: 12px; right: 12px;
  background: rgba(255,255,255,.95);
  border-radius: 8px; padding: 10px 14px;
  font-size: 11px; box-shadow: 0 2px 10px rgba(0,0,0,.18);
  z-index: 50; line-height: 1.9;
  border-top: 3px solid var(--teal);
}
#legend img, #stats-legend img {
  display: block; width: 100%; max-width: 110px;
  margin: 0 auto 8px; object-fit: contain;
}
#legend h4, #stats-legend h4 {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted); margin-bottom: 4px;
}
.leg-item { display: flex; align-items: center; gap: 7px; }
.leg-dot  { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

/* ── Edit Modal ───────────────────────────────────────────────── */
#modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
#modal {
  background: var(--surface); border-radius: 10px;
  width: 540px; max-width: 96vw; max-height: 92vh;
  display: flex; flex-direction: column;
  box-shadow: 0 10px 40px rgba(0,0,0,.3);
  overflow: hidden;
  border-top: 4px solid var(--teal);
}
#modal-head {
  display: flex; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
#modal-head h2 {
  flex: 1; font-size: 15px;
  font-family: 'Playfair Display', serif;
  color: var(--primary);
}
#modal-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 13px;
  scrollbar-width: none;
}
#modal-body::-webkit-scrollbar { display: none; }
#modal-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-top: 1px solid var(--border);
  background: var(--bg); gap: 8px;
}
#modal-foot .right { display: flex; gap: 8px; }

/* ── Form fields ──────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted);
}
.field input, .field select, .field textarea {
  padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 5px;
  font-size: 13px; font-family: inherit; color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(0,122,158,.15);
}
.field textarea { resize: vertical; min-height: 60px; }

.field-error {
  font-size: 11px; color: #c62828;
  background: #fdecea; border-left: 3px solid #c62828;
  border-radius: 4px; padding: 7px 10px;
  margin-top: -6px;
}

.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.field-row .field.narrow { flex: 0 0 80px; }

.coord-group { display: flex; gap: 8px; align-items: flex-end; }
.coord-group .field { flex: 1; }

/* ── Info Window (Google Maps popup) ──────────────────────────── */
.iw { font-family: 'Barlow', sans-serif; max-width: 270px; }
.iw-top { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.iw-badge {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.iw-badge.parish     { background: var(--parish); }
.iw-badge.hospital   { background: var(--hospital); }
.iw-badge.university { background: var(--university); }
.iw-badge.other      { background: var(--other); }
.iw-name  { font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--primary); }
.iw-addr  { font-size: 11px; color: var(--text-muted); margin: 4px 0; }
.iw-dates { font-size: 11px; color: var(--teal); margin: 3px 0; }
.iw-notes { font-size: 11px; font-style: italic; color: var(--text-muted); margin: 3px 0; }
.iw-status {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px; margin: 5px 0 8px;
}
.iw-status.parish     { background: #dbeafe; color: var(--parish); }
.iw-status.hospital   { background: #fee2e2; color: var(--hospital); }
.iw-status.university { background: #dcfce7; color: var(--university); }
.iw-status.other      { background: #f3f4f6; color: var(--other); }
.iw-edit-icon {
  margin-left: auto; flex-shrink: 0;
  background: none !important; border: none !important; outline: none !important;
  box-shadow: none !important; cursor: pointer;
  font-size: 15px; padding: 2px 5px; border-radius: 4px;
  color: #5f6368; line-height: 1; transition: background .15s;
}
.iw-edit-icon:hover { background: #f1f3f4 !important; }
.iw-actions { margin-top: 8px; }
.iw-next-btn {
  display: block; width: 100%; padding: 9px 11px;
  background: transparent; color: var(--primary);
  border: 1px solid #c8c8c8; border-radius: 6px; cursor: pointer;
  font-family: inherit; text-align: left;
  transition: background .15s, color .15s, border-color .15s;
}
.iw-next-btn:hover {
  background: var(--teal); color: #fff; border-color: var(--teal);
}
.iw-next-label  { display: block; font-size: 10px; font-weight: 600; color: #888; margin-bottom: 3px; }
.iw-next-name   { display: block; font-size: 12px; font-weight: 700; line-height: 1.3; margin-bottom: 3px; color: var(--primary); }
.iw-next-detail { display: block; font-size: 10px; color: #666; }
.iw-next-btn:hover .iw-next-label,
.iw-next-btn:hover .iw-next-name,
.iw-next-btn:hover .iw-next-detail { color: #fff; }

/* ── Toast notifications ──────────────────────────────────────── */
.toast {
  position: fixed; bottom: 22px; right: 22px;
  background: var(--primary); color: #fff;
  padding: 11px 18px; border-radius: 6px; font-size: 13px;
  z-index: 3000; box-shadow: 0 4px 16px rgba(0,0,0,.3);
  animation: toastIn .25s ease; pointer-events: none;
  border-left: 4px solid var(--teal);
}
.toast.error { background: #8b1a0e; border-color: var(--gold-light); }

@keyframes toastIn {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Auth-gated visibility ────────────────────────────────────── */
.auth-btn       { display: none !important; }
.auth-admin-btn { display: none !important; }
body.auth-logged-in .auth-btn        { display: inline-flex !important; }
body.auth-logged-in.auth-admin .auth-admin-btn { display: flex !important; }
/* Stop edit buttons hidden until logged in */
.stop-edit { display: none; }
body.auth-logged-in .stop-edit { display: inline-flex; }

/* ── Nav tabs (centered between equal flex groups) ────────────── */
#header-left {
  display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0;
}
#nav-tabs { display: flex; gap: 2px; align-self: stretch; }
.nav-tab {
  padding: 0 20px; align-self: stretch;
  border: none; border-bottom: 3px solid transparent;
  background: transparent; color: rgba(255,255,255,.6);
  cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-tab:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-tab.active { color: #fff; border-bottom-color: var(--gold-light); background: rgba(255,255,255,.08); }

/* ── Stats view ────────────────────────────────────────────────── */
#stats-view   { flex: 1; overflow: hidden; display: flex; flex-direction: column; position: relative; }
#stats-scroll { flex: 1; overflow-y: auto; background: var(--bg); }
.stats-wrapper { max-width: 860px; margin: 32px auto; padding: 0 24px 48px; }
.stats-title   { font-size: 18px; font-weight: 700; color: var(--primary); margin-bottom: 20px; }
.stats-empty   { padding: 80px 40px; text-align: center; color: var(--text-muted); font-size: 14px; }

.stats-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08); border-radius: 8px; overflow: hidden;
}
.stats-table thead th {
  background: var(--primary); color: #fff;
  padding: 11px 10px; font-size: 12px; font-weight: 700;
  letter-spacing: .3px; text-align: center;
}
.stats-table thead th.st-month-col { text-align: left; min-width: 160px; padding-left: 16px; }
.stats-table thead th.st-total-col { background: var(--primary-mid); min-width: 64px; }
.st-wk-hdr   { font-size: 11px; font-weight: 700; }
.st-wk-range { font-size: 10px; font-weight: 400; opacity: .75; margin-top: 2px; }

.stats-table tbody tr td {
  padding: 9px 10px; border-bottom: 1px solid var(--border);
  vertical-align: top; text-align: center;
}
.st-row-alt td { background: #f6f8fc; }
.st-month-name { text-align: left; padding-left: 16px; font-weight: 600; color: var(--primary); white-space: nowrap; }
.st-wk-cell    { min-width: 90px; }
.st-has-stops  { background: rgba(49,70,144,.05) !important; }
.st-row-alt .st-has-stops { background: rgba(49,70,144,.09) !important; }
.st-count      { display: block; font-size: 20px; font-weight: 700; color: var(--primary); line-height: 1; margin-bottom: 5px; }
.st-zero       { font-size: 16px; font-weight: 400; color: #ccc; }
.st-badges     { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }
.st-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 10px; font-weight: 700; color: #fff;
  cursor: default;
}
.st-row-total  { font-weight: 700; font-size: 14px; color: var(--primary); background: rgba(49,70,144,.06) !important; }
.st-footer td  { padding: 11px 10px; background: var(--primary) !important; color: #fff; font-weight: 700; font-size: 13px; border: none; }
.st-footer-label { text-align: left !important; padding-left: 16px !important; letter-spacing: .3px; }
.st-footer-cell  { }
.st-footer-grand { background: var(--primary-mid) !important; font-size: 16px; }

/* ── Timeline view ─────────────────────────────────────────────── */
#timeline-view { flex: 1; display: flex; overflow: hidden; min-height: 0; }
#timeline-scroll { flex: 1; overflow: auto; background: var(--bg); }
#timeline-sidebar {
  width: 290px; flex-shrink: 0; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 16px;
}
#timeline-sidebar::-webkit-scrollbar { width: 4px; }
#timeline-sidebar::-webkit-scrollbar-thumb { background: #c5cdd5; border-radius: 2px; }

/* Placeholder when chart can't render */
.tl-empty { padding: 80px 40px; text-align: center; color: var(--text-muted); line-height: 1.7; }
.tl-empty-icon  { font-size: 52px; margin-bottom: 14px; }
.tl-empty-title { font-size: 15px; font-weight: 600; color: var(--primary); margin-bottom: 8px; }

/* Gantt table */
#timeline-table { border-collapse: separate; border-spacing: 0; font-size: 12px; white-space: nowrap; }
#timeline-table thead { position: sticky; top: 0; z-index: 25; }

.tl-month-hdr {
  background: var(--primary); color: #fff;
  text-align: center; font-size: 17px; font-weight: 700; letter-spacing: .5px;
  padding: 9px 8px; border-right: 1px solid rgba(255,255,255,.15);
}
.tl-day-hdr {
  background: var(--primary-mid); color: rgba(255,255,255,.9);
  text-align: center; font-size: 15px; font-weight: 600;
  padding: 5px 0; border-right: 1px solid rgba(255,255,255,.1);
  width: 36px; min-width: 36px;
}
.tl-day-hdr.tl-weekend { background: #253882; }
.tl-dow-hdr {
  background: #fff; color: var(--primary-mid);
  text-align: center; font-size: 13px; font-weight: 700;
  padding: 4px 0; border-right: 1px solid #e8edf2;
  border-bottom: 1px solid var(--border); width: 36px; min-width: 36px;
  text-transform: uppercase;
}
.tl-dow-hdr.tl-weekend { background: #edf0f7; color: #253882; }
.tl-cell {
  height: 36px; padding: 3px 0;
  border-right: 1px solid #e8edf2; border-bottom: 1px solid var(--border);
  vertical-align: middle; width: 36px; min-width: 36px;
}
.tl-cell.tl-weekend  { background: #edf0f7; }
.tl-cell.tl-seamless { border-right: none; }

/* Alternating month — odd months use a purple-slate palette */
.tl-month-hdr.tl-m-odd               { background: #4a3f80; }
.tl-day-hdr.tl-m-odd                 { background: #5b52a0; }
.tl-day-hdr.tl-weekend.tl-m-odd      { background: #3d3272; }
.tl-dow-hdr.tl-m-odd                 { color: #5b52a0; }
.tl-dow-hdr.tl-weekend.tl-m-odd      { background: #edeaf7; color: #3d3272; }
.tl-cell.tl-weekend.tl-m-odd         { background: #edeaf7; }
.tl-bar {
  height: 30px; width: 100%;
  display: flex; align-items: center;
  position: relative; overflow: visible;
  cursor: grab;
}
.tl-bar.solo  { border-radius: 3px; }
.tl-bar.first { border-radius: 3px 0 0 3px; }
.tl-bar.last  { border-radius: 0 3px 3px 0; }
.tl-bar.mid   {}
.tl-resize-handle {
  position: absolute; top: 0; bottom: 0; width: 8px;
  cursor: ew-resize; z-index: 6;
  background: rgba(0,0,0,0.18); border-radius: inherit;
}
.tl-resize-left  { left: 0; }
.tl-resize-right { right: 0; }
body.tl-dragging            { cursor: grabbing !important; user-select: none; }
body.tl-dragging .tl-bar    { cursor: grabbing !important; }
.tl-bar-label {
  position: absolute; transform: translateX(-50%);
  color: #fff; font-size: 11px; font-weight: 700;
  pointer-events: none; text-shadow: 0 1px 2px rgba(0,0,0,.4);
  white-space: nowrap; z-index: 5;
}

/* Timeline sidebar */
.tl-sidebar-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px;
  color: var(--text-muted); margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
/* Timeline bar hover tooltip */
.tl-tip {
  position: fixed; z-index: 9999; pointer-events: none;
  background: rgba(29,51,60,.96); color: #fff;
  padding: 8px 13px; border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  max-width: 280px;
}
.tl-tip.hidden { display: none; }
.tl-tip-name  { font-size: 13px; font-weight: 600; line-height: 1.4; }
.tl-tip-dates { font-size: 11px; color: rgba(255,255,255,.75); margin-top: 3px; }

.tl-warning-box {
  background: #fff3e0; border: 1px solid #ffb74d;
  border-left: 3px solid #fb8c00; border-radius: 6px;
  padding: 10px 12px; font-size: 12px; color: #e65100;
  margin-bottom: 14px; line-height: 1.5;
}
.tl-stop-row {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 8px 6px; border-bottom: 1px solid var(--border); font-size: 12px;
  cursor: pointer; border-radius: 5px; margin: 0 -6px;
  transition: background .12s;
}
.tl-stop-row:last-child { border-bottom: none; }
.tl-stop-row:hover { background: var(--bg); }
.tl-issue-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; margin-top: 3px;
}
.tl-issue-dot.ok       { background: #43a047; }
.tl-issue-dot.missing  { background: #e53935; }
.tl-issue-dot.conflict { background: #fb8c00; }
.tl-stop-meta { flex: 1; min-width: 0; }
.tl-stop-row-name {
  font-weight: 600; color: var(--primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-stop-row-dates         { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.tl-stop-row-dow           { font-size: 10px; color: var(--text-muted); margin-top: 1px; font-style: italic; }
.tl-stop-row-issue         { font-size: 10px; color: #c62828; margin-top: 2px; }
.tl-stop-row-issue.conflict { color: #e65100; }
.tl-stop-edit-hint {
  font-size: 13px; color: var(--text-muted); flex-shrink: 0; opacity: 0;
  transition: opacity .12s; align-self: center;
}
.tl-stop-row:hover .tl-stop-edit-hint { opacity: 1; }

/* ── Auth user chip & dropdown ────────────────────────────────── */
#auth-user-info { position: relative; display: flex; align-items: center; }
#auth-user-name { font-size: 13px; font-weight: 600; color: var(--gold-light); white-space: nowrap; }
.user-menu-trigger { display: flex; align-items: center; gap: 6px; }
.user-menu-caret   { font-size: 10px; opacity: .7; }

.user-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  background: #fff; border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,.22);
  min-width: 170px; z-index: 500;
  border: 1px solid var(--border); overflow: hidden;
}
.dropdown-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 11px 15px;
  background: none; border: none; cursor: pointer;
  font-size: 13px; font-family: inherit;
  color: var(--text); text-align: left;
  transition: background .12s;
}
.dropdown-item:hover { background: var(--bg); }

/* ── Auth overlay modals (login / forgot) ─────────────────────── */
.auth-overlay {
  position: fixed; inset: 0;
  background: rgba(10,20,30,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 2100;
}
.auth-modal {
  background: #fff; border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  width: 360px; max-width: 95vw;
  overflow: hidden;
}
.auth-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-mid));
}
.auth-modal-head h2 {
  font-family: 'Playfair Display', serif;
  color: #fff; font-size: 18px; margin: 0;
}
.auth-modal-body { padding: 22px 24px 24px; }
.auth-modal-body .field { margin-bottom: 16px; }
.auth-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.auth-msg {
  border-radius: 5px; padding: 9px 12px;
  font-size: 13px; margin-bottom: 12px;
}
.auth-msg.error   { background: #fdecea; color: #c62828; border-left: 3px solid #c62828; }
.auth-msg.success { background: #e8f5e9; color: #2e7d32; border-left: 3px solid #2e7d32; }
.auth-link-row { text-align: center; margin-top: 12px; font-size: 12px; }
.text-link { color: var(--teal); text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* ── Users management modal ───────────────────────────────────── */
#users-overlay {
  position: fixed; inset: 0;
  background: rgba(10,20,30,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 2100;
}
#users-modal {
  background: #fff; border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  width: 560px; max-width: 95vw;
  display: flex; flex-direction: column;
  max-height: 80vh; overflow: hidden;
}
#users-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-mid));
}
#users-head h2 {
  font-family: 'Playfair Display', serif;
  color: #fff; font-size: 18px; margin: 0;
}
#users-body { padding: 20px; overflow-y: auto; flex: 1; }
#users-foot {
  padding: 14px 20px; border-top: 1px solid #eee; flex-shrink: 0;
}
#users-list-foot, #users-form-foot {
  display: flex; align-items: center; justify-content: space-between;
}
/* Users table */
#users-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
#users-table th {
  text-align: left; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); padding: 0 10px 8px;
  border-bottom: 2px solid #eee;
}
#users-table td {
  padding: 10px; border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
#users-table tr:last-child td { border-bottom: none; }
.user-actions { text-align: right; }
.role-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px;
}
.role-badge.administrator { background: #e0eaf8; color: var(--primary-mid); }
.role-badge.collaborator  { background: #f0f0f0; color: #555; }

/* ── Utilities ────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  #sidebar { position: absolute; z-index: 100; height: 100%; }
  #header-controls .btn span { display: none; }
  #header-controls .toggle-text { display: none; }
  #legend, #stats-legend { display: none; }
  #header-logo { height: 34px; }
}
