:root {
  color-scheme: light;
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-muted: #f7f9f8;
  --ink: #17201e;
  --muted: #687572;
  --line: #dce3e0;
  --line-strong: #c8d2ce;
  --accent: #087866;
  --accent-hover: #066655;
  --accent-soft: #e7f4f1;
  --blue-soft: #e9f1f8;
  --amber: #a76b0b;
  --amber-soft: #fff3da;
  --danger: #b63c3c;
  --danger-soft: #fcebea;
  --success: #24764e;
  --success-soft: #e8f5ed;
  --shadow: 0 10px 28px rgba(25, 45, 39, 0.07);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151a19;
  --surface: #1e2523;
  --surface-muted: #242c29;
  --ink: #edf4f1;
  --muted: #9fada8;
  --line: #35403c;
  --line-strong: #495650;
  --accent: #55bda9;
  --accent-hover: #6dccb9;
  --accent-soft: #193c34;
  --blue-soft: #223440;
  --amber: #f0b95b;
  --amber-soft: #42351f;
  --danger: #f08b86;
  --danger-soft: #472827;
  --success: #72c89a;
  --success-soft: #203b2d;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.is-hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px max(24px, calc((100vw - 1320px) / 2));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
}

.brand,
.topbar-actions,
.section-heading,
.section-heading > div,
.history-header,
.history-header > div {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--surface);
  font-size: 18px;
  font-weight: 800;
}

.brand h1,
.brand p,
.section-heading h2,
.history-header h2,
.empty-state h3 {
  margin: 0;
}

.brand h1 {
  font-size: 17px;
  font-weight: 750;
}

.brand p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.topbar-actions {
  gap: 10px;
}

.connection-status,
.mode-badge,
.status-pill,
.small-meta {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  white-space: nowrap;
}

.connection-status,
.mode-badge {
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
}

.connection-status i {
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--amber);
}

.connection-status.is-online i {
  background: var(--success);
}

.connection-status.is-offline i {
  background: var(--danger);
}

.mode-badge.is-demo {
  border-color: color-mix(in srgb, var(--amber) 35%, var(--line));
  background: var(--amber-soft);
  color: var(--amber);
}

.mode-badge.is-live {
  border-color: color-mix(in srgb, var(--success) 35%, var(--line));
  background: var(--success-soft);
  color: var(--success);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 18px;
}

.page-shell {
  width: min(1320px, calc(100% - 48px));
  margin: 28px auto 56px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 382px) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

.tool-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.recovery-panel {
  margin-bottom: 20px;
  padding: 18px 20px;
  border-color: color-mix(in srgb, var(--danger) 38%, var(--line));
  background: color-mix(in srgb, var(--danger-soft) 52%, var(--surface));
}

.recovery-heading,
.recovery-title,
.recovery-confirm-row,
.recovery-actions {
  display: flex;
  align-items: center;
}

.recovery-heading {
  justify-content: space-between;
  gap: 16px;
}

.recovery-title {
  min-width: 0;
  gap: 11px;
}

.recovery-icon {
  display: grid;
  flex: 0 0 28px;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--danger);
  border-radius: 50%;
  color: var(--danger);
  font-weight: 800;
}

.recovery-title h2 {
  margin: 0;
  font-size: 15px;
}

.recovery-title p,
.recovery-detail {
  margin: 4px 0 0;
  color: var(--danger);
  font-size: 12px;
  line-height: 18px;
}

.recovery-detail {
  margin-top: 14px;
  color: var(--muted);
}

