/* After Hours theme. Taken from ggafterhours.xyz/fivem/index.php: same palette, fonts, clipped gold buttons,
   gold-edged panels and Oswald headings. Edit the variables to retune. */
:root, :root:root {
  --navy-900:#070e1a; --navy-800:#0b1526; --navy-700:#111f36; --navy-600:#1a2c4a;
  --gold:#c9a45c; --gold-light:#e3c78a; --gold-dark:#9a7a3c;
  --white:#f2f0ea; --red:#c0272d;
  --display:'Oswald',Impact,sans-serif; --body:'Inter',system-ui,sans-serif;

  --bg: var(--navy-900); --surface: var(--navy-800); --ink: var(--white); --muted:#9aa6ba;
  --line: rgba(201,164,92,.18); --accent: var(--gold); --accent-ink: var(--navy-900); --focus: var(--gold-light);
  --c-infraction:#5cb8d9; --c-misdemeanor:#e0a94a; --c-felony:#ee6a76; --c-federal:#b79ae6;
  --s-available:#3ccf6e; --s-enroute:#6fa8e6; --s-onscene:#b79ae6; --s-busy:#e0a94a; --ok:#3ccf6e;
  --sans: var(--body); --serif: var(--display);
}
@media (prefers-color-scheme: light) { :root, :root:root { --bg: var(--navy-900); --surface: var(--navy-800); --ink: var(--white); --muted:#9aa6ba; --line: rgba(201,164,92,.18); --accent: var(--gold); --accent-ink: var(--navy-900); } }

body { background: var(--navy-900); color: var(--white); font-family: var(--body); line-height: 1.6; }
.cad-body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(26,44,74,.9), transparent 70%), linear-gradient(180deg, var(--navy-800), var(--navy-900) 60%); }

/* Nav */
.topbar { background: rgba(7,14,26,.92); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(201,164,92,.25); min-height: 76px; }
.brand { gap: .7rem; }
.brand-mark { width: 44px; height: 44px; background: none; border-radius: 0; color: var(--gold); }
.brand-mark img { width: 44px; height: 44px; object-fit: contain; border-radius: 0; }
.brand-mark svg { color: var(--gold); width: 30px; height: 30px; }
.brand-text { flex-direction: column; }
.brand-text strong { font-family: var(--display); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 1.15rem; color: var(--white); }
.brand-text strong b { color: var(--gold); font-weight: 700; }
.brand-text span { font-family: var(--display); text-transform: uppercase; letter-spacing: .3em; font-size: .62rem; color: var(--gold); }
.topnav { gap: 1.8rem; }
.topnav a { font-family: var(--display); text-transform: uppercase; letter-spacing: .14em; font-size: .88rem; color: var(--muted); transition: color .2s; }
.topnav a:hover { color: var(--gold-light); }
.topnav a[aria-current] { color: var(--gold-light); font-weight: 500; box-shadow: inset 0 -2px 0 var(--gold); }
.clock, .whoami { font-family: var(--display); letter-spacing: .08em; }

