/* MK Injector panel — "Ember" design language: charcoal surfaces, orange accent, lime for live state. */
:root {
  --bg: #0d0e12; --bg-2: #111319; --card: #15171d; --card-2: #1b1d24; --card-3: #23262e;
  --stroke: #262932; --stroke-2: #3a3d47;
  --text: #f1ede8; --muted: #b2ada6; --dim: #6e6b66;
  --accent: #ff7a1a; --accent-soft: #ffb067; --accent-bg: #3a2313;
  --ok: #a6f55a; --ok-bg: rgba(166,245,90,.12); --warn: #ffc553; --warn-bg: rgba(255,197,83,.12); --err: #ff6b6b; --err-bg: rgba(255,107,107,.12); --info: #7cc4ff; --info-bg: rgba(124,196,255,.12);
  --radius: 18px; --radius-s: 12px; --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif; --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f8f5f1; --bg-2: #fcfaf7; --card: #ffffff; --card-2: #f2eee9; --card-3: #ebe6e0; --stroke: #e6e0d8; --stroke-2: #cfc8bf;
    --text: #1c1b19; --muted: #5c574f; --dim: #8b867f; --accent: #e2640a; --accent-soft: #8a4b14; --accent-bg: #ffe0c7;
    --ok: #3e7d0a; --ok-bg: rgba(62,125,10,.12); --warn: #b07400; --warn-bg: rgba(176,116,0,.12); --err: #ba1a1a; --err-bg: rgba(186,26,26,.12); --info: #0b63b8; --info-bg: rgba(11,99,184,.12);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 800; } h2 { font-size: 17px; font-weight: 700; } h3 { font-size: 14px; font-weight: 700; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .mono { font-family: var(--mono); font-size: 13px; }
.small { font-size: 13px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--bg-2); border-right: 1px solid var(--stroke); padding: 18px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; }
.brand .bolt { width: 34px; height: 34px; border-radius: 10px; background: var(--card-3); display: grid; place-items: center; }
.brand .bolt svg { width: 20px; height: 20px; }
.brand b { display: block; font-weight: 800; } .brand span { display: block; font-size: 12px; color: var(--muted); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-s); color: var(--muted); font-weight: 600; }
.nav a:hover { background: var(--card-2); color: var(--text); }
.nav a.active { background: var(--accent-bg); color: var(--accent-soft); }
.nav a .ico { width: 18px; height: 18px; opacity: .9; }
.nav .badge { margin-left: auto; }
.side .me { margin-top: auto; padding: 12px; border-radius: var(--radius-s); background: var(--card); border: 1px solid var(--stroke); }
.side .me b { display: block; } .side .me .role { font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.main { padding: 26px 30px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vw rgba(0,0,0,.5); }
  .menu-btn { display: inline-flex; }
  .main { padding: 16px 16px 60px; }
}

/* cards & grid */
.card { background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 14px; }
.card h2 { margin-bottom: 10px; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius-s); padding: 14px 16px; }
.tile .label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.tile .value { font-size: 26px; font-weight: 800; font-family: var(--mono); margin-top: 4px; }
.tile .value.ok { color: var(--ok); } .tile .value.warn { color: var(--warn); } .tile .value.accent { color: var(--accent); } .tile .value.err { color: var(--err); }
.tile .hint { font-size: 12px; color: var(--dim); margin-top: 2px; }
.section-title { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin: 22px 0 8px; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field .help { font-size: 12px; color: var(--dim); }
.input, select, textarea { width: 100%; background: var(--bg-2); border: 1px solid var(--stroke-2); border-radius: var(--radius-s); padding: 10px 12px; outline: none; transition: border-color .15s; }
.input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 96px; resize: vertical; font-family: var(--mono); font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1; min-width: 120px; }
.row.tight > * { flex: 0 0 auto; min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--stroke-2); background: var(--card-2); color: var(--text); padding: 9px 14px; border-radius: 999px; font-weight: 600; cursor: pointer; transition: filter .15s, background .15s; white-space: nowrap; }
.btn:hover { filter: brightness(1.1); } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0e05; }
.btn.ok { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.btn.danger { background: var(--err-bg); border-color: transparent; color: var(--err); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--stroke-2); background: var(--card-2); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 13px; font-weight: 600; }
.chip.active { background: var(--accent-bg); color: var(--accent-soft); border-color: transparent; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--stroke); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--stroke); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: var(--card-2); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* badges & status */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--card-3); color: var(--muted); }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.err { background: var(--err-bg); color: var(--err); } .badge.info { background: var(--info-bg); color: var(--info); } .badge.accent { background: var(--accent-bg); color: var(--accent-soft); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.banner { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--radius-s); border: 1px solid; font-size: 14px; margin-bottom: 14px; }
.banner.info { background: var(--info-bg); border-color: rgba(124,196,255,.35); } .banner.warn { background: var(--warn-bg); border-color: rgba(255,197,83,.35); } .banner.err { background: var(--err-bg); border-color: rgba(255,107,107,.35); } .banner.ok { background: var(--ok-bg); border-color: rgba(166,245,90,.35); }
.bar { height: 8px; background: var(--card-3); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar > i.ok { background: var(--ok); } .bar > i.warn { background: var(--warn); } .bar > i.err { background: var(--err); }
.countdown { font-family: var(--mono); font-weight: 600; }
.countdown.low { color: var(--warn); } .countdown.out { color: var(--err); }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; }
.kv .k { color: var(--muted); }
.log-list { display: flex; flex-direction: column; gap: 8px; }
.log { display: grid; grid-template-columns: 70px 1fr; gap: 10px; padding: 8px 10px; border-radius: var(--radius-s); background: var(--bg-2); font-size: 13px; }
.log .t { font-family: var(--mono); color: var(--dim); }
.log .a { color: var(--accent-soft); font-weight: 600; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(600px 400px at 50% -10%, rgba(255,122,26,.18), transparent 70%), var(--bg); }
.auth .card { width: 100%; max-width: 420px; padding: 28px; }
.auth .logo { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.auth .logo .bolt { width: 40px; height: 40px; border-radius: 12px; background: var(--card-3); display: grid; place-items: center; }
.auth .tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.auth .tabs button { flex: 1; }
.error { color: var(--err); font-size: 13px; margin: 6px 0; }

/* modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.modal .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--card-3); color: var(--text); padding: 10px 16px; border-radius: 999px; border: 1px solid var(--stroke-2); font-size: 14px; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.toast.err { border-color: var(--err); color: var(--err); } .toast.ok { border-color: var(--ok); color: var(--ok); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--stroke-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
code.pill { background: var(--card-3); padding: 2px 6px; border-radius: 6px; font-family: var(--mono); font-size: 12px; }
.config-content { white-space: pre-wrap; word-break: break-all; font-family: var(--mono); font-size: 12px; background: var(--bg-2); padding: 10px; border-radius: var(--radius-s); max-height: 140px; overflow: auto; }
