/* ── Design tokens ──────────────────────────────────────────────────── */
:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --surface2:  #22263a;
  --border:    #2e3347;
  --accent:    #4f8ef7;
  --accent-dk: #3a72d8;
  --text:      #e4e6f0;
  --muted:     #7880a0;
  --green:     #3ecf74;
  --red:       #f25f5c;
  --amber:     #f7b731;
  --radius:    8px;
  --shadow:    0 2px 12px rgba(0,0,0,.4);
}

/* ── Reset & base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ── Nav ────────────────────────────────────────────────────────────── */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky; top: 0; z-index: 100;
}
nav .inner {
  display: flex; align-items: center; justify-content: space-between;
}
nav .logo { font-size: 1.15rem; font-weight: 700; color: var(--accent); letter-spacing: .5px; }
nav .logo span { color: var(--text); }
nav .nav-links { display: flex; gap: 20px; align-items: center; }
nav .nav-links > a { color: var(--muted); font-size: .9rem; }
nav .nav-links > a:hover { color: var(--text); text-decoration: none; }

/* ── Page header ────────────────────────────────────────────────────── */
.page-header {
  padding: 36px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.page-header h1 { font-size: 1.7rem; font-weight: 700; }
.page-header p  { color: var(--muted); margin-top: 6px; font-size: .95rem; }
.sv-name-row { display: flex; align-items: center; gap: 12px; }
.sv-name-row h1 { margin: 0; }
.sv-logo { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.card-header { display: flex; align-items: center; gap: 8px; }
.card-server-icon { width: 28px; height: 28px; border-radius: 5px; object-fit: cover; flex-shrink: 0; }

/* ── Search bar ─────────────────────────────────────────────────────── */
.search-row {
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 24px; flex-wrap: wrap;
}
.search-row input {
  flex: 1; min-width: 200px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); padding: 9px 14px; border-radius: var(--radius);
  font-size: .9rem; outline: none;
}
.search-row input:focus { border-color: var(--accent); }

/* ── Server card grid ───────────────────────────────────────────────── */
.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}
.server-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
  display: flex; flex-direction: column; gap: 10px;
}
.server-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.server-card .card-title {
  font-size: 1rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.server-card .card-meta { color: var(--muted); font-size: .82rem; display: flex; flex-wrap: wrap; gap: 8px; }
.server-card .card-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.server-card .card-actions { margin-top: auto; }
.server-card .btn { width: 100%; text-align: center; }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 8px 18px; border-radius: var(--radius);
  font-size: .875rem; font-weight: 600; cursor: pointer;
  border: none; transition: background .15s, opacity .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dk); text-decoration: none; }
.btn-ghost {
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-ghost:hover { background: rgba(79,142,247,.1); text-decoration: none; }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: .85; }
.btn-success { background: var(--green); color: #000; }
.btn-success:hover { opacity: .85; }

/* ── Badges ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: .75rem; font-weight: 600; letter-spacing: .3px;
}
.badge-green  { background: rgba(62,207,116,.15); color: var(--green); }
.badge-red    { background: rgba(242,95,92,.15);  color: var(--red); }
.badge-amber  { background: rgba(247,183,49,.15); color: var(--amber); }
.badge-blue   { background: rgba(79,142,247,.15); color: var(--accent); }
.badge-muted  { background: var(--surface2); color: var(--muted); }

/* ── Tabs ───────────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  margin-bottom: 24px; flex-wrap: wrap;
}
.tab-btn {
  padding: 11px 18px; font-size: .875rem; font-weight: 600;
  background: none; border: none; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap; transition: color .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Tables ─────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse; font-size: .875rem;
}
th, td {
  padding: 9px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
}
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.025); }

/* ── Key-value settings table ───────────────────────────────────────── */
.kv-search { margin-bottom: 14px; }
.kv-key   { font-family: monospace; color: var(--muted); font-size: .83rem; }
.kv-val   { word-break: break-all; }

/* ── Section headers ────────────────────────────────────────────────── */
.section-title {
  font-size: 1rem; font-weight: 700;
  margin: 0 0 14px; color: var(--text);
}

/* ── Selectors (dept / zone / unit) ─────────────────────────────────── */
.selector-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.selector-btn {
  padding: 6px 14px; border-radius: 20px; font-size: .82rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface2); color: var(--muted);
  cursor: pointer; transition: all .15s;
}
.selector-btn:hover { border-color: var(--accent); color: var(--text); }
.selector-btn.active { border-color: var(--accent); background: rgba(79,142,247,.15); color: var(--accent); }

