:root {
  font-family:
    Inter, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #18202b;
  background: #f3f5f8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

a {
  color: #1769aa;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #1769aa;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

button:hover,
.button:hover {
  opacity: 0.9;
  text-decoration: none;
}

.button-secondary {
  color: #18202b;
  background: #fff;
  border: 1px solid #d7dde5;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 34px;
  border: 1px solid #e0e5eb;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 45px rgb(20 31 44 / 10%);
}

.login-card h1 {
  margin: 18px 0 6px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  color: #fff;
  background: #1769aa;
  font-weight: 800;
}

label {
  display: grid;
  gap: 7px;
  margin-top: 18px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #cbd3dd;
  border-radius: 8px;
  background: #fff;
  font: inherit;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.login-card button {
  width: 100%;
  margin-top: 24px;
}

.muted {
  color: #6d7785;
  font-size: 0.92rem;
  font-weight: 400;
}

.alert {
  margin: 18px 0;
  padding: 12px 14px;
  border-radius: 8px;
}

.alert-error {
  color: #9b1c1c;
  background: #fff0f0;
  border: 1px solid #ffcaca;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 28px;
  color: #fff;
  background: #18202b;
}

.topbar > div {
  display: flex;
  gap: 18px;
  align-items: center;
}

.topbar span {
  color: #b9c3cf;
}

.container {
  width: min(1180px, calc(100% - 36px));
  margin: 34px auto;
}

.page-heading {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-heading h1 {
  margin: 0 0 6px;
}

.empty-state,
.table-card {
  padding: 28px;
  border: 1px solid #dfe4ea;
  border-radius: 14px;
  background: #fff;
}

.empty-state {
  text-align: center;
}

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

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid #e7ebf0;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #616c79;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
}

.status-on {
  color: #176c38;
  background: #e8f8ee;
}

.status-off {
  color: #7b4242;
  background: #f4eaea;
}

@media (max-width: 800px) {
  .topbar {
    padding: 12px 18px;
  }

  .topbar span {
    display: none;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-card {
    overflow-x: auto;
    padding: 12px;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-actions > a {
  color: #fff;
}

.form-container {
  max-width: 980px;
}

.provider-form {
  display: grid;
  gap: 20px;
}

.form-card {
  padding: 24px;
  border: 1px solid #dfe4ea;
  border-radius: 14px;
  background: #fff;
}

.form-card h2 {
  margin: 0 0 20px;
  font-size: 1.15rem;
}

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

.form-grid-wide {
  grid-column: 1 / -1;
}

.field-help {
  color: #6d7785;
  font-size: 0.82rem;
  font-weight: 400;
}

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

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  margin: 0;
}

.checkbox-label input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.alert-success {
  color: #176c38;
  background: #e8f8ee;
  border: 1px solid #b7e4c7;
}

.danger-zone {
  margin-top: 28px;
  padding: 22px;
  border: 1px solid #f0bebe;
  border-radius: 14px;
  background: #fff6f6;
}

.danger-zone h2 {
  margin-top: 0;
  color: #9b1c1c;
}

.button-danger {
  background: #b42318;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.row-actions form {
  margin: 0;
}

.link-button {
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #1769aa;
  background: transparent;
  font-weight: 400;
}

.link-button:hover {
  text-decoration: underline;
  opacity: 1;
}

.link-danger {
  color: #b42318;
}

@media (max-width: 800px) {
  .form-grid,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .form-grid-wide {
    grid-column: auto;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions .button,
  .form-actions button {
    width: 100%;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-actions > a {
  color: #fff;
}

.form-container {
  max-width: 980px;
}

.provider-form {
  display: grid;
  gap: 20px;
}

.form-card {
  padding: 24px;
  border: 1px solid #dfe4ea;
  border-radius: 14px;
  background: #fff;
}

.form-card h2 {
  margin: 0 0 20px;
  font-size: 1.15rem;
}

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

.form-grid-wide {
  grid-column: 1 / -1;
}

.field-help {
  color: #6d7785;
  font-size: 0.82rem;
  font-weight: 400;
}

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

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  margin: 0;
}

.checkbox-label input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.alert-success {
  color: #176c38;
  background: #e8f8ee;
  border: 1px solid #b7e4c7;
}

.danger-zone {
  margin-top: 28px;
  padding: 22px;
  border: 1px solid #f0bebe;
  border-radius: 14px;
  background: #fff6f6;
}

.danger-zone h2 {
  margin-top: 0;
  color: #9b1c1c;
}

.button-danger {
  background: #b42318;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.row-actions form {
  margin: 0;
}

.link-button {
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #1769aa;
  background: transparent;
  font-weight: 400;
}

.link-button:hover {
  text-decoration: underline;
  opacity: 1;
}

.link-danger {
  color: #b42318;
}

@media (max-width: 800px) {
  .form-grid,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .form-grid-wide {
    grid-column: auto;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions .button,
  .form-actions button {
    width: 100%;
  }
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.heading-actions form {
  margin: 0;
}

.button-apply {
  background: #176c38;
}

.apply-status-card {
  margin-bottom: 24px;
  padding: 20px 24px;
  border: 1px solid #dfe4ea;
  border-radius: 14px;
  background: #fff;
}

.apply-status-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.apply-status-heading h2 {
  margin: 0;
  font-size: 1.1rem;
}

.apply-status-card p {
  margin-bottom: 0;
}

.apply-status-success {
  color: #176c38;
  background: #e8f8ee;
}

.apply-status-error {
  color: #9b1c1c;
  background: #fff0f0;
}

.apply-status-pending {
  color: #805500;
  background: #fff5d6;
}

.apply-status-idle {
  color: #566171;
  background: #edf0f4;
}

@media (max-width: 800px) {
  .heading-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .heading-actions form,
  .heading-actions button,
  .heading-actions .button {
    width: 100%;
  }
}


.voice-description {
  margin: -8px 0 20px;
}

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

.voice-option {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #d7dde5;
  border-radius: 12px;
  background: #f9fafb;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.voice-option-selected,
.voice-option:has(input:checked) {
  border-color: #1769aa;
  background: #f2f8fd;
  box-shadow: 0 0 0 2px rgb(23 105 170 / 12%);
}

.voice-option-choice {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0;
  cursor: pointer;
}

.voice-option-choice input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
}

.voice-option-text {
  display: grid;
  gap: 2px;
}

.voice-option-text span {
  color: #6d7785;
  font-size: 0.82rem;
  font-weight: 400;
}

.voice-option audio {
  width: 100%;
  height: 36px;
}

@media (max-width: 800px) {
  .voice-options {
    grid-template-columns: 1fr;
  }
}


.greeting-text-field {
  margin-top: 22px;
}

.greeting-text-field textarea {
  min-height: 135px;
  line-height: 1.5;
}


.greeting-preview {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #d7dde5;
  border-radius: 12px;
  background: #f9fafb;
}

.greeting-preview audio {
  width: 100%;
}

/* Compact provider editor */
.form-container {
  max-width: 1120px;
}

.provider-compact-summary {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid #dfe4ea;
  border-radius: 14px;
  background: #dfe4ea;
}

.provider-compact-summary > div {
  min-width: 0;
  padding: 13px 15px;
  background: #fff;
}

.provider-summary-label {
  display: block;
  margin-bottom: 3px;
  color: #6d7785;
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.provider-compact-summary strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .94rem;
}

.provider-settings-tabs {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid #dfe4ea;
  border-radius: 12px;
  background: #f3f5f7;
}

.provider-settings-tabs button {
  min-height: 38px;
  padding: 8px 15px;
  border: 0;
  border-radius: 8px;
  color: #4c5867;
  background: transparent;
  white-space: nowrap;
  font-weight: 700;
}

.provider-settings-tabs button:hover {
  background: #e7ebef;
}

.provider-settings-tabs button.is-active {
  color: #17202b;
  background: #fff;
  box-shadow: 0 1px 4px rgb(20 32 45 / 10%);
}

.provider-form.provider-tabs-ready [data-provider-tab] {
  display: none;
}

.provider-form.provider-tabs-ready [data-provider-tab].is-active {
  display: block;
}

.provider-form.provider-tabs-ready {
  gap: 14px;
}

.provider-form.provider-tabs-ready .form-card {
  padding: 20px 22px;
}

.provider-form.provider-tabs-ready .form-card h2 {
  margin-bottom: 16px;
}

.provider-form.provider-tabs-ready .voice-options {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.provider-form.provider-tabs-ready .voice-option {
  padding: 12px;
}

.provider-form.provider-tabs-ready .voice-option audio {
  width: 100%;
  max-width: 100%;
}

.provider-sticky-actions {
  grid-column: 1 / -1;
  position: sticky;
  z-index: 20;
  bottom: 10px;
  justify-content: flex-end;
  padding: 10px 12px;
  border: 1px solid #dfe4ea;
  border-radius: 12px;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 6px 24px rgb(25 35 45 / 12%);
  backdrop-filter: blur(8px);
}

@media (max-width: 900px) {
  .provider-compact-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .provider-form.provider-tabs-ready .voice-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .provider-compact-summary {
    grid-template-columns: 1fr;
  }

  .provider-settings-tabs {
    margin-inline: -4px;
  }

  .provider-form.provider-tabs-ready .voice-options {
    grid-template-columns: 1fr;
  }

  .provider-sticky-actions {
    bottom: 6px;
  }
}
