:root {
  --bg: #050505;
  --panel: #0a0a0a;
  --text: #f5f5f5;
  --text-dim: #a3a3a3;
  --muted: #737373;
  --border: #3f1515;
  --border-strong: #7f1d1d;
  --red: #ef4444;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --shadow: 0 18px 50px rgba(0,0,0,.45);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, Segoe UI, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.app { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.sidebar {
  background: #070707;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px 14px; }
.brand-mark {
  width: 36px; height: 36px; display: grid; place-items: center;
  background: #7f1d1d; color: #fff; font-weight: 800; letter-spacing: .04em;
}
.brand-name { font-weight: 800; letter-spacing: .08em; font-size: 12px; }
.brand-sub { color: var(--muted); font-size: 11px; }
.sidebar-scroll { flex: 1; overflow: auto; padding: 8px 10px 16px; }
.nav-sec {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .14em;
  font-weight: 800;
  padding: 12px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 8px;
  color: #d4d4d4; text-decoration: none;
  padding: 8px 10px; margin: 2px 0;
}
.nav-item:hover { background: rgba(239,68,68,.08); color: #fff; }
.nav-item.active { background: rgba(239,68,68,.16); color: #fff; border-left: 2px solid var(--red); }
.nav-ico { width: 16px; text-align: center; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 12px; }
.api-chip {
  font-family: var(--mono); font-size: 11px; color: #fca5a5;
  border: 1px solid var(--border); padding: 6px 8px; margin-bottom: 10px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px 8px; border-bottom: 1px solid #1a1a1a;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.page-title { margin: 0; font-size: 18px; }
.page-sub { color: var(--text-dim); font-size: 12px; }
.content { padding: 18px 22px 40px; }
.page-hero h2 { color: var(--red); margin: 0 0 4px; font-size: 28px; font-weight: 800; }
.page-hero p { color: var(--text-dim); margin: 0; }
.menu-btn {
  display: none; background: transparent; border: 1px solid var(--border);
  color: #fff; padding: 6px 10px;
}
.sidebar-overlay { display: none; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 16px;
}
.section-title {
  color: var(--red); font-size: 13px; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase; margin: 0 0 12px;
}
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin: 14px 0; }
.kpi { border: 1px solid var(--border); background: #080808; padding: 14px; }
.kpi .v { font-size: 28px; font-weight: 800; }
.kpi .l { margin-top: 8px; color: #a3a3a3; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; }
.kpi.accent .v { color: #86efac; }
.kpi.amber .v { color: #fcd34d; }
.license-bar {
  border: 1px solid #166534; background: rgba(22,101,52,.15);
  color: #86efac; padding: 10px 14px; margin: 12px 0 8px; text-align: center; font-weight: 600;
}
.license-bar-bad { border-color: #7f1d1d; background: rgba(127,29,29,.18); color: #fecaca; }
.table-wrap { overflow: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #1f1f1f; vertical-align: top; }
table.data th { color: #a3a3a3; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
table.data .empty { color: var(--muted); text-align: center; padding: 28px; }
.mono { font-family: var(--mono); }
.pill {
  display: inline-flex; align-items: center; padding: 3px 8px;
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid transparent;
}
.pill-ok { background: #14532d; color: #86efac; border-color: #22c55e; }
.pill-bad { background: #7f1d1d; color: #fecaca; border-color: #ef4444; }
.pill-warn { background: #713f12; color: #fde68a; border-color: #f59e0b; }
.pill-mute { background: #171717; color: #a3a3a3; border-color: #404040; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 12px; border: 1px solid var(--border-strong);
  background: #111; color: #fff; font-weight: 600; text-decoration: none;
}
.btn:hover { background: #1a1a1a; }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-red { background: #e11d48; border-color: #e11d48; }
.btn-red:hover { background: #f43f5e; }
.btn-del { background: #991b1b; border-color: #7f1d1d; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.form-group { margin-bottom: 12px; }
.form-group label, label {
  display: block; color: #a3a3a3; font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; font-weight: 700; margin-bottom: 6px;
}
input, select, textarea {
  width: 100%; background: #0a0a0a; border: 1px solid #7f1d1d;
  color: #fff; padding: 9px 10px; border-radius: 0;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: #ef4444; box-shadow: 0 0 0 1px rgba(239,68,68,.25);
}
.create-lure-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.create-lure-grid .full { grid-column: 1 / -1; }
.loading { display: flex; gap: 10px; align-items: center; color: var(--text-dim); padding: 24px 0; }
.spinner {
  width: 16px; height: 16px; border: 2px solid #404040; border-top-color: #ef4444;
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 28px; }
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #000;
}
.login-card {
  width: min(420px, 92vw); border: 1px solid #7f1d1d; background: #0a0a0a; padding: 28px;
}
.login-card h1 { color: #ef4444; margin: 0 0 6px; }
.login-card .sub { color: var(--muted); margin-bottom: 22px; font-size: 13px; }
.login-error {
  background: rgba(127,29,29,.25); border: 1px solid rgba(239,68,68,.35);
  color: #fecdd3; padding: 10px 12px; margin-bottom: 14px; font-size: 13px;
}
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 40;
  background: #111; border: 1px solid #404040; padding: 10px 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }
.toast.ok { border-left: 3px solid #22c55e; }
.toast.err { border-left: 3px solid #ef4444; }
.split-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.hint { color: var(--muted); font-size: 12px; }
a { color: #fca5a5; }
a:hover { color: #fff; }
.msg-row { cursor: pointer; }
.msg-row:hover td { background: rgba(239,68,68,.06); }
.msg-body {
  white-space: pre-wrap; background: #050505; border: 1px solid var(--border);
  padding: 14px; margin-top: 12px; max-height: 420px; overflow: auto;
}
@media (max-width: 1000px) {
  .kpi-grid, .split-2, .create-lure-grid { grid-template-columns: 1fr; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 240px; z-index: 20;
    transform: translateX(-105%); transition: transform .18s;
  }
  .sidebar.open { transform: none; }
  .sidebar-overlay.on {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 15;
  }
  .menu-btn { display: inline-flex; }
}
