:root {
  color-scheme: dark;
  --bg: #121410;
  --raise: #1b1f17;
  --sunken: #0d0f0b;
  --line: #31382b;
  --text: #f4f6ef;
  --muted: #a3aa96;
  --faint: #737a68;
  --lime: #d6ff4a;
  --ink: #172000;
  --danger: #ff6b57;
  --ok: #8dffb0;
  --warn: #ffc857;
  --info: #9fd0ff;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --sans: "Segoe UI", "Helvetica Neue", sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(214, 255, 74, 0.08), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
}
button, input, select, textarea { font: inherit; color: inherit; }
button, .button {
  border: 0; border-radius: 999px; padding: 10px 16px; min-height: 40px;
  background: var(--lime); color: var(--ink); font-weight: 700; cursor: pointer;
}
button.ghost, .button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--danger); border: 1px solid rgba(255, 107, 87, 0.45); }
button:disabled { opacity: 0.55; cursor: wait; }
input, select, textarea {
  width: 100%; background: var(--sunken); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #8eae45; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 0.86rem; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.card, .panel { background: rgba(27, 31, 23, 0.92); border: 1px solid var(--line); border-radius: 16px; box-shadow: none; }
.login { width: min(440px, 100%); padding: 28px; }
.brand { display: flex; gap: 8px; align-items: baseline; letter-spacing: -0.04em; }
.brand .mark { font-size: 1.8rem; font-weight: 760; }
.brand .product { color: var(--lime); font-weight: 680; }
h1 { font-size: 1.55rem; letter-spacing: -0.04em; margin: 0 0 6px; }
.composer h2, .panel h2 { margin: 0; font-size: 1.05rem; letter-spacing: -0.03em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.error { color: var(--danger); min-height: 1.2em; }
form { display: grid; gap: 16px; margin: 0; }
.grid-2, .grid-3 { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-2:has(> :nth-child(3):last-child) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 9rem; }
.grid-3 { grid-template-columns: 1.4fr 1fr 1fr auto; align-items: end; }
.row, .spread { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; align-items: start; }
.side {
  padding: 28px 18px 20px; border-right: 1px solid var(--line);
  background: rgba(13, 15, 11, 0.88); display: flex; flex-direction: column; gap: 22px;
}
.side > .brand { padding: 0 10px; }
.side-foot { margin-top: auto; display: grid; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.side-foot .muted { line-height: 1.45; padding: 0 10px; }
.side { position: sticky; top: 0; height: 100vh; overflow: auto; }
.nav { display: grid; gap: 4px; }
.nav a { text-decoration: none; color: var(--muted); padding: 10px 12px; border-radius: 12px; }
.nav a.active, .nav a:hover { background: #262c20; color: var(--text); }
.nav a.active { color: var(--lime); box-shadow: inset 3px 0 0 var(--lime); }
.main { padding: 32px 36px 48px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin: 0; }
.page-head p { margin: 0; line-height: 1.45; }
.main > h2 { margin: 4px 0 0; font-size: 0.92rem; letter-spacing: 0.02em; color: var(--muted); }
.list { display: grid; gap: 12px; }
.item, .stat, .panel, .composer { padding: 20px 22px; }
.item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: 16px 24px; text-decoration: none; color: inherit;
}
.item:has(.item-tools) { grid-template-columns: 1fr; align-items: stretch; }
.item-body { display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.item-tools {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 14px 20px; padding-top: 16px; border-top: 1px solid var(--line);
}
.tool-fields { display: flex; flex-wrap: wrap; gap: 12px 16px; }
.tool { min-width: 9.5rem; }
.tool input, .tool select { width: 100%; min-width: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions.end { justify-content: flex-end; }
.item > .row { justify-content: flex-end; }
.title { font-weight: 700; }
.meta { color: var(--muted); font-size: 0.86rem; margin-top: 3px; }
.badge {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px;
  font-size: 0.75rem; border: 1px solid var(--line); color: var(--muted);
}
.badge.ok { color: var(--ok); border-color: rgba(141, 255, 176, 0.35); }
.badge.warn { color: var(--warn); border-color: rgba(255, 200, 87, 0.4); }
.badge.bad { color: var(--danger); border-color: rgba(255, 107, 87, 0.4); }
.badge.lime { color: var(--ink); background: var(--lime); border-color: transparent; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0; }
.panel { display: grid; gap: 16px; align-content: start; }
.panel .confirm-box { margin: 0; }
.stat b { display: block; font-size: 1.7rem; letter-spacing: -0.04em; }
.tabs {
  display: flex; gap: 4px; margin: 0; flex-wrap: wrap; width: fit-content; max-width: 100%;
  padding: 4px; background: var(--sunken); border: 1px solid var(--line); border-radius: 14px;
}
.tabs a {
  text-decoration: none; color: var(--muted); padding: 8px 14px; border-radius: 10px; font-weight: 700;
  min-height: 36px; display: inline-flex; align-items: center;
}
.tabs a.active, .tabs a:hover { background: #262c20; color: var(--text); }
.tabs a.active { color: var(--lime); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { color: var(--faint); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.term-frame {
  display: flex; flex-direction: column; height: calc(100vh - 220px); min-height: 420px;
  background: #070806; border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
}
.term-bar {
  display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px;
  color: var(--muted); font-size: 0.82rem; border-bottom: 1px solid var(--line); background: #141910;
}
.terminal {
  flex: 1; min-height: 0; height: auto; background: #070806; padding: 14px 16px; overflow: hidden;
  font-family: var(--mono); font-size: 14px; line-height: 1.35; white-space: pre;
}
.terminal:focus { outline: 2px solid rgba(214, 255, 74, 0.45); outline-offset: 2px; }
.term-row { height: 1.35em; white-space: pre; }
.term-probe { position: absolute; visibility: hidden; font: inherit; white-space: pre; }
.toast {
  position: fixed; right: 18px; bottom: 18px; background: var(--lime); color: var(--ink);
  padding: 12px 14px; border-radius: 14px; font-weight: 700; box-shadow: var(--shadow);
  max-width: min(420px, calc(100% - 36px));
}
.toast.bad { background: #3a1814; color: #ffd2cb; }
.log {
  white-space: pre-wrap; font-family: var(--mono); font-size: 12px; background: var(--sunken);
  border-radius: 12px; padding: 12px; max-height: 240px; overflow: auto;
}
.check { display: flex; gap: 8px; align-items: center; color: var(--text); }
.check input { width: auto; }
.mode-menu {
  display: flex; flex-wrap: wrap; gap: 4px; width: fit-content; max-width: 100%;
  padding: 4px; background: var(--sunken); border: 1px solid var(--line); border-radius: 14px;
}
.mode-menu button { background: transparent; color: var(--muted); border: 0; border-radius: 10px; min-height: 36px; }
.mode-menu button.active { background: var(--raise); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
form.composer > button[type="submit"], form.panel > button[type="submit"] { width: auto; justify-self: start; }
.panel p, .composer p { margin: 0; line-height: 1.5; }
.spread { gap: 20px; }
.row select { width: auto; min-width: 11rem; }
.composer a { color: var(--lime); }
.row input[type="number"] { width: 96px; }
.confirm-box {
  margin-top: 14px; padding: 12px; border-radius: 14px;
  background: rgba(255, 107, 87, 0.08); border: 1px solid rgba(255, 107, 87, 0.35);
}
.confirm-box p { margin: 0 0 10px; }
table {
  background: rgba(27, 31, 23, 0.92); border: 1px solid var(--line); border-radius: 16px;
  border-collapse: separate; border-spacing: 0; overflow: hidden;
}
.panel table { background: transparent; border: 0; border-radius: 0; }
.pending { border-color: rgba(214, 255, 74, 0.45); }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav, .stats, .grid-2, .grid-3 { grid-template-columns: 1fr 1fr; }
  .main { padding: 18px; }
}
