:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f4f7fb;
  color: #07152c;
  --paper: #ffffff;
  --paper-soft: #f8fafc;
  --line: #d8e1ee;
  --line-strong: #b7c5da;
  --text-soft: #586b86;
  --navy: #06142d;
  --navy-soft: #102143;
  --green: #10a37f;
  --green-soft: #e4f8f2;
  --blue: #3b82f6;
  --blue-dark: #2563eb;
  --amber: #a15c08;
  --red: #b42318;
  --shadow: 0 18px 50px rgba(16, 33, 67, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(72, 216, 197, 0.14), transparent 28%),
    linear-gradient(180deg, #f7fbff 0, #edf3fb 420px, #f4f7fb 100%);
}

button,
input,
select {
  font: inherit;
}

button,
.nav-button {
  min-height: 38px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
}

button:hover:not(:disabled),
.nav-button:hover:not(:disabled) {
  background: var(--blue-dark);
}

button:disabled {
  border-color: #cbd3c9;
  background: #dfe5dc;
  color: #7a847e;
  cursor: not-allowed;
}

button.secondary {
  border-color: var(--line-strong);
  background: #ffffff;
  color: #07152c;
}

button.secondary:hover {
  background: #f5f8fc;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 42px);
  border-bottom: 1px solid rgba(216, 226, 246, 0.78);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.brand,
.topnav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  min-width: 0;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 154px;
  height: 50px;
  border: 1px solid rgba(216, 226, 246, 0.18);
  border-radius: 8px;
  background: linear-gradient(145deg, #06142d, #102143);
  object-fit: contain;
  object-position: left center;
  padding: 4px 8px;
}

.brand-text {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.brand strong,
.brand small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small,
.topnav a,
.system-status,
.eyebrow,
.notice,
label,
th,
.summary-grid span,
.meta {
  color: var(--text-soft);
  font-size: 0.84rem;
}

.topnav a {
  text-decoration: none;
}

.system-status {
  justify-self: end;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  white-space: nowrap;
}

.system-status.connected {
  border-color: #9be8d4;
  background: var(--green-soft);
  color: #047857;
}

.system-status.error {
  border-color: #efb9b9;
  background: #fff0f0;
  color: var(--red);
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px clamp(14px, 3vw, 34px) 44px;
}

.auth-strip,
.workspace,
.content > .view {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.auth-strip {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(520px, 1.2fr);
  align-items: stretch;
  gap: 18px;
  margin-bottom: 20px;
  padding: 18px;
  background:
    radial-gradient(circle at 14% 22%, rgba(72, 216, 197, 0.16), transparent 30%),
    linear-gradient(145deg, #06142d, #102143);
  color: #ffffff;
}

.auth-panel {
  display: grid;
  gap: 12px;
}

.auth-copy {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
}

.auth-copy h1 {
  max-width: 520px;
  color: #ffffff;
  font-size: clamp(2rem, 4vw, 3.15rem);
}

.auth-copy p {
  max-width: 560px;
  color: #d8e6fb;
}

.auth-highlights {
  display: grid;
  gap: 10px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.auth-highlights li {
  border: 1px solid rgba(216, 226, 246, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: #eaf3ff;
  padding: 11px 12px;
  font-weight: 750;
}

.auth-card,
.session-panel {
  border: 1px solid rgba(216, 226, 246, 0.92);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 38px rgba(3, 7, 26, 0.15);
  color: #07152c;
  padding: 18px;
}

.auth-card-muted {
  background: #f8fbff;
}

.auth-card-header {
  display: flex;
  align-items: start;
  gap: 12px;
  margin-bottom: 16px;
}

.auth-card-header h2 {
  margin: 0;
  font-size: 1.18rem;
}

.auth-card-header p,
.form-help {
  margin: 5px 0 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.auth-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  background: #e8f0ff;
  color: #2454c6;
  padding: 0 10px;
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.auth-badge.secondary {
  background: #e4f8f2;
  color: #047857;
}

.auth-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

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

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

.session-panel div {
  display: grid;
  gap: 3px;
}

.session-panel span {
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 750;
}

.session-panel span {
  color: var(--text-soft);
}

.session-panel strong {
  color: #07152c;
  font-weight: 850;
}

.auth-form label,
.form-grid label,
.purchase-bar label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: #07152c;
  padding: 9px 11px;
}

input::placeholder {
  color: #7b8da8;
  opacity: 1;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.2);
  outline-offset: 2px;
}

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  padding-right: 72px;
}

.password-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  min-height: 30px;
  border-color: transparent;
  background: #eef4ff;
  color: #2454c6;
  padding: 0 10px;
  font-size: 0.78rem;
}

.password-toggle:hover:not(:disabled) {
  background: #dce9ff;
  color: #163f9f;
}

.notice {
  justify-self: stretch;
  margin: 0;
  border-radius: 8px;
  color: #d8e6fb;
  padding: 0;
  text-align: left;
}

.notice.error {
  color: var(--red);
}

.notice.ok {
  color: var(--green);
}

.workspace {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  gap: 0;
  min-height: 650px;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: #f7f8f3;
}

.nav-button {
  justify-content: flex-start;
  width: 100%;
  border-color: transparent;
  background: transparent;
  color: #34413b;
  text-align: left;
}

.nav-button.active {
  background: #173b32;
  color: #ffffff;
}

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

.view {
  display: none;
  min-height: 612px;
  padding: clamp(18px, 3vw, 28px);
}

.view.active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2.25rem);
  letter-spacing: 0;
  line-height: 1.15;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-grid div,
.details-panel,
.purchase-bar,
fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
}

.summary-grid div {
  min-width: 0;
  padding: 14px;
}

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

.summary-grid strong {
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 1.2rem;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

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

th {
  background: #f0f3ed;
  font-weight: 800;
}

tbody tr {
  background: #ffffff;
}

tbody tr:hover {
  background: #f8fbf6;
}

tbody tr.selected {
  background: #eef8f2;
}

td.actions {
  min-width: 280px;
}

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

.action-row button {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 0.82rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #edf2ea;
  color: #334139;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.active,
.status-pill.approved,
.status-pill.awaiting_internal_test {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.needs_customer_information,
.status-pill.awaiting_admin_review,
.status-pill.awaiting_number_selection,
.status-pill.pending {
  background: #fff4dd;
  color: var(--amber);
}

.status-pill.cancelled,
.status-pill.suspended,
.status-pill.disabled,
.status-pill.payment_failed,
.status-pill.number_unavailable,
.status-pill.twilio_failed,
.status-pill.vapi_failed,
.status-pill.test_failed {
  background: #fff0f0;
  color: var(--red);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
  align-items: end;
}

.form-grid.compact {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 11px 12px;
}

legend {
  padding: 0 4px;
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 800;
}

.check {
  display: inline-flex;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  margin-right: 12px;
  color: #26332e;
  font-weight: 700;
}

.check input {
  width: 16px;
  min-height: 16px;
}

.purchase-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 14px;
  align-items: end;
  margin: 18px 0;
  padding: 14px;
}

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

.audit-panel {
  margin-top: 18px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.detail {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.detail span,
.detail strong {
  display: block;
}

.detail span {
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 800;
}

.detail strong {
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.history-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-list li {
  display: grid;
  grid-template-columns: minmax(160px, auto) minmax(0, 1fr) auto;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.empty {
  margin: 0;
  color: var(--text-soft);
}

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

  .sidebar {
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-button {
    width: auto;
    min-width: 112px;
    text-align: center;
  }

  .form-grid,
  .form-grid.compact,
  .purchase-bar,
  .details-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar,
  .auth-strip,
  .auth-form,
  .signup-form,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .topnav,
  .system-status,
  .notice {
    justify-self: start;
    text-align: left;
  }

  .app-shell,
  .content,
  .view {
    padding: 12px;
  }

  .section-heading {
    display: grid;
  }
}
