:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #e8edf3;
  color: #151922;
}

* {
  box-sizing: border-box;
}

body {
  background:
    linear-gradient(180deg, #142033 0, #142033 220px, #e8edf3 220px, #e8edf3 100%);
  margin: 0;
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

button {
  align-items: center;
  border: 0;
  border-radius: 8px;
  background: #175cd3;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

button:hover {
  background: #1248a3;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

button:active {
  transform: translateY(1px);
}

.secondary {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #1f2937;
}

.secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.danger {
  background: #b42318;
}

.danger:hover {
  background: #8f1d15;
}

.outline-danger {
  background: #ffffff;
  border: 1px solid #f1a7a0;
  color: #b42318;
}

.outline-danger:hover {
  background: #fef3f2;
}

.small-button {
  min-height: 36px;
  padding: 0 12px;
}

.login {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.shell {
  margin: 0 auto;
  max-width: 1280px;
  padding: 34px 20px 56px;
}

.topbar,
.section-head,
.command-header,
.command-footer {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.topbar {
  color: #ffffff;
  margin-bottom: 28px;
  min-height: 132px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

.subhead {
  color: #c8d3df;
  margin-top: 8px;
  max-width: 680px;
}

.topbar .eyebrow {
  color: #7dd3fc;
}

.topbar .secondary {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.topbar .secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.36);
}

.eyebrow {
  color: #175cd3;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted,
.hint {
  color: #667085;
}

.target-group {
  background: #eef4ff;
  border: 1px solid #c7d7fe;
  border-radius: 8px;
  color: #175cd3;
  font-weight: 800;
  padding: 10px 12px;
}

.notice {
  background: #f8fafc;
  border: 1px solid #d4dce8;
  border-radius: 8px;
  color: #475467;
  font-size: 14px;
  margin-top: 14px;
  padding: 10px 12px;
}

.error {
  color: #b42318;
}

.overview-grid,
.content-grid {
  display: grid;
  gap: 18px;
}

.overview-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  margin-bottom: 18px;
}

.content-grid {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.side-stack {
  display: grid;
  gap: 18px;
}

.panel {
  background: #ffffff;
  border: 1px solid #d4dce8;
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.09);
  padding: 22px;
}

.auth-panel {
  display: grid;
  gap: 16px;
  max-width: 420px;
  width: 100%;
}

.connection-panel {
  display: grid;
  gap: 18px;
}

.connection-body {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(260px, 360px) 1fr;
}

.qr-box {
  align-items: center;
  background: #eef4f8;
  border: 1px dashed #9aa8bd;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  min-height: 280px;
  padding: 18px;
}

.qr-box img {
  height: auto;
  max-width: 260px;
  width: 100%;
}

.qr-placeholder {
  color: #667085;
  font-weight: 700;
  text-align: center;
}

.action-stack {
  align-content: start;
  display: grid;
  gap: 12px;
}

.status-badge,
.mini-badge,
.event-type {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 7px 10px;
  text-transform: uppercase;
}

.status-badge {
  background: #eef4ff;
  color: #175cd3;
}

.status-badge[data-state="ready"] {
  background: #ecfdf3;
  color: #067647;
}

.status-badge[data-state="error"],
.status-badge[data-state="disconnected"],
.status-badge[data-state="auth_failure"],
.status-badge[data-state="group_not_found"] {
  background: #fef3f2;
  color: #b42318;
}

.status-badge[data-state="qr"] {
  background: #fff7ed;
  color: #c2410c;
}

.mini-badge {
  background: #eef4ff;
  color: #175cd3;
  margin-left: 8px;
}

.form,
label,
.command-form,
.command-fields {
  display: grid;
  gap: 8px;
}

.form,
.command-form {
  gap: 14px;
}

.compact-form {
  margin-top: 14px;
}

input,
textarea {
  background: #fbfdff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #151922;
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  resize: vertical;
}

.toggle-row {
  align-items: center;
  display: flex;
  gap: 10px;
}

.toggle-row input {
  min-height: auto;
  width: auto;
}

.commands,
.event-log,
.users-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.user-row {
  align-items: center;
  border-top: 1px solid #e5eaf0;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding-top: 12px;
}

.user-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.command {
  border-top: 1px solid #e5eaf0;
  padding-top: 16px;
}

.command:first-child {
  border-top: 0;
  padding-top: 0;
}

.command-fields {
  grid-template-columns: 180px minmax(0, 1fr) 220px;
}

.command-footer {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.media-link {
  color: #667085;
  margin-left: auto;
}

.media-link a {
  color: #175cd3;
  font-weight: 700;
}

.event {
  align-items: flex-start;
  border-top: 1px solid #e5eaf0;
  display: grid;
  gap: 10px;
  grid-template-columns: 92px 1fr;
  padding-top: 12px;
}

.event:first-child {
  border-top: 0;
  padding-top: 0;
}

.event-type {
  background: #e8eef6;
  color: #475467;
  justify-content: center;
}

.event p {
  color: #1f2937;
  line-height: 1.35;
}

.event time {
  color: #667085;
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

.empty {
  color: #667085;
  padding: 12px 0;
}

.toast {
  background: #151922;
  border-radius: 8px;
  bottom: 22px;
  color: #ffffff;
  left: 50%;
  opacity: 0;
  padding: 12px 16px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-type="error"] {
  background: #b42318;
}

@media (max-width: 980px) {
  .overview-grid,
  .content-grid,
  .connection-body,
  .command-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar,
  .section-head,
  .command-header,
  .command-footer {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 28px;
  }

  .media-link {
    margin-left: 0;
  }
}
