:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --paper: #f8fafc;
  --card: #ffffff;
  --brand: #0f766e;
  --brand-dark: #0d9488;
  --accent: #2563eb;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --sidebar: #111827;
  --wa: #128c7e;
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Instrument Serif", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.page--login {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(15, 118, 110, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(37, 99, 235, 0.12), transparent 50%),
    var(--paper);
}

.shell--split {
  display: grid;
  grid-template-columns: minmax(280px, 42%) 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

.brand-pane {
  background: var(--sidebar);
  color: #fff;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.brand-pane::after {
  content: "";
  position: absolute;
  inset: auto -20% -30% auto;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(18, 140, 126, 0.45), transparent 70%);
  pointer-events: none;
}

.brand-mark {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  margin-bottom: 2.5rem;
}

.brand-mark img {
  border-radius: 12px;
  background: #fff;
}

.brand-mark__name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark__sub {
  margin: 0;
  color: #94a3b8;
  font-size: 0.85rem;
}

.brand-pane__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2rem, 3vw, 2.75rem);
  line-height: 1.1;
  margin: 0 0 1rem;
}

.brand-pane__copy,
.brand-pane__note {
  color: #cbd5e1;
  line-height: 1.55;
  max-width: 28rem;
}

.brand-pane__note {
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: #94a3b8;
}

.brand-pane__foot {
  margin: 0;
  color: #64748b;
  font-size: 0.85rem;
}

.form-pane {
  display: grid;
  place-items: center;
  padding: 2rem;
}

.form-card {
  width: min(100%, 420px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.75rem;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.06);
}

.form-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.muted { color: var(--muted); }
.fineprint { font-size: 0.8rem; color: var(--muted); }

.stack { display: grid; gap: 1rem; margin-top: 1.25rem; }

.field {
  display: grid;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.field input,
.field textarea {
  font: inherit;
  font-weight: 400;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  background: #fff;
  color: var(--ink);
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.btn {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.btn--primary {
  background: var(--brand);
  color: #fff;
}

.btn--primary:hover { background: var(--brand-dark); }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line);
}

.btn--danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1.5px solid #fecaca;
}

.btn--sm { padding: 0.45rem 0.75rem; font-size: 0.85rem; }

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.alert {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  font-size: 0.9rem;
}

.alert--error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}

.page--denied {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(160deg, #0f172a 0%, #134e4a 55%, #0f766e 100%);
  padding: 1.5rem;
}

.denied__card {
  width: min(100%, 460px);
  background: #fff;
  border-radius: 18px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
}

.denied__logo { margin-bottom: 0.75rem; }
.denied__kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}
.denied__card h1 {
  margin: 0 0 0.75rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: 2.2rem;
}
.denied__meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 1rem 0 1.5rem;
}
.denied__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.topbar__brand img { border-radius: 8px; }

.topbar__brand strong { display: block; font-size: 0.95rem; }
.topbar__brand span { color: var(--muted); font-size: 0.8rem; }

.topbar__user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.console {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
}

.panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.panel__head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.pill {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
}

.pill--connected { background: #d1fae5; color: #065f46; }
.pill--qr { background: #fef3c7; color: #92400e; }
.pill--disconnected,
.pill--logged_out { background: #fee2e2; color: #991b1b; }
.pill--connecting { background: #e0e7ff; color: #3730a3; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.meta-grid dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.meta-grid dd {
  margin: 0.2rem 0 0;
  font-weight: 650;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.qr-wrap {
  display: grid;
  place-items: center;
  min-height: 220px;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.06), transparent),
    #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 1rem;
}

.qr-wrap img {
  width: min(280px, 100%);
  height: auto;
  border-radius: 8px;
  background: #fff;
}

@media (max-width: 860px) {
  .shell--split { grid-template-columns: 1fr; }
  .brand-pane { min-height: auto; padding: 1.75rem; }
  .meta-grid { grid-template-columns: 1fr; }
}