/* Buttons: clipped corners, gold gradient */
.btn { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: .14em;
  background: linear-gradient(180deg, var(--gold-light), var(--gold) 55%, var(--gold-dark)); color: var(--navy-900); border: 0; border-radius: 0;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); transition: filter .25s, transform .25s; }
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn-sm { clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px); letter-spacing: .1em; }
.btn-quiet, .btn-light { background: rgba(201,164,92,.06); color: var(--gold-light); box-shadow: inset 0 0 0 1px var(--gold); }
.btn-quiet:hover, .btn-light:hover { background: rgba(201,164,92,.16); color: var(--gold-light); filter: none; }
.btn-danger { background: var(--red); color: #fff; }
.btn-discord { background: #5865f2; color: #fff; }
.link-btn, .modal a, .cad-main a:not(.btn):not(.map-row) { color: var(--gold-light); }

/* Panels */
.card, .panel, .modal-box { background: linear-gradient(180deg, rgba(26,44,74,.6), rgba(11,21,38,.8)); border: 1px solid rgba(201,164,92,.18); border-radius: 0; box-shadow: 0 20px 50px rgba(0,0,0,.35); position: relative; }
.card:hover { border-color: rgba(201,164,92,.4); }
.card h2, .panel h2, .page-head h1, .admin h1, .cat-block h2, .modal-head h2 { font-family: var(--display); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.card h2 { font-size: 1.15rem; }
.card-head { border-bottom: 1px solid rgba(201,164,92,.18); padding-bottom: 8px; }
.count { font-family: var(--display); color: var(--gold); }

input, select, textarea { background: var(--navy-900); color: var(--white); border: 1px solid rgba(201,164,92,.35); border-radius: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: 1px solid var(--gold-light); }
table th { font-family: var(--display); text-transform: uppercase; letter-spacing: .12em; color: var(--gold); font-weight: 500; }

/* Sign-in: eyebrow with red bars, gold headline, framed panel */
.auth { max-width: 420px; padding: 2.4rem 2.2rem; background: linear-gradient(180deg, rgba(26,44,74,.6), rgba(11,21,38,.85)); border: 2px solid var(--gold); position: relative; border-radius: 0; }
.auth::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(201,164,92,.3); pointer-events: none; }
.eyebrow { display: flex; align-items: center; justify-content: center; gap: .8rem; font-family: var(--display); letter-spacing: .35em; text-transform: uppercase; color: var(--gold); font-size: .78rem; margin: 0 0 1rem; }
.eyebrow::before, .eyebrow::after { content: ""; width: 28px; height: 2px; background: var(--red); }
.auth h1 { font-family: var(--display); text-transform: uppercase; text-align: center; font-size: 2.6rem; line-height: 1; background: linear-gradient(180deg, var(--gold-light), var(--gold) 60%, var(--gold-dark)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth .lead { text-align: center; color: var(--muted); }

/* Footer */
.footer { background: var(--navy-900); border-top: 1px solid rgba(201,164,92,.2); color: #6b7891; max-width: none; justify-content: space-between; padding: 1.6rem max(4vw, 20px); }

/* Live map */
.mapwrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.map-card { padding: 0; overflow: hidden; }
.map-card .card-head { padding: 12px 16px; margin: 0; }
.map-hint { font-size: .82rem; }
.map { height: calc(100vh - 230px); min-height: 420px; position: relative; cursor: grab; touch-action: none; }
.map:active { cursor: grabbing; }
.map canvas { display: block; width: 100%; height: 100%; }
.map-list { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 280px); overflow: auto; }
.map-row { display: flex; flex-direction: column; gap: 2px; text-align: left; background: rgba(17,31,54,.55); color: var(--white); border: 0; border-left: 3px solid var(--gold); padding: 8px 10px; cursor: pointer; font: inherit; }
.map-row:hover { background: rgba(201,164,92,.12); }
@media (max-width: 900px) { .mapwrap { grid-template-columns: 1fr; } .map { height: 60vh; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.btn { justify-content: center; }
.panic-banner { background: var(--red); color: #fff; border: 0; border-radius: 0; }
.auth .btn { width: 100%; padding: .85rem 1rem; }
.btn-sm { padding: 6px 14px; }

/* Role picker */
.switch-btn svg { margin-right: 2px; }
.portal { max-width: 1380px; margin: 0 auto; padding-top: 2.5vh; }
.portal-brand { display: flex; align-items: center; justify-content: center; gap: 1rem; text-align: center; }
.portal-brand img { width: 64px; height: 64px; object-fit: contain; }
.portal-brand h1 { font-family: var(--display); font-size: 2.2rem; text-transform: uppercase; letter-spacing: .08em; line-height: 1.05; text-align: left; }
.portal-brand h1 b { color: var(--gold); }
.portal-brand p { margin: 0; text-align: left; font-family: var(--display); text-transform: uppercase; letter-spacing: .3em; font-size: .72rem; color: var(--gold); }
.portal-lead { text-align: center; color: var(--muted); margin: 1.6rem 0 1.8rem; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.mode-form { display: contents; }
.mode-card { position: relative; display: flex; flex-direction: column; justify-content: space-between; aspect-ratio: 3 / 4; padding: 14px 16px; text-align: left; font: inherit; color: var(--white); cursor: pointer;
  background: linear-gradient(180deg, rgba(26,44,74,.55), rgba(7,14,26,.9)); border: 1px solid rgba(201,164,92,.22); border-radius: 14px; overflow: hidden; transition: transform .25s, border-color .25s, box-shadow .25s; }
.mode-card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 90% 60% at 50% 100%, rgba(201,164,92,.16), transparent 70%); opacity: 0; transition: opacity .3s; }
.mode-card:hover, .mode-card:focus-visible { transform: translateY(-5px); border-color: var(--gold); box-shadow: 0 18px 40px -16px rgba(0,0,0,.8); }
.mode-card:hover::before, .mode-card:focus-visible::before { opacity: 1; }
.mode-title { position: relative; display: flex; justify-content: space-between; align-items: center; font-family: var(--display); font-size: 1.25rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.mode-arrow { color: var(--muted); }
.mode-card:hover .mode-arrow { color: var(--gold-light); }
.mode-art { position: relative; flex: 1; display: grid; place-items: center; color: var(--gold); opacity: .55; filter: grayscale(.3); transition: opacity .3s; }
.mode-art svg { width: 56%; max-width: 120px; }
.mode-card:hover .mode-art, .mode-card.is-active .mode-art { opacity: 1; }
.mode-text { position: relative; font-size: .82rem; color: var(--muted); min-height: 2.6em; }
.mode-card.is-active { border-color: var(--gold); }
.mode-card.is-admin .mode-art { color: var(--gold-light); }
.mode-card.is-locked { cursor: not-allowed; opacity: .45; filter: grayscale(1); }
.mode-card.is-locked:hover { transform: none; border-color: rgba(201,164,92,.22); box-shadow: none; }
.mode-card.is-locked::before { display: none; }
.mode-card.is-locked .mode-art { opacity: .35; }
.topbar { flex-wrap: nowrap; gap: 14px; }
.topbar a, .topbar button, .topbar .clock, .topbar .whoami { white-space: nowrap; }
.topnav { gap: 1.1rem; margin-left: 4px; }
.topnav a { font-size: .8rem; letter-spacing: .1em; }
.brand-text strong { font-size: 1rem; }
.topbar-right { gap: 10px; }
.whoami { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.mode-grid { grid-template-columns: repeat(4, 1fr); max-width: 1060px; margin: 0 auto; }
@media (max-width: 900px) { .mode-grid { grid-template-columns: repeat(2, 1fr); } .topnav { display: none; } }
.mode-card { aspect-ratio: 4 / 4.2; }

/* Admin: sidebar + section menus */
.admin-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 22px; align-items: start; max-width: 1400px; margin: 0 auto; }
.admin-side-nav { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 12px; }
.admin-menu { display: flex; flex-direction: column; gap: 2px; padding: 8px; background: linear-gradient(180deg, rgba(26,44,74,.5), rgba(11,21,38,.8)); border: 1px solid rgba(201,164,92,.18); border-radius: 12px; }
.admin-menu a, .admin-menu button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 8px; background: none; color: var(--white); font: inherit; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer; width: 100%; }
.admin-menu svg { color: var(--gold); flex: none; }
.admin-menu a:hover, .admin-menu button:hover { background: rgba(201,164,92,.1); }
.admin-menu a[aria-current] { background: rgba(201,164,92,.16); box-shadow: inset 3px 0 0 var(--gold); }
.admin-menu-low a, .admin-menu-low button { color: var(--muted); font-weight: 400; }
.admin-menu-low form { margin: 0; }
.admin-main { min-width: 0; max-width: none; margin: 0; padding: 0; }
.admin-back { display: inline-block; margin-bottom: 12px; color: var(--gold-light); text-decoration: none; font-family: var(--display); text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; }
.admin-group { font-family: var(--display); text-transform: uppercase; letter-spacing: .08em; font-size: 1rem; margin: 22px 0 10px; }
.admin-group:first-child { margin-top: 0; }
.admin-rows { display: flex; flex-direction: column; gap: 8px; }
.admin-row { display: flex; align-items: center; gap: 16px; padding: 14px 18px; text-decoration: none; color: var(--white); background: rgba(26,44,74,.45); border: 1px solid rgba(201,164,92,.14); border-radius: 10px; transition: border-color .2s, background .2s; }
.admin-row:hover, .admin-row:focus-visible { border-color: var(--gold); background: rgba(26,44,74,.75); }
.ar-ic { color: var(--gold); display: grid; place-items: center; width: 28px; }
.ar-t { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ar-t strong { font-weight: 600; }
.ar-t small { color: var(--muted); font-size: .82rem; }
.ar-go { color: var(--muted); }
.admin-row:hover .ar-go { color: var(--gold-light); }
.admin-row.is-danger { background: rgba(192,39,45,.14); border-color: rgba(192,39,45,.35); }
.admin-row.is-danger:hover { border-color: var(--red); background: rgba(192,39,45,.22); }
.admin-row.is-danger .ar-ic { color: #ee6a76; }
ul.plain { padding-left: 1.2rem; margin: 0 0 .8rem; }
@media (max-width: 900px) { .admin-shell { grid-template-columns: 1fr; } .admin-side-nav { position: static; flex-direction: row; flex-wrap: wrap; } .admin-menu { flex-direction: row; flex-wrap: wrap; } .admin-menu a, .admin-menu button { width: auto; } }
.admin-shell .admin-menu a, .admin-shell a.admin-row { color: var(--white); }
.admin-shell .admin-menu-low a, .admin-shell .admin-menu-low button { color: var(--muted); }
.admin-shell .admin-menu a[aria-current] { color: var(--gold-light); }
.map-preview { max-width: 100%; max-height: 320px; border: 1px solid var(--line); margin: 8px 0 12px; }
.settings-form .sub { margin: 14px 0 0; font-family: var(--display); text-transform: uppercase; letter-spacing: .08em; font-size: 1rem; }
.roles-table input[type=text], .roles-table select { width: 100%; }
.mode-checks .check { display: inline-flex; gap: 4px; margin-right: 10px; white-space: nowrap; }
.code-block { overflow: auto; }
