:root {
  --bg: #0a0a0b;
  --bg-elevated: #131315;
  --bg-card: #1a1a1d;
  --border: #2a2a2e;
  --border-strong: #3a3a3f;
  --text: #f4f4f5;
  --text-muted: #9a9aa2;
  --text-faint: #6b6b72;
  --red: #dc2626;
  --red-bright: #ef4444;
  --red-dim: #7f1d1d;
  --amber: #d97706;
  --green: #16a34a;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

a { color: inherit; }

::selection { background: var(--red-dim); color: white; }

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-box { width: 100%; max-width: 380px; }

/* Replaced the "BE" square badge with the real logo mark (2026-08-07,
   Brandon's direct request: "loose the BE square"). logo_black.png is a
   dark/black mark -- fine against the light auth-box card it usually sits
   on, but worth knowing it'll be low-contrast anywhere it lands on this
   app's near-black page background instead; logo_white.png exists as a
   ready swap if that turns out to matter in practice. */
.brand-logo { display: block; margin: 0 auto 12px; width: auto; }
.brand-logo-auth { height: 56px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.card-padded { padding: 24px; }

.shadow-xl { box-shadow: 0 20px 40px rgba(0,0,0,.4); }

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input[type=text], input[type=email], input[type=password], input[type=tel], textarea, select {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 1px var(--red);
}

.btn {
  display: inline-block;
  border: none;
  border-radius: 4px;
  padding: 10px 16px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.btn-primary { background: var(--red); color: white; width: 100%; }
.btn-primary:hover { background: var(--red-bright); }
.btn-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text); }
.btn-outline:hover { border-color: var(--red); color: var(--red-bright); }

.alert-error {
  border: 1px solid var(--red-dim);
  background: rgba(127, 29, 29, .2);
  color: var(--red-bright);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 14px;
}

/* Real bug found live (2026-08-11) -- used in a couple of "Saved." banners
   (admin/security-contract.php originally, now admin/contract-sections.php)
   but never actually defined, so it rendered as unstyled plain text. */
.alert-success {
  border: 1px solid rgba(22, 163, 74, .4);
  background: rgba(22, 163, 74, .15);
  color: var(--green);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 14px;
}

.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-center { text-align: center; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.space-y-4 > * + * { margin-top: 16px; }

.emulation-bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  flex-wrap: wrap;
  background: var(--red); color: #fff;
  padding: 10px 16px; font-size: 13px; font-weight: 500; text-align: center;
}
.emulation-bar strong { font-weight: 700; }
.emulation-bar a {
  color: #fff; text-decoration: underline; font-weight: 600; white-space: nowrap;
}
.emulation-bar a:hover { color: rgba(255,255,255,.85); }

/* App shell */
.app-shell { display: flex; min-height: 100vh; }
.app-shell.has-emulation-bar { min-height: calc(100vh - 41px); }
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.sidebar-header {
  display: flex; align-items: center; gap: 8px;
  padding: 16px; border-bottom: 1px solid var(--border);
}
.sidebar-header .brand-logo-sidebar { height: 32px; margin: 0; }
.sidebar-title { font-size: 14px; font-weight: 600; }
.sidebar-title .brand-os, .brand-os { color: var(--red-bright); }
.sidebar-subtitle { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.sidebar-clock { font-size: 10px; color: var(--text-faint); margin-top: 4px; line-height: 1.5; }
.sidebar-clock span { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 12px; }
.nav-link {
  display: block;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 4px;
}
.nav-link:hover { background: var(--bg-elevated); color: var(--text); }
.nav-link.active { background: rgba(127,29,29,.4); color: white; border-left: 2px solid var(--red-bright); padding-left: 10px; }
.nav-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 9px; background: var(--red-bright); color: white;
  font-size: 11px; font-weight: 700; line-height: 1;
}
.nav-link-highlight { color: var(--amber); font-weight: 600; }
.nav-link-highlight:hover { background: rgba(217,119,6,.15); color: var(--amber); }
.nav-link-highlight.active { background: rgba(217,119,6,.25); color: var(--amber); border-left: 2px solid var(--amber); padding-left: 10px; }
.nav-separator { border: none; border-top: 1px solid var(--border); margin: 8px 12px 12px; }

/* Category sidebar links (2026-08-10 nav redesign) -- replaced the old
   collapsible <details class="nav-section"> blocks (that CSS, and the
   nav-section-label/nav-section-toggle rules that went with it, is gone
   now, not just unused -- nothing renders those classes anymore). Each
   category link carries a small icon + its rolled-up badge total (sum of
   its items' own badges, Brandon direct: "the counters should also roll
   upward... show me the total of all the counters for that page"). */
/* Real bug, caught live (2026-08-10/11, Brandon: "the icons are huge") --
   this rule was scoped to `.nav-category-link .nav-tile-svg`, but that
   wrapper class only exists on the six category links. The Quick Access
   pinned items (Event Viewer/Time Clock/Event Work Log) use the SAME
   icon+label markup (borgia_nav_link_html(), not
   borgia_category_link_html()) but never carry `.nav-category-link` --
   so their icons had no sizing rule at all and fell through to the raw,
   unsized SVG. Scoped to `.nav-category-link-label` instead -- the actual
   shared wrapper both functions use -- so one rule covers both. */
.nav-category-link-label { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nav-category-link-label .nav-tile-svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .85; }
.nav-category-link.active .nav-tile-svg,
.nav-link.active .nav-tile-svg,
.nav-link-highlight .nav-tile-svg { opacity: 1; }

/* Category icon-grid page (2026-08-10) -- adapted from the same concept
   built for Trube OS earlier the same session, same responsive-by-column
   approach (real minimum tile width, no fixed breakpoint list) so it
   reflows from the existing mobile slide-in drawer layout up through
   desktop without extra media queries. Kept in this same dark/red theme,
   not Trube OS's own palette -- Brandon direct: "keep all the same colors
   that it has." */
.breadcrumb { margin: 0 0 16px; font-size: 13px; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }

.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.nav-tile {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 20px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  text-decoration: none;
  text-align: center;
  position: relative;
  transition: transform .1s ease, border-color .1s ease, background .1s ease;
}
.nav-tile:hover { transform: translateY(-2px); background: var(--bg-elevated); border-color: var(--border-strong); }
.nav-tile.active { border-color: var(--red-bright); }
.nav-tile-icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; opacity: .9; }
.nav-tile-svg { width: 100%; height: 100%; }
.nav-tile-label { font-size: 14px; line-height: 1.25; }
.nav-tile-badge {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 9px; background: var(--red-bright); color: white;
  font-size: 11px; font-weight: 700; line-height: 1;
}

