:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --page: #eef3f4;
  --panel: #ffffff;
  --ink: #17252b;
  --muted: #63777c;
  --line: #d8e4e2;
  --soft: #f6faf9;
  --green: #128c7e;
  --green-dark: #075e54;
  --focus: #2563eb;
  --gold: #a16207;
  --danger: #b42318;
  --shadow: 0 18px 42px rgba(18, 42, 50, 0.13);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    linear-gradient(140deg, rgba(18, 140, 126, 0.10), rgba(37, 99, 235, 0.07)),
    var(--page);
  color: var(--ink);
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

.page-shell {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 22px;
}

.admin-panel {
  width: min(1040px, 100%);
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 22px;
}

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
}

.eyebrow,
.detail-kicker {
  margin: 0 0 4px;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: 1.42rem;
}

h2 {
  font-size: 1.08rem;
}

.login-form {
  width: min(430px, 100%);
  display: grid;
  gap: 12px;
}

.field-label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
}

.text-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: #fbfdfd;
  color: var(--ink);
  font-weight: 800;
}

.text-input:focus {
  border-color: var(--focus);
  outline: 3px solid rgba(37, 99, 235, 0.18);
}

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

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

.create-form {
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 136px;
  gap: 10px;
}

.primary-action,
.secondary-action,
.table-action {
  min-height: 40px;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

.primary-action {
  border: 0;
  background: var(--green);
  color: #ffffff;
}

.secondary-action,
.table-action {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.table-action {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.table-action.is-danger {
  color: var(--danger);
}

button:disabled {
  cursor: progress;
  opacity: 0.68;
}

button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.38);
  outline-offset: 2px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.bots-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.bots-table th,
.bots-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.bots-table th {
  background: var(--soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.bots-table tr:last-child td {
  border-bottom: 0;
}

.bots-table tr.is-selected td {
  background: rgba(18, 140, 126, 0.06);
}

.bot-name-cell {
  font-weight: 900;
}

.number-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.empty-cell {
  color: var(--muted);
  font-weight: 800;
  text-align: center !important;
}

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

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 900;
}

.status-badge.is-pending {
  background: rgba(161, 98, 7, 0.12);
  color: var(--gold);
}

.status-badge.is-ready {
  background: rgba(18, 140, 126, 0.12);
  color: var(--green-dark);
}

.status-badge.is-error {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
}

.modal-panel {
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.modal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-action {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.secondary-action.is-danger {
  color: var(--danger);
}

.status-row {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(161, 98, 7, 0.12);
}

.status-row.is-ready .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(18, 140, 126, 0.14);
}

.status-row.is-error .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.12);
}

.qr-frame {
  width: min(318px, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
  justify-self: center;
}

#qr-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#qr-placeholder {
  padding: 18px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 850;
  text-align: center;
}

.login-message,
.status-message,
.modal-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.login-message.is-error,
.status-message.is-error,
.modal-message.is-error {
  color: var(--danger);
}

.login-message.is-pending,
.status-message.is-pending,
.modal-message.is-pending {
  color: var(--gold);
}

.login-message.is-ready,
.status-message.is-ready,
.modal-message.is-ready {
  color: var(--green-dark);
}

@media (max-width: 680px) {
  .page-shell {
    padding: 14px;
  }

  .admin-panel {
    margin-top: 0;
    padding: 18px;
  }

  .toolbar,
  .modal-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-actions {
    grid-template-columns: 1fr;
  }

  .create-form {
    grid-template-columns: 1fr;
  }

  .secondary-action,
  .primary-action {
    width: 100%;
  }

  .brand-logo {
    width: 46px;
    height: 46px;
  }

  h1 {
    font-size: 1.18rem;
  }
}
