/* NOR Dashboard - same black/neon-green theme as AMAP and nor.workisboring.com */

:root {
  --bg: #0a0d0a;
  --bg-elevated: rgba(18, 22, 16, .85);
  --accent: #39ff14;
  --accent-soft: rgba(57, 255, 20, .14);
  --accent-border: rgba(57, 255, 20, .35);
  --text: #eef1ec;
  --text-muted: #a6b0a3;
  --danger: #ff4d4d;
  --border: rgba(115, 118, 128, .35);
  --radius: 12px;
  --font-heading: 'Rajdhani', 'Arial Narrow', Arial, sans-serif;
  --font-body: 'Segoe UI', Arial, sans-serif;
  --topbar-h: 57px;
  --tabbar-h: 53px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

h1, h2, h3 {
  font-family: var(--font-heading);
  letter-spacing: .5px;
  margin: 0 0 .5em;
}

a { color: var(--accent); }

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 101;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: #000;
  border-bottom: 1px solid var(--accent-border);
}

.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-heading); }
.brand-logo { height: 28px; display: block; }
.brand-name { color: var(--text-muted); font-size: 16px; }

.wipe-countdown {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-family: var(--font-heading);
  line-height: 1.3;
  pointer-events: none;
}
.wipe-countdown-label {
  display: block;
  font-size: 22px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.wipe-countdown-time {
  display: block;
  font-size: 38px;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 8px rgba(57, 255, 20, .5);
}

@media (max-width: 900px) {
  .wipe-countdown { display: none; }
}

.topbar-right { display: flex; align-items: center; gap: 18px; }
.player-count-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.player-count { font-family: var(--font-heading); font-weight: 700; color: var(--text); font-size: 15px; }
.queue-count { font-family: var(--font-heading); font-weight: 600; color: var(--accent); font-size: 11px; }

.status-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.last-checked { font-size: 11px; color: var(--text-muted); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-muted); }
.status-online { border-color: var(--accent-border); color: var(--accent); }
.status-online .status-dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.status-offline { border-color: rgba(255, 77, 77, .4); color: var(--danger); }
.status-offline .status-dot { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

.tabs {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  gap: 4px;
  padding: 0 24px;
  background: #000;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 15px;
  padding: 14px 18px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.page-wrap { max-width: 1700px; margin: 0 auto; padding: calc(var(--topbar-h) + var(--tabbar-h) + 28px) 24px 60px; }

.overview-hero {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  padding: 56px 32px;
  margin-bottom: 22px;
  text-align: center;
  border: 1px solid var(--accent-border);
  background-image:
    linear-gradient(180deg, rgba(10, 13, 10, .72) 0%, rgba(10, 13, 10, .9) 70%, rgba(10, 13, 10, 1) 100%),
    url("../img/bg.jpg");
  background-size: cover;
  background-position: center;
}
.overview-hero h1 {
  font-size: 32px;
  text-shadow: 0 0 16px rgba(57, 255, 20, .4);
}
.overview-description {
  color: var(--text-muted);
  white-space: pre-wrap;
  max-width: 760px;
  margin: 10px auto 0;
  font-size: 14px;
  line-height: 1.6;
}

.overview-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.overview-stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-align: center;
}
.overview-stat-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  font-family: var(--font-heading);
  margin-bottom: 6px;
}
.overview-stat-value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--accent);
  text-shadow: 0 0 8px rgba(57, 255, 20, .4);
}

#overview-player-list { max-height: none; overflow-y: auto; flex: 1; min-height: 0; }

/* ---- Overview: no-scroll viewport layout ---- */
#tab-overview.active { display: flex; flex-direction: column; }

/* Tighter hero so it doesn't eat the vertical budget */
.overview-hero { padding: 20px 32px; }

/* Stats row: tighter bottom margin */
#tab-overview .overview-stats-grid { margin-bottom: 14px; }

/* Main content area: charts left, players right */
.overview-body {
  display: flex;
  gap: 16px;
  height: calc(100vh - 410px);
  min-height: 360px;
  overflow: hidden;
}

