:root {
  --bg: #10120f;
  --sidebar: #171a14;
  --panel: #1d2118;
  --panel-2: #24291f;
  --ink: #f4f0df;
  --muted: #aeb3a0;
  --line: #384031;
  --accent: #78dc96;
  --accent-2: #e8b45f;
  --danger: #e77272;
  --ok: #8ee8a8;
  --shadow: #00000038;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #30402a 0, transparent 320px),
    radial-gradient(circle at 80% 10%, #4a2f21 0, transparent 280px),
    var(--bg);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 1px solid #50613f;
  background: #dfe9cf;
  color: #12170f;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

button:hover { background: #f0f7df; }

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover { color: #d7f7a8; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--sidebar) 94%, #000);
  padding: 22px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand span:last-child {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 5px #78dc9617;
}

nav {
  display: grid;
  align-content: start;
  gap: 6px;
}

nav a {
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 6px;
}

nav a:hover {
  background: #26301f;
  color: var(--ink);
}

.key-form {
  display: grid;
  gap: 10px;
}

main {
  padding: 28px;
  display: grid;
  gap: 22px;
  max-width: 1620px;
  width: 100%;
}

.topline {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  min-width: 0;
}

.eyeless {
  color: var(--muted);
  margin: 0 0 8px;
  font-size: 13px;
}

h1, h2, h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(38px, 5vw, 68px);
  line-height: 1;
}

h2 { font-size: 22px; }

h3 {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.status-pill {
  min-width: 260px;
  border: 1px solid var(--line);
  background: #1c2118cc;
  border-radius: 8px;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
}

.status-pill span {
  color: var(--ok);
  font-size: 13px;
}

.status-pill strong {
  overflow-wrap: anywhere;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
}

input,
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #12160f;
  color: var(--ink);
  padding: 10px 12px;
  min-width: 0;
  width: 100%;
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric,
.workspace {
  background: color-mix(in srgb, var(--panel) 94%, #000);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 60px var(--shadow);
}

.metric {
  padding: 18px;
  min-height: 104px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metric strong {
  display: block;
  font-size: clamp(26px, 3vw, 38px);
  overflow-wrap: anywhere;
  line-height: 1;
}

.workspace {
  padding: 20px;
  display: grid;
  gap: 16px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.head-actions,
.quick-links,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-links a,
.filters button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 6px;
  padding: 9px 12px;
  min-height: 38px;
}

.filters button.active,
.filters button:hover,
.quick-links a:hover {
  color: var(--ink);
  border-color: #5e704d;
  background: #303926;
}

.role-grid,
.editor-grid,
.stats-grid,
.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.editor-grid.three,
.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.role-grid article,
.row,
.action-row,
.stat-row {
  border: 1px solid var(--line);
  background: #151a12;
  border-radius: 6px;
}

.role-grid article {
  padding: 14px;
}

.role-grid p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.toggles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.toggles label,
.action-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  color: var(--ink);
  padding: 12px;
}

.toggles input,
.action-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.actions-list {
  display: grid;
  gap: 10px;
}

.action-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.action-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.action-title strong {
  overflow-wrap: anywhere;
}

.tag {
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
}

.tag.hot {
  border-color: #8b6631;
  color: #f3c67a;
}

.tag.safe {
  border-color: #527a58;
  color: #9df0a9;
}

.action-main p,
.action-main code,
.row small,
.stat-row small {
  color: var(--muted);
}

.action-main p {
  margin: 0;
  line-height: 1.45;
}

.action-main code {
  overflow-wrap: anywhere;
}

.compose {
  display: grid;
  gap: 14px;
}

.compose button {
  justify-self: start;
}

.output {
  overflow: auto;
  max-height: 320px;
  background: #090b08;
  color: #d9f4d5;
  padding: 14px;
  border-radius: 6px;
  min-height: 48px;
  border: 1px solid #2b3325;
  white-space: pre-wrap;
}

.list,
.stat-list {
  display: grid;
  gap: 10px;
}

.row,
.stat-row {
  padding: 12px;
  display: grid;
  gap: 5px;
}

.stat-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.stat-row strong,
.row strong {
  overflow-wrap: anywhere;
}

.stat-row span {
  color: var(--accent-2);
  font-weight: 800;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    grid-template-rows: auto auto auto;
  }

  nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metrics,
  .toggles,
  .editor-grid.three,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  main,
  .sidebar {
    padding: 18px;
  }

  nav,
  .topline,
  .metrics,
  .role-grid,
  .editor-grid,
  .editor-grid.three,
  .stats-grid,
  .split,
  .toggles {
    grid-template-columns: 1fr;
  }

  .topline,
  .section-head {
    display: grid;
  }

  .status-pill {
    min-width: 0;
  }
}
