:root {
  color-scheme: dark;
  --bg: #081018;
  --bg-2: #0c1520;
  --panel: #101a27;
  --line: rgba(232, 214, 184, 0.14);
  --text: #f4efe6;
  --muted: #9aa7b5;
  --accent: #e8a35a;
  --accent-soft: rgba(232, 163, 90, 0.14);
  --online: #5dce9a;
  --danger: #ff7b8a;
  --font: "Instrument Sans", "Segoe UI", sans-serif;
  --display: "Sora", "Instrument Sans", sans-serif;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(232, 163, 90, 0.12), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(93, 206, 154, 0.08), transparent 50%),
    linear-gradient(180deg, #0a121c, var(--bg) 40%);
  color: var(--text);
}
button, input, select { font: inherit; }
button {
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: #1a1208;
  font-weight: 700;
  padding: 9px 12px;
  cursor: pointer;
}
button:hover { filter: brightness(1.06); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.ghost, .filter {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}
.filter.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(232, 163, 90, 0.4);
}
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0a121b;
  color: inherit;
  padding: 9px 11px;
}
input:focus, select:focus {
  outline: 2px solid rgba(232, 163, 90, 0.35);
  border-color: var(--accent);
}
label { display: grid; gap: 6px; color: var(--muted); font-size: .82rem; }
.error { color: var(--danger); min-height: 1.2em; }
.brand-mark {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -.04em;
  font-size: 1.35rem;
  color: var(--text);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(400px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(10px);
}
.login-card h1 {
  margin: 8px 0 4px;
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -.05em;
}
.login-copy { margin: 0 0 18px; color: var(--muted); }
.login-card form { display: grid; gap: 12px; }

.fleet-screen { min-height: 100vh; padding: 18px 18px 110px; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}
.brand-lockup { display: flex; align-items: baseline; gap: 12px; }
.topbar-meta { color: var(--muted); font-size: .86rem; }
.topbar-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.topbar-tools input[type="search"] { width: min(240px, 40vw); }
.filter-group { display: flex; gap: 6px; }

.wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.tile {
  position: relative;
  display: grid;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--panel);
  min-height: 210px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  padding: 0;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.tile:hover {
  transform: translateY(-2px);
  border-color: rgba(232, 163, 90, 0.45);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  filter: none;
}
.tile.selected { outline: 2px solid var(--accent); }
.tile-shot {
  aspect-ratio: 16 / 10;
  width: 100%;
  object-fit: cover;
  background:
    linear-gradient(45deg, #0d1622 25%, transparent 25%),
    linear-gradient(-45deg, #0d1622 25%, transparent 25%),
    #121c28;
  background-size: 18px 18px;
  background-position: 0 0, 0 9px;
  display: block;
}
.tile-shot.offline { filter: grayscale(.8) brightness(.7); }
.tile-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px 12px 12px;
}
.tile-name { font-weight: 700; font-size: .95rem; }
.tile-sub { color: var(--muted); font-size: .72rem; margin-top: 2px; }
.tile-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
}
.tile-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}
.tile.online .tile-status { color: var(--online); }
.tile.online .tile-status::before {
  background: var(--online);
  box-shadow: 0 0 10px rgba(93, 206, 154, 0.7);
}
.tile-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 700;
  color: #1a1204;
  background: #e7b549;
}
.tile-check {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}
.empty { text-align: center; color: var(--muted); padding: 48px 12px; }
.notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #3a1c24;
  color: #ffc2ca;
  border: 1px solid #62343e;
}

.bulk-dock {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(980px, calc(100% - 24px));
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, #101925 92%, transparent);
  backdrop-filter: blur(12px);
  z-index: 30;
}
.bulk-dock-main {
  display: grid;
  grid-template-columns: auto minmax(140px, 180px) minmax(180px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}
.bulk-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.bulk-result {
  margin: 10px 0 0;
  max-height: 120px;
  overflow: auto;
  font-size: 11px;
  color: var(--muted);
}

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(4, 8, 14, 0.72);
  backdrop-filter: blur(8px);
  padding: 18px;
  overflow: auto;
}
.detail-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 12px;
}
.close-detail { width: fit-content; }
.detail-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.9fr);
  gap: 14px;
  align-items: start;
}
.viewer-panel, .controls-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  overflow: hidden;
}
.viewer-head, .controls-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.viewer-head h2, .controls-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: -.03em;
}
.viewer-sub { color: var(--muted); font-size: .78rem; margin-top: 4px; }
.display-screen {
  min-height: 360px;
  height: min(58vh, 640px);
  background: #070d14;
}
.display-screen > div { width: 100% !important; height: 100% !important; }
.viewer-actions, .button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.controls-panel { padding-bottom: 8px; }
.control-block {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
}
.control-block:last-child { border-bottom: 0; }
.control-block h3 {
  margin: 0;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.slider-label { display: flex; justify-content: space-between; color: var(--muted); font-size: .82rem; }
.status-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: .84rem;
  color: var(--muted);
}
.status-line strong { color: var(--text); font-weight: 600; }
.result-box {
  margin: 0 16px 16px;
  padding: 10px;
  border-radius: 10px;
  background: #0a121b;
  color: var(--muted);
  font-size: 11px;
  max-height: 140px;
  overflow: auto;
  white-space: pre-wrap;
}
button.danger {
  background: #3b1c23;
  color: #ffb7bf;
  border-color: #67303b;
}
button.secondary {
  background: #1a2533;
  color: var(--text);
  border-color: var(--line);
}

@media (max-width: 960px) {
  .detail-stage { grid-template-columns: 1fr; }
  .bulk-dock-main { grid-template-columns: 1fr; }
  .topbar { align-items: stretch; flex-direction: column; }
}
