/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --sb-bg:       #0f2942;
  --sb-hover:    rgba(255,255,255,.08);
  --sb-active:   #1d6fd8;
  --sb-text:     rgba(255,255,255,.75);
  --sb-dim:      rgba(255,255,255,.38);
  --sb-w:        245px;
  --hdr-h:       58px;
  --bg:          #f0f4f8;
  --card:        #ffffff;
  --text:        #1a2332;
  --muted:       #64748b;
  --border:      #e2e8f0;
  --primary:     #1d6fd8;
  --orange:      #e8751a;
  --success:     #10b981;
  --warning:     #f59e0b;
  --danger:      #ef4444;
  --r:           12px;
  --sh:          0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --sh-md:       0 4px 12px rgba(0,0,0,.1);
}

*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); margin: 0; }

/* ── Login ─────────────────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #08192b; padding: 1rem; position: relative; overflow: hidden;
}

/* Animated glow orbs */
.login-orb {
  position: absolute; border-radius: 50%; pointer-events: none;
  filter: blur(80px); opacity: .55;
}
.login-orb-blue {
  width: 520px; height: 520px;
  background: radial-gradient(circle, #1d6fd8 0%, transparent 70%);
  top: -180px; left: -180px;
  animation: orbDrift1 14s ease-in-out infinite alternate;
}
.login-orb-orange {
  width: 420px; height: 420px;
  background: radial-gradient(circle, #e8751a 0%, transparent 70%);
  bottom: -160px; right: -140px;
  animation: orbDrift2 18s ease-in-out infinite alternate;
}
@keyframes orbDrift1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(80px, 60px) scale(1.1); }
}
@keyframes orbDrift2 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-60px, -50px) scale(1.08); }
}