@media (max-width: 768px) {
  .nav-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
  .nav-tile { padding: 16px 10px; }
}

.sidebar-footer { border-top: 1px solid var(--border); padding: 12px; display: flex; align-items: center; justify-content: space-between; }
.main-content { flex: 1; padding: 32px; max-width: 100%; overflow-x: hidden; }

/* Site footer -- the standard "Hosted & maintained by Trube Technologies"
   footer every other trube-site carries (resources/includes/trubetech_footer.php),
   restyled in this app's own dark tokens instead of that file's #333 bar, and
   carrying the build version (includes/version.php).
   Deliberately in-flow at the end of .main-content rather than the shared
   file's position:fixed -- these pages are long scrolling tables, and a fixed
   bar parks itself permanently on top of the last row. */
.site-footer {
  margin-top: 48px; padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  gap: 10px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-faint); text-align: center;
}
.site-footer a.brand { color: var(--text-muted); font-weight: 600; text-decoration: none; }
.site-footer a.brand:hover { color: var(--text); text-decoration: underline; }
.site-footer .build { font-variant-numeric: tabular-nums; opacity: .8; }

.mobile-topbar { display: none; }
.mobile-menu-btn { display: none; }
.mobile-backdrop { display: none; }

@media (max-width: 768px) {
  .sidebar {
    display: flex; /* always in the DOM on mobile now; slides on/off screen */
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 0 0 0 rgba(0,0,0,0);
  }
  body.mobile-nav-open .sidebar { transform: translateX(0); box-shadow: 8px 0 24px rgba(0,0,0,.4); }

  .mobile-backdrop {
    display: block; position: fixed; inset: 0; z-index: 39;
    background: rgba(0,0,0,.5); opacity: 0; pointer-events: none;
    transition: opacity .2s ease;
  }
  body.mobile-nav-open .mobile-backdrop { opacity: 1; pointer-events: auto; }

  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: var(--bg-card); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
  }
  /* 44px touch target per mobile tap-target guidance. Bars are positioned with
     margins rather than flex gap so they still stack if flex layout misbehaves. */
  .mobile-menu-btn {
    display: block; width: 44px; height: 44px; padding: 10px 12px;
    background: none; border: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-menu-btn span {
    display: block; width: 20px; height: 2px;
    background: var(--text); border-radius: 1px;
  }
  .mobile-menu-btn span + span { margin-top: 5px; }
  .mobile-menu-btn:active span { background: var(--red-bright); }

  .main-content { padding: 16px; }
  .app-shell { flex-direction: column; }
}

