:root {
  --bg: #0a0f14;
  --panel: #111922;
  --panel-alt: #16212d;
  --panel-hover: #1b2938;
  --border: #233344;
  --text: #e6eef7;
  --muted: #8aa0b8;
  --accent: #3ce37d;
  --accent-dim: rgba(60, 227, 125, 0.16);
  --blue: #38bdf8;
  --danger: #ff4d5e;
  --danger-dim: rgba(255, 77, 94, 0.18);
  --warn: #f59e0b;
  --warn-dim: rgba(245, 158, 11, 0.18);
  --purple: #c084fc;
}

* {
  box-sizing: border-box;
}

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

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[hidden] {
  display: none !important;
}

/* Login Gate */
.login-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 16px;
  background: radial-gradient(circle at 50% 30%, #142230 0%, #080c11 75%);
  z-index: 200;
}

.login-card {
  width: min(390px, 92vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.login-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 8px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
}

.login-sub {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

input, textarea, select {
  padding: 9px 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}

.input-sm {
  padding: 6px 9px;
  font-size: 12px;
}

#login-btn, .btn-primary {
  padding: 9px 14px;
  background: var(--accent);
  color: #06140b;
  border: none;
  border-radius: 7px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

#login-btn:hover, .btn-primary:hover {
  filter: brightness(1.07);
}

.btn-warn {
  padding: 8px 13px;
  background: var(--warn-dim);
  border: 1px solid rgba(245, 158, 11, 0.55);
  color: #fde68a;
  border-radius: 7px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.btn-warn:hover {
  background: rgba(245, 158, 11, 0.28);
}

.btn-danger {
  padding: 8px 13px;
  background: var(--danger-dim);
  border: 1px solid rgba(255, 77, 94, 0.55);
  color: #ffb8c0;
  border-radius: 7px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-danger:hover {
  background: rgba(255, 77, 94, 0.3);
}

.login-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--danger-dim);
  border: 1px solid rgba(255, 77, 94, 0.45);
  color: #ffd5da;
  font-size: 13px;
}

/* App Chrome */
.app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.topbar {
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 10px var(--warn);
}

.brand-dot.live {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.brand-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 10px var(--danger);
}

.brand-name {
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 15px;
}

.brand-tag {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.pill {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--muted);
  letter-spacing: 0.06em;
}

.pill.live {
  background: var(--accent-dim);
  border-color: rgba(60, 227, 125, 0.45);
  color: var(--accent);
}

.pill.offline {
  background: var(--danger-dim);
  border-color: rgba(255, 77, 94, 0.45);
  color: #ff9aa4;
}

.status-strip, .top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.strip-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text);
}

.incident-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(66, 16, 22, 0.94);
  border-bottom: 1px solid var(--danger);
  font-size: 13px;
}

.incident-bar-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shell {
  flex: 1;
  min-height: 0;
  display: flex;
}

/* Left Nav Rail */
.nav-rail {
  width: 210px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 10px;
  background: #0d141c;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.nav-btn:hover {
  background: var(--panel-alt);
  color: var(--text);
}

.nav-btn.active {
  background: var(--accent-dim);
  border-color: rgba(60, 227, 125, 0.45);
  color: var(--accent);
}

.nav-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.nav-badge.danger {
  background: var(--danger-dim);
  color: #ff9aa4;
}