/* Card */
.login-card {
  position: relative; z-index: 1;
  background: #fff; border-radius: 22px; padding: 2.5rem 2rem;
  width: 100%; max-width: 400px; text-align: center;
  box-shadow: 0 32px 64px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.04);
  animation: cardRise .65s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes cardRise {
  from { opacity: 0; transform: translateY(28px) scale(.96); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.login-card.shake { animation: shake .42s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
  10%, 90%       { transform: translateX(-3px); }
  20%, 80%       { transform: translateX( 5px); }
  30%, 50%, 70%  { transform: translateX(-7px); }
  40%, 60%       { transform: translateX( 7px); }
}

/* Badge / shield */
.login-badge {
  position: relative; width: 80px; height: 80px; border-radius: 50%;
  margin: 0 auto 1.4rem;
  background: linear-gradient(145deg, #0f2942 0%, #1d6fd8 55%, #e8751a 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.1rem; color: #fff;
  box-shadow: 0 8px 24px rgba(232,117,26,.35);
  animation: badgePop .75s cubic-bezier(0.34, 1.56, 0.64, 1) .12s both;
}
.login-badge::after {
  content: ''; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid rgba(232,117,26,.45);
  animation: ringPulse 2.8s ease-in-out infinite;
}
@keyframes badgePop {
  from { opacity: 0; transform: scale(.25) rotate(-25deg); }
  to   { opacity: 1; transform: scale(1)   rotate(0deg); }
}
@keyframes ringPulse {
  0%,100% { transform: scale(1);    opacity: .75; }
  50%     { transform: scale(1.15); opacity: .2; }
}

/* Title */
.login-title-wrap {
  display: inline-flex; align-items: flex-start; gap: .4rem;
  justify-content: center; margin-bottom: .2rem;
  animation: fadeSlideUp .5s ease .28s both;
}
.login-title-wrap h1 {
  font-size: 1.75rem; font-weight: 800; color: #0f2942; margin: 0; line-height: 1;
}
.ver-pill {
  background: var(--orange); color: #fff;
  font-size: .58rem; font-weight: 700; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 20px;
  margin-top: .15rem; line-height: 1.6;
}
.login-subtitle {
  color: var(--muted); font-size: .875rem; margin-bottom: 1.75rem;
  animation: fadeSlideUp .5s ease .38s both;
}
.login-footer {
  font-size: .7rem; color: #94a3b8; margin-top: 1.5rem; margin-bottom: 0;
  animation: fadeSlideUp .5s ease .6s both;
}

/* Input fields */
.inp-wrap { position: relative; animation: fadeSlideUp .5s ease var(--d, .45s) both; }
.inp-wrap:nth-child(2) { --d: .5s; }
.inp-icon {
  position: absolute; left: .9rem; top: 50%; transform: translateY(-50%);
  color: #94a3b8; font-size: .95rem; pointer-events: none; z-index: 5;
  transition: color .2s;
}
.inp-field { padding-left: 2.6rem !important; transition: border-color .2s, box-shadow .2s; }
.inp-wrap:focus-within .inp-icon { color: var(--orange); }
.inp-field:focus {
  border-color: var(--orange) !important;
  box-shadow: 0 0 0 3px rgba(232,117,26,.18) !important;
}

/* Login button */
.btn-login {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: .75rem 1.5rem; border: none; border-radius: 10px;
  background: linear-gradient(135deg, #1d6fd8 0%, #e8751a 100%);
  color: #fff; font-size: 1rem; font-weight: 700; letter-spacing: .02em;
  cursor: pointer; position: relative; overflow: hidden;
  box-shadow: 0 4px 18px rgba(232,117,26,.38);
  transition: transform .15s, box-shadow .15s;
  animation: fadeSlideUp .5s ease .55s both;
}
.btn-login::before {
  content: ''; position: absolute;
  top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.22), transparent);
  transition: left .45s ease;
}
.btn-login:hover::before { left: 110%; }
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 7px 24px rgba(232,117,26,.48); }
.btn-login:active { transform: translateY(0); }
.btn-login:disabled { opacity: .7; cursor: not-allowed; transform: none; }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Shell layout ──────────────────────────────────────────────────────────── */
#app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sb-w); background: var(--sb-bg); display: flex; flex-direction: column;
  flex-shrink: 0; height: 100vh; overflow-y: auto; z-index: 200;
  transition: transform .25s ease;
}
.sidebar-header {
  display: flex; align-items: center; gap: 11px;
  padding: 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-logo {
  width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(145deg, #1d6fd8, #e8751a);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; color: #fff;
}
.sidebar-title { font-weight: 700; font-size: .95rem; color: #fff; line-height: 1.2; }
.sidebar-ver   { font-size: .65rem; color: var(--sb-dim); }

.sidebar-nav { flex: 1; padding: .5rem; overflow-y: auto; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: .55rem .75rem; border-radius: 8px; margin-bottom: 2px;
  color: var(--sb-text); text-decoration: none;
  font-size: .85rem; font-weight: 500;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--sb-hover); color: #fff; }
.nav-item.active { background: var(--sb-active); color: #fff; }
.nav-item i { font-size: .95rem; width: 18px; text-align: center; flex-shrink: 0; }
.nav-danger:hover { background: rgba(239,68,68,.15) !important; color: #fca5a5 !important; }
.nav-classic { color: var(--sb-dim) !important; font-size: .78rem !important; }
.nav-classic:hover { background: rgba(255,255,255,.06) !important; color: #94a3b8 !important; }
.msg-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #fff;
  font-size: .6rem; font-weight: 700; border-radius: 10px;
  min-width: 16px; height: 16px; padding: 0 4px;
  margin-left: auto; flex-shrink: 0;
}

/* ── Message Center ────────────────────────────────────────────────────────── */
.msg-layout { display: grid; grid-template-columns: 280px 1fr; gap: 1rem; height: calc(100vh - var(--hdr-h) - 3rem - 32px); }
@media (max-width: 768px) { .msg-layout { grid-template-columns: 1fr; height: auto; } }
.msg-pane { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); display: flex; flex-direction: column; overflow: hidden; }
.msg-pane-header { padding: .75rem 1rem; border-bottom: 1px solid var(--border); font-weight: 600; font-size: .85rem; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.conv-list { flex: 1; overflow-y: auto; }
.conv-item { display: flex; align-items: flex-start; gap: .65rem; padding: .75rem 1rem; cursor: pointer; border-bottom: 1px solid var(--border); transition: background .1s; }
.conv-item:hover { background: var(--bg); }
.conv-item.active { background: rgba(29,111,216,.08); }
.conv-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; background: linear-gradient(135deg, #0f2942, #1d6fd8); display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; color: #fff; }
.conv-name { font-weight: 600; font-size: .83rem; line-height: 1.3; }
.conv-preview { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.conv-meta { margin-left: auto; text-align: right; flex-shrink: 0; }
.conv-time { font-size: .68rem; color: var(--muted); }
.conv-unread { display: inline-block; background: var(--primary); color: #fff; border-radius: 10px; font-size: .6rem; font-weight: 700; padding: 1px 5px; margin-top: 3px; }
.msg-thread { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.msg-bubble { max-width: 75%; padding: .5rem .75rem; border-radius: 12px; font-size: .85rem; line-height: 1.45; word-break: break-word; }
.msg-bubble.mine { background: var(--primary); color: #fff; border-bottom-right-radius: 3px; align-self: flex-end; }
.msg-bubble.theirs { background: var(--bg); color: var(--text); border-bottom-left-radius: 3px; align-self: flex-start; border: 1px solid var(--border); }
.msg-time { font-size: .65rem; color: var(--muted); margin-top: 2px; }
.msg-time.mine { text-align: right; }
.msg-compose { padding: .75rem 1rem; border-top: 1px solid var(--border); display: flex; gap: .5rem; flex-shrink: 0; align-items: flex-end; }
.msg-compose textarea { flex: 1; resize: none; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); padding: .5rem .75rem; font-size: .85rem; font-family: inherit; line-height: 1.4; max-height: 100px; }
.msg-compose textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,111,216,.12); }
.msg-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); font-size: .88rem; gap: .5rem; }
.msg-empty i { font-size: 2.5rem; opacity: .25; }

.nav-section {
  padding: .7rem .75rem .2rem;
  font-size: .62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--sb-dim);
}

.sidebar-footer { border-top: 1px solid rgba(255,255,255,.07); padding: .4rem .5rem; }
.sidebar-user-block {
  display: flex; align-items: center; gap: 10px;
  padding: .6rem .75rem .8rem;
}
.s-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #1d6fd8, #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: #fff;
}
.s-name { font-size: .8rem; font-weight: 600; color: #fff; line-height: 1.2; }
.s-unit { font-size: .68rem; color: var(--sb-dim); }

/* ── Mobile sidebar ────────────────────────────────────────────────────────── */
#sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 199;
}
@media (max-width: 767px) {
  #sidebar { position: fixed; transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #sidebar-overlay.show { display: block; }
}

/* ── Main wrapper ──────────────────────────────────────────────────────────── */
#main-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ── Top bar ───────────────────────────────────────────────────────────────── */
#top-bar {
  height: var(--hdr-h); background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 1.25rem; gap: .75rem;
  flex-shrink: 0; box-shadow: var(--sh); z-index: 10;
}
#page-title { font-size: 1.05rem; font-weight: 600; margin: 0; flex: 1; }

.duty-badge {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 20px; font-size: .78rem; font-weight: 600;
}
.duty-off { background: #f1f5f9; color: #475569; }
.duty-on  { background: #dcfce7; color: #15803d; }
.duty-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.duty-on .duty-dot { animation: blink 2s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.35} }

.icon-btn {
  background: none; border: none; cursor: pointer; padding: 5px 7px;
  border-radius: 6px; font-size: 1.3rem; color: var(--text); line-height: 1;
}
.icon-btn:hover { background: var(--bg); }

/* ── View area ─────────────────────────────────────────────────────────────── */
.view-area { flex: 1; overflow-y: auto; padding: 1.5rem; }
@media (max-width: 576px) { .view-area { padding: 1rem; } }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card { border: none; border-radius: var(--r); box-shadow: var(--sh); background: var(--card); color: var(--text); }
.card-header {
  background: transparent; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: .875rem; padding: .85rem 1.1rem;
  display: flex; align-items: center; justify-content: space-between;
}

/* ── Stat cards ────────────────────────────────────────────────────────────── */
.stat-card { background: var(--card); border-radius: var(--r); padding: 1.1rem 1.2rem; box-shadow: var(--sh); }
.stat-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .4rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; margin-bottom: .15rem; }
.stat-sub   { font-size: .78rem; color: var(--muted); margin-bottom: .7rem; }
.progress   { height: 5px; border-radius: 3px; background: #e2e8f0; margin-bottom: 0; }
.progress-bar { border-radius: 3px; transition: width .6s ease; }

/* ── Hero tour card ────────────────────────────────────────────────────────── */
.tour-hero {
  border-radius: var(--r); padding: 1.4rem 1.5rem; margin-bottom: 1.25rem;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
}
.tour-hero-active {
  background: linear-gradient(135deg, #0f2942 0%, #1a3a6e 100%);
  color: #fff; box-shadow: var(--sh-md);
}
.tour-hero-off { background: var(--card); border: 2px dashed var(--border); color: var(--text); }
.hero-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .7; margin-bottom: .3rem; }
.hero-status { font-size: 1.3rem; font-weight: 700; margin-bottom: .25rem; }
.hero-detail { font-size: .83rem; opacity: .75; }
.hero-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.btn-hero { padding: .45rem 1rem; border-radius: 8px; font-size: .83rem; font-weight: 600; border: none; cursor: pointer; transition: all .15s; }
.btn-hero:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn-signon  { background: var(--success); color: #fff; }
.btn-ten1    { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.3) !important; }
.btn-ten68   { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.3) !important; }
.btn-signoff { background: var(--danger); color: #fff; }

/* ── Layout helpers ────────────────────────────────────────────────────────── */
.g2 { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
.g3 { display: grid; gap: 1rem; grid-template-columns: repeat(3,1fr); }
.g4 { display: grid; gap: 1rem; grid-template-columns: repeat(4,1fr); }
.row-split { display: grid; gap: 1.25rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 992px) { .g4 { grid-template-columns: 1fr 1fr; } .row-split { grid-template-columns: 1fr; } }
@media (max-width: 768px) { .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 576px) { .g2,.g3,.g4 { grid-template-columns: 1fr; } }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table { font-size: .85rem; }
.table th { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .65rem 1rem; border-bottom-width: 1px; }
.table td { padding: .75rem 1rem; vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fafc; cursor: pointer; }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.tag { display: inline-block; padding: 2px 8px; border-radius: 5px; font-size: .72rem; font-weight: 600; }
.tag-patrol   { background: #dbeafe; color: #1d4ed8; }
.tag-locldetl { background: #fef3c7; color: #92400e; }
.tag-cntydetl { background: #fce7f3; color: #9d174d; }
.tag-admin    { background: #f3f4f6; color: #374151; }
.tag-vehmaint { background: #d1fae5; color: #065f46; }
.tag-other    { background: #ede9fe; color: #5b21b6; }
.tag-open     { background: #dcfce7; color: #15803d; }
.tag-closed   { background: #f1f5f9; color: #475569; }
.tag-actv     { background: #dcfce7; color: #15803d; }
.tag-susp     { background: #fee2e2; color: #991b1b; }
.tag-rmp1     { background: #dcfce7; color: #166534; }
.tag-rmp30    { background: #fef3c7; color: #92400e; }
.tag-rmp68    { background: #f1f5f9; color: #475569; }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty i { font-size: 2.5rem; display: block; margin-bottom: .75rem; opacity: .3; }
.empty p { margin: 0; font-size: .9rem; }

/* ── Loading ───────────────────────────────────────────────────────────────── */
.loading { display: flex; align-items: center; justify-content: center; padding: 4rem; }

/* ── Filter bar ────────────────────────────────────────────────────────────── */
.filter-bar { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.filter-bar select, .filter-bar input { font-size: .83rem; padding: .35rem .65rem; border-radius: 7px; border: 1px solid var(--border); background: var(--card); color: var(--text); }

/* ── Tour charts ───────────────────────────────────────────────────────────── */
.chart-wrap { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart-bar { width: 100%; background: var(--primary); border-radius: 3px 3px 0 0; min-height: 2px; transition: height .5s ease; opacity: .75; }
.chart-col:hover .chart-bar { opacity: 1; }
.chart-col.cur .chart-bar { background: var(--orange); opacity: 1; }
.chart-col-lbl { font-size: .55rem; color: var(--muted); margin-top: 4px; text-align: center; line-height: 1; }
.type-stat-row { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.type-stat-row:last-child { margin-bottom: 0; }
.type-stat-label { font-size: .78rem; color: var(--text); width: 110px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.type-stat-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.type-stat-fill { height: 100%; border-radius: 3px; transition: width .6s ease; }
.type-stat-count { font-size: .75rem; font-weight: 700; min-width: 1.5rem; text-align: right; color: var(--text); }
.type-stat-hrs { font-size: .72rem; color: var(--muted); min-width: 3rem; text-align: right; }

/* ── Detail event cards ────────────────────────────────────────────────────── */
.detail-card {
  background: var(--card); border-radius: var(--r); padding: 1rem 1.1rem;
  box-shadow: var(--sh); display: flex; align-items: flex-start; gap: 1rem;
  margin-bottom: .75rem;
}
.detail-date-box {
  background: var(--primary); color: #fff; border-radius: 10px;
  padding: .5rem .7rem; text-align: center; flex-shrink: 0; min-width: 52px;
}
.dbox-month { font-size: .62rem; font-weight: 700; text-transform: uppercase; opacity: .8; }
.dbox-day   { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.detail-body { flex: 1; min-width: 0; }
.detail-loc  { font-weight: 600; font-size: .9rem; margin-bottom: .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-meta { font-size: .78rem; color: var(--muted); }
.detail-actions { flex-shrink: 0; }

/* ── Officer roster cards ──────────────────────────────────────────────────── */
.officer-card {
  background: var(--card); border-radius: var(--r); padding: 1rem 1.1rem;
  box-shadow: var(--sh); display: flex; align-items: center; gap: 1rem;
}
.o-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #0f2942, #1d6fd8);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; color: #fff;
}
.o-name  { font-weight: 600; font-size: .9rem; }
.o-rank  { font-size: .78rem; color: var(--muted); }
.o-stats { margin-left: auto; text-align: right; flex-shrink: 0; }
.o-hours { font-size: 1rem; font-weight: 700; }
.o-hlabel{ font-size: .68rem; color: var(--muted); }

/* ── Fleet ─────────────────────────────────────────────────────────────────── */
.rmp-status { font-size: .8rem; font-weight: 700; }

/* ── Profile ───────────────────────────────────────────────────────────────── */
.profile-section { background: var(--card); border-radius: var(--r); padding: 1.5rem; box-shadow: var(--sh); margin-bottom: 1.25rem; }
.profile-section h5 { font-size: .9rem; font-weight: 700; margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }

/* ── Form helpers ──────────────────────────────────────────────────────────── */
.form-label { font-size: .82rem; font-weight: 600; color: var(--text); }
.form-control, .form-select { border-radius: 8px; border-color: var(--border); font-size: .875rem; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,111,216,.12); }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.toast { border: none; box-shadow: var(--sh-md); font-size: .85rem; }

/* ── Footer ────────────────────────────────────────────────────────────────── */
#app-footer {
  flex-shrink: 0; text-align: center;
  padding: .3rem 1rem; font-size: .62rem; color: #b0bec5;
  border-top: 1px solid var(--border); background: var(--card);
}
#app-footer a { color: inherit; text-decoration: none; }
#app-footer a:hover { text-decoration: underline; opacity: .8; }

/* ── Misc ──────────────────────────────────────────────────────────────────── */
.section-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .75rem; margin-top: 1.5rem; }
.mb-section { margin-bottom: 1.25rem; }
hr.light { border-color: var(--border); opacity: 1; }

/* ── Dark mode ─────────────────────────────────────────────────────────────── */
body.dark {
  --bg:     #0d1520;
  --card:   #162032;
  --text:   #dce6f0;
  --muted:  #7a90a8;
  --border: #1f3352;
  --sh:     0 1px 4px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.35);
  --sh-md:  0 4px 16px rgba(0,0,0,.6);
}

/* Bootstrap table variables */
body.dark .table {
  --bs-table-color:      var(--text);
  --bs-table-bg:         transparent;
  --bs-table-border-color: var(--border);
  --bs-table-hover-color: var(--text);
  --bs-table-hover-bg:   rgba(255,255,255,.045);
  color: var(--text);
}
body.dark .table > :not(caption) > * { border-color: var(--border); }
body.dark .table > :not(caption) > * > * { border-bottom-color: var(--border); }

/* Bootstrap modal */
body.dark .modal-content {
  --bs-modal-bg: var(--card);
  background: var(--card); color: var(--text);
  border-color: var(--border);
}
body.dark .modal-header { border-bottom-color: var(--border); }
body.dark .modal-footer { border-top-color: var(--border); }
body.dark .btn-close { filter: invert(1) grayscale(1) brightness(.8); }

/* Forms */
body.dark .form-control,
body.dark .form-select,
body.dark .filter-bar select,
body.dark .filter-bar input {
  background: #1a2e46; color: var(--text);
  border-color: var(--border);
}
body.dark .form-control:focus,
body.dark .form-select:focus { background: #1a2e46; color: var(--text); box-shadow: 0 0 0 3px rgba(29,111,216,.2); }
body.dark .form-control::placeholder { color: #3d5470; }
body.dark textarea.form-control { background: #1a2e46; }

/* Progress bars */
body.dark .progress { background: #1f3352; }

/* Duty badge */
body.dark .duty-off { background: rgba(255,255,255,.07); color: var(--muted); }
body.dark .duty-on  { background: rgba(16,185,129,.15); color: #34d399; }

/* Tour hero */
body.dark .tour-hero-off { background: var(--card); border-color: var(--border); }

/* Borders & dividers */
body.dark .card-header { border-bottom-color: var(--border); }
body.dark .profile-section h5 { border-bottom-color: var(--border); }
body.dark hr { border-color: var(--border); opacity: 1; }

/* Buttons */
body.dark .btn-outline-danger { color: #fca5a5; border-color: rgba(239,68,68,.4); }
body.dark .btn-outline-danger:hover { background: rgba(239,68,68,.15); color: #fca5a5; border-color: rgba(239,68,68,.5); }
body.dark .btn-secondary { background: #243554; border-color: #243554; color: var(--text); }
body.dark .btn-secondary:hover { background: #2d4268; border-color: #2d4268; }

/* Alerts */
body.dark .alert-danger { background: rgba(239,68,68,.1); color: #fca5a5; border-color: rgba(239,68,68,.2); }

/* Tags — reduce saturation so they don't bleed on dark */
body.dark .tag-patrol   { background: rgba(29,111,216,.2);  color: #93c5fd; }
body.dark .tag-locldetl { background: rgba(232,117,26,.18); color: #fdba74; }
body.dark .tag-cntydetl { background: rgba(219,39,119,.18); color: #f9a8d4; }
body.dark .tag-admin    { background: rgba(100,116,139,.2); color: #cbd5e1; }
body.dark .tag-vehmaint { background: rgba(16,185,129,.18); color: #6ee7b7; }
body.dark .tag-open     { background: rgba(16,185,129,.15); color: #6ee7b7; }
body.dark .tag-closed   { background: rgba(100,116,139,.18); color: #94a3b8; }
body.dark .tag-rmp1     { background: rgba(16,185,129,.15); color: #6ee7b7; }
body.dark .tag-rmp30    { background: rgba(232,117,26,.18); color: #fdba74; }
body.dark .tag-rmp68    { background: rgba(100,116,139,.18); color: #94a3b8; }
