:root {
  --bg: #0b1020;
  --bg-raise: #131a35;
  --bg-raise-2: #1a2244;
  --line: #2a3360;
  --text: #e6ebff;
  --muted: #93a0c8;
  --accent: #5b8cff;
  --accent-2: #4172e9;
  --ok: #29c46f;
  --warn: #ffb020;
  --danger: #ff5577;
  --premium: #c97bff;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  --font: "Be Vietnam Pro", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 16px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body {
  min-height: 100vh;
}

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

button { cursor: pointer; }

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 480px at -10% -10%, rgba(91, 140, 255, 0.18), transparent 60%),
    radial-gradient(700px 420px at 110% 0%, rgba(201, 123, 255, 0.08), transparent 55%),
    linear-gradient(180deg, #0d1430 0%, #0b1020 40%, #090e1c 100%);
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(42, 51, 96, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 51, 96, 0.35) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 78%);
}

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px;
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  align-items: center;
}

.login__hero h1 {
  margin: 12px 0 8px;
  font-size: clamp(40px, 5vw, 64px);
  letter-spacing: -0.05em;
  line-height: 0.95;
}

.login__hero p { color: var(--muted); font-size: 17px; max-width: 460px; }

.mark {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(160deg, #79a2ff, #3e67d6);
  color: white;
  font-weight: 700;
  letter-spacing: -0.04em;
  box-shadow: 0 10px 30px rgba(65, 114, 233, 0.35);
}

.eyebrow {
  margin: 18px 0 0;
  color: #b9c7ff;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.feature-list {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.feature-list li {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
}

.feature-list li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(41, 196, 111, 0.12);
}

.card, .panel, dialog {
  background: rgba(19, 26, 53, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login__card { padding: 28px; }

.login__card h2 { margin: 0 0 6px; font-size: 24px; }

.sub { margin: 0 0 22px; color: var(--muted); }

label { display: grid; gap: 6px; margin-bottom: 14px; }

label span, .block h2, .panel__title {
  font-size: 13px;
  font-weight: 600;
  color: #c5d0f5;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #0e1430;
  border-radius: 12px;
  padding: 12px 12px;
  outline: none;
}

textarea {
  min-height: 220px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
}

input:focus, select:focus, textarea:focus {
  border-color: #6f97ff;
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.2);
}

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 14px;
  background: var(--bg-raise-2);
  color: var(--text);
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-2); }
.btn-danger { background: #8d3148; color: white; }
.btn-danger:hover:not(:disabled) { background: #a53a54; }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-wide { width: 100%; }

.form-error { min-height: 1.2em; color: #ffb3c2; margin: 8px 0 0; }

.app { min-height: 100vh; display: grid; grid-template-rows: auto auto 1fr auto; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(42, 51, 96, 0.8);
  background: rgba(11, 16, 32, 0.8);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand { display: flex; gap: 12px; align-items: center; }
.brand h1 { margin: 0; font-size: 18px; letter-spacing: -0.03em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

.top-actions, .row-actions, .tabs, .filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.who { color: var(--muted); font-size: 13px; }
.who strong { color: var(--text); font-weight: 600; }

.banner {
  margin: 12px 18px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 176, 32, 0.12);
  color: #ffd48a;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.workspace {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 18px 18px;
  min-height: 0;
}

.panel { padding: 14px; min-height: 0; }
.side { display: flex; flex-direction: column; gap: 14px; }
.block { display: grid; gap: 8px; }
.block h2 { margin: 0; }
.hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

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

.counts { color: var(--accent); font-variant-numeric: tabular-nums; font-size: 13px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid-3 label span { font-size: 11px; color: var(--muted); }
.grid-3 input { padding: 10px; }

.actions { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 8px; }

.stage { display: grid; grid-template-rows: auto auto minmax(280px, 1fr) 168px; gap: 12px; min-height: 0; }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.stat {
  background: rgba(19, 26, 53, 0.92);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
}
.stat span { display: block; color: var(--muted); font-size: 12px; }
.stat strong { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -0.04em; }
.stat.ok strong { color: var(--ok); }
.stat.premium strong { color: var(--premium); }
.stat.taken strong { color: var(--danger); }
.stat.err strong { color: var(--warn); }

.progress-card { padding: 12px 14px; }
.progress-label { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.track { height: 8px; border-radius: 99px; background: #0e1430; overflow: hidden; }
.track > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #3e67d6, #7dffa8); transition: width 0.25s ease; }

.results { display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding-bottom: 0; }
.log-card { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.tabs { padding: 10px 10px 0; }
.tab, .chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 12px;
}
.tab.active, .chip.active { background: #24315f; color: white; border-color: #3d4e8c; }
.toolbar { padding: 10px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.toolbar input { max-width: 260px; padding: 8px 10px; }
.table-wrap { flex: 1; overflow: auto; min-height: 0; }
.results > .toolbar { flex-shrink: 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid rgba(42, 51, 96, 0.65); white-space: nowrap; }
th { position: sticky; top: 0; background: #162044; color: var(--muted); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
td.domain, .mono { font-family: var(--mono); }
tr:hover td { background: rgba(91, 140, 255, 0.06); }
.domain-btn {
  border: 0;
  background: transparent;
  padding: 0;
  color: #dce5ff;
  font-family: var(--mono);
  text-align: left;
}
.linkish { border: 0; background: transparent; color: var(--accent); padding: 0 0 0 8px; }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pill.available { color: #b8ffd4; background: rgba(41, 196, 111, 0.16); }
.pill.premium { color: #f0d4ff; background: rgba(201, 123, 255, 0.16); }
.pill.taken { color: #ffd0da; background: rgba(255, 85, 119, 0.16); }
.pill.error { color: #ffe1a8; background: rgba(255, 176, 32, 0.16); }

.log {
  margin: 0;
  overflow: auto;
  background: #0a0f24;
  color: #c9d4f8;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  padding: 10px 12px;
  min-height: 0;
}
.log .warn { color: #ffd48a; }
.log .error { color: #ff9aaf; }

.statusbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  background: #0c1226;
}

.empty {
  margin: 0;
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
}

dialog { width: min(560px, calc(100% - 24px)); padding: 18px; color: var(--text); }
dialog::backdrop { background: rgba(4, 7, 16, 0.72); }
dialog h3 { margin: 0 0 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.user-list { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 8px; max-height: 280px; overflow: auto; }
.user-list li {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.role { color: var(--muted); font-size: 12px; }

.toast {
  position: fixed;
  right: 16px;
  bottom: 40px;
  background: #1c274d;
  border: 1px solid #46548d;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-width: 360px;
}

@media (max-width: 980px) {
  .login { grid-template-columns: 1fr; padding: 28px 0 40px; }
  .workspace, .stats, .grid-3 { grid-template-columns: 1fr; }
  .stage { grid-template-rows: auto auto 460px 180px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .toolbar, .topbar, .banner { align-items: stretch; flex-direction: column; }
  .toolbar input { max-width: none; }
}
