/* Simeon — premium dark OLED control center */
:root {
  --bg: #0a0d12;
  --bg-elev: #11151c;
  --bg-elev2: #161c26;
  --border: #232b38;
  --border-soft: #1a212c;
  --text: #e7edf4;
  --text-dim: #9aa7b5;
  --text-mute: #5f6b7a;
  --primary: #3b82f6;
  --primary-700: #1e40af;
  --accent: #f59e0b;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 14px;
  --radius-sm: 9px;
  --ring: 0 0 0 3px rgba(59, 130, 246, 0.35);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sans: "Fira Sans", system-ui, -apple-system, sans-serif;
  --mono: "Fira Code", ui-monospace, "SF Mono", monospace;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
} /* must beat .field/.grid display rules */
html,
body {
  margin: 0;
  padding: 0;
}
body {
  background: radial-gradient(
      1200px 600px at 80% -10%,
      #121a2b 0%,
      var(--bg) 55%
    )
    fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
.ic {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
button {
  font-family: inherit;
  cursor: pointer;
}
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- brand ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
}
.brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 14px var(--primary);
}
.brand-name {
  font-family: var(--mono);
  letter-spacing: -0.3px;
  font-weight: 700;
}
.brand-lg .brand-name {
  font-size: 26px;
}
.tag {
  font-size: 11px;
  color: var(--text-mute);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
  font-weight: 500;
}

/* ---------- auth ---------- */
.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-card .brand-lg {
  justify-content: center;
  margin-bottom: 2px;
}
.auth-sub {
  text-align: center;
  color: var(--text-dim);
  margin: -6px 0 6px;
  font-size: 14px;
}

/* ---------- cards / layout ---------- */
.card {
  background: linear-gradient(180deg, var(--bg-elev) 0%, var(--bg-elev2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.content {
  padding: 18px;
  max-width: 1180px;
  margin: 0 auto;
}
.grid {
  display: grid;
  gap: 14px;
}
.sec-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 2px 14px;
}
.sec-h h2 {
  font-family: var(--mono);
  font-size: 18px;
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.sec-h p {
  margin: 0;
  color: var(--text-mute);
  font-size: 13px;
}

/* ---------- topbar + nav ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(10, 13, 18, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ops-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #cfe0ff;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 999px;
  padding: 5px 10px;
}
.ops-badge .ic {
  width: 14px;
  height: 14px;
}
.nav {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-soft);
  scrollbar-width: none;
  position: sticky;
  top: 53px;
  z-index: 30;
  background: rgba(10, 13, 18, 0.82);
  backdrop-filter: blur(14px);
}
.nav::-webkit-scrollbar {
  display: none;
}
.nav-i {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.18s var(--ease);
}
.nav-i:hover {
  color: var(--text);
  background: var(--bg-elev);
}
.nav-i.active {
  color: #fff;
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.45);
}
.nav-i.active .ic {
  color: var(--primary);
}

/* ---------- KPI ---------- */
.kpis {
  grid-template-columns: repeat(2, 1fr);
}
.kpi {
  padding: 16px;
}
.kpi .label {
  font-size: 12px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kpi .val {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  margin-top: 6px;
}
.kpi .val.accent {
  color: var(--accent);
}

/* ---------- chips / pills ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.chip.ex {
  border-color: rgba(239, 68, 68, 0.3);
  color: #f3b6b6;
  background: rgba(239, 68, 68, 0.08);
}
.chip button {
  background: none;
  border: none;
  color: inherit;
  display: inline-flex;
  padding: 0;
  opacity: 0.6;
}
.chip button:hover {
  opacity: 1;
}
.chip button .ic {
  width: 13px;
  height: 13px;
}

/* ---------- niche rows ---------- */
.nrow {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  margin-bottom: 10px;
  overflow: hidden;
}
.nrow-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 15px;
}
.nrow-emoji {
  font-size: 20px;
}
.nrow-title {
  font-weight: 600;
  flex: 1;
}
.nrow-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
}
.nrow-body {
  padding: 0 15px 15px;
  border-top: 1px solid var(--border-soft);
}
.nrow-body[hidden] {
  display: none;
}
.addline {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.addline input {
  flex: 1;
}

/* ---------- status dot ---------- */
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.dot.ok {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}
.dot.off {
  background: var(--text-mute);
}
.dot.bad {
  background: var(--bad);
  box-shadow: 0 0 8px var(--bad);
}
.statline {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 14px;
}
.statline:last-child {
  border-bottom: none;
}
.statline .muted {
  color: var(--text-mute);
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
}

/* ---------- forms ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
}
.field > span {
  font-weight: 500;
}
input,
select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
input::placeholder {
  color: var(--text-mute);
}
input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
}
input[type="password"] {
  letter-spacing: 0.12em;
}
.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  transition:
    transform 0.12s var(--ease),
    filter 0.15s,
    background 0.15s,
    border-color 0.15s;
}
.btn:active {
  transform: scale(0.975);
}
.btn-primary {
  background: linear-gradient(
    180deg,
    var(--primary) 0%,
    var(--primary-700) 100%
  );
  color: #fff;
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.28);
}
.btn-primary:hover {
  filter: brightness(1.08);
}
.btn-ghost {
  background: var(--bg-elev);
  border-color: var(--border);
  color: var(--text-dim);
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--primary);
}
.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f3b6b6;
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}
.btn-sm {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 14px;
}
.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}
.btn .ic {
  width: 16px;
  height: 16px;
}

/* ---------- toggle ---------- */
.sw {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  transition:
    background 0.18s,
    border-color 0.18s;
  flex: none;
}
.sw::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-mute);
  transition:
    transform 0.18s var(--ease),
    background 0.18s;
}
.sw.on {
  background: rgba(59, 130, 246, 0.25);
  border-color: var(--primary);
}
.sw.on::after {
  transform: translateX(20px);
  background: var(--primary);
}

/* ---------- table / empty ---------- */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.tbl th {
  text-align: left;
  color: var(--text-mute);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.tbl td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border-soft);
}
.empty {
  text-align: center;
  color: var(--text-mute);
  padding: 40px 16px;
}
.empty svg {
  width: 34px;
  height: 34px;
  opacity: 0.5;
  margin-bottom: 10px;
}
.note {
  font-size: 12px;
  color: var(--text-mute);
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
}

/* ---------- err + toast ---------- */
.err {
  color: #f3b6b6;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  margin: 0;
}
.err[hidden] {
  display: none;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
}
.toast[hidden] {
  display: none;
}
.toast.ok {
  border-color: rgba(34, 197, 94, 0.45);
}
.toast.bad {
  border-color: rgba(239, 68, 68, 0.45);
}

/* ---------- desktop: sidebar ---------- */
@media (min-width: 1024px) {
  #view-app {
    display: grid;
    grid-template-columns: 230px 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100dvh;
  }
  .topbar {
    grid-column: 1 / -1;
  }
  .nav {
    flex-direction: column;
    gap: 4px;
    overflow: visible;
    border-bottom: none;
    border-right: 1px solid var(--border-soft);
    position: sticky;
    top: 61px;
    align-self: start;
    height: calc(100dvh - 61px);
    padding: 16px 12px;
  }
  .nav-i {
    width: 100%;
    justify-content: flex-start;
  }
  .content {
    padding: 26px;
  }
  .kpis {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 1023px) {
  .hide-sm {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