.nav-footer {
  margin-top: auto;
  padding: 10px 10px 4px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Views Container */
.views {
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
  display: flex;
}

.view {
  display: none;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.view.active {
  display: flex;
  flex-direction: column;
}

.view.scrollable {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px;
  gap: 16px;
}

.view.scrollable > * {
  flex-shrink: 0;
}

/* Cards & Grids */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
}

.kpi-sub {
  font-size: 12px;
  color: var(--muted);
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 15px;
  background: var(--panel-alt);
  border-bottom: 1px solid var(--border);
}

.card-head.wrap {
  flex-wrap: wrap;
}

.card-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.card-body {
  padding: 15px;
}

.inline-actions, .quick-ops-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.defcon-buttons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.defcon-btn {
  padding: 10px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}

.defcon-btn:hover {
  filter: brightness(1.15);
}

.defcon-btn.lvl-1.active { background: #992d22; border-color: #ff6b6b; color: #fff; }
.defcon-btn.lvl-2.active { background: #c0392b; border-color: #ff7675; color: #fff; }
.defcon-btn.lvl-3.active { background: #d35400; border-color: #f39c12; color: #fff; }
.defcon-btn.lvl-4.active { background: #b7950b; border-color: #f1c40f; color: #fff; }
.defcon-btn.lvl-5.active { background: #1e8449; border-color: #3ce37d; color: #fff; }

.defcon-instructions {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.incident-box {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--danger-dim);
  border: 1px solid rgba(255, 77, 94, 0.45);
  margin-bottom: 12px;
  font-size: 13px;
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-row.wrap {
  flex-wrap: wrap;
}

.form-row input, .form-row textarea {
  flex: 1;
  min-width: 120px;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.hint-text {
  font-size: 11px;
  color: var(--muted);
  margin-right: auto;
}

.subhead {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 14px;
  margin-bottom: 8px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.guild-chip {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  font-size: 12px;
}

.empty-inline {
  font-size: 12px;
  color: var(--muted);
}

/* Service Status Rows */
.svc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.svc-row:last-child {
  margin-bottom: 0;
}

.svc-title {
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.svc-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.ok { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.status-dot.bad { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

/* Buttons & Tabs */
.dim-tabs, .controls, .board-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dim-btn, .ctrl-btn, .board-tab {
  background: var(--panel-alt);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dim-btn:hover, .ctrl-btn:hover, .board-tab:hover {
  color: var(--text);
  border-color: #364e66;
}

.dim-btn.active, .ctrl-btn.active, .board-tab.active {
  background: var(--accent-dim);
  border-color: rgba(60, 227, 125, 0.55);
  color: var(--accent);
}

.ctrl-btn.danger:hover {
  background: var(--danger-dim);
  border-color: rgba(255, 77, 94, 0.55);
  color: #ff98a2;
}

.dim-count, .tab-cnt {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(35, 51, 68, 0.55);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
}

.tag.online { background: var(--accent-dim); border-color: rgba(60, 227, 125, 0.5); color: var(--accent); }
.tag.offline { background: rgba(138, 160, 184, 0.1); color: var(--muted); }
.tag.combatant-enemy { background: rgba(239, 68, 68, 0.18); border-color: rgba(239, 68, 68, 0.55); color: #f87171; }
.tag.combatant-ally { background: rgba(59, 130, 246, 0.18); border-color: rgba(59, 130, 246, 0.55); color: #60a5fa; }
.tag.pearl { background: rgba(192, 132, 252, 0.18); border-color: rgba(192, 132, 252, 0.55); color: #e9d5ff; }
.tag.manager { background: var(--warn-dim); border-color: rgba(245, 158, 11, 0.55); color: #fde68a; }
.tag.admin { background: rgba(56, 189, 248, 0.16); border-color: rgba(56, 189, 248, 0.5); color: #7dd3fc; }
.tag.lvl-5, .tag.lvl-4 { background: var(--danger-dim); border-color: rgba(255, 77, 94, 0.5); color: #ffb3bc; }
.tag.lvl-3, .tag.lvl-2 { background: var(--warn-dim); border-color: rgba(245, 158, 11, 0.5); color: #fde68a; }
.tag.src-web { background: rgba(56, 189, 248, 0.16); border-color: rgba(56, 189, 248, 0.5); color: #7dd3fc; }
.tag.src-discord { background: rgba(139, 92, 246, 0.18); border-color: rgba(139, 92, 246, 0.55); color: #c4b5fd; }
.tag.src-mod { background: var(--accent-dim); border-color: rgba(60, 227, 125, 0.5); color: var(--accent); }
.tag.src-system { background: rgba(148, 163, 184, 0.14); border-color: rgba(148, 163, 184, 0.4); color: #cbd5e1; }

.audit-table-wrap {
  max-height: 480px;
  overflow-y: auto;
}

.audit-table td {
  vertical-align: top;
  font-size: 12px;
}

.audit-meta-sub {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}

.audit-details {
  margin-top: 4px;
}

.audit-details summary {
  cursor: pointer;
  font-size: 10.5px;
  color: var(--muted);
  user-select: none;
}

.audit-details pre {
  margin: 4px 0 0;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(8, 12, 17, 0.85);
  border: 1px solid var(--border);
  font-size: 10.5px;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 480px;
}

.token-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--accent-dim);
  border: 1px solid rgba(60, 227, 125, 0.5);
  margin-bottom: 14px;
  word-break: break-all;
}

.token-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 3px;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}

.stack-item {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  font-size: 12.5px;
}

.stack-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.stack-item-body {
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.4;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-right: 6px;
}

/* Map View */
.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.map-search-wrap {
  position: relative;
  flex: 1;
  min-width: 190px;
  max-width: 340px;
}

.map-search-input {
  width: 100%;
}

.map-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  background: rgba(13, 20, 28, 0.98);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6);
  z-index: 60;
}

.search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(35, 51, 68, 0.5);
  cursor: pointer;
  font-size: 12px;
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover {
  background: var(--panel-hover);
}

.search-item-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.search-item-title {
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-sub {
  font-size: 10.5px;
  color: var(--muted);
}

/* Floating CivMap Layers Panel */
.layers-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 248px;
  max-height: calc(100% - 86px);
  display: flex;
  flex-direction: column;
  background: rgba(13, 20, 28, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  z-index: 25;
  overflow: hidden;
}

.layers-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  background: rgba(22, 33, 45, 0.95);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.layers-body {
  padding: 10px 11px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.layers-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}

.basemap-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.basemap-btn {
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.basemap-btn:hover {
  color: var(--text);
  border-color: #364e66;
}

.basemap-btn.active {
  background: var(--accent-dim);
  border-color: rgba(60, 227, 125, 0.55);
  color: var(--accent);
}

.layer-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text);
  padding: 3px 2px;
  cursor: pointer;
  user-select: none;
}

.layer-toggle input[type="checkbox"] {
  padding: 0;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.layer-swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
}

.layer-cnt {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--muted);
}

.layer-slider-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
  padding: 2px 2px 4px 20px;
}

.layer-slider-row input[type="range"] {
  flex: 1;
  padding: 0;
  min-width: 60px;
  accent-color: var(--accent);
}

/* Feature Inspector Card */
.map-inspector {
  position: absolute;
  right: 54px;
  bottom: 12px;
  width: min(300px, calc(100% - 70px));
  background: rgba(13, 20, 28, 0.94);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  z-index: 25;
  overflow: hidden;
}

.inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  background: rgba(22, 33, 45, 0.95);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.inspector-coords {
  padding: 6px 11px 4px;
  font-size: 11px;
  color: var(--accent);
}

.inspector-body {
  padding: 4px 11px 8px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 210px;
  overflow-y: auto;
}

.inspector-entry {
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(35, 51, 68, 0.7);
}

.inspector-entry strong {
  color: var(--text);
}

.inspector-entry a {
  color: var(--blue);
  text-decoration: none;
}

.inspector-entry a:hover {
  text-decoration: underline;
}

.inspector-actions {
  display: flex;
  gap: 6px;
  padding: 8px 11px;
  border-top: 1px solid var(--border);
  background: rgba(10, 15, 20, 0.55);
}

.coord-sub {
  font-size: 11px;
  color: var(--muted);
}

/* Tactical Draw & Edit Bars */
.draw-bar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  border-radius: 9px;
  background: rgba(13, 20, 28, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
  z-index: 24;
  flex-wrap: wrap;
  max-width: calc(100% - 280px);
}

.draw-btn {
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.draw-btn:hover {
  color: var(--text);
  border-color: #3a546e;
}

.draw-btn.active {
  background: var(--accent-dim);
  border-color: rgba(60, 227, 125, 0.65);
  color: var(--accent);
}

.draw-btn.accent {
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(139, 92, 246, 0.55);
  color: #ddd6fe;
}

.draw-editor-bar {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(13, 20, 28, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid var(--accent);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  z-index: 26;
  max-width: min(760px, calc(100% - 24px));
}

.draw-editor-hint {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 6px;
}

.draw-editor-fields {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.color-in {
  width: 30px;
  height: 28px;
  padding: 2px;
  border-radius: 5px;
  cursor: pointer;
}

/* Modal */
.modal-backdrop {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 10, 15, 0.72);
  backdrop-filter: blur(4px);
  z-index: 80;
}

.modal-card {
  width: min(560px, 92%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: var(--panel-alt);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.modal-body {
  padding: 14px;
}

.modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #0d141c;
  border-top: 1px solid var(--border);
}

/* Sidebar Tabs */
.side-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: #0d141c;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.side-tab {
  padding: 9px 6px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.side-tab:hover {
  color: var(--text);
}

.side-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: rgba(60, 227, 125, 0.06);
}

.side-pane {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.side-pane.active {
  display: flex;
}

.forces-controls {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: var(--panel-alt);
}

.forces-summary {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  justify-content: space-between;
}

.snitch-sources-box {
  padding: 7px 8px;
  border-radius: 7px;
  background: rgba(10, 15, 20, 0.6);
  border: 1px solid var(--border);
}

.snitch-sources-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  font-size: 11px;
}

.source-chip.matched {
  border-color: rgba(60, 227, 125, 0.5);
  color: var(--accent);
}

.assets-filter-row {
  display: flex;
  gap: 5px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-alt);
}

.asset-filter.active {
  background: var(--accent-dim);
  border-color: rgba(60, 227, 125, 0.55);
  color: var(--accent);
}

.asset-row, .force-row {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  cursor: pointer;
}

.asset-row:hover, .force-row:hover {
  border-color: #3c5772;
}

.force-row.aff-enemy { border-left: 3px solid #ef4444; }
.force-row.aff-ally { border-left: 3px solid #3b82f6; }
.force-row.aff-priority { border-left: 3px solid #f59e0b; }
.force-row.aff-insiding { border-left: 3px solid #c084fc; }
.force-row.aff-unknown { border-left: 3px solid #64748b; }

.workspace {
  flex: 1;
  min-height: 0;
  display: flex;
}

.map-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  background: #080c11;
  overflow: hidden;
}

#map-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#map-canvas.dragging {
  cursor: grabbing;
}

.panic-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 14px;
  border-radius: 10px;
  background: rgba(48, 12, 18, 0.94);
  border: 1px solid var(--danger);
  box-shadow: 0 8px 30px rgba(255, 77, 94, 0.32);
  z-index: 20;
}

.panic-banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.panic-pill {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.08em;
}

.panic-banner-actions {
  display: flex;
  gap: 6px;
}

.mini-btn {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.mini-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.mini-btn.danger:hover {
  background: var(--danger-dim);
  border-color: var(--danger);
  color: #ffd5da;
}

.map-hud-bl {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 12px;
  border-radius: 8px;
  background: rgba(13, 20, 28, 0.86);
  border: 1px solid var(--border);
  font-size: 12px;
  pointer-events: none;
}

.scale-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.scale-bar {
  width: 72px;
  height: 6px;
  border-left: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
}

.follow-pill {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(13, 28, 20, 0.9);
  border: 1px solid rgba(60, 227, 125, 0.55);
  font-size: 12px;
}

.zoom-stack {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zoom-btn {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: rgba(17, 25, 34, 0.92);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.zoom-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sidebar {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--border);
}

.panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: var(--panel-alt);
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
}

.panic-badge {
  background: var(--danger-dim);
  color: #ff8c97;
}

.list-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.empty-msg {
  padding: 16px 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.player-row, .panic-row {
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  cursor: pointer;
}

.player-row:hover, .panic-row:hover {
  border-color: #3c5772;
}

.player-row.following {
  border-color: var(--accent);
  background: rgba(60, 227, 125, 0.09);
}

.panic-row {
  border-left: 3px solid var(--danger);
}

.row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.player-id {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 13px;
}

.color-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dim-chip {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.row-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

.relay-footer {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 11px;
  color: var(--muted);
  background: #0d141c;
}

/* Live Player Inventories & Hidden Mode */
.tag.hidden-mode {
  background: rgba(192, 132, 252, 0.2);
  border-color: #c084fc;
  color: #e9d5ff;
}
.inv-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 10px;
}
.inv-card {
  background: rgba(15, 23, 34, 0.85);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.inv-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.inv-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 11px;
}
.inv-section-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 4px 0 3px;
}
.inv-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 3px;
}
.inv-equip-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 6px;
}
.inv-slot {
  position: relative;
  min-height: 36px;
  background: rgba(9, 14, 21, 0.9);
  border: 1px solid rgba(56, 78, 102, 0.55);
  border-radius: 4px;
  padding: 3px 4px;
  font-size: 9.5px;
  line-height: 1.15;
  color: #cbd5e1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.inv-slot.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.inv-slot.empty {
  opacity: 0.35;
}
.inv-slot-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-slot-cnt {
  align-self: flex-end;
  font-weight: 700;
  color: #f8fafc;
}
.inv-dur-bar {
  height: 2px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}
.inv-dur-fill {
  height: 100%;
  background: #3ce37d;
}

.tag.flock-paired {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.24), rgba(56, 189, 248, 0.24));
  border-color: #34d399;
  color: #a7f3d0;
  font-weight: 700;
}

.tag.flock-unpaired {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.55);
  color: #fde68a;
}

/* Playtime Analysis Studio */
.pt-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.pt-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.pt-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 4px;
}

.pt-stat-val {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}

.pt-stat-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.pt-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.pt-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 12.5px;
}

.pt-bars {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 4px;
  align-items: end;
  height: 150px;
  padding: 10px 6px 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.pt-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  cursor: pointer;
  gap: 4px;
}

.pt-bar-fill {
  width: 100%;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: var(--blue);
  transition: filter 0.12s ease;
}

.pt-bar-col:hover .pt-bar-fill {
  filter: brightness(1.25);
}

.pt-bar-col.peak .pt-bar-fill {
  background: var(--danger);
}

.pt-bar-col.ally-peak .pt-bar-fill {
  background: var(--accent);
}

.pt-bar-col.selected .pt-bar-fill {
  outline: 2px solid #ffffff;
}

.pt-bar-lbl {
  font-size: 9.5px;
  color: var(--muted);
}

.pt-hour-detail {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(15, 24, 36, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.45);
  font-size: 12px;
}

.pt-point-box {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(20, 35, 52, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.55);
  font-size: 12.5px;
}

.pt-heatmap {
  overflow-x: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

.pt-hm-grid {
  display: grid;
  grid-template-columns: 42px repeat(24, minmax(18px, 1fr));
  gap: 3px;
  align-items: center;
}

.pt-hm-hdr {
  font-size: 9.5px;
  color: var(--muted);
  text-align: center;
}

.pt-hm-day {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.pt-hm-cell {
  height: 20px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
}

.pt-daily-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 110px;
  padding: 10px 8px 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
}

.pt-day-col {
  flex: 1 0 18px;
  max-width: 34px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}

.pt-day-fill {
  width: 100%;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: #38bdf8;
}

.pt-day-lbl {
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
}

/* Inline Player Status Controls */
.pl-status-ctrl {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.pl-aff-sel {
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
}
.pl-aff-sel.aff-ally {
  border-color: rgba(96, 165, 250, 0.65);
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.14);
}
.pl-aff-sel.aff-enemy {
  border-color: rgba(248, 113, 113, 0.65);
  color: #f87171;
  background: rgba(239, 68, 68, 0.14);
}
.pl-aff-sel.aff-neutral {
  border-color: var(--border);
  color: var(--muted);
}

.st-pill {
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--muted);
  opacity: 0.48;
  cursor: pointer;
  transition: opacity 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.st-pill:hover:not(:disabled) {
  opacity: 0.92;
  border-color: rgba(148, 163, 184, 0.65);
}
.st-pill:disabled {
  opacity: 0.18;
  cursor: not-allowed;
}
.st-pill.on {
  opacity: 1;
}
.st-pill.star.on {
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.7);
  background: rgba(245, 158, 11, 0.16);
}
.st-pill.pearl.on {
  color: #d8b4fe;
  border-color: rgba(168, 85, 247, 0.75);
  background: rgba(168, 85, 247, 0.18);
}
.st-pill.banned.on {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.75);
  background: rgba(239, 68, 68, 0.18);
}
.st-pill.wl.on {
  color: #3ce37d;
  border-color: rgba(60, 227, 125, 0.7);
  background: rgba(60, 227, 125, 0.16);
}

.pl-ins-sel {
  padding: 2px 5px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--muted);
  cursor: pointer;
}
.pl-ins-sel.active {
  color: #e9d5ff;
  border-color: rgba(192, 132, 252, 0.75);
  background: rgba(168, 85, 247, 0.2);
}

/* Toasts */
.toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
  max-width: min(420px, 90vw);
}

.toast {
  padding: 10px 14px;
  border-radius: 8px;
  background: #13251b;
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 12.5px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.toast.error {
  background: #2b1216;
  border-color: var(--danger);
  color: #ffd5da;
}

/* Live Combat Status & Loadout Chips */
.combat-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
  margin-bottom: 2px;
}

.cs-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  font-family: var(--mono, monospace);
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: #cbd5e1;
}

.cs-hp {
  background: rgba(60, 227, 125, 0.14);
  border-color: rgba(60, 227, 125, 0.4);
  color: #86efac;
}

.cs-hp.warn,
.cs-pots.warn,
.cs-armor.warn {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.55);
  color: #fde68a;
}

.cs-hp.low,
.cs-armor.low {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.65);
  color: #fca5a5;
}

.cs-ct {
  background: rgba(239, 68, 68, 0.28);
  border-color: rgba(239, 68, 68, 0.8);
  color: #fecaca;
}

.cs-pots {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.4);
  color: #bae6fd;
}

.cs-armor {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(129, 140, 248, 0.4);
  color: #c7d2fe;
}

/* Streamlined Global Polish & Smooth Interactions */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.45) transparent;
}
*::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.38);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.62);
}

.card,
.kpi-card,
.layers-panel,
.map-inspector,
.modal-box {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.card:hover {
  border-color: rgba(100, 140, 180, 0.32);
}

.btn-primary,
.ctrl-btn,
.mini-btn,
.nav-item,
.board-tab,
.dim-btn,
.basemap-btn {
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-primary:hover,
.ctrl-btn:hover,
.mini-btn:hover {
  transform: translateY(-0.5px);
}

.btn-primary:active,
.ctrl-btn:active,
.mini-btn:active {
  transform: translateY(0);
}

.data-table tbody tr {
  transition: background 0.12s ease;
}
.data-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.055);
}

/* Map Inspector Live Inventory Bar */
.inspector-inv-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

/* Watchlists: Unpearled Sort Toggle & Force Summary Strip */
.wl-sort-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 34, 0.72);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.wl-sort-toggle:hover {
  border-color: rgba(60, 227, 125, 0.55);
  background: rgba(20, 32, 46, 0.9);
}
.wl-sort-toggle input {
  accent-color: var(--accent);
  cursor: pointer;
}

