:root {
  --bg: #0e1116;
  --bg-elev: #161b22;
  --bg-soft: #1c2330;
  --line: #2a3344;
  --text: #e8eef7;
  --muted: #8b9bb3;
  --accent: #2f6fed;
  --accent-2: #3d7cff;
  --ok: #1f9d6a;
  --warn: #c4922a;
  --bad: #d4534f;
  --run: #3d8fd1;
  --radius: 10px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Code", "Consolas", "SF Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(47, 111, 237, 0.18), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(28, 35, 48, 0.9), transparent 50%),
    var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.wrap { word-break: break-all; }
.err { color: #ffb4b0; }

.shell { max-width: 1180px; margin: 0 auto; padding: 20px 20px 48px; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: 16px; letter-spacing: 0.02em; }
.brand .muted { font-size: 12px; }
.mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(145deg, var(--accent), #1a3f9a);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 8px 20px rgba(47,111,237,0.25);
}
.back { color: var(--muted); margin-right: 8px; }

.filters {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 0.7fr auto;
  gap: 10px;
  margin-bottom: 16px;
}
input, select, button, textarea {
  font: inherit; color: var(--text);
}
input, select {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
input[type="file"] {
  padding: 8px;
}
input:focus, select:focus {
  outline: 2px solid rgba(47,111,237,0.45);
  border-color: var(--accent);
}

.btn {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}
.btn:hover { border-color: #3d4b63; background: #222a38; }
.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn.compact { padding: 6px 10px; font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.panel {
  background: rgba(22, 27, 34, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(8px);
}
.panel-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.panel-head h1 { margin: 0; font-size: 15px; font-weight: 650; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
tr:hover td { background: rgba(255,255,255,0.02); }
.empty { color: var(--muted); padding: 28px 14px !important; }
.empty code { color: #c9d7ef; }

.pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 650; letter-spacing: 0.02em;
  background: #243041; color: #c5d3e8;
}
.pill.ready, .pill.ok { background: rgba(31,157,106,0.18); color: #7ddeb8; }
.pill.failed, .pill.callback_failed { background: rgba(212,83,79,0.18); color: #ffb0ac; }
.pill.running, .pill.processing { background: rgba(61,143,209,0.18); color: #9fd0ff; }
.pill.queued, .pill.pending { background: rgba(196,146,42,0.16); color: #efd08a; }

.meta.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.meta.grid > div {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }

.alert {
  background: rgba(212,83,79,0.12);
  border: 1px solid rgba(212,83,79,0.35);
  color: #ffc6c2;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  padding: 14px;
}
.card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.thumb {
  aspect-ratio: 1 / 1;
  background: #0b0e13;
  display: grid;
  place-items: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-empty { color: var(--muted); font-family: var(--mono); }
.card-body { padding: 12px; display: grid; gap: 8px; }
.card-body .row { display: flex; justify-content: space-between; align-items: center; }
details summary { cursor: pointer; color: var(--muted); font-size: 12px; }

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(400px, 100%);
  background: rgba(22,27,34,0.95);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  display: grid;
  gap: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}
.auth-card label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.brand.block { margin-bottom: 4px; }

.alert.ok {
  background: rgba(31,157,106,0.12);
  border: 1px solid rgba(31,157,106,0.35);
  color: #9ee0c0;
}
.nav-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.nav-actions form { margin: 0; }
.install-card { width: min(520px, 100%); }
.check-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 8px;
}
.check-list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 10px; border-radius: 8px;
  background: var(--bg-elev); border: 1px solid var(--line);
}
.check-list li.ok { border-color: rgba(31,157,106,0.35); }
.check-list li.bad { border-color: rgba(212,83,79,0.45); color: #ffb4b0; }
.stack-form, .form-grid {
  display: grid; gap: 12px; padding: 14px 16px 18px;
}
.stack-form label, .form-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.check-inline {
  display: flex !important; flex-direction: row !important; align-items: center; gap: 8px !important;
  color: var(--text) !important; font-size: 13px !important;
}
.check-inline input { width: auto; }
.stack-form .actions { margin-top: 4px; }

@media (max-width: 800px) {
  .filters { grid-template-columns: 1fr; }
  .meta.grid { grid-template-columns: 1fr 1fr; }
  .top { flex-direction: column; align-items: flex-start; }
}
