:root {
  --bg: #07161d;
  --panel: #0c232d;
  --panel-alt: #102a35;
  --border: rgba(185, 223, 230, 0.14);
  --text: #eff7f8;
  --muted: #a6c1c7;
  --accent: #46c59f;
  --blue: #5da8ff;
  --warning: #f3c661;
  --danger: #ff6d6d;
  --ok: #38d27a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(70, 197, 159, 0.16), transparent 22rem),
    linear-gradient(180deg, #0a1e28 0%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, input, textarea, select {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.shell-header, .shell-main {
  width: min(1400px, calc(100vw - 2rem));
  margin: 0 auto;
}
.shell-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0 0.75rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.shell-main {
  display: grid;
  gap: 1rem;
  padding-bottom: 2rem;
}
.shell-copy, .section-copy, .group-copy, .muted, .muted-inline {
  color: var(--muted);
}
.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 700;
}
.shell-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.shell-nav a {
  padding: 0.7rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(12, 35, 45, 0.75);
  color: var(--text);
}
.shell-nav a.is-active {
  background: rgba(93, 168, 255, 0.16);
  border-color: rgba(93, 168, 255, 0.35);
}
.panel {
  background: rgba(12, 35, 45, 0.88);
  border: 1px solid var(--border);
  border-radius: 1.1rem;
  padding: 1.1rem 1.2rem;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.stats-grid, .form-grid, .job-grid, .kv-grid {
  display: grid;
  gap: 0.9rem;
}
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.form-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.job-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.kv-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stat-card, .group-card, .job-card {
  background: rgba(6, 22, 29, 0.66);
  border: 1px solid rgba(185, 223, 230, 0.1);
  border-radius: 0.95rem;
  padding: 0.95rem;
}
.label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.field, .stack-md, .stack-lg, .flash-stack { display: grid; gap: 0.65rem; }
.stack-lg { gap: 1rem; }
label { font-weight: 700; display: block; margin-bottom: 0.25rem; }
input, select, textarea {
  width: 100%;
  border-radius: 0.8rem;
  border: 1px solid rgba(185, 223, 230, 0.2);
  background: var(--panel-alt);
  color: var(--text);
  padding: 0.8rem 0.9rem;
}
textarea { min-height: 8rem; }
.secret-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: start;
}
button, .button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 0.85rem;
  background: #1c7af2;
  color: white;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
button.secondary { background: #506779; }
button.danger { background: var(--danger); }
.ghost-button, .button-link.secondary-link {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.button-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.flash {
  border-radius: 0.9rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
}
.flash-success { background: rgba(56, 210, 122, 0.12); }
.flash-error { background: rgba(255, 109, 109, 0.12); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 0.8rem 0.7rem;
  border-top: 1px solid rgba(185, 223, 230, 0.08);
  vertical-align: top;
}
thead th {
  border-top: 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}
.status-ready, .status-succeeded { background: rgba(56, 210, 122, 0.12); color: #bdf7cf; border-color: rgba(56, 210, 122, 0.3); }
.status-deploying, .status-running, .status-pending, .status-queued { background: rgba(243, 198, 97, 0.14); color: #fde29c; border-color: rgba(243, 198, 97, 0.3); }
.status-shared, .status-selfsigned { background: rgba(93, 168, 255, 0.14); color: #bfdbff; border-color: rgba(93, 168, 255, 0.3); }
.status-stopped, .status-disabled { background: rgba(128, 145, 152, 0.14); color: #d8e0e3; border-color: rgba(128, 145, 152, 0.3); }
.status-failed, .status-invalid, .status-missing { background: rgba(255, 109, 109, 0.12); color: #ffc8c8; border-color: rgba(255, 109, 109, 0.3); }
.issue-list { margin: 0; padding-left: 1.2rem; }
.job-head { display: flex; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.log-detail {
  margin-top: 0.6rem;
  border: 1px solid rgba(185, 223, 230, 0.12);
  border-radius: 0.8rem;
  overflow: hidden;
}
.log-detail summary {
  cursor: pointer;
  padding: 0.75rem 0.9rem;
  font-weight: 700;
}
pre {
  margin: 0;
  padding: 0.9rem;
  background: rgba(4, 14, 19, 0.92);
  max-height: 22rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.tab-strip {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.tab-button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.tab-button.is-active {
  background: rgba(93, 168, 255, 0.16);
  border-color: rgba(93, 168, 255, 0.35);
}
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }
.inline-search {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.inline-search input { min-width: min(28rem, 100%); }
.checkbox-list { display: grid; gap: 0.6rem; }
.checkbox-row {
  display: flex;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  border-radius: 0.8rem;
  background: rgba(6, 22, 29, 0.66);
  border: 1px solid rgba(185, 223, 230, 0.1);
}
.checkbox-row input { width: auto; }
.small { padding: 0.45rem 0.7rem; }
.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
}
.login-card {
  width: min(32rem, calc(100vw - 2rem));
  background: rgba(12, 35, 45, 0.92);
  border: 1px solid var(--border);
  border-radius: 1.1rem;
  padding: 1.5rem;
}
@media (max-width: 900px) {
  .shell-header { align-items: stretch; }
  .secret-row { grid-template-columns: 1fr; }
}
