:root {
  --ink: #0f1720;
  --ink-soft: #4b5a6b;
  --muted: #8592a3;
  --line: #e2e6ea;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --accent: #3b6ef6;
  --accent-ink: #1d3fa0;
  --ok: #1a9c6e;
  --ok-bg: #e6f7f0;
  --warn: #b5820c;
  --warn-bg: #fbf1dc;
  --danger: #c0392b;
  --nav-bg: #0f1720;
  --panel-alt: #f5f6f9;
  --accent-bg: #eef1ff;
  --input-bg: #ffffff;
  --shadow: rgba(0, 0, 0, 0.3);
  --radius: 8px;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ---- dark mode ----
   Toggled by adding data-theme="dark" to <html> -- see
   includes/settings.php's rt_theme_init_script() (sets it before first
   paint, from localStorage / prefers-color-scheme) and assets/theme.js
   (flips it when someone clicks the toggle in the nav). Only the
   variables actually need overriding almost everywhere in this file,
   since nearly every color already goes through var(--x) -- the handful
   of hardcoded pastel badge/alert colors below are the exception, since
   they're deliberately soft-tinted backgrounds with dark text that don't
   translate to a dark background by just inverting lightness. */
:root[data-theme="dark"] {
  --ink: #e8ecf1;
  --ink-soft: #b7c2d0;
  --muted: #8996a8;
  --line: #2b3542;
  --bg: #10151c;
  --panel: #1a212c;
  --panel-alt: #212a37;
  --accent: #6c93ff;
  --accent-ink: #a9c1ff;
  --accent-bg: #1c2740;
  --ok: #3ddb99;
  --ok-bg: #103526;
  --warn: #e2b13c;
  --warn-bg: #3a2c0f;
  --danger: #ff7a68;
  --input-bg: #171e27;
  --shadow: rgba(0, 0, 0, 0.6);
}