select.styled-select {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: var(--radius); font-size: .875rem;
  outline: none; cursor: pointer; min-width: 200px;
}
select.styled-select:focus { border-color: var(--accent); }

/* ── Card / info blocks ─────────────────────────────────────────────── */
.info-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.info-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.info-card .ic-label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.info-card .ic-value { font-size: .95rem; font-weight: 600; word-break: break-all; }

/* ── Overview sections ──────────────────────────────────────────────── */
.overview-section { margin-bottom: 24px; }
.overview-section-title {
  font-size: .75rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 10px;
}
.overview-text {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  font-size: .9rem; line-height: 1.65; color: var(--text);
  white-space: pre-wrap; word-break: break-word; max-width: 720px;
}

/* ── Livery rows ────────────────────────────────────────────────────── */
.vehicle-block { margin-bottom: 22px; }
.vehicle-name  { font-weight: 700; margin-bottom: 8px; font-size: .9rem; }

.swatch {
  display: inline-block; width: 14px; height: 14px;
  border-radius: 3px; border: 1px solid rgba(255,255,255,.15);
  vertical-align: middle; margin-right: 4px;
}

/* ── ELS viewer layout ──────────────────────────────────────────────── */
.els-layout {
  display: flex; gap: 0; max-height: 75vh; min-height: 200px;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.els-browser {
  width: 150px; flex-shrink: 0; background: var(--surface2);
  border-right: 1px solid var(--border); overflow-y: auto;
}
.els-browser-hdr {
  padding: 10px 14px; font-size: .75rem; font-weight: 700; letter-spacing: .07em;
  color: var(--muted); text-transform: uppercase; border-bottom: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0; z-index: 1;
}
.els-unit-item {
  padding: 7px 14px; font-size: .82rem; color: var(--muted);
  cursor: pointer; transition: background .1s, color .1s;
  border-bottom: 1px solid rgba(255,255,255,.03);
}
.els-unit-item:hover { background: rgba(79,142,247,.08); color: var(--text); }
.els-unit-item.active { background: rgba(79,142,247,.15); color: var(--accent); font-weight: 600; }

.els-viewer { flex: 1; min-width: 0; overflow: hidden; display: flex; flex-direction: column; }
.els-unit-info {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; flex-shrink: 0;
  padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.els-unit-name { font-size: .95rem; font-weight: 700; color: var(--text); margin-right: 6px; }
.els-stat { font-size: .82rem; color: var(--text); display: flex; align-items: center; gap: 5px; }
.els-stat-lbl { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.els-grids { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.els-section { flex: 1; min-width: 0; overflow: hidden; display: flex; flex-direction: column; border-right: 1px solid var(--border); }
.els-section:last-child { border-right: none; }
.els-section-title {
  padding: 8px 14px; font-size: .72rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.els-grid-scroll { flex: 1; overflow: auto; }
.els-grid { border-collapse: collapse; width: 100%; }
.els-grid th {
  padding: 4px 4px; font-size: .68rem; font-weight: 700; color: var(--muted);
  text-align: center; border-bottom: 1px solid var(--border);
  background: var(--surface2); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.els-grid td { padding: 3px 2px; text-align: center; border: 1px solid rgba(255,255,255,.04); }
.els-rn {
  width: 24px; font-size: .68rem; color: var(--muted); background: var(--surface2) !important;
  border-right: 1px solid var(--border) !important; font-weight: 600;
}
.els-cell { font-size: .7rem; font-weight: 600; min-width: 40px; }

/* ── Asset archive badges ───────────────────────────────────────────── */
.asset-id-row {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  padding: 2px 0;
}
.asset-id-row + .asset-id-row { border-top: 1px solid rgba(255,255,255,.04); }
.asset-badge { display: inline-flex; gap: 4px; align-items: center; }
.asset-view-btn { border: none; font: inherit; cursor: pointer; }

/* ── Asset modal ─────────────────────────────────────────────────────── */
.asset-modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.75); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.asset-modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; max-width: min(520px, 92vw); width: 100%;
  max-height: 90vh; overflow: hidden;
}
.asset-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.asset-modal-title { font-weight: 600; font-size: .9rem; color: var(--text); }
.asset-modal-close {
  background: none; border: none; color: var(--muted); font-size: 1.4rem; line-height: 1;
  cursor: pointer; padding: 0 4px; transition: color .15s;
}
.asset-modal-close:hover { color: var(--text); }
.asset-modal-body {
  flex: 1; overflow: auto; padding: 16px;
  display: flex; align-items: center; justify-content: center;
}
.asset-modal-img-wrap { display: flex; align-items: center; justify-content: center; min-height: 80px; }
.asset-modal-loading { color: var(--muted); font-size: .85rem; }
.asset-modal-img { max-width: 100%; max-height: 60vh; border-radius: 4px; image-rendering: pixelated; }
.asset-modal-footer {
  padding: 10px 16px; border-top: 1px solid var(--border); flex-shrink: 0;
  display: flex; justify-content: flex-end;
}
.asset-modal-download { font-size: .8rem; padding: 5px 14px; }

/* ── Form ───────────────────────────────────────────────────────────── */
.form-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 32px;
  max-width: 560px; box-shadow: var(--shadow); margin: 0 auto;
}
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.form-group input,
.form-group textarea {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); padding: 9px 13px; border-radius: var(--radius);
  font-size: .9rem; outline: none; font-family: inherit;
  transition: border-color .15s;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 100px; }
.form-note { font-size: .8rem; color: var(--muted); margin-top: 4px; }

/* ── Uniform viewer layout ──────────────────────────────────────────── */
.unif-layout {
  display: flex; gap: 0; height: 75vh; min-height: 420px;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.unif-browser {
  width: 180px; flex-shrink: 0; background: var(--surface2);
  border-right: 1px solid var(--border); overflow-y: auto;
}
.unif-dept-group { border-bottom: 1px solid var(--border); }
.unif-dept-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px 7px 14px; font-size: .72rem; font-weight: 700; letter-spacing: .07em;
  color: var(--muted); text-transform: uppercase;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1;
}
.unif-dl-btn {
  color: var(--muted); font-size: .85rem; text-decoration: none; line-height: 1;
  padding: 2px 4px; border-radius: 3px; transition: color .1s, background .1s;
}
.unif-dl-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }
.unif-team-item {
  padding: 7px 14px; font-size: .82rem; color: var(--muted);
  cursor: pointer; transition: background .1s, color .1s;
  border-bottom: 1px solid rgba(255,255,255,.03);
}
.unif-team-item:hover  { background: rgba(79,142,247,.08); color: var(--text); }
.unif-team-item.active { background: rgba(79,142,247,.15); color: var(--accent); font-weight: 600; }
.unif-viewer {
  flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
}
.unif-viewer-hdr {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px; padding: 10px 16px; flex-shrink: 0;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.unif-hdr-left { display: flex; align-items: baseline; gap: 8px; }
.unif-team-name { font-size: .95rem; font-weight: 700; color: var(--text); }
.unif-dept-lbl  { font-size: .78rem; }
.unif-ids-row   { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.unif-id-chip   { display: flex; align-items: center; gap: 5px; font-size: .82rem; }
.unif-stat-lbl  {
  font-size: .7rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.unif-canvas-wrap {
  flex: 1; min-height: 0; position: relative; overflow: hidden;
}
.unif-canvas-wrap canvas { display: block; width: 100% !important; height: 100% !important; }

/* ── Livery viewer ──────────────────────────────────────────────────── */
.lv-layout {
  display: flex; gap: 0; height: 75vh; min-height: 420px;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.lv-browser {
  width: 190px; flex-shrink: 0; background: var(--surface2);
  border-right: 1px solid var(--border); overflow-y: auto;
}
.lv-veh-hdr {
  padding: 7px 12px 5px; font-size: .7rem; font-weight: 700; letter-spacing: .07em;
  color: var(--muted); text-transform: uppercase;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1;
}
.lv-item {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; font-size: .82rem; color: var(--muted);
  cursor: pointer; transition: background .1s, color .1s;
  border-bottom: 1px solid rgba(255,255,255,.03);
}
.lv-item:hover  { background: rgba(79,142,247,.08); color: var(--text); }
.lv-item.active { background: rgba(79,142,247,.15); color: var(--accent); font-weight: 600; }
.lv-item-swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; border: 1px solid rgba(255,255,255,.12); }
.lv-item-name   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-viewer {
  flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
}
.lv-viewer-hdr {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px; padding: 10px 16px; flex-shrink: 0;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.lv-hdr-left  { display: flex; align-items: baseline; gap: 8px; }
.lv-hdr-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.lv-livery-name { font-size: .95rem; font-weight: 700; color: var(--text); }
.lv-car-lbl     { font-size: .78rem; }
.lv-stat { font-size: .82rem; color: var(--text); display: flex; align-items: center; gap: 5px; }
.lv-canvas-wrap {
  flex: 1; min-height: 0; position: relative; overflow: hidden;
}
.lv-canvas-wrap canvas { display: block; width: 100% !important; height: 100% !important; }
.lv-no3d { flex: 1; padding: 16px; overflow-y: auto; }

/* ── Viewer loading overlay ─────────────────────────────────────────── */
.viewer-loading {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; background: rgba(15,17,23,.82); pointer-events: none;
}
.viewer-loading.hidden { display: none; }
.viewer-loading-label { font-size: .78rem; color: var(--muted); }
.viewer-progress-bar  { width: 140px; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.viewer-progress-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 2px; transition: width .1s linear; }
.lv-tex-ids { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 8px 12px; border-top: 1px solid var(--border); background: var(--surface); flex-shrink: 0; }
.lv-tex-ids:empty { display: none; }
.lv-tex-row { display: flex; align-items: center; gap: 6px; font-size: .72rem; }
.lv-tex-side { color: var(--muted); min-width: 36px; }
.lv-tex-id { color: var(--text); }
.lv-tex-view { color: var(--accent); text-decoration: none; font-size: .7rem; opacity: .7; }
.lv-tex-view:hover { opacity: 1; }

/* ── Global livery browser ──────────────────────────────────────────── */
.lv-filter-bar { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:20px; }
.lv-filter-bar input[type="search"] { flex:1; min-width:180px; max-width:320px; padding:8px 12px; background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius); color:var(--text); font-size:.875rem; }
.lv-filter-bar input[type="search"]:focus { outline:none; border-color:var(--accent); }
.lv-hastex-label { display:flex; align-items:center; gap:6px; font-size:.85rem; color:var(--text); cursor:pointer; white-space:nowrap; }

.lv-card-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:14px; }
.lv-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); cursor:pointer; overflow:hidden; transition:border-color .15s,transform .15s; }
.lv-card:hover { border-color:var(--accent); transform:translateY(-2px); }
.lv-card:focus { outline:2px solid var(--accent); outline-offset:2px; }
.lv-card-preview { position:relative; aspect-ratio:16/9; background:var(--surface2); overflow:hidden; }
.lv-card-preview img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; z-index:1; }
.lv-card-color { position:absolute; inset:0; opacity:.3; z-index:0; }
.lv-no-model-badge { position:absolute; bottom:6px; right:6px; z-index:2; font-size:.65rem; background:rgba(0,0,0,.65); color:#aaa; padding:2px 6px; border-radius:3px; }
.lv-no-preview-icon { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:2.5rem; opacity:.25; }
.lv-card-info { padding:10px 12px; }
.lv-card-name { font-size:.85rem; font-weight:600; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.lv-card-car  { font-size:.75rem; margin-bottom:6px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.lv-card-meta { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }

.lv-pagination { display:flex; justify-content:center; gap:5px; margin:28px 0 8px; flex-wrap:wrap; }
.lv-page-btn { padding:5px 11px; border-radius:var(--radius); border:1px solid var(--border); background:var(--surface); color:var(--text); cursor:pointer; font-size:.82rem; transition:background .12s,border-color .12s; }
.lv-page-btn:hover:not(:disabled) { border-color:var(--accent); }
.lv-page-btn.active { background:var(--accent); color:#fff; border-color:var(--accent); }
.lv-page-btn:disabled { opacity:.4; cursor:default; }

/* Full-page overlay */
.lv-overlay { position:fixed; inset:0; z-index:200; background:var(--bg); display:flex; flex-direction:column; overflow:hidden; }
.lv-overlay.hidden { display:none; }
.lv-overlay-bar { display:flex; align-items:center; gap:14px; padding:11px 20px; border-bottom:1px solid var(--border); flex-shrink:0; flex-wrap:wrap; }
.lv-overlay-title { display:flex; flex-direction:column; gap:1px; flex:1; min-width:0; }
.lv-overlay-title span { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.lv-overlay-server-link { color:var(--accent); text-decoration:none; font-size:.82rem; white-space:nowrap; }
.lv-overlay-server-link:hover { text-decoration:underline; }
.lv-overlay-body { display:flex; flex:1; min-height:0; }
.lv-overlay-body .lv-canvas-wrap { flex:1; min-height:0; position:relative; overflow:hidden; }
.lv-overlay-info { width:250px; flex-shrink:0; padding:18px 16px; overflow-y:auto; border-left:1px solid var(--border); background:var(--surface); }
.lv-overlay-info .lv-tex-ids { flex-direction:column; gap:6px; padding:0; border:none; background:none; }
.lv-stat { display:flex; align-items:center; gap:6px; font-size:.82rem; }
.lv-no-model-msg { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:var(--muted); font-size:.9rem; }
.lv-no-model-msg.hidden { display:none; }

/* ── UV Tune panel ──────────────────────────────────────────────────── */
#unif-tune-panel {
  padding: 10px 14px 12px;
  background: color-mix(in srgb, var(--bg) 60%, var(--surface) 40%);
  border-bottom: 1px solid var(--border);
  font-size: .78rem;
}
.tune-grid {
  display: grid;
  grid-template-columns: 110px repeat(4, 62px);
  gap: 4px 6px;
  align-items: center;
}
.tune-hdr { font-weight: 600; color: var(--muted); text-align: center; }
.tune-label { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tune-hint { color: var(--muted); font-style: italic; font-size: .72rem; align-self: center; }
.tune-inp {
  width: 58px; padding: 3px 4px; font-size: .77rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 3px; color: var(--text); text-align: center;
  -moz-appearance: textfield;
}
.tune-inp::-webkit-inner-spin-button,
.tune-inp::-webkit-outer-spin-button { opacity: 0.4; }
.tune-inp:focus { outline: none; border-color: var(--accent); }
.tune-tabs {
  display: flex; gap: 4px; padding: 8px 10px 0;
  border-bottom: 1px solid var(--border);
}
.tune-tab {
  padding: 5px 12px; font-size: .78rem; border-radius: 4px 4px 0 0;
  border: 1px solid transparent; border-bottom: none;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: color .15s, background .15s;
}
.tune-tab:hover { color: var(--text); background: var(--surface); }
.tune-tab.active {
  color: var(--text); background: var(--surface);
  border-color: var(--border);
}
.tune-table-wrap { overflow-x: auto; max-height: 280px; overflow-y: auto; }
.tune-table {
  width: 100%; border-collapse: collapse; font-size: .76rem;
}
.tune-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: color-mix(in srgb, var(--bg) 80%, var(--surface) 20%);
  padding: 5px 6px; color: var(--muted); font-weight: 600;
  text-align: center; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tune-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface) 50%, transparent 50%); }
.tune-table td { padding: 2px 4px; text-align: center; }
.tune-idx { color: var(--muted); font-size: .72rem; min-width: 20px; }
.tune-table .tune-inp { width: 52px; }

/* ── Alert / notice ─────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius); font-size: .875rem;
  margin-bottom: 16px; display: none;
}
.alert.show  { display: block; }
.alert-ok    { background: rgba(62,207,116,.12); border: 1px solid rgba(62,207,116,.3); color: var(--green); }
.alert-err   { background: rgba(242,95,92,.12); border: 1px solid rgba(242,95,92,.3); color: var(--red); }

/* ── History banner ─────────────────────────────────────────────────── */
.history-banner {
  background: rgba(247,183,49,.1); border: 1px solid rgba(247,183,49,.3);
  color: var(--amber); border-radius: var(--radius);
  padding: 10px 16px; margin-bottom: 20px; font-size: .875rem;
  display: flex; align-items: center; gap: 10px;
}

/* ── Loading / empty states ─────────────────────────────────────────── */
.loading, .empty-state {
  text-align: center; color: var(--muted);
  padding: 48px 0; font-size: .95rem;
}
.spinner {
  width: 32px; height: 32px; margin: 0 auto 12px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Admin key bar ──────────────────────────────────────────────────── */
.key-bar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 0; margin-bottom: 24px;
}
.key-bar .inner { display: flex; gap: 10px; align-items: center; }
.key-bar input {
  flex: 1; max-width: 380px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); padding: 8px 13px; border-radius: var(--radius);
  font-size: .875rem; outline: none;
}
.key-bar input:focus { border-color: var(--accent); }

/* ── code-pre (expandable object/array in settings table) ───────────── */
.code-pre {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 8px 10px; margin-top: 6px;
  font-size: .75rem; color: var(--muted); overflow-x: auto;
  max-height: 200px; overflow-y: auto; white-space: pre;
}
details summary::-webkit-details-marker { color: var(--muted); }

/* ── Map layout code block ───────────────────────────────────────────── */
.map-code-block {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.map-code-label {
  font-size: .82rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: var(--muted); margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.map-code-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.map-code-value {
  font-family: monospace; font-size: .85rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 6px 10px;
  color: var(--text); word-break: break-all; flex: 1;
}

/* ── Server card stats row ───────────────────────────────────────────── */
.card-stats {
  display: flex; gap: 0; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin: 4px 0;
}
.card-stat {
  flex: 1; text-align: center; padding: 8px 4px;
  border-right: 1px solid var(--border);
}
.card-stat:last-child { border-right: none; }
.stat-val { display: block; font-size: 1rem; font-weight: 700; color: var(--accent); }
.stat-lbl { display: block; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }

/* ── Zone grid (map tab) ─────────────────────────────────────────────── */
.zone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px; margin-top: 12px;
}
.zone-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; flex-direction: column;
}
.zone-name { font-weight: 600; font-size: .875rem; margin-bottom: 4px; }
.zone-count { font-size: 1.1rem; font-weight: 700; color: var(--accent); }
.layout-code-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.layout-code-row .map-code-value { font-size: .75rem; padding: 4px 7px; }

/* ── Misc ───────────────────────────────────────────────────────────── */
.back-link { color: var(--muted); font-size: .85rem; margin-bottom: 14px; display: inline-block; }
.back-link:hover { color: var(--text); }
.text-muted { color: var(--muted); }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mono { font-family: monospace; }

/* ── Variant defaults admin car list ────────────────────────────────── */
.vd-car-btn {
  width: 100%; text-align: left; padding: 7px 10px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; color: inherit;
  line-height: 1.3; transition: border-color .15s;
}
.vd-car-btn:hover { border-color: var(--accent); }
.vd-car-btn.active { border-color: var(--accent); background: rgba(99,102,241,.12); }

/* ── Variant toggle panel (absolute overlay in viewer canvas) ───────── */
.lv-variant-panel {
  position: absolute; top: 10px; right: 10px; z-index: 10;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 180px; max-width: 240px;
  font-size: .82rem; box-shadow: 0 2px 8px rgba(0,0,0,.4);
  pointer-events: all;
}
.lv-variant-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; border-bottom: 1px solid var(--border); font-weight: 600;
}
.lv-variant-toggle-btn {
  background: none; border: none; color: inherit; cursor: pointer; font-size: .9rem;
}
.lv-variant-body { padding: 6px 0; max-height: 260px; overflow-y: auto; }
.lv-variant-cat  {
  padding: 4px 10px 2px; font-size: .7rem; color: var(--accent);
  text-transform: uppercase; letter-spacing: .04em;
}
.lv-variant-row {
  display: flex; align-items: center; gap: 6px; padding: 4px 10px; cursor: pointer;
}
.lv-variant-row:hover { background: var(--surface2); }
.lv-variant-row input { margin: 0; cursor: pointer; }
.lv-variant-default-badge {
  font-size: .65rem; padding: 1px 5px; border-radius: 3px;
  background: rgba(62,207,116,.15); color: var(--green); margin-left: 2px;
}

