:root {
  --bg: #07080b;
  --bg-2: #101216;
  --panel: #12141a;
  --line: #2c3038;
  --gold-line: rgba(224, 180, 74, 0.38);
  --text: #f6f3ec;
  --muted: #a8a092;
  --gold: #e0b44a;
  --gold-2: #f3d78a;
  --ok: #3dbe7a;
  --warn: #e0a15a;
  --bad: #e36a5d;
  --info: #8ec0e0;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Outfit, "Segoe UI", sans-serif;
  background:
    radial-gradient(880px 420px at 0% -8%, rgba(224, 180, 74, 0.14), transparent 55%),
    radial-gradient(720px 380px at 100% 0%, rgba(90, 104, 128, 0.16), transparent 48%),
    var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.boot { padding: 48px 20px; color: var(--muted); }

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 300px;
  flex: none;
  background:
    linear-gradient(180deg, rgba(224, 180, 74, 0.08), transparent 180px),
    #050506;
  border-right: 1px solid var(--gold-line);
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gold-line);
}
.brand img {
  width: 100%;
  max-height: 228px;
  object-fit: contain;
  display: block;
  border-radius: 16px;
  border: 1px solid var(--gold-line);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  background: #000;
}
.brand p {
  margin: 0;
  color: var(--gold-2);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.nav { overflow: auto; padding-right: 4px; flex: 1; }
.nav-group { margin: 12px 8px 6px; color: var(--gold-2); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; }
.nav-btn {
  width: 100%; text-align: left; border: 0; background: transparent;
  color: var(--text); border-radius: 10px; padding: 8px 10px; display: flex; justify-content: space-between; gap: 8px;
}
.nav-btn small { color: var(--muted); font-family: "IBM Plex Mono", monospace; }
.nav-btn:hover { background: rgba(255, 255, 255, 0.04); }
.nav-btn[aria-current="page"] {
  background: linear-gradient(90deg, rgba(224, 180, 74, 0.2), transparent 78%);
  box-shadow: inset 2px 0 0 var(--gold);
}
.side-foot { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.who-role { margin: 0; font-size: 14px; }
.who-role span { color: var(--gold-2); font-size: 12px; }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  background:
    linear-gradient(180deg, rgba(224, 180, 74, 0.1), transparent 42%),
    var(--panel);
  border: 1px solid var(--gold-line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.gate-card img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid var(--gold-line);
  background: #000;
}
.gate-card h2 { margin: 0; font-size: 28px; }
.gate-card .sub { margin: 0; color: var(--muted); }
.gate-card .btn { width: 100%; }
.gate-error { margin: 0; color: #ffd0cb; }
.side-foot label { font-size: 11px; color: var(--muted); display: grid; gap: 6px; }
.conn { font-size: 12px; color: var(--muted); line-height: 1.45; }
.conn a { color: var(--gold-2); }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; box-shadow: 0 0 0 0 rgba(60, 186, 122, 0.7); animation: pulse 1.8s infinite; }
@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(60, 186, 122, 0); }
  100% { box-shadow: 0 0 0 0 rgba(60, 186, 122, 0); }
}