/* Left column: stacks entity chart on top, player+fps side-by-side below */
.overview-charts-col {
  flex: 3;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

/* Side-by-side row for player count + framerate */
.overview-chart-row {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 0;
}

/* Each chart panel stretches to fill its flex slot */
.overview-chart-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  margin-bottom: 0;
}
.overview-chart-panel h2 { margin: 0 0 4px; flex-shrink: 0; }
.overview-chart-panel p.muted { margin: 0 0 4px; flex-shrink: 0; font-size: 12px; }
.overview-chart-panel .apex-chart-wrap { flex: 1; min-height: 160px; }

/* Right column: connected players fills full height, scrolls internally */
.overview-players-col {
  flex: 1 1 260px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  margin-bottom: 0;
  padding-bottom: 0;
}
.overview-players-col h2 { flex-shrink: 0; margin: 0 0 10px; }

.dashboard-footer {
  text-align: center;
  padding: 14px 24px 24px;
  font-size: 12px;
  color: var(--text-muted);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 22px;
}

.console-layout { display: flex; gap: 22px; align-items: flex-start; }
.console-layout > .panel:first-child { flex: 2 1 0%; min-width: 0; }
.player-sidebar { flex: 1 1 0%; min-width: 0; max-width: 300px; display: flex; flex-direction: column; }

.console-player-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  max-height: 200px;
  overflow-y: auto;
}
.console-player-row { display: flex; align-items: center; gap: 10px; }
.console-player-avatar { width: 36px; height: 36px; border-radius: 6px; border: 1px solid var(--border); flex-shrink: 0; }
.console-player-avatar-blank { background: rgba(255, 255, 255, .05); }
.console-player-meta { flex: 1; min-width: 0; }
.console-player-name { font-weight: 600; font-size: 14px; }
.console-player-time { font-size: 12px; }

/* ---- Quick Commands bar (Console tab) ---- */
.quick-commands-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.quick-commands-bar:empty { display: none; }
.quick-cmd-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color .15s, color .15s;
  white-space: nowrap;
}
.quick-cmd-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Quick Commands settings section ---- */
.qc-settings-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.qc-settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.qc-settings-label { font-weight: 600; font-size: 13px; min-width: 90px; flex-shrink: 0; }
.qc-settings-command { font-size: 12px; color: var(--text-muted); flex: 1; font-family: monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qc-add-form { display: flex; gap: 8px; flex-wrap: wrap; }
.qc-add-form input[type="text"] { flex: 1; min-width: 120px; }

@media (max-width: 860px) {
  .console-layout { flex-direction: column; }
  .player-sidebar { max-width: none; width: 100%; }
}

.panel-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 10px; }
.panel-header-row .btn-row { margin-top: 0; align-items: center; margin-left: auto; }
.table-filter { min-width: 220px; }

.bulk-action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
}
.bulk-action-bar.hidden { display: none; }

.apex-chart-wrap { margin-top: 10px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  cursor: pointer;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.15); }
.btn-primary { background: var(--accent); color: #06250a; }
.btn-outline { background: transparent; }
.btn-danger { background: var(--danger); color: #2b0000; border-color: var(--danger); }
.btn-warning { background: #e6a817; color: #1a0e00; border-color: #e6a817; }
.btn-small { padding: 5px 10px; font-size: 12px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.inline-form { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 160px; }

.combo-wrap { position: relative; flex: 1; min-width: 160px; }
.combo-wrap input { width: 100%; }
.combo-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  margin-top: 4px;
  background: #0d0f0c;
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .55);
}
.combo-option {
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.combo-option:hover { background: var(--accent-soft); color: var(--accent); }
.combo-empty { cursor: default; }
.combo-empty:hover { background: none; color: var(--text-muted); }
/* Optional color swatch next to a dropdown option/trigger label - opt-in via
   a data-color attribute on the <option>, used today by the Theme preset
   picker but generic to any custom-select. */
.combo-option-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  background: var(--dot-color);
  box-shadow: 0 0 5px var(--dot-color);
}
/* Optional item icon next to a dropdown option/trigger label - opt-in via
   a data-icon attribute on the <option>, used by the Give Item picker but
   generic to any custom-select, same idea as the color dot above. */
.combo-option-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  vertical-align: middle;
  object-fit: contain;
}

.custom-select-hidden { display: none; }
.custom-select-trigger {
  width: 100%;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font-body);
  cursor: pointer;
  user-select: none;
}
.custom-select-trigger:hover { border-color: var(--accent-border); }

