:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  --ink: #14231c;
  --muted: #617068;
  --line: #dce7e1;
  --surface: #ffffff;
  --soft: #f4f8f6;
  --green: #087a4e;
  --green-dark: #075a3d;
  --gold: #d6a827;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #eef5f1;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.onboarding-topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px clamp(16px, 4vw, 52px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.onboarding-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.onboarding-brand img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.onboarding-brand strong,
.onboarding-brand span {
  display: block;
}

.onboarding-brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.onboarding-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 34px auto 60px;
}

.onboarding-intro {
  max-width: 720px;
  margin-bottom: 26px;
}

.onboarding-intro h1 {
  margin: 6px 0 10px;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.08;
}

.onboarding-intro p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.onboarding-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(20, 49, 36, 0.08);
}

.step-indicator {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.step-indicator span {
  padding: 14px 18px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.step-indicator span.is-active {
  color: var(--green-dark);
  background: #eaf7f0;
  box-shadow: inset 0 -3px 0 var(--green);
}

.onboarding-form {
  padding: clamp(20px, 4vw, 38px);
}

.form-section + .form-section {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.form-section h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid #cbdad2;
  border-radius: 6px;
  background: #fff;
}

.field input:focus,
.field select:focus {
  outline: 3px solid rgba(8, 122, 78, 0.13);
  border-color: var(--green);
}

.field small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.4;
}

.check-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 24px;
  color: var(--muted);
  line-height: 1.45;
}

.check-field input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.form-actions,
.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}

.primary-action,
.secondary-action,
.danger-action {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
}

.primary-action {
  color: #fff;
  background: var(--green);
}

.primary-action:hover {
  background: var(--green-dark);
}

.secondary-action {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}

.danger-action {
  color: var(--danger);
  border-color: #f1c6c1;
  background: #fff;
}

.primary-action:disabled,
.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.status-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 650;
}

.status-message.error {
  color: var(--danger);
}

.status-message.success {
  color: var(--green-dark);
}

.verification-view {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}

.verification-view input {
  max-width: 280px;
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 8px;
}

.uat-code {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid #ead69a;
  border-radius: 6px;
  background: #fff9e7;
}

.tenant-layout {
  display: grid;
  gap: 22px;
}

.tenant-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.summary-item {
  min-width: 0;
  padding: 18px;
}

.summary-item + .summary-item {
  border-left: 1px solid var(--line);
}

.summary-item span,
.summary-item strong {
  display: block;
}

.summary-item span {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.summary-item strong {
  overflow-wrap: anywhere;
  font-size: 20px;
}

.management-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.management-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.management-header h2,
.management-header p {
  margin: 0;
}

.management-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.device-list,
.offer-list {
  display: grid;
}

.device-row,
.offer-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}

.device-row:last-child,
.offer-row:last-child {
  border-bottom: 0;
}

.device-row strong,
.device-row span,
.offer-row strong,
.offer-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  width: max-content;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--green-dark);
  background: #e5f6ed;
  font-size: 12px;
  font-weight: 800;
}

.empty-message {
  padding: 28px 20px;
  color: var(--muted);
  text-align: center;
}

.token-result {
  margin: 0 20px 20px;
  padding: 16px;
  border: 1px solid #ead69a;
  border-radius: 6px;
  background: #fff9e7;
}

.token-value {
  display: block;
  margin: 10px 0;
  padding: 10px;
  overflow-wrap: anywhere;
  border: 1px dashed #c59b1d;
  background: #fff;
  font-family: Consolas, monospace;
}

dialog {
  width: min(520px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(10, 35, 24, 0.3);
}

dialog::backdrop {
  background: rgba(8, 24, 17, 0.58);
}

.policy-shell {
  max-width: 920px;
}

.policy-content {
  line-height: 1.65;
}

.policy-content h2 {
  margin: 24px 0 6px;
  font-size: 1.08rem;
}

.policy-content h2:first-child {
  margin-top: 0;
}

.policy-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  font-size: 0.88rem;
}

.dialog-form {
  padding: 24px;
}

.dialog-form h2 {
  margin: 0 0 18px;
}

.dialog-form .field + .field {
  margin-top: 14px;
}

@media (max-width: 760px) {
  .onboarding-topbar {
    gap: 8px;
    padding: 8px 10px;
  }

  .onboarding-topbar .page-actions {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .onboarding-topbar .page-actions .secondary-action {
    min-height: 36px;
    padding: 7px 10px;
  }

  .onboarding-shell {
    width: min(100% - 20px, 1080px);
    margin-top: 20px;
  }

  .field-grid,
  .tenant-summary {
    grid-template-columns: 1fr;
  }

  .summary-item + .summary-item {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .device-row,
  .offer-row {
    grid-template-columns: 1fr;
  }

  .management-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