.wl-force-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.wl-force-card {
  position: relative;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(20, 30, 44, 0.86), rgba(12, 19, 29, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.wl-force-card.ally {
  border-left: 3px solid #3b82f6;
}
.wl-force-card.enemy {
  border-left: 3px solid #ef4444;
}
.wl-force-card.compare-cta {
  border-left: 3px solid var(--accent);
  justify-content: space-between;
}

.wl-force-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.wl-force-counts {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.wl-force-metric {
  font-size: 13px;
  color: var(--text);
}
.wl-force-metric strong {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--mono, monospace);
}
.wl-force-card.ally .wl-force-metric.unpearled strong {
  color: #60a5fa;
}
.wl-force-card.enemy .wl-force-metric.unpearled strong {
  color: #f87171;
}
.wl-force-metric.pearled strong {
  color: #c084fc;
}
.wl-force-vs {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
}
.wl-force-sub {
  font-size: 11px;
  color: var(--muted);
}
.wl-force-cta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wl-compare-btn {
  width: 100%;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
}

/* Watchlists One-Click Availability Comparison Panel */
.wl-compare-panel {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.34);
  background: linear-gradient(180deg, rgba(13, 22, 34, 0.96), rgba(10, 16, 25, 0.98));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
}

.wl-compare-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}
.wl-compare-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.wl-compare-sub {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted);
}