.field-label-text { font-size: 13px; color: var(--text-muted); }
.stacked-form { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.stacked-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-muted); }
.stacked-form input, .stacked-form select { width: 100%; }
.stacked-form label[hidden] { display: none; }
.stacked-form label.checkbox-label { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.stacked-form label.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; flex-shrink: 0; }

input[type="text"], input[type="number"], input[type="password"], select {
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font-body);
  color-scheme: dark;
}
input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus, select:focus {
  outline: none;
  border-color: var(--accent-border);
}

.console-output {
  background: #000;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  height: 380px;
  overflow-y: auto;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  margin-top: 12px;
}
.console-output.small { height: 140px; margin-top: 10px; overflow-x: hidden; word-break: break-word; white-space: pre-wrap; }
/* The main Console tab's log specifically scales with the window instead
   of staying a fixed height regardless of how tall the browser is - the
   other, smaller uses of .console-output (AMAP's log, permission lookups,
   player notes) stay at the fixed default above, which suits their much
   shorter content. */
#console-output { height: calc(100vh - 400px); min-height: 280px; }
#show-output { height: 240px; white-space: pre-wrap; word-break: break-word; overflow-x: hidden; }
.console-line { white-space: pre-wrap; word-break: break-word; margin-bottom: 4px; color: var(--text); }
.console-ts { color: var(--text-muted); }
.console-cmd { color: var(--accent); }
.console-error { color: var(--danger); }
.note-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.note-row span { word-break: break-word; }
.note-author { color: var(--accent); font-weight: 600; }

.chat-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.chat-filters input { flex: 1; min-width: 180px; }
.chat-log { max-height: calc(100vh - 340px); min-height: 240px; overflow-y: auto; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column-reverse; gap: 2px; }
.chat-line { display: flex; gap: 8px; align-items: baseline; padding: 2px 0; border-bottom: 1px solid var(--border); }
.chat-line:last-child { border-bottom: none; }
.chat-player { color: var(--accent); font-weight: 600; white-space: nowrap; }
.chat-steamid { color: var(--text-muted); font-size: .8em; font-weight: 400; }
.chat-sep { color: var(--text-muted); }
.chat-text { word-break: break-word; flex: 1; }

.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.data-table th, .data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.data-table th {
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .5px;
}
.mono { font-family: 'Consolas', 'Courier New', monospace; }
.muted { color: var(--text-muted); }

.lookup-result { margin-top: 16px; }
.lookup-card { display: flex; gap: 18px; align-items: flex-start; }
.lookup-avatar { width: 84px; height: 84px; border-radius: 8px; border: 1px solid var(--border); }
.lookup-info h3 { margin-bottom: 2px; }

.tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.tag { padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; border: 1px solid var(--border); }
.tag-ok { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.tag-danger { color: var(--danger); border-color: rgba(255, 77, 77, .4); background: rgba(255, 77, 77, .1); }

/* Inline tooltips - pure CSS, no JS positioning, matches this project's
   no-external-JS-deps convention. data-tooltip holds the text; the
   popup is just a styled ::after shown on hover/focus, themed with the
   same CSS variables as everything else so it follows whatever
   accent/background colors the user has picked in Settings > Theme. */
.has-tooltip { position: relative; cursor: help; }
.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 240px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  text-align: center;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .12s ease;
  z-index: 50;
}
.has-tooltip:hover::after, .has-tooltip:focus-visible::after { opacity: 1; visibility: visible; }

.settings-grid { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.settings-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-muted); }
.settings-grid .inline-form { margin-top: 0; }

.map-legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 10px 0 14px; font-size: 13px; color: var(--text-muted); }
.map-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.map-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.map-dot-player { background: var(--accent); box-shadow: 0 0 5px var(--accent); }

