
:root {
  --bg: #0d1320;
  --bg-soft: #11192a;
  --panel: rgba(16, 24, 40, 0.92);
  --panel-2: rgba(13, 19, 32, 0.85);
  --line: rgba(148, 163, 184, 0.18);
  --text: #e5edf8;
  --muted: #9ca9bc;
  --brand: #38bdf8;
  --brand-2: #0ea5e9;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
  --radius: 20px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.10), transparent 26%),
    linear-gradient(180deg, #0b1020 0%, #08111f 100%);
}

a { color: inherit; }
button, input, select, textarea {
  font: inherit;
}
button {
  cursor: pointer;
}

.shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.brand-lockup {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.logo-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(241, 245, 249, 0.98), rgba(226, 232, 240, 0.94));
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.35);
  width: fit-content;
  max-width: min(100%, 520px);
}

.brand-logo {
  display: block;
  width: min(100%, 420px);
  height: auto;
}

.subtext {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 760px;
}

.topbar-meta {
  display: grid;
  gap: 12px;
  min-width: 240px;
}

.status-pill {
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  font-size: 0.92rem;
  color: var(--muted);
}

.app-root {
  display: grid;
  gap: 20px;
}

.card {
  background: linear-gradient(180deg, rgba(17, 25, 42, 0.95), rgba(10, 15, 27, 0.95));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.loading-card { max-width: 520px; }
.loading-card h2,
.section-title {
  margin: 0 0 10px;
}

.section-subtitle,
.inline-help,
.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.metric {
  padding: 18px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.12);
}
.metric-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.92rem;
}
.metric-value {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
}
.metric-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.page-head h2 {
  margin: 0;
  font-size: 1.45rem;
}

.badge-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.72);
  color: var(--muted);
  font-size: 0.9rem;
}
.badge.success { color: #dcfce7; border-color: rgba(34,197,94,.35); background: rgba(20, 83, 45, .35); }
.badge.warning { color: #fef3c7; border-color: rgba(245,158,11,.35); background: rgba(120, 53, 15, .35); }
.badge.info { color: #e0f2fe; border-color: rgba(56,189,248,.35); background: rgba(14, 116, 144, .28); }

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button,
.button-link {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
  color: white;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .15s ease, opacity .15s ease;
}
button:hover,
.button-link:hover {
  transform: translateY(-1px);
}
button.secondary {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--line);
  color: var(--text);
}
button.danger {
  background: linear-gradient(180deg, #ef4444, #dc2626);
}
button.ghost {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--text);
}
button:disabled {
  opacity: 0.65;
  transform: none;
  cursor: wait;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(2, 6, 23, 0.55);
  color: var(--text);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

textarea { min-height: 110px; resize: vertical; }

.table-wrap {
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.12);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
  background: rgba(8, 15, 27, 0.55);
}

thead {
  background: rgba(15, 23, 42, 0.92);
}

th, td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

tbody tr:hover {
  background: rgba(30, 41, 59, 0.35);
}

.flash {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.72);
}
.flash.success {
  border-color: rgba(34,197,94,.35);
  background: rgba(20, 83, 45, .28);
}
.flash.error {
  border-color: rgba(239,68,68,.35);
  background: rgba(127, 29, 29, .28);
}
.flash.warning {
  border-color: rgba(245,158,11,.35);
  background: rgba(120, 53, 15, .28);
}

.split {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.split > * { flex: 1 1 280px; }
.stack-mobile { flex-wrap: wrap; }

.hr {
  height: 1px;
  background: rgba(148, 163, 184, 0.12);
  margin: 4px 0;
}

.small {
  font-size: 0.88rem;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.kv {
  display: grid;
  gap: 10px;
}
.kv div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.14);
  padding-bottom: 10px;
}
.kv span:last-child { text-align: right; }

.table-action-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-action {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.88rem;
}

@media (max-width: 980px) {
  .shell { padding: 16px; }
  .topbar { flex-direction: column; }
  .topbar-meta { width: 100%; min-width: 0; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .logo-box { padding: 12px 14px; }
  .brand-logo { width: min(100%, 340px); }
}
