:root {
  --bg: #0e1116; --panel: #161b22; --panel2: #1c2230; --border: #2a3240;
  --text: #e6edf3; --muted: #8b97a7; --accent: #FF521D; --accent2: #ff7a4d;
  --green: #3fb950; --red: #f85149; --yellow: #d29922; --blue: #4d9dff;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg); color: var(--text); }
a { color: var(--accent2); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.login-card { width: 340px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.brand .logo { width: 40px; height: 40px; border-radius: 10px; background: var(--accent);
  display: grid; place-items: center; font-weight: 800; color: #fff; }
.brand h1 { font-size: 18px; margin: 0; }
.brand small { color: var(--muted); }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
input, select { width: 100%; padding: 9px 11px; background: var(--panel2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px; }
button { cursor: pointer; border: none; border-radius: 8px; padding: 9px 14px; font-weight: 600; font-size: 14px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); }
.btn-ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--border); }
.btn-sm { padding: 4px 8px; font-size: 11px; }
.actions { display: flex; gap: 4px; flex-wrap: nowrap; white-space: nowrap; }
.actions button { padding: 3px 7px; font-size: 11px; }
.btn-danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
.err { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 8px; }

.layout { display: flex; min-height: 100vh; }
.sidebar { width: 210px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 12px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { margin-bottom: 18px; }
.main { flex: 1; min-width: 0; }
.side-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; border-top: 1px solid var(--border); }
.topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.view-title { font-size: 16px; font-weight: 700; }
.tabs { display: flex; flex-direction: column; gap: 4px; }
.tab { padding: 9px 14px; border-radius: 8px; color: var(--muted); cursor: pointer; font-size: 14px; }
.tab:hover { background: var(--panel2); }
.tab.active { background: var(--accent); color: #fff; }
.wrap { padding: 20px; max-width: 1200px; margin: 0 auto; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.kpi .v { font-size: 26px; font-weight: 700; }
.kpi .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.charts { grid-template-columns: 1fr 1fr; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.panel h3 { margin: 0 0 12px; font-size: 14px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }
.badge { padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge.on { background: rgba(63,185,80,.15); color: var(--green); }
.badge.off { background: rgba(248,81,73,.15); color: var(--red); }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hidden { display: none; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--panel2); border: 1px solid var(--border);
  padding: 12px 16px; border-radius: 10px; font-size: 13px; z-index: 20; }
.scroll { overflow-x: auto; }
.muted { color: var(--muted); }
.keychip { background: var(--panel2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; }