/* Event/monument markers - real icon images (user-supplied, already
   full-color) under static/img/map-icons/, one file per type, named to
   match the slug used in app.js (EVENT_LABEL_SLUGS/OIL_RIG_SLUGS).
   .map-legend-icon is the same sizing at legend-swatch scale, so the
   legend matches what's actually drawn on the map. Paths are relative to
   this file's own location (static/css/) rather than absolute - same
   convention as this file's existing bg.jpg reference below - so they
   still resolve correctly when this app is reverse-proxied under a path
   prefix (e.g. the hosted demo's /Demo), where an absolute "/static/..."
   path would resolve against the domain root and miss the prefix. */
.map-legend-icon { width: 16px; height: 16px; display: inline-block; flex-shrink: 0; background-repeat: no-repeat; background-position: center; background-size: contain; }
.map-icon-cargoship { background-image: url("../img/map-icons/cargoship.png"); }
.map-icon-patrolhelicopter { background-image: url("../img/map-icons/patrolhelicopter.png"); }
.map-icon-bradleyapc { background-image: url("../img/map-icons/bradleyapc.png"); }
.map-icon-ch47 { background-image: url("../img/map-icons/ch47.png"); }
.map-icon-cargoplane { background-image: url("../img/map-icons/cargoplane.png"); }
.map-icon-oilrig-small { background-image: url("../img/map-icons/oilrig-small.png"); }
.map-icon-oilrig-large { background-image: url("../img/map-icons/oilrig-large.png"); }

/* .map-wrap is the visible viewport, capped at .map-canvas's own native
   size so the full map is always visible at once - centered on the page.
   overflow: hidden (not auto) since border-box sizing otherwise leaves the
   900px canvas a hair taller/wider than the wrap's content box (the border
   eats into the declared width), which was enough to spawn a scrollbar;
   the page itself scrolls instead, never this widget. Marker positions are
   percentages of the canvas, so they land correctly regardless of size. */
.map-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.map-toggle-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.map-wrap {
  position: relative;
  width: 100%;
  max-width: 900px;
  aspect-ratio: 1 / 1;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 0 auto;
}
.map-wrap { cursor: grab; user-select: none; }
.map-wrap.panning { cursor: grabbing; }
.map-canvas { position: relative; width: 900px; height: 900px; transform-origin: 0 0; will-change: transform; }
.map-player-selected { z-index: 10; }
.map-player-selected .map-player-avatar { box-shadow: 0 0 0 3px #fff, 0 0 14px var(--accent); }
.map-player-marker { cursor: pointer; }
.map-image { display: block; width: 100%; height: 100%; }
.map-image[hidden] { display: none; }
.map-overlay { position: absolute; inset: 0; }
.map-marker-icon {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, .85));
  cursor: default;
}
.map-icon-oilrig-small { width: 18px; height: 18px; }
.map-icon-oilrig-large { width: 28px; height: 28px; }

.map-player-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.map-player-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  box-shadow: 0 0 6px var(--accent);
  background: #06250a;
  object-fit: cover;
}
.map-player-avatar-blank { background: var(--accent); }
.map-player-name {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  background: rgba(0, 0, 0, .75);
  padding: 1px 7px;
  border-radius: 5px;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 24px 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.modal-box h3 { margin-bottom: 10px; }
.modal-box p { margin-bottom: 0; }
.confirm-modal-typed-wrap { margin-top: 14px; }
.confirm-modal-typed-wrap input { width: 100%; }
.modal-box .btn-row { margin-top: 18px; justify-content: flex-end; }

/* First-run guided tour. .tour-highlight's own oversized box-shadow IS
   the dimmed backdrop (a standard "spotlight" trick) - filling the whole
   viewport except its own box, so there's no separate full-page overlay
   element needed just to dim the page. */
.tour-overlay { position: fixed; inset: 0; z-index: 998; pointer-events: none; }
.tour-overlay[hidden] { display: none; }
.tour-highlight {
  position: fixed;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .75);
  border: 2px solid var(--accent);
  border-radius: 8px;
  transition: top .2s ease, left .2s ease, width .2s ease, height .2s ease;
}
.tour-caption {
  position: fixed;
  width: 320px;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .6);
  pointer-events: auto;
  transition: top .2s ease, bottom .2s ease, left .2s ease;
}
.tour-caption h3 { margin: 2px 0 8px; }
.tour-caption .checkbox-label { margin: 12px 0 0; font-size: 13px; }
.tour-caption .btn-row { justify-content: flex-end; margin-top: 14px; }