.wl-cmp-mode-group {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(8, 13, 20, 0.85);
}
.wl-cmp-mode-btn {
  padding: 5px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.wl-cmp-mode-btn.active {
  background: rgba(60, 227, 125, 0.18);
  color: #86efac;
}

.wl-cmp-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.wl-cmp-kpi {
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 24, 36, 0.78);
}
.wl-cmp-kpi.ally { border-top: 2px solid #3b82f6; }
.wl-cmp-kpi.enemy { border-top: 2px solid #ef4444; }
.wl-cmp-kpi.edge { border-top: 2px solid var(--accent); }
.wl-cmp-kpi-lbl {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.wl-cmp-kpi-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 3px 0;
}
.wl-cmp-kpi.ally .wl-cmp-kpi-val { color: #60a5fa; }
.wl-cmp-kpi.enemy .wl-cmp-kpi-val { color: #f87171; }
.wl-cmp-kpi.edge .wl-cmp-kpi-val { color: #86efac; }
.wl-cmp-kpi-sub {
  font-size: 11px;
  color: var(--muted);
}

.wl-cmp-charts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 12px;
}

.wl-cmp-box {
  padding: 11px 12px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(11, 18, 28, 0.75);
}
.wl-cmp-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}
.wl-cmp-legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.wl-leg-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 3px;
}
.wl-leg-dot.ally { background: #3b82f6; }
.wl-leg-dot.enemy { background: #ef4444; }

.wl-cmp-days-chart {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.wl-day-row {
  display: grid;
  grid-template-columns: 34px 1fr 42px;
  align-items: center;
  gap: 8px;
}
.wl-day-lbl {
  font-size: 11.5px;
  font-weight: 600;
  color: #cbd5e1;
}
.wl-day-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.wl-bar-track {
  position: relative;
  height: 11px;
  border-radius: 4px;
  background: rgba(30, 41, 59, 0.65);
  overflow: hidden;
  display: flex;
  align-items: center;
}
.wl-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.25s ease;
}
.wl-bar-fill.ally { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.wl-bar-fill.enemy { background: linear-gradient(90deg, #dc2626, #f87171); }
.wl-bar-num {
  position: absolute;
  right: 5px;
  font-size: 9.5px;
  color: #f1f5f9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}
.wl-day-adv {
  text-align: right;
  font-size: 11px;
  font-weight: 700;
}
.wl-day-adv.ally { color: #60a5fa; }
.wl-day-adv.enemy { color: #f87171; }
.wl-day-adv.even { color: var(--muted); }

.wl-cmp-hourly-chart {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 3px;
  align-items: end;
  height: 158px;
  padding-top: 6px;
}
.wl-hr-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  gap: 4px;
}
.wl-hr-pair {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  padding-bottom: 1px;
}
.wl-hr-bar {
  width: 45%;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  transition: height 0.25s ease;
}
.wl-hr-bar.ally { background: #3b82f6; }
.wl-hr-bar.enemy { background: #ef4444; }
.wl-hr-lbl {
  font-size: 9.5px;
  color: var(--muted);
  height: 12px;
}

.wl-cmp-matrix {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-x: auto;
}
.wl-mx-row {
  display: grid;
  grid-template-columns: 34px repeat(24, minmax(22px, 1fr));
  gap: 2px;
  align-items: center;
}
.wl-mx-day {
  font-size: 10.5px;
  font-weight: 600;
  color: #cbd5e1;
}
.wl-mx-head {
  text-align: center;
  font-size: 9.5px;
  color: var(--muted);
}
.wl-mx-cell {
  height: 21px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  cursor: default;
  transition: transform 0.1s ease, outline 0.1s ease;
}
.wl-mx-cell:hover {
  transform: scale(1.08);
  outline: 1px solid rgba(255, 255, 255, 0.55);
  z-index: 2;
}

/* Drawable EZ, Infra Size Selector & Enemy Logout Danger Alerts */
.draw-size-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.forces-alerts-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(10, 15, 24, 0.85);
}

.forces-alert-item {
  padding: 7px 9px;
  border-radius: 7px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}
.forces-alert-item:hover {
  transform: translateY(-1px);
}
.forces-alert-item.danger {
  background: rgba(127, 29, 29, 0.34);
  border: 1px solid rgba(239, 68, 68, 0.65);
}
.forces-alert-item.ez-flag {
  background: rgba(120, 53, 15, 0.34);
  border: 1px solid rgba(245, 158, 11, 0.65);
}
.forces-alert-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11.5px;
  color: #fecaca;
}
.forces-alert-item.ez-flag .forces-alert-top {
  color: #fef08a;
}
.forces-alert-sub {
  margin-top: 3px;
  font-size: 10.5px;
  color: #cbd5e1;
}

.tag.snitch-logout-alert {
  background: rgba(220, 38, 38, 0.32);
  border-color: #ef4444;
  color: #fecaca;
  font-weight: 700;
  font-size: 9.5px;
  padding: 0 5px;
}

.tag.ez-neutral-tag {
  background: rgba(217, 119, 6, 0.3);
  border-color: #f59e0b;
  color: #fde68a;
  font-weight: 700;
  font-size: 9.5px;
  padding: 0 5px;
}

.force-row.critical-snitch-logout {
  border-left: 3px solid #ef4444;
  background: rgba(127, 29, 29, 0.22);
}

.force-row.offline-last-known {
  opacity: 0.84;
}

@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .wl-force-summary { grid-template-columns: 1fr; }
  .wl-cmp-kpis { grid-template-columns: 1fr; }
  .wl-cmp-charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .nav-rail { width: 100%; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .nav-footer { display: none; }
  .status-strip { display: none; }
  .workspace { flex-direction: column; }
  .sidebar { width: 100%; height: 220px; border-left: none; border-top: 1px solid var(--border); }
}