/* ── ELS section in livery detail panel ─────────────────────────────── */
.lv-els-section   { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.lv-els-header    {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
  font-weight: 600; font-size: .88rem;
}
.lv-els-stop {
  padding: 2px 8px; font-size: .78rem; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; color: var(--text);
}
.lv-els-stop:hover { border-color: var(--accent); }
.lv-els-list  { display: flex; flex-direction: column; gap: 3px; }
.lv-els-row   {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px;
  border-radius: var(--radius); border: 1px solid transparent;
}
.lv-els-row.active { border-color: var(--accent); background: var(--surface2); }
.lv-els-play  {
  flex-shrink: 0; width: 26px; height: 26px; display: flex; align-items: center;
  justify-content: center; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; font-size: .78rem; color: var(--text);
}
.lv-els-play:hover { border-color: var(--accent); color: var(--accent); }
.lv-els-name  { flex: 1; font-size: .84rem; }
.lv-els-meta  { font-size: .74rem; }

/* ── Request notes panel ─────────────────────────────────────────────── */
.req-notes-row td { background: var(--surface); padding: 0 !important; }
.req-notes-panel {
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.req-comments-list { display: flex; flex-direction: column; gap: 8px; }
.req-comment { background: var(--surface2); border-radius: var(--radius); padding: 8px 12px; }
.req-comment-meta { font-size: .72rem; color: var(--muted); display: block; margin-bottom: 3px; }
.req-comment-text { font-size: .85rem; margin: 0; white-space: pre-wrap; word-break: break-word; }
.req-note-form { display: flex; gap: 8px; align-items: flex-start; }
.req-note-input {
  flex: 1; background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); padding: 7px 10px; border-radius: var(--radius);
  font-size: .85rem; resize: vertical; font-family: inherit;
}
.req-note-input:focus { outline: none; border-color: var(--accent); }
.req-note-count {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; border-radius: 10px;
  font-size: .65rem; font-weight: 700; min-width: 16px; height: 16px; padding: 0 4px;
  vertical-align: middle;
}

/* ── Auth / Discord nav elements ─────────────────────────────────────── */
.auth-nav-item { display: flex; align-items: center; }

.nav-user { display: flex; align-items: center; gap: 8px; }
.nav-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.nav-username { font-size: .85rem; color: var(--text); }
.nav-logout { font-size: .78rem; color: var(--muted); text-decoration: none; }
.nav-logout:hover { color: #ef4444; }

.nav-credits-badge {
  font-size: .68rem; font-weight: 700; padding: 2px 7px;
  border-radius: 3px; background: #16a34a; color: #fff;
}

.btn-discord {
  background: #5865F2; color: #fff !important;
  padding: 6px 14px; border-radius: var(--radius);
  font-size: .82rem; font-weight: 600;
  white-space: nowrap; text-decoration: none;
  transition: background .15s;
}
.btn-discord:hover { background: #4752c4; }

/* ── Daily limit banner ──────────────────────────────────────────────── */
.limit-banner {
  position: sticky; top: 57px; z-index: 200;
  background: #2d1b00; border-bottom: 2px solid #d97706;
  color: #fbbf24; padding: 10px 20px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: .875rem; gap: 12px;
}
.limit-banner a { color: var(--accent); }
.banner-close {
  background: none; border: none; color: #fbbf24;
  font-size: 1.2rem; cursor: pointer; padding: 0 4px; flex-shrink: 0;
}
.banner-close:hover { color: #fff; }

/* ── ELS browser ─────────────────────────────────────────────────────── */
.els-card-preview { display:flex; flex-direction:column; justify-content:center; align-items:flex-start; gap:6px; padding:10px 12px; background:var(--surface2); min-height:70px; }
.els-preview-dots { display:flex; flex-wrap:wrap; gap:4px; }
.els-dot { display:inline-block; width:14px; height:14px; border-radius:50%; flex-shrink:0; }
.els-dot-none { background:rgba(255,255,255,.07); }
.els-fpm-badge { font-size:.65rem; background:rgba(255,255,255,.1); color:#aaa; padding:2px 6px; border-radius:3px; }
.els-preview-meta { display:flex; gap:6px; }

/* ELS overlay — view tabs float inside the canvas area */
.els-view-tabs { position:absolute; top:10px; left:10px; z-index:10; display:flex; gap:4px; pointer-events:auto; }
.els-view-tab { padding:4px 13px; background:rgba(10,12,20,.72); border:1px solid rgba(255,255,255,.14); border-radius:20px; color:#bbb; cursor:pointer; font-size:.76rem; font-weight:600; backdrop-filter:blur(6px); transition:background .15s,color .15s,border-color .15s; }
.els-view-tab.active { background:var(--accent); border-color:var(--accent); color:#fff; }
.els-view-tab:hover:not(.active) { background:rgba(255,255,255,.1); color:#fff; }
/* pattern displaces 3D when active — tabs float above it at z-index:10 */
.els-pattern-wrap { position:absolute; inset:0; z-index:5; display:flex; flex-direction:column; padding-top:44px; background:var(--bg); overflow:hidden; }

/* ELS overlay — right panel */
.els-right-panel { width:240px; flex-shrink:0; border-left:1px solid var(--border); background:var(--surface); overflow-y:auto; display:flex; flex-direction:column; }
.els-ctrl-section { padding:12px 14px; border-bottom:1px solid var(--border); display:flex; flex-direction:column; gap:8px; }
.els-ctrl-section .styled-select { width:100%; }
.els-ctrl-label { font-size:.7rem; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:.05em; }
.els-color-row { display:flex; align-items:center; gap:8px; }
.els-color-picker { width:36px; height:28px; padding:0; border:1px solid var(--border); border-radius:4px; background:transparent; cursor:pointer; flex-shrink:0; }
.els-color-text { flex:1; min-width:0; }
.els-play-btn { width:100%; justify-content:center; }
.els-meta { padding:12px 14px; display:flex; flex-direction:column; gap:10px; }
.els-meta-row { display:flex; justify-content:space-between; align-items:center; font-size:.82rem; }

/* btn-danger */
.btn-danger { background:var(--danger,#e53e3e); color:#fff; }
.btn-danger:hover { background:#c53030; }

/* ── Users tab inputs ───────────────────────────────────────────────── */
#users-search {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  padding: 7px 12px; font-size: .875rem; font-family: inherit;
  outline: none; transition: border-color .15s;
}
#users-search:focus { border-color: var(--accent); }
#users-search::placeholder { color: var(--muted); }

.credits-input,
#users-bulk-amount {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  padding: 5px 8px; font-size: .82rem; font-family: inherit;
  outline: none; transition: border-color .15s;
}
.credits-input:focus,
#users-bulk-amount:focus { border-color: var(--accent); }

/* ── Shop ───────────────────────────────────────────────────────────── */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
  margin-top: 16px;
}
.shop-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow);
}
.shop-card h2 { margin: 0; font-size: 1.05rem; }
.shop-card p { color: var(--muted); font-size: .88rem; margin: 6px 0 14px; }
.shop-card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 4px;
}
.shop-price {
  font-size: .8rem; font-weight: 600; color: var(--accent);
  background: rgba(79,142,247,.12); padding: 4px 10px; border-radius: 999px;
  white-space: nowrap;
}
.shop-form-row {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.shop-form-row > input,
.shop-form-row > select {
  flex: 1 1 200px; min-width: 0;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); padding: 8px 12px; border-radius: var(--radius);
  font-size: .9rem; outline: none;
}
.shop-form-row > input:focus,
.shop-form-row > select:focus { border-color: var(--accent); }
.shop-grants {
  list-style: none; padding: 0; margin: 0;
  font-size: .88rem; color: var(--muted);
}
.shop-grants li { padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.shop-grants li:last-child { border-bottom: none; }
.shop-grants code {
  font-size: .8rem; background: var(--surface2); padding: 2px 6px;
  border-radius: 3px; color: var(--text);
}
.shop-note {
  background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.3);
  color: #f59e0b; padding: 10px 14px; border-radius: var(--radius);
  margin-bottom: 16px; font-size: .88rem;
}

/* Confirmation modal extras */
.shop-confirm-modal { max-width: min(440px, 92vw); }
.shop-confirm-msg { color: var(--text); font-size: .9rem; line-height: 1.45; }
.shop-confirm-msg p { margin: 0 0 8px; }

/* Toast */
.shop-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 18px; font-size: .9rem; box-shadow: var(--shadow);
  opacity: 0; transition: opacity .2s, transform .2s; z-index: 2000;
  pointer-events: none;
}
.shop-toast-show { opacity: 1; transform: translate(-50%, 0); }
.shop-toast-ok  { border-color: rgba(34,197,94,.45); }
.shop-toast-err { border-color: rgba(239,68,68,.45); color: #fca5a5; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .page-header h1 { font-size: 1.3rem; }
  .form-card { padding: 20px 16px; }
  nav .nav-links { gap: 12px; }
  .server-grid { grid-template-columns: 1fr; }
}