/* ---- Toast notifications ---- */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1100; /* above .modal-overlay's 1000, so a toast can't get hidden behind an open modal */
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  pointer-events: none; /* the container itself is never a click target */
}
.toast {
  pointer-events: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .55);
  position: relative;
  font-size: 13px;
}
.toast-clickable { cursor: pointer; }
.toast-clickable:hover { filter: brightness(1.15); }
.toast-title { font-family: var(--font-heading); font-weight: 700; margin-bottom: 4px; padding-right: 22px; }
.toast-message { color: var(--text); }
.toast-fix { margin-top: 8px; color: var(--text-muted); font-size: 12px; }

/* Player Notes panel's Force Sync feedback - small and self-clearing,
   unlike the persistent bottom-right toasts, since it's just confirming
   a button click rather than reporting an unprompted error. */
.sync-bubble {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  display: inline-block;
}
.sync-bubble.hidden { display: none; }
.sync-bubble-error { background: rgba(255, 77, 77, .14); border: 1px solid rgba(255, 77, 77, .4); color: var(--danger); }
.sync-bubble-info { background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--accent); }
.sync-warning { color: var(--danger); }
.toast-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.toast-close:hover { color: var(--text); }

.toast-info .toast-title { color: var(--accent); }
.toast-error { border-color: rgba(255, 77, 77, .5); }
.toast-error .toast-title { color: var(--danger); }

@keyframes toast-flash-pulse {
  0%, 100% { box-shadow: 0 12px 32px rgba(0, 0, 0, .55); border-color: rgba(255, 77, 77, .5); }
  50% { box-shadow: 0 0 22px rgba(255, 77, 77, .85); border-color: var(--danger); }
}
.toast-flash { animation: toast-flash-pulse 0.5s ease-in-out 3; }

.amap-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 16px; }
.amap-card {
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-border);
  border-radius: 8px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.amap-card-critical { border-left-color: var(--danger); }
.amap-card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.amap-card-title { font-family: var(--font-heading); font-weight: 700; font-size: 16px; }
.amap-card-desc { font-size: 13px; color: var(--text-muted); margin: 0; flex: 1; }
.amap-card-fields { display: flex; flex-direction: column; gap: 8px; }
.amap-card-fields input, .amap-card-fields select { width: 100%; }
.amap-field-label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); font-weight: 600; letter-spacing: .03em; }
.amap-checkbox-label { display: flex; flex-direction: row; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.amap-card .btn { width: 100%; justify-content: center; }

.amap-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}
.amap-tag-critical { background: rgba(255, 77, 77, .15); color: var(--danger); border: 1px solid rgba(255, 77, 77, .4); }
.amap-tag-noncritical { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-border); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 14px; }
.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}
.stat-label { color: var(--text-muted); font-size: 13px; }
.stat-value { font-family: var(--font-heading); font-weight: 700; color: var(--accent); text-align: right; }

.terminal-connect-form { max-width: 360px; }
.terminal-wrap { margin-top: 14px; }
.terminal-container {
  height: 65vh;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

/* ---- Settings: gear icon + theme UI ---- */
.settings-gear-wrap { display: flex; align-items: center; margin-left: auto; }
.topbar-username { color: var(--accent); font-size: 13px; font-weight: 600; padding: 0 4px 0 12px; white-space: nowrap; }
.settings-gear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  padding: 14px 18px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  line-height: 1;
}
.settings-gear-btn:hover { color: var(--text); }
.settings-gear-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- Settings page: sub-nav + compact panels ---- */
.settings-subnav { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.settings-subnav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}
.settings-subnav-btn:hover { color: var(--text); }
.settings-subnav-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.settings-section { display: none; }
.settings-section.active { display: block; }

