:root {
  --bg: #12141a;
  --card: #1b1f29;
  --border: #2c3344;
  --text: #e8ecf4;
  --muted: #8b93a7;
  --accent: #5b8cff;
  --ok: #3ecf8e;
  --err: #ff6b6b;
  --warn: #f0b429;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font: 14px/1.45 system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, #1e2740, var(--bg));
  padding: 24px;
}

h1, h2, h3 { margin: 0 0 8px; font-weight: 650; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3.sub { margin-top: 16px; font-size: 13px; color: var(--muted); font-weight: 600; }

.muted { color: var(--muted); font-size: 12px; }
.err-text { color: var(--err); font-size: 12px; min-height: 1.2em; white-space: pre-wrap; }
.hidden { display: none !important; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
  max-width: 1100px;
}

.login-card { max-width: 380px; margin: 12vh auto; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  max-width: 1100px;
  margin-bottom: 14px;
}

.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }

label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
}

input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #12161f;
  color: var(--text);
  margin-bottom: 10px;
  font: inherit;
}

button {
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:disabled { opacity: 0.5; cursor: wait; }
.primary { background: var(--accent); color: #fff; }
.ghost { background: #2a3142; color: var(--text); }
.danger { background: #4a2430; color: #ffb4b4; }

.status-line { font-size: 14px; margin: 8px 0; }

.bar-wrap {
  height: 12px;
  background: #10141d;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 8px 0;
}

.bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3d6df0, #5b8cff);
  transition: width 0.35s ease;
}

.sessions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.slot {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #151a24;
}

.slot .id { font-weight: 700; }
.slot .proxy { font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace; }

.badge {
  display: inline-block;
  margin-top: 6px;
  margin-right: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}
.badge.ok { background: #1d3b2e; color: var(--ok); }
.badge.err { background: #3b1f24; color: var(--err); }
.badge.warn { background: #3a3018; color: var(--warn); }
.badge.muted { background: #2a2f3a; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
th, td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; }

.webhook-form {
  display: grid;
  grid-template-columns: 1fr 160px auto;
  gap: 8px;
  margin-bottom: 12px;
}
.webhook-form input { margin: 0; }

.hooks { display: flex; flex-direction: column; gap: 8px; }
.hook {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #151a24;
}
.hook .url { font-family: ui-monospace, monospace; font-size: 12px; word-break: break-all; }
.hook .actions { display: flex; gap: 6px; flex-shrink: 0; }

@media (max-width: 700px) {
  .webhook-form { grid-template-columns: 1fr; }
  .row.between { flex-direction: column; align-items: stretch; gap: 10px; }
}
