:root {
  color-scheme: light;
  --ink: #0b0146;
  --muted: #514b72;
  --line: #ecd5e5;
  --panel: #ffffff;
  --accent: #c91486;
  --accent-dark: #a80f6f;
  --secondary: #ff6601;
  --support-blue: #2e58a6;
  --support-yellow: #ffd900;
  --danger: #a4123d;
  --bg: #faeef6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(250, 238, 246, 0.96) 0%, rgba(255, 255, 255, 0.98) 58%, rgba(255, 245, 236, 0.96) 100%);
}

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

.panel,
.admin-card {
  width: min(100%, 460px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 18px 50px rgba(11, 1, 70, 0.11);
}

.brand-logo {
  display: block;
  width: min(100%, 280px);
  height: auto;
  margin: 0 0 26px;
}

.connected-panel {
  text-align: center;
}

.connected-panel .brand-logo {
  margin-inline: auto;
}

.success-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  color: #fff;
  background: var(--support-blue);
  font-size: 34px;
  font-weight: 700;
}

.connected-panel button {
  width: 100%;
}

.admin-logo {
  display: block;
  width: 220px;
  max-width: 100%;
  height: auto;
  margin-bottom: 12px;
}

h1,
h2 {
  margin: 0 0 12px;
  letter-spacing: 0;
  color: var(--ink);
}

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

.field-help {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.form,
.admin-card {
  display: grid;
  gap: 12px;
}

label {
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus {
  outline: 3px solid rgba(46, 88, 166, 0.18);
  border-color: var(--support-blue);
}

button,
.button-link {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button-link:hover {
  background: var(--secondary);
}

.alert,
.notice {
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 16px;
}

.alert {
  color: var(--danger);
  background: #fff3f7;
  border: 1px solid #f1bdd7;
}

.notice {
  color: var(--accent-dark);
  background: var(--bg);
  border: 1px solid var(--line);
}

.admin-shell {
  padding: 24px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-header a {
  color: var(--support-blue);
  font-weight: 700;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 20px;
  align-items: start;
}

.table-card {
  width: 100%;
}

.table-wrap {
  overflow-x: auto;
}

.code-link {
  color: var(--support-blue);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.detail-card,
.device-card {
  width: 100%;
}

.detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-heading h2 {
  margin-bottom: 6px;
}

.detail-list {
  margin: 4px 0 8px;
}

.detail-list div {
  display: grid;
  grid-template-columns: 135px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.detail-actions {
  margin-top: 12px;
}

.detail-back {
  margin: 0 0 8px;
}

.metric {
  margin: 0;
  color: var(--muted);
}

.device-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: #1b8f5a;
}

.device-help {
  display: flex;
  align-items: center;
  margin-top: 2px;
}

.device-help .device-status-dot {
  flex: 0 0 8px;
}

.device-row-active {
  color: #111111;
}

.device-row-inactive {
  color: #4a4a4a;
}

.device-row-active code,
.device-row-inactive code {
  color: inherit;
}

.session-count {
  display: inline-flex;
  align-items: center;
  color: #111111;
  font-variant-numeric: tabular-nums;
}

.session-count-zero {
  color: #4a4a4a;
  font-variant-numeric: tabular-nums;
}

.device-table th,
.device-table td {
  white-space: nowrap;
}

.device-table {
  min-width: 940px;
}

.empty-state {
  margin: 14px 0 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px;
  vertical-align: top;
}

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  background: #edf1f5;
}

.status.active {
  color: var(--ink);
  background: #fff4bf;
}

.status.revoked,
.status.expired {
  color: var(--danger);
  background: #fff3f7;
}

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

.actions form {
  margin: 0;
}

.actions button {
  min-height: 34px;
  font-size: 14px;
}

.danger {
  background: var(--danger);
}

@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }
}

.secondary-action {
  display: block;
  width: 100%;
  margin-top: 14px;
  text-align: center;
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.secondary-action:hover {
  color: #fff;
  border-color: var(--secondary);
}

.wide-panel {
  width: min(100%, 760px);
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}

.choice-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.choice-panel h2 {
  font-size: 20px;
}

.back-link {
  display: inline-block;
  margin-top: 18px;
  color: var(--support-blue);
  font-weight: 700;
}

.code-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin: 16px 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Consolas, Monaco, monospace;
  font-size: 30px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0;
}

@media (max-width: 720px) {
  .choice-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .admin-card {
    padding: 24px;
  }
}

.request-panel .brand-logo {
  margin-bottom: 18px;
}

.choice-grid {
  align-items: stretch;
}

.choice-panel {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.choice-panel .muted {
  min-height: 58px;
}

.action-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.guest-request-form {
  gap: 10px;
}

.guest-request-form label {
  min-height: 24px;
}

[hidden] {
  display: none !important;
}

.handoff-url {
  overflow-wrap: anywhere;
  font-weight: 700;
  color: var(--ink) !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(11, 1, 70, 0.34);
  z-index: 10;
}

.modal-dialog {
  width: min(100%, 430px);
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 22px 70px rgba(11, 1, 70, 0.24);
  padding: 28px;
  text-align: center;
}

.modal-dialog h2 {
  margin-bottom: 10px;
}

.modal-dialog p {
  margin: 0 0 16px;
  color: var(--muted);
}

.modal-icon {
  width: 54px;
  height: 54px;
  display: inline-grid;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 32px;
  font-weight: 700;
}

@media (max-width: 720px) {
  .choice-panel {
    min-height: unset;
  }

  .choice-panel .muted {
    min-height: unset;
  }
}
