:root {
  --bg: #0b1120;
  --bg-soft: #111c33;
  --card: #16223c;
  --card-2: #1c2a49;
  --line: #2b3a5e;
  --text: #e8eefc;
  --muted: #93a4c4;
  --green: #34d399;
  --green-dark: #065f46;
  --amber: #fbbf24;
  --red: #fb7185;
  --blue: #60a5fa;
  --radius: 16px;
  --shadow: 0 12px 30px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: radial-gradient(circle at 15% -10%, #1e3a5f 0, transparent 42%),
              radial-gradient(circle at 95% 0%, #123b36 0, transparent 38%),
              var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

.app {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 22px 18px calc(90px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand-icon { width: 46px; height: 46px; border-radius: 13px; }
.brand h1 { font-size: 21px; margin: 0; letter-spacing: -.02em; }
.brand h1 span { color: var(--green); font-weight: 600; }
.subtitle { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

.top-actions, .row-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: .15s ease;
}
.btn:hover { border-color: var(--blue); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: linear-gradient(135deg, #22c55e, #0ea5a4); color: #04231c; border-color: transparent; }
.btn.danger { border-color: var(--red); color: var(--red); }

.banner {
  border: 1px solid var(--amber);
  background: rgba(251, 191, 36, .12);
  color: #ffe6a7;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-weight: 600;
}
.banner.critical { border-color: var(--red); background: rgba(251, 113, 133, .12); color: #ffd0d8; }
.hidden { display: none !important; }

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 16px;
  scrollbar-width: thin;
}
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 9px 15px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.tab.active { background: var(--card-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }

.panel { display: none; }
.panel.active { display: block; }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent), var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card h2 { font-size: 15.5px; margin: 0 0 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.muted { color: var(--muted); font-size: 12.5px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: linear-gradient(180deg, rgba(255,255,255,.035), transparent), var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; }
.stat .value { font-size: 19px; font-weight: 800; margin-top: 5px; word-break: break-word; }
.stat .value.ok { color: var(--green); }
.stat .value.warn { color: var(--amber); }
.stat .value.bad { color: var(--red); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 780px) { .grid-2 { grid-template-columns: 1fr; } }

.summary { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12.5px;
  font-weight: 700;
}
.pill.green { color: var(--green); }
.pill.amber { color: var(--amber); }
.pill.red { color: var(--red); }
.pill.blue { color: var(--blue); }

.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; }
.checklist .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--muted); }
.checklist li.ok .dot { background: var(--green); }
.checklist li.warn .dot { background: var(--amber); }
.checklist li.bad .dot { background: var(--red); }

.table-wrap { overflow: auto; border-radius: 12px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
th, td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--card-2); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(255,255,255,.02); }
td a { color: var(--blue); text-decoration: none; }
td a:hover { text-decoration: underline; }
.clip { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; background: var(--card-2); border: 1px solid var(--line); }
.badge.feed { color: var(--blue); }
.badge.reel { color: #c084fc; }
.badge.story { color: var(--amber); }
.badge.posted { color: var(--green); }
.badge.failed { color: var(--red); }
.badge.ready { color: var(--green); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
input, select, textarea {
  background: #0e1729;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 11px;
  font: inherit;
  font-size: 13px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(96,165,250,.35); border-color: var(--blue); }
textarea { resize: vertical; min-height: 96px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin: 14px 0; }
@media (max-width: 680px) { .form-grid { grid-template-columns: 1fr; } }
label { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 700; }

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 12px;
}
.asset {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
  position: relative;
}
.asset img { width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block; background: #0e1729; }
.asset .meta { padding: 9px; font-size: 11.5px; display: grid; gap: 5px; }
.asset .meta a { color: var(--blue); text-decoration: none; font-weight: 700; }

footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(11,17,32,.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11.5px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 70px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 15px;
  border-radius: 11px;
  box-shadow: var(--shadow);
  z-index: 50;
  font-size: 13px;
  max-width: 320px;
}
.error { color: var(--red); }