/* RCON/Theme/Wipe Schedule content is each short, so these panels stay
   noticeably smaller than the default .panel rather than stretching to
   fill the page width. */
.settings-panel { max-width: 460px; padding: 18px 22px; }

/* Module Settings' status list + any "compact" module settings panel
   (see module.json's settings_panel_compact) sit in a 3-column row here
   instead of each taking a full-width row of their own. Fewer than 3
   compact panels just leaves empty grid space on that row rather than
   stretching to fill it - acceptable since this is expected to fill in
   as more modules opt in, not something to special-case for. */
.settings-modules-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 20px; }
.settings-modules-row .settings-panel { max-width: none; margin-bottom: 0; }

@media (max-width: 900px) {
  .settings-modules-row { grid-template-columns: 1fr; }
}

/* Update section: core Update/Version Rollback in the left column, any
   module settings panel opting into settings_section: "update" (e.g.
   Module Updater) in the right - same 2-column reasoning as
   .settings-modules-row above, just a fixed 2 columns instead of 3 since
   there's no equivalent "status list" filling a first slot here. */
.settings-update-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; align-items: start; }
.settings-update-row .settings-panel { max-width: none; }

@media (max-width: 900px) {
  .settings-update-row { grid-template-columns: 1fr; }
}

.panel-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.panel-title-row h2 { margin: 0; }

.panel-subheading { margin-top: 22px; font-size: 16px; }

.help-faq { margin: 16px 0; }
.help-faq-list dt { font-weight: 700; color: var(--accent); margin-top: 14px; }
.help-faq-list dt:first-child { margin-top: 6px; }
.help-faq-list dd { margin: 4px 0 0; color: var(--text-muted); }
.theme-color-row { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; }
.theme-color-row label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-muted); }
input[type="color"] {
  width: 48px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, .04);
  cursor: pointer;
}

/* ---- Loading screen ---- */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.loading-screen[hidden] {
  display: none;
}
.loading-screen-logo { height: 56px; filter: drop-shadow(0 0 12px var(--accent-soft)); }
.loading-progress-track {
  width: 280px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--border);
  overflow: hidden;
}
.loading-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  transition: width .3s ease;
}
.loading-screen-status { color: var(--text-muted); font-family: var(--font-heading); letter-spacing: .5px; }

/* ---- Payback3 module ---- */
.pb3-category {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex: 0 0 165px;
}
.pb3-category[open] {
  flex: 1 0 300px;
}
.pb3-cat-summary {
  list-style: none;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--bg-elevated);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pb3-cat-summary::-webkit-details-marker { display: none; }
.pb3-cat-summary::before {
  content: "▶";
  font-size: 10px;
  color: var(--text-muted);
  transition: transform .15s;
}
.pb3-category[open] > .pb3-cat-summary::before { transform: rotate(90deg); }
.pb3-cat-summary:hover { background: rgba(0,255,128,.06); }
.pb3-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  padding: 10px;
  background: var(--bg);
}

.pb3-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}

.pb3-customize-summary {
  list-style: none;
  padding: 8px 0 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  letter-spacing: .3px;
}
.pb3-customize-summary::-webkit-details-marker { display: none; }
.pb3-customize-summary::before { content: "▶ "; font-size: 9px; }
details[id="pb3-customize"][open] > .pb3-customize-summary::before { content: "▼ "; }
.pb3-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s;
}
.pb3-card:hover { border-color: var(--accent); background: rgba(0,255,128,.05); }
.pb3-card.active { border-color: var(--accent); background: var(--accent-soft); }
.pb3-card-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; }
.pb3-card-badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(0,255,128,.12);
  color: var(--accent);
  border: 1px solid rgba(0,255,128,.3);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.pb3-action-panel { min-width: 220px; max-width: 300px; }
.pb3-sel-name { font-size: 16px; margin: 0 0 2px; }
.pb3-sel-cat { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; margin: 0 0 8px; }
.pb3-output {
  margin-top: 14px;
  padding: 10px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-muted);
  max-height: 180px;
  overflow-y: auto;
}


/* ---- DevTools module ---- */
.devtools-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.devtools-row > .panel { margin-bottom: 0; }
