@import url('/assets/fonts/fonts.css?v=7');

:root {
  color-scheme: dark;
  --bg: #090a0c;
  --rail: #15171a;
  --surface: #17191d;
  --surface-2: #1f2228;
  --surface-inset: #111317;
  --border: #282b32;
  --border-hi: #3b404c;
  --text: #ffffff;
  --text-2: #a5abb6;
  --muted: #787f8c;
  --blue: #2563eb;
  --blue-hover: #3b82f6;
  --blue-soft: #22262e;
  --blue-border: rgba(59, 130, 246, 0.42);
  --blue-text: #60a5fa;
  --cyan: #2dd4bf;
  --amber: #f59e0b;
  --violet: #a855f7;
  --red: #ef4444;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

button, input, select, textarea {
  font-family: inherit;
}

/* ============================================================
   UNIFIED NATIVE CLIENT SHELL — 1:1 VARIANT 6 PROPORTIONS
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--rail);
  border-right: 1px solid #22252a;
  display: flex;
  flex-direction: column;
  padding: 28px 0 22px;
  z-index: 30;
  overflow-y: auto;
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 24px 30px;
  text-decoration: none;
  color: #ffffff;
}

.sb-mark {
  width: 44px;
  height: 25px;
  flex-shrink: 0;
  display: block;
}

.sb-brand-name {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
}

.sb-brand-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--blue-text);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 4px;
}

.sb-section-lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 12px 24px 6px;
}

.sb-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 12px;
}

.sb-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 500;
  color: #9ea4b0;
  text-decoration: none;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.sb-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 1.85;
  fill: none;
  opacity: 0.85;
}

.sb-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.sb-link.active {
  background: #232730;
  color: #ffffff;
  font-weight: 500;
}

.sb-link.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #3b82f6;
}

/* Compact sidebar links for dense HQ control panel */
.sidebar.sb-compact .sb-link {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
}

.sb-divider {
  height: 1px;
  background: #23262d;
  margin: 12px 16px;
}

.sb-foot {
  margin-top: auto;
  padding: 16px 16px 0;
  border-top: 1px solid #22252a;
}

/* Mobile Header */
.mob-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--rail);
  border-bottom: 1px solid #22252a;
  padding: 12px 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mob-bar .sb-brand {
  padding: 0;
}

.mob-bar .sb-mark {
  width: 34px;
  height: 20px;
}

.mob-bar .sb-brand-name {
  font-size: 20px;
}

.mob-nav-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.mob-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 7, 0.74);
  z-index: 45;
}

.mob-backdrop.open {
  display: block;
}

/* Typography & Controls */
.num {
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--border-hi);
  background: #272b33;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  font-weight: 600;
}

.btn.primary:hover {
  background: #3b82f6;
  border-color: #3b82f6;
}

.btn.ok {
  background: rgba(37, 99, 235, 0.22);
  border-color: rgba(59, 130, 246, 0.45);
  color: #93c5fd;
}

.btn.ok:hover {
  background: rgba(37, 99, 235, 0.34);
}

.btn.err {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.38);
  color: #fca5a5;
}

.btn.err:hover {
  background: rgba(239, 68, 68, 0.26);
}

.btn.warn {
  background: rgba(165, 171, 182, 0.10);
  border-color: rgba(165, 171, 182, 0.28);
  color: #e5e7eb;
}

.btn.warn:hover {
  border-color: #3b82f6;
  color: #ffffff;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.on {
  background: rgba(37, 99, 235, 0.20);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.38);
}

.badge.off {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.36);
}

.badge.lock {
  background: #23262d;
  color: #b8bec8;
  border: 1px solid #343842;
}

.badge.hs {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  margin-left: 6px;
}

.badge.kill {
  background: rgba(37, 99, 235, 0.20);
  color: #93c5fd;
}

.badge.death {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1b1e24;
  border: 1px solid #3b82f6;
  color: #ffffff;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 99;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Workspace Standard Padding for Stats & HQ */
.workspace {
  padding: 28px 34px 48px;
  width: 100%;
  min-width: 0;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head h2, .panel-head h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

input[type="text"], input[type="password"], input[type="number"], input:not([type]), select, textarea {
  background: var(--surface-inset);
  border: 1px solid var(--border);
  color: #ffffff;
  padding: 9px 13px;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.14s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #3b82f6;
}

/* Crisp Hairline Tables */
.tbl-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 11px 13px;
  border-bottom: 1px solid #22252c;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
}

th.sortable {
  cursor: pointer;
}

th.sortable:hover {
  color: #ffffff;
}

tr.row-click {
  cursor: pointer;
  transition: background 0.12s ease;
}

tr.row-click:hover {
  background: rgba(255, 255, 255, 0.035);
}

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

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .mob-bar {
    display: flex;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 264px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 50;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .workspace {
    padding: 18px 16px 40px;
  }
}