.recovery-manual {
  margin-top: 14px;
  padding: 13px;
  border: 1px dashed color-mix(in srgb, var(--danger) 42%, var(--line));
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.recovery-manual p {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

.recovery-manual code {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 4px;
  background: var(--surface-muted);
  color: var(--ink);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 11px;
}

.recovery-confirm-row {
  align-items: end;
  gap: 10px;
  margin-top: 12px;
}

.recovery-confirm-row .input-field {
  flex: 1 1 auto;
}

.recovery-confirm-row .danger-button {
  flex: 0 0 auto;
  min-height: 42px;
}

.recovery-actions {
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.recovery-actions small {
  color: var(--muted);
  font-size: 10px;
  line-height: 16px;
  text-align: right;
}

.login-body {
  min-height: 100vh;
}

.login-topbar {
  position: relative;
}

.login-shell {
  display: grid;
  min-height: calc(100vh - 73px);
  padding: 40px 20px 72px;
  place-items: center;
}

.login-panel {
  width: min(100%, 420px);
  padding: 30px;
  border-top: 3px solid var(--accent);
}

.login-heading {
  margin-bottom: 28px;
}

.login-heading .section-index {
  width: auto;
  padding: 0 8px;
}

.login-heading h2 {
  margin: 12px 0 0;
  font-size: 22px;
}

.login-field {
  display: block;
  margin-top: 18px;
}

.login-field > span:first-child {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.login-field input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  background: var(--surface-muted);
  color: var(--ink);
}

.login-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  padding-right: 64px;
}

.password-control button {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 58px;
  height: 44px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 5px 5px 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.login-remember {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 18px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 18px;
}

.login-remember input {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 18px;
  height: 18px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.login-remember .check-mark {
  position: relative;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-muted);
}

.login-remember input:checked + .check-mark {
  border-color: var(--accent);
  background: var(--accent);
}

.login-remember input:focus-visible + .check-mark {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.login-remember input:checked + .check-mark::after {
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 9px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  content: "";
  transform: rotate(45deg);
}

.login-error {
  min-height: 40px;
  margin: 18px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  line-height: 20px;
}

.account-success {
  border-left-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}

.login-button {
  margin-top: 22px;
}

.topbar-logout {
  min-width: 54px;
}

.account-link {
  display: inline-flex;
  align-items: center;
  min-width: 54px;
  justify-content: center;
  text-decoration: none;
}

.setup-panel,
.activation-panel {
  min-height: 570px;
  padding: 22px;
}

.section-heading,
.history-header {
  justify-content: space-between;
  gap: 16px;
}

.section-heading > div,
.history-header > div {
  gap: 10px;
}

.section-index {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.section-heading h2,
.history-header h2 {
  font-size: 17px;
}

.small-meta {
  padding: 4px 8px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
}

.field-group {
  margin: 26px 0 0;
  padding: 0;
  border: 0;
}

.provider-field-heading,
.input-field > span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.provider-field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
}

.balance-refresh-button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
}

.balance-refresh-button:hover:not(:disabled) {
  border-color: var(--line-strong);
  color: var(--ink);
}

.balance-refresh-button.is-loading span {
  animation: balance-spin 750ms linear infinite;
}

@keyframes balance-spin {
  to { transform: rotate(360deg); }
}

.provider-segments {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.provider-option {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 82px;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
  color: var(--ink);
  text-align: left;
}

.provider-option:hover:not(:disabled) {
  border-color: var(--line-strong);
}

.provider-option.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.provider-copy {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  align-items: baseline;
}

.provider-name,
.provider-option small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.provider-name {
  font-size: 13px;
}

.provider-option small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.provider-balance {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  min-width: 0;
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.provider-balance b {
  max-width: 88px;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-balance b.is-unavailable {
  color: var(--danger);
  font-size: 10px;
  font-weight: 650;
}

.provider-emblem {
  display: grid;
  flex: 0 0 31px;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 6px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.provider-emblem.bower {
  background: #087866;
}

.provider-emblem.hero {
  background: #365c89;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.input-field {
  display: block;
  min-width: 0;
}

.input-field input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  background: var(--surface-muted);
  color: var(--ink);
  padding: 0 11px;
}

.input-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.country-field {
  position: relative;
}

.country-combobox {
  position: relative;
}

.country-combobox input {
  padding-right: 40px;
}

.country-toggle {
  position: absolute;
  top: 1px;
  right: 1px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 40px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 5px 5px 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
}

.country-toggle:hover {
  color: var(--accent);
}

.country-combobox[aria-expanded="true"] .country-toggle span {
  transform: rotate(180deg);
}

.country-options {
  position: absolute;
  top: 68px;
  right: 0;
  left: 0;
  z-index: 30;
  max-height: 264px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 14px 30px rgba(20, 36, 31, 0.18);
}

.country-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  gap: 12px;
  padding: 7px 9px;
  border-radius: 5px;
  cursor: pointer;
}

.country-option:hover,
.country-option.is-active {
  background: var(--accent-soft);
}

.country-option span,
.country-option strong,
.country-option small {
  display: block;
  min-width: 0;
}

.country-option strong {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.country-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.country-option b {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 10px;
}

.country-empty {
  padding: 14px 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 17px;
  text-align: center;
}

.field-hint {
  display: block;
  min-height: 16px;
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 10px;
  line-height: 16px;
}

.advanced-settings {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.advanced-settings summary {
  padding: 13px 0;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.advanced-settings summary span {
  float: right;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.advanced-body {
  display: grid;
  gap: 14px;
  padding: 5px 0 16px;
}

.advanced-body .form-grid {
  margin-top: 0;
}

.budget-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}

.budget-toolbar strong,
.budget-toolbar span {
  display: block;
  overflow-wrap: anywhere;
}

.budget-toolbar strong {
  font-size: 12px;
}

.budget-toolbar span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 15px;
}

.budget-reset-button {
  flex: 0 0 auto;
  min-width: 82px;
}

.budget-reset-button.is-active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
}

.advanced-field-grid {
  align-items: start;
}

.authorization-check {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 18px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 18px;
}

.authorization-check input {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 18px;
  height: 18px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.check-mark {
  position: relative;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-muted);
}

.authorization-check input:checked + .check-mark {
  border-color: var(--accent);
  background: var(--accent);
}

.authorization-check input:focus-visible + .check-mark {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.authorization-check input:checked + .check-mark::after {
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 9px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  content: "";
  transform: rotate(45deg);
}

.primary-button,
.success-button,
.danger-button,
.secondary-button {
  min-height: 42px;
  border-radius: 6px;
  font-weight: 700;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 18px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover:not(:disabled) {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.activation-panel {
  display: flex;
  flex-direction: column;
}

.status-pill {
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.status-pill.is-progress {
  border-color: color-mix(in srgb, var(--amber) 35%, var(--line));
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.is-success {
  border-color: color-mix(in srgb, var(--success) 35%, var(--line));
  background: var(--success-soft);
  color: var(--success);
}

.status-pill.is-danger {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-state {
  display: grid;
  flex: 1;
  place-content: center;
  justify-items: center;
  min-height: 420px;
  color: var(--muted);
}

.empty-symbol {
  display: grid;
  place-items: center;
  width: 62px;
  height: 48px;
  margin-bottom: 15px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--accent);
  font-size: 20px;
}

.empty-state h3 {
  font-size: 14px;
  font-weight: 650;
}

.active-state {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  padding-top: 28px;
}

.number-band,
.code-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.phone-number {
  display: block;
  overflow-wrap: anywhere;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 32px;
  font-weight: 760;
  line-height: 1.1;
}

.secondary-button {
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.compact {
  flex: 0 0 auto;
  min-height: 34px;
  font-size: 12px;
}

.activation-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 18px 4px;
  border-bottom: 1px solid var(--line);
}

.activation-meta span {
  min-width: 0;
  padding: 0 14px;
  border-right: 1px solid var(--line);
}

.activation-meta span:first-child {
  padding-left: 0;
}

.activation-meta span:last-child {
  border-right: 0;
}

.activation-meta b,
.activation-meta i {
  display: block;
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activation-meta b {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
}

.activation-meta i {
  font-size: 12px;
  font-weight: 700;
}

.lifecycle {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
  padding: 24px 0;
  list-style: none;
}

.lifecycle li {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.lifecycle li::before {
  position: absolute;
  top: 13px;
  right: 50%;
  left: -50%;
  height: 1px;
  background: var(--line-strong);
  content: "";
}

.lifecycle li:first-child::before {
  display: none;
}

.lifecycle i {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
}

.lifecycle li.is-done,
.lifecycle li.is-current {
  color: var(--accent);
  font-weight: 700;
}

.lifecycle li.is-done i,
.lifecycle li.is-current i {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.lifecycle li.is-done::before,
.lifecycle li.is-current::before {
  background: var(--accent);
}

.code-band {
  border-color: color-mix(in srgb, var(--success) 30%, var(--line));
  background: var(--success-soft);
}

.code-band strong {
  display: block;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 30px;
  color: var(--success);
}

.task-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
}

.action-bar {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 9px;
  margin-top: auto;
  padding-top: 20px;
}

.action-bar .action-primary {
  width: 100%;
}

.success-button,
.danger-button {
  padding: 0 15px;
  background: transparent;
}

.success-button {
  border: 1px solid var(--success);
  color: var(--success);
}

.success-button:hover:not(:disabled) {
  background: var(--success-soft);
}

.danger-button {
  border: 1px solid var(--danger);
  color: var(--danger);
}

.danger-button:hover:not(:disabled) {
  background: var(--danger-soft);
}

.history-section {
  margin-top: 20px;
  border-top: 1px solid var(--line-strong);
  background: var(--surface);
}

.history-header {
  padding: 18px 20px;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  scrollbar-color: var(--line-strong) var(--surface-muted);
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.table-scroll::-webkit-scrollbar {
  height: 9px;
}

.table-scroll::-webkit-scrollbar-track {
  background: var(--surface-muted);
}

.table-scroll::-webkit-scrollbar-thumb {
  border: 2px solid var(--surface-muted);
  border-radius: 4px;
  background: var(--line-strong);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.table-scroll:has(.table-empty) table {
  min-width: 100%;
}

.table-scroll:has(.table-empty) thead {
  display: none;
}

th,
td {
  height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

td {
  color: var(--ink);
  font-size: 12px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: color-mix(in srgb, var(--accent-soft) 45%, transparent);
}

.align-right {
  text-align: right;
}

.history-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.history-status.is-progress {
  background: var(--amber-soft);
  color: var(--amber);
}

.history-status.is-success {
  background: var(--success-soft);
  color: var(--success);
}

.history-status.is-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.table-action {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
}

.table-empty {
  height: 96px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 44px));
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .page-shell {
    width: min(100% - 28px, 720px);
    margin-top: 18px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .setup-panel,
  .activation-panel {
    min-height: auto;
  }

  .activation-panel {
    min-height: 540px;
  }
}

@media (max-width: 560px) {
  .topbar {
    min-height: 64px;
    padding: 10px 14px;
  }

  .brand p,
  .connection-status {
    display: none;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand h1 {
    font-size: 15px;
  }

  .login-shell {
    min-height: calc(100vh - 65px);
    padding: 24px 14px 48px;
  }

  .login-panel {
    padding: 24px 20px;
  }

  .login-topbar .brand p {
    display: block;
  }

  .mode-badge {
    padding: 4px 7px;
    font-size: 10px;
  }

  .page-shell {
    width: calc(100% - 20px);
    margin-bottom: 32px;
  }

  .setup-panel,
  .activation-panel {
    padding: 16px;
  }

  .provider-segments,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .provider-option {
    min-height: 76px;
  }

  .budget-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .budget-reset-button {
    width: 100%;
  }

  .phone-number {
    font-size: 26px;
  }

  .number-band,
  .code-band {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .number-band .secondary-button,
  .code-band .secondary-button {
    width: 100%;
  }

  .activation-meta {
    grid-template-columns: 1fr 1fr;
    row-gap: 16px;
  }

  .activation-meta span:nth-child(2) {
    border-right: 0;
  }

  .activation-meta span:nth-child(3) {
    padding-left: 0;
  }

  .lifecycle span {
    max-width: 56px;
    white-space: normal;
  }

  .action-bar {
    grid-template-columns: 1fr 1fr;
  }

  .action-bar .action-primary {
    grid-column: 1 / -1;
  }

  .recovery-confirm-row,
  .recovery-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .recovery-confirm-row .danger-button {
    width: 100%;
  }

  .recovery-actions small {
    text-align: left;
  }

  .history-header {
    padding: 15px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