:root[data-theme="dark"] .btn-danger { background: #3a1e1c; color: var(--danger); border-color: #5a2b26; }
:root[data-theme="dark"] .badge-role-admin { background: #1c2740; color: var(--accent-ink); }
:root[data-theme="dark"] .badge-role-employee { background: #262b36; color: #b9c1cf; }
:root[data-theme="dark"] .badge-role-manager { background: #3a2c0f; color: #e6bd6a; }
:root[data-theme="dark"] .badge-role-it_staff { background: #103526; color: #4fd39c; }
:root[data-theme="dark"] .badge-status-rejected { background: #3a1e1c; color: var(--danger); }
:root[data-theme="dark"] .badge-kudos { background: #3a2c0f; color: #e6bd6a; }
:root[data-theme="dark"] .badge-ticket-progress { background: #1c2740; color: var(--accent-ink); }
:root[data-theme="dark"] .badge-ticket-closed { background: #262b36; color: #b9c1cf; }
:root[data-theme="dark"] .badge-priority-low { background: #262b36; color: #b9c1cf; }
:root[data-theme="dark"] .badge-priority-normal { background: #1c2740; color: var(--accent-ink); }
:root[data-theme="dark"] .badge-priority-urgent { background: #3a1e1c; color: var(--danger); }
:root[data-theme="dark"] .badge-expiry-expired { background: #3a1e1c; color: var(--danger); }
:root[data-theme="dark"] .alert-error { background: #3a1e1c; color: var(--danger); border-color: #5a2b26; }
:root[data-theme="dark"] .alert-success { background: var(--ok-bg); color: var(--ok); border-color: #1c5c42; }
:root[data-theme="dark"] .alert-info { background: var(--accent-bg); color: var(--accent-ink); border-color: #34456e; }
:root[data-theme="dark"] .row-anomaly { background: rgba(255, 122, 104, 0.12); }
:root[data-theme="dark"] input[type="text"],
:root[data-theme="dark"] input[type="email"],
:root[data-theme="dark"] input[type="password"],
:root[data-theme="dark"] input[type="url"],
:root[data-theme="dark"] input[type="date"],
:root[data-theme="dark"] input[type="time"],
:root[data-theme="dark"] input[type="file"],
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  background: var(--input-bg);
  color-scheme: dark;
}
:root[data-theme="dark"] .icon-preview,
:root[data-theme="dark"] .qr-image,
:root[data-theme="dark"] .link-card-icon {
  background: #fff;
}
:root[data-theme="dark"] .login-card { background: var(--panel); }
:root[data-theme="dark"] .link-card-admin-actions a { background: var(--panel); }
:root[data-theme="dark"] .nav-dropdown-menu,
:root[data-theme="dark"] .topnav-links {
  box-shadow: 0 12px 24px var(--shadow);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* A <button> made to look and sit like an inline text link -- used for
   destructive actions that need to be real POST forms (CSRF-protected)
   instead of plain GET links. */
.link-btn {
  background: none; border: none; padding: 0; margin: 0;
  font: inherit; font-size: 12px; color: var(--accent-ink);
  text-decoration: none; cursor: pointer; display: inline;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger-link { color: #c0392b; }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 440px; }
main.wrap { padding-top: 28px; padding-bottom: 60px; }

@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  main.wrap { padding-top: 18px; padding-bottom: 40px; }
  .panel { padding: 16px; }
}

/* ---- top nav ---- */
.topnav { background: var(--nav-bg); color: #fff; }
.topnav-inner { display: flex; align-items: center; justify-content: space-between; height: 54px; position: relative; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; letter-spacing: 0.2px; min-width: 0; }
.brand:hover { text-decoration: none; opacity: 0.9; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark {
  width: 28px; height: 28px; object-fit: contain; flex-shrink: 0;
}
.topnav-links { display: flex; align-items: center; }
.topnav-links a { color: #cfd8e3; margin-left: 20px; font-size: 13px; }
.topnav-links a:hover { color: #fff; }

/* "Apps & Tools" dropdown -- groups the less-frequently-used nav links
   (Posts, Events, Documents, Resources, Time Clock, Mileage, QR Codes,
   Assets) behind one menu so the top nav doesn't run long. Same items
   are also surfaced as a quick-access tile grid on the homepage -- see
   .app-grid below -- so nothing is buried, just tidied up. */
.nav-dropdown { position: relative; margin-left: 20px; }
.nav-dropdown-btn {
  background: none; border: none; color: #cfd8e3; font-size: 13px; cursor: pointer;
  padding: 0; font-family: inherit; display: flex; align-items: center; gap: 4px;
}
.nav-dropdown-btn:hover { color: #fff; }
.nav-caret { font-size: 10px; }
.nav-dropdown-menu {
  display: none; flex-direction: column;
  position: absolute; top: 100%; right: 0; margin-top: 14px;
  background: var(--nav-bg); border: 1px solid rgba(255,255,255,0.12); border-radius: 8px;
  padding: 6px 0; min-width: 180px; box-shadow: 0 12px 24px rgba(0,0,0,0.3); z-index: 60;
}
.nav-dropdown-menu.open { display: flex; }
.nav-dropdown-menu a { margin-left: 0; padding: 9px 16px; font-size: 13px; }

/* Hamburger toggle -- hidden on wide screens, where the nav links fit
   inline; shown once the links would start crowding/wrapping the bar. */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 44px; height: 44px;
  margin: -5px -8px -5px 8px;
  background: none; border: none; cursor: pointer; padding: 0; flex-shrink: 0;
}
.nav-toggle span { display: block; width: 20px; height: 2px; background: #fff; border-radius: 2px; }

@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .topnav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: 54px; left: 0; right: 0;
    background: var(--nav-bg);
    padding: 4px 0 10px;
    box-shadow: 0 12px 24px rgba(0,0,0,0.3);
    z-index: 50;
    max-height: calc(100vh - 54px);
    overflow-y: auto;
  }
  .topnav-links.open { display: flex; }
  .topnav-links a {
    margin-left: 0;
    padding: 13px 24px;
    font-size: 15px;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  .topnav-links a:first-child { border-top: none; }

  /* On mobile the dropdown lives inline inside the already-collapsed
     hamburger menu, so it drops the floating-card styling and just
     expands/collapses in place. */
  .nav-dropdown { margin-left: 0; width: 100%; }
  .nav-dropdown-btn {
    width: 100%; text-align: left; padding: 13px 24px; font-size: 15px;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  .nav-dropdown-menu {
    position: static; box-shadow: none; border: none; border-radius: 0;
    margin-top: 0; min-width: 0; background: rgba(255,255,255,0.04);
  }
  .nav-dropdown-menu a { padding: 13px 24px 13px 40px; font-size: 15px; border-top: 1px solid rgba(255,255,255,0.06); }
}

/* ---- panels ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.panel-head h2 { margin: 0; font-size: 16px; }
.panel-head-actions { display: flex; gap: 10px; align-items: center; }

/* ---- stat cards (e.g. mileage summary strip) ---- */
.stat-row { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 20px; }
.stat-card {
  flex: 1 1 160px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
}
.stat-value { font-size: 26px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---- progress bar (onboarding checklists) ---- */
.progress-track {
  width: 100%; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden;
}
.progress-fill { height: 100%; background: var(--accent); border-radius: 4px; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); text-decoration: none; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--ink-soft); text-decoration: none; }
.btn-danger { background: #fdecea; color: var(--danger); border-color: #f5c6c0; }
.btn-block { width: 100%; margin-top: 6px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ---- badges ---- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-role-admin { background: #e8edff; color: var(--accent-ink); }
.badge-role-employee { background: #f1f0f4; color: #6b6478; }
.badge-role-manager { background: #fbf1dc; color: #8a5f0c; }
.badge-role-it_staff { background: #e6f7f0; color: #12805f; }
.badge-status-pending { background: var(--warn-bg); color: var(--warn); }
.badge-status-approved { background: var(--ok-bg); color: var(--ok); }
.badge-status-rejected { background: #fdecea; color: var(--danger); }
.badge-kudos { background: #fff4e0; color: #8a5a00; margin-left: 6px; }

/* ---- IT help desk ticket badges ---- */
.badge-ticket-open { background: var(--warn-bg); color: var(--warn); }
.badge-ticket-progress { background: #e8edff; color: var(--accent-ink); }
.badge-ticket-resolved { background: var(--ok-bg); color: var(--ok); }
.badge-ticket-closed { background: #f1f0f4; color: #6b6478; }
.badge-priority-low { background: #f1f0f4; color: #6b6478; }
.badge-priority-normal { background: #e8edff; color: var(--accent-ink); }
.badge-priority-high { background: var(--warn-bg); color: var(--warn); }
.badge-priority-urgent { background: #fdecea; color: var(--danger); }

/* Two-column ticket detail layout: thread + description on the left,
   requester info and (for Admins/IT Staff) status/priority/assignment
   controls in a narrower sidebar on the right. Stacks on narrow screens. */
.detail-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 800px) {
  .detail-layout { grid-template-columns: 1fr; }
}
.ticket-comment { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ticket-comment:last-child { border-bottom: none; }
.ticket-comment-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.ticket-comment-body { white-space: pre-wrap; }

/* ---- post comments ---- */
.post-comments { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }

/* Visually hidden but still readable by screen readers -- used for form
   labels that would otherwise duplicate a visible placeholder. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- table ---- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); border-bottom: 1px solid var(--line); padding: 8px 10px; }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.row-actions a, .row-actions button { margin-right: 10px; font-size: 12px; }

/* Inline approve/deny form on timeoff-report.php -- a short note field
   stacked above the two action buttons, sized to fit a table cell. */
.timeoff-review-form { display: flex; flex-direction: column; gap: 6px; min-width: 190px; }
.timeoff-review-form input[type="text"] { font-size: 12px; padding: 5px 8px; }

@media (max-width: 640px) {
  /* Wide tables (Users, Documents, Mileage report, etc.) scroll
     horizontally on narrow phones instead of squeezing every column
     down to unreadable widths. */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
  .table-scroll .table { min-width: 560px; }
}

/* ---- forms ---- */
.form-row { margin-bottom: 16px; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="date"], input[type="time"], input[type="file"], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 14px; color: var(--ink); background: #fff; font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 110, 246, 0.15);
}
.hint { font-size: 12px; color: var(--muted); margin: 5px 0 0; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.icon-fetch-row { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.icon-fetch-row input { flex: 1; min-width: 140px; }
.icon-preview { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 6px; object-fit: contain; padding: 4px; background: #fff; flex-shrink: 0; }

/* ---- empty state ---- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state .btn { margin-top: 10px; }

/* ---- alerts ---- */
.alert { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }
.alert-error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c0; }
.alert-success { background: var(--ok-bg); color: var(--ok); border: 1px solid #b7e4d1; }
.alert-info { background: #eaf1ff; color: var(--accent-ink); border: 1px solid #c9dbff; }

/* ---- login/register ---- */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #0f1720 0%, #1c2a3a 100%); }
.login-body { padding: 16px; }
.login-card { background: #fff; width: 360px; max-width: 100%; padding: 32px 30px; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.35); }
.login-mark { width: 48px; height: 48px; object-fit: contain; margin-bottom: 14px; }
.login-card h1 { font-size: 19px; margin: 0 0 4px; }
.login-card p { margin: 0 0 18px; }
@media (max-width: 420px) {
  .login-card { padding: 26px 22px; }
}

/* ---- link grid (the shared directory) ---- */
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.link-card {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  position: relative;
}
.link-card:hover { border-color: var(--accent); }
.link-card-icon { width: 36px; height: 36px; border-radius: 6px; object-fit: contain; flex-shrink: 0; background: #fff; }
.link-card-body { min-width: 0; flex: 1; }
.link-card-title { font-weight: 600; color: var(--ink); }
.link-card-title:hover { text-decoration: none; }
.link-card-desc { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-card-admin-actions { position: absolute; top: 6px; right: 6px; display: none; gap: 4px; }
.link-card:hover .link-card-admin-actions { display: flex; }
.link-card-admin-actions a { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; font-size: 11px; color: var(--ink-soft); }

@media (max-width: 720px) {
  .link-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .link-grid { grid-template-columns: 1fr; }
}

/* ---- homepage "Apps & Tools" quick-access grid ---- */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.app-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 8px; color: var(--ink); font-weight: 600; font-size: 13px;
}
.app-tile:hover { border-color: var(--accent); text-decoration: none; }
.app-tile-icon { font-size: 24px; line-height: 1; }
@media (max-width: 640px) {
  .app-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .app-tile { padding: 12px 6px; font-size: 11.5px; }
  .app-tile-icon { font-size: 20px; }
}

/* ---- checkboxes (post pin, etc.) ---- */
.checkbox-row { display: flex; flex-direction: column; gap: 8px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.checkbox-label input { width: auto; }

.form-row-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.path-generate-row { display: flex; gap: 8px; }
.path-generate-row input { flex: 1; }
.path-generate-row .btn { flex: 0 0 auto; white-space: nowrap; }

/* ---- QR panel ---- */
.qr-row { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.qr-image { width: 140px; height: 140px; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 8px; }
.qr-image-large { width: 220px; height: 220px; }

/* ---- library grid (QR codes) ---- */
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.library-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: flex; gap: 12px; align-items: flex-start; }
.library-card .qr-image { width: 72px; height: 72px; padding: 4px; flex-shrink: 0; }
.library-card-body { min-width: 0; }

@media (max-width: 720px) {
  .form-row-inline { grid-template-columns: 1fr; }
  .path-generate-row { flex-wrap: wrap; }
  .path-generate-row input { flex: 1 1 100%; }
}

/* ---- weather widget ---- */
.weather-widget {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
}
.weather-icon { font-size: 36px; line-height: 1; }

/* ---- posts ---- */
.post-preview {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.post-preview:last-child { border-bottom: none; padding-bottom: 0; }
.post-preview-title {
  display: block;
  font-weight: 600;
  color: var(--ink);
  margin: 2px 0 2px;
}
.post-preview-title:hover { color: var(--accent-ink); }
.post-full { scroll-margin-top: 70px; }
.post-body {
  white-space: pre-wrap;
  line-height: 1.6;
  margin-top: 10px;
  color: var(--ink-soft);
}

/* ---- link categories ---- */
.link-category-heading {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin: 24px 0 10px;
  font-weight: 700;
}
.link-category-heading:first-of-type { margin-top: 0; }

/* ---- resources (how-to guides / research links) ---- */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.resource-card { display: flex; flex-direction: column; gap: 6px; }
.resource-card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.resource-card-title { font-weight: 600; color: var(--ink); }
.resource-card-title:hover { text-decoration: underline; }
.resource-card-desc {
  font-size: 13px; color: var(--ink-soft); margin: 2px 0 0; line-height: 1.45;
}
.resource-card-meta { margin-top: 4px; }
.resource-card-actions { display: flex; gap: 10px; margin-top: 6px; }
.resource-card-actions a, .resource-card-actions .link-btn {
  font-size: 11px; color: var(--ink-soft);
}

/* ---- directory ---- */
.directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.directory-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 0;
}
.directory-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.directory-initial {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.directory-bio {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ---- org chart ----
   A vertically-indented tree rather than a horizontal flowchart -- reads
   fine at any width, including on a phone, without a separate mobile
   layout. Each nested level draws a vertical line down the left edge
   (border-left on the <ul>) with a short horizontal tick connecting it
   to each child's card. */
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.org-tree { overflow-x: auto; }
.org-tree-children {
  list-style: none;
  margin: 0;
  padding-left: 0;
}
.org-tree-children.org-tree-roots > .org-node + .org-node {
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 6px;
}
.org-tree-children:not(.org-tree-roots) {
  margin-left: 21px;
  padding-left: 31px;
  border-left: 1px solid var(--line);
}
.org-node { position: relative; padding: 8px 0; }
.org-tree-children:not(.org-tree-roots) > .org-node::before {
  content: '';
  position: absolute;
  left: -31px;
  top: 26px;
  width: 31px;
  height: 1px;
  background: var(--line);
}
.org-node-card { display: flex; align-items: center; gap: 12px; }
.org-node-initial { width: 36px; height: 36px; font-size: 13px; flex-shrink: 0; }
/* Each node links to that person's Directory card -- style it like a
   card, not a link (no underline, inherits ink color), with a subtle
   hover so it still reads as clickable. */
.org-node-link {
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
  margin: -6px -8px;
  padding: 6px 8px;
}
.org-node-link:hover {
  background: var(--panel-alt, #f5f6f9);
  text-decoration: none;
}
.org-node-link:hover .strong { color: var(--accent-ink); }

/* Landing on a Directory card via an org chart click gets a brief
   highlight so it's obvious which one you jumped to. */
.directory-card:target {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  animation: rt-target-fade 2.5s ease-out;
}
@keyframes rt-target-fade {
  0% { background: var(--accent-bg, #eef1ff); }
  100% { background: transparent; }
}
/* Same idea, generalized: every row/card a search result can deep-link
   to (documents, resources, events, assets -- anything without its own
   detail page) gets this class so landing on it from search.php is
   obviously the right one, without needing a bespoke rule per page. A
   background flash rather than an outline, since this class also lands
   on table rows, where outline rendering is inconsistent across browsers. */
.search-target:target {
  animation: rt-target-fade 2.5s ease-out;
}

/* ---- search ---- */
.search-result-row {
  display: block;
  padding: 12px 16px;
  color: inherit;
  text-decoration: none;
}
.search-result-row:hover {
  background: var(--panel-alt, #f5f6f9);
  text-decoration: none;
}
.search-result-row:hover .strong { color: var(--accent-ink); }
.nav-search-form {
  display: flex;
  align-items: center;
  margin-left: 20px;
}
.nav-search-form input {
  width: 160px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 13px;
}
.nav-search-form input::placeholder { color: #9aa7b8; }
.nav-search-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255,255,255,0.15);
}

/* ---- dark mode toggle (in the nav, both partials/nav.php and
   admin/partials/nav.php) ---- */
.theme-toggle {
  background: none;
  border: none;
  color: #cfd8e3;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin-left: 20px;
  display: flex;
  align-items: center;
}
.theme-toggle:hover { color: #fff; }
@media (max-width: 900px) {
  .theme-toggle {
    margin-left: 0;
    width: 100%;
    padding: 13px 24px;
    font-size: 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
    justify-content: flex-start;
  }
}

/* ---- events ---- */
.badge-expiry-soon { background: var(--warn-bg); color: var(--warn); }
.past-events { margin-top: 24px; }
.past-events summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 0;
}

/* ---- time clock ---- */
.badge-expiry-expired { background: #fdecea; color: var(--danger); }
.timeclock-status-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.timeclock-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.timeclock-buttons button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.timeclock-range-form {
  display: flex;
  align-items: center;
  gap: 8px;
}
.timeclock-range-form input[type="date"] {
  width: auto;
}
.row-anomaly { background: #fdecea33; }

/* ---- mileage ---- */
.badge-ssl-on { background: var(--ok-bg); color: var(--ok); }
.drop-zone {
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  color: var(--muted);
  font-size: 14px;
}
.drop-zone:hover, .drop-zone.drag {
  border-color: var(--accent);
  background: rgba(59, 110, 246, 0.04);
  color: var(--ink);
}
.drop-zone strong { color: var(--accent-ink); }

/* ---- admin hub ---- */
.admin-hub-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}
/* Tuned per grid's actual item count (4 destination tiles, 3 quick-add
   tiles) rather than a generic auto-fill, which left an orphaned card
   alone in its own row with a large empty gap beside it at several common
   tablet widths (a real, measured bug -- not just a hypothetical one). */
@media (min-width: 680px) {
  .admin-hub-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .admin-hub-grid-3 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 960px) {
  .admin-hub-grid-4 { grid-template-columns: repeat(4, 1fr); }
}
.admin-hub-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 0;
  color: var(--ink);
  transition: border-color .15s, transform .1s;
}
.admin-hub-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}
.admin-hub-icon {
  font-size: 26px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 10px;
  flex-shrink: 0;
}