/* Mobile usability pass (2026-08-11, Brandon's direct request: screenshots
   of admin/bid-form.php's Roster table on a phone -- couldn't scroll to see
   the rest of the table, and the rate/per-diem boxes were too small to type
   in). Two real, site-wide bugs, not just this one page:

   1. .main-content sets overflow-x: hidden (above), and most tables aren't
      wrapped in their own scroll container -- only the .card-based list
      pages that happened to be built with style="overflow-x:auto" on their
      wrapper div were fine. Any table wider than the viewport was just
      silently clipped with no way to reach the hidden columns at all.

   2. iOS Safari auto-zooms the whole page on focusing any input under
      16px, which is what actually made those boxes feel "too small to
      type in" -- less a size problem, more a jarring zoom-and-repan on
      every tap.

   Fixed once, here, for every table/input/select/textarea/flex-row on
   every page -- no per-page markup changes needed, so it applies uniformly
   instead of drifting page by page. */
@media (max-width: 768px) {
  /* Forcing just the <table> element to display:block turns it into its
     own horizontally-scrollable box; thead/tbody/tr/td keep their normal
     table-context display values, so column alignment across rows is
     unaffected -- a standard, well-supported technique. */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  input[type=text], input[type=email], input[type=password], input[type=tel],
  input[type=number], input[type=date], input[type=datetime-local], textarea, select {
    font-size: 16px;
  }

  /* Compact inline-width inputs inside tables (pay rate, per-diem days,
     etc. -- e.g. style="width:44px") are genuinely too narrow once their
     own text bumps up to 16px above. min-width wins over a smaller inline
     width per the CSS box model no matter which one set it, so this
     widens them without touching the inline style on every page that has
     one. */
  table input[type=text], table input[type=number] {
    min-width: 56px;
    padding: 8px 6px;
  }
}

@media (max-width: 480px) {
  /* Small inline flex rows (e.g. "pick a person + Add to bid") get room
     to wrap onto a second line instead of squeezing everything into one
     row that can't shrink any further. Purely additive -- a row that
     already fits on one line at this width is unaffected. */
  [style*="display:flex"] { flex-wrap: wrap; }
}

.page-header { margin-bottom: 24px; }
.page-title { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.page-subtitle { font-size: 14px; color: var(--text-muted); margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.stat-value { font-size: 24px; font-weight: 600; margin-top: 4px; }
.stat-value.tone-red { color: var(--red-bright); }
.stat-value.tone-amber { color: var(--amber); }

.section-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }
.section-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; scroll-margin-top: 60px; }
.section-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.section-card-header h2 { font-size: 14px; font-weight: 600; margin: 0; }
.section-card-header a { font-size: 12px; color: var(--text-muted); text-decoration: none; }
.section-card-header a:hover { color: var(--red-bright); }
.row { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: none; }
.row-empty { padding: 24px; text-align: center; color: var(--text-faint); font-size: 14px; }

.badge {
  display: inline-block;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-muted);
}
.badge-green { border-color: rgba(22,163,74,.4); background: rgba(22,163,74,.1); color: var(--green); }
.badge-amber { border-color: rgba(217,119,6,.4); background: rgba(217,119,6,.1); color: var(--amber); }
.badge-red { border-color: var(--red-dim); background: rgba(127,29,29,.2); color: var(--red-bright); }
.badge-blue { border-color: rgba(59,130,246,.4); background: rgba(59,130,246,.1); color: #60a5fa; }
.badge-magenta { border-color: rgba(219,39,119,.4); background: rgba(219,39,119,.1); color: #f472b6; }

.event-picker { padding: 12px 0; border-bottom: 1px solid var(--border); }

.checklist { padding: 0; }
.checklist-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 14px;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.checklist-item.clear .dot { background: var(--green); }
.checklist-item.blocked .dot { background: var(--red-bright); }
.checklist-item.blocked { color: var(--text); }
.checklist-item .count { margin-left: auto; color: var(--text-faint); font-size: 12px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab {
  padding: 8px 12px; font-size: 14px; font-weight: 500;
  color: var(--text-muted); text-decoration: none;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--red-bright); }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.event-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 16px;
  text-decoration: none; color: inherit; display: block;
}
.event-card:hover { border-color: var(--border-strong); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 500; padding: 12px 16px; border-bottom: 1px solid var(--border); }
td { padding: 10px 16px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
td.text-main { color: var(--text); }

.waiver-box {
  max-height: 260px; overflow-y: auto;
  border: 1px solid var(--border); background: var(--bg-elevated);
  border-radius: 4px; padding: 16px; font-size: 14px; color: var(--text-muted);
}
.waiver-box p.waiver-title { color: var(--text); font-weight: 500; margin: 0 0 4px; }
.waiver-box > div + div { margin-top: 16px; }