.main { flex: 1; min-width: 0; padding: 18px 22px 40px; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.kicker { margin: 0 0 2px; color: var(--gold); font-size: 11px; font-weight: 650; letter-spacing: 0.22em; }
.topbar h2 { margin: 0 0 4px; font-size: 28px; letter-spacing: -0.03em; color: #f7f4ee; }
.topbar .sub { margin: 0; color: var(--muted); max-width: 640px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.clock { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--muted); text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.who { font-family: Outfit, "Segoe UI", sans-serif; }
.bell { white-space: nowrap; flex: none; }
.menu-btn, .icon-btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: 999px; padding: 8px 12px;
}
.menu-btn { display: none; }
.bell { position: relative; }
.badge {
  position: absolute; top: -6px; right: -6px; background: var(--bad); color: white;
  border-radius: 999px; font-size: 11px; min-width: 18px; text-align: center; padding: 1px 4px;
}

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.kpi, .panel {
  background:
    linear-gradient(180deg, rgba(224, 180, 74, 0.07), transparent 42%),
    var(--panel);
  border: 1px solid var(--gold-line);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.kpi { position: relative; overflow: hidden; }
.kpi::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.kpi span, .muted { color: var(--muted); font-size: 12px; }
.kpi strong { display: block; margin-top: 6px; font-size: 26px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi em { font-style: normal; color: var(--gold-2); font-size: 12px; }
.split { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 12px; margin-bottom: 12px; }
.maps { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.maps h3 { margin: 0 0 8px; font-size: 14px; }
.maps .map-wrap { height: 380px; }
.live-tag { display: inline-flex; align-items: center; gap: 8px; color: var(--gold-2); font-size: 12px; letter-spacing: 0.04em; }
.panel + .panel, .split + .panel, .panel + .split { margin-top: 12px; }
.panel h3 { margin: 0 0 10px; font-size: 16px; }
.panel-h { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 10px; }
.panel-h h3 { margin: 0; }

.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #2a3038; stroke-width: 1; }
.chart .tick { fill: #a8a092; font-size: 11px; font-family: "IBM Plex Mono", monospace; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; margin-top: 6px; }
.swatch { width: 18px; height: 3px; display: inline-block; margin-right: 6px; vertical-align: middle; }

.map-wrap { position: relative; height: 460px; border-radius: 14px; overflow: hidden; border: 1px solid #3d4a38; }
.map-pit {
  height: 100%;
  background:
    linear-gradient(90deg, transparent 0 18%, rgba(90, 78, 58, 0.35) 18% 20%, transparent 20%),
    radial-gradient(ellipse at 32% 46%, #4a3e30 0%, transparent 46%),
    radial-gradient(ellipse at 68% 58%, #2e291f 0%, transparent 42%),
    linear-gradient(160deg, #1d2a22, #121612 70%);
}
.map-koridor {
  height: 100%;
  background:
    linear-gradient(#163246, #163246) 8% 62% / 78% 8px no-repeat,
    linear-gradient(#5c5346, #5c5346) 10% 74% / 40% 6px no-repeat,
    radial-gradient(circle at 88% 40%, #1d4d63, transparent 28%),
    linear-gradient(#14201c, #101612);
}
.place { position: absolute; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #d5dece; }
.eq, .vehicle {
  position: absolute; transform: translate(-50%, -50%); text-align: center; min-width: 54px;
}
.eq i, .vehicle i {
  display: block; width: 14px; height: 14px; margin: 0 auto 3px; border-radius: 3px; border: 2px solid #10140f;
}
.eq span, .vehicle span { font-size: 10px; font-family: "IBM Plex Mono", monospace; background: rgba(10,14,10,0.72); padding: 1px 4px; border-radius: 6px; }
.eq.bad i { background: var(--bad); }
.eq.ok i, .vehicle.ok i { background: var(--ok); }
.eq.warn i, .vehicle.warn i { background: var(--warn); }
.eq.info i, .vehicle.info i { background: var(--info); }
.eq.selected i { outline: 2px solid var(--gold); }
.eq.drone i { border-radius: 50%; background: #39d98a; box-shadow: 0 0 0 4px rgba(57, 217, 138, 0.28); }
.map-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
th, td { padding: 9px 8px; border-bottom: 1px solid #2a3038; vertical-align: top; }
td.num, th.num { text-align: right; font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 8px; font-size: 12px; border: 1px solid transparent; text-transform: lowercase; }
.pill.ok { background: rgba(60,186,122,.15); color: #8ee0b4; }
.pill.warn { background: rgba(224,161,90,.15); color: #f0c297; }
.pill.bad { background: rgba(227,106,93,.16); color: #ffb1a8; }
.pill.info { background: rgba(126,182,216,.15); color: #c5e4f6; }
.meter { width: 72px; height: 8px; border-radius: 99px; background: #2a3328; display: inline-block; vertical-align: middle; margin-right: 6px; overflow: hidden; }
.meter > span { display: block; height: 100%; }
.meter.ok > span { background: var(--ok); }
.meter.warn > span { background: var(--warn); }
.meter.bad > span { background: var(--bad); }
.meter-label { font-family: "IBM Plex Mono", monospace; font-size: 12px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 10px; color: var(--muted); }
.chip.on { color: #1a1404; background: var(--gold); border-color: var(--gold); }

.note-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.note-list button, .note-list li {
  text-align: left; width: 100%; border-radius: 12px; padding: 10px 12px; background: #0c0e12; border: 1px solid var(--line);
}
.note-list strong { display: block; }
.lvl-bad { box-shadow: inset 3px 0 0 var(--bad); }
.lvl-warn { box-shadow: inset 3px 0 0 var(--warn); }
.lvl-info { box-shadow: inset 3px 0 0 var(--info); }

.form-grid, .filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; margin-bottom: 12px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
input, select, textarea {
  background: #0c0e12; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none;
}
textarea { min-height: 74px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
.btn { background: var(--gold); color: #1d1604; border: 0; border-radius: 999px; padding: 10px 14px; font-weight: 650; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.bad { background: #7d332d; color: white; }
.btn:disabled { opacity: 0.55; cursor: wait; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.mounds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mound { background: #0c0e12; border-radius: 14px; padding: 12px; border: 1px solid var(--line); }
.pile { height: 120px; display: flex; align-items: flex-end; background: repeating-linear-gradient(90deg, #22281f, #22281f 8px, #1a2019 8px, #1a2019 16px); border-radius: 10px; overflow: hidden; }
.pile span { display: block; width: 100%; background: linear-gradient(#2b2b2b, #111); }
.feeds { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.feed { position: relative; min-height: 230px; border-radius: 14px; overflow: hidden; background: radial-gradient(circle at 50% 40%, #243028, #101612 70%); border: 1px solid var(--line); }
.scan { position: absolute; left: 0; right: 0; height: 2px; background: rgba(167, 230, 120, 0.85); animation: scan 3.4s linear infinite; }
@keyframes scan { from { top: 0; } to { top: 100%; } }
.feed .tel { position: absolute; left: 10px; right: 10px; bottom: 10px; background: rgba(8,12,8,.78); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.statement td:first-child { width: 70%; }
.statement .sub td { font-weight: 650; }
.statement .total td { font-weight: 750; border-top: 2px solid var(--gold); font-size: 16px; }
.cost { color: #f0c2ba; }
.org { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.card { background: #0c0e12; border: 1px solid var(--gold-line); border-radius: 14px; padding: 12px; }
.card h3 { margin: 0 0 6px; }
.chat { display: grid; grid-template-columns: 220px 1fr; gap: 12px; min-height: 420px; }
.channels { display: grid; align-content: start; gap: 6px; }
.thread { display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow: auto; padding-right: 4px; }
.bubble { background: #0c0e12; border-radius: 12px; padding: 8px 10px; border: 1px solid var(--line); }
.bubble header { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.composer { display: flex; gap: 8px; margin-top: 10px; }
.composer input { flex: 1; }
.check { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.spec-copy { white-space: pre-wrap; line-height: 1.55; color: #d5e0d2; }
.toast {
  position: fixed; bottom: 16px; right: 16px; background: #243024; border: 1px solid var(--ok);
  padding: 12px 14px; border-radius: 12px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease;
  max-width: min(420px, calc(100vw - 32px));
}
.toast.show { opacity: 1; transform: none; }
.toast.bad { border-color: var(--bad); }
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(420px, 100%);
  background: #0c0e12; border-left: 1px solid var(--gold-line); z-index: 31; padding: 18px; overflow: auto;
}
.detail { margin-top: 10px; }
.warn-banner { border: 1px solid var(--warn); color: #f3d7bc; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.ok-banner { border: 1px solid #2f6b49; color: #b7ebcf; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }

@media (max-width: 980px) {
  .kpis, .split, .maps, .mounds, .feeds, .chat { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex; }
  .sidebar { position: fixed; z-index: 25; transform: translateX(-110%); transition: transform .2s ease; }
  .app.nav-open .sidebar { transform: none; }
  .main { padding: 14px; }
  .topbar { align-items: center; }
  .topbar h2 { font-size: 22px; }
  .who { display: none; }
  .map-wrap { height: 380px; }
}
@media (prefers-reduced-motion: reduce) {
  .dot-live, .scan { animation: none; }
}
