.sms-settings-page {
  --sms-primary: #3157c8;
  --sms-primary-hover: #2647aa;
  --sms-text: #172033;
  --sms-muted: #64748b;
  --sms-border: #dfe6f1;
  display: grid;
  width: 100%;
  gap: 16px;
  color: var(--sms-text);
}

.sms-page-header,
.sms-card__header,
.sms-log-toolbar,
.sms-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.sms-page-header {
  padding: 2px 2px 4px;
}

.sms-page-eyebrow {
  color: #667eea;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .11em;
}

.sms-page-header h1 {
  margin: 5px 0 0;
  font-size: 24px;
  line-height: 1.25;
}

.sms-page-header p,
.sms-card__header p {
  margin: 6px 0 0;
  color: var(--sms-muted);
  font-size: 13px;
}

.sms-card {
  overflow: hidden;
  border: 1px solid var(--sms-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .055);
}

.sms-card__header {
  padding: 17px 20px;
  border-bottom: 1px solid #edf1f6;
}

.sms-card__header h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.sms-service-state,
.sms-log-total {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.sms-service-state.is-enabled {
  background: #ecfdf3;
  color: #168454;
}

.sms-settings-content {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, .8fr);
  gap: 24px;
  padding: 20px;
  transition: opacity 160ms ease;
}

.sms-settings-content.is-loading {
  opacity: .58;
  pointer-events: none;
}

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

.sms-field,
.sms-search-field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.sms-field__label,
.sms-search-field > span {
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.sms-field small {
  color: #94a3b8;
  font-size: 11px;
  line-height: 1.45;
}

.sms-input {
  box-sizing: border-box;
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid #d7deea;
  border-radius: 7px;
  background: #fff;
  color: #24324a;
  font: inherit;
  font-size: 13px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.sms-input::placeholder {
  color: #a2adbd;
}

.sms-input:hover {
  border-color: #acb8c9;
}

.sms-input:focus {
  border-color: #667eea;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, .13);
}

.sms-secret-control {
  position: relative;
}

.sms-secret-control .sms-input {
  padding-right: 54px;
}

.sms-secret-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  padding: 4px 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #506987;
  cursor: pointer;
  font-size: 12px;
  transform: translateY(-50%);
}

.sms-secret-toggle:hover,
.sms-secret-toggle:focus-visible {
  background: #edf2ff;
  color: var(--sms-primary);
  outline: 0;
}

.sms-switches {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e5eaf1;
  border-radius: 9px;
  background: #f8fafc;
}

.sms-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.sms-switch-row > span:first-child {
  display: grid;
  gap: 4px;
}

.sms-switch-row strong {
  color: #334155;
  font-size: 13px;
}

.sms-switch-row small {
  color: #94a3b8;
  font-size: 11px;
  line-height: 1.4;
}

.sms-switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
}

.sms-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.sms-switch > span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 160ms ease;
}

.sms-switch > span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .2);
  content: "";
  transition: transform 160ms ease;
}

.sms-switch.is-on > span {
  background: var(--sms-primary);
}

.sms-switch.is-on > span::after {
  transform: translateX(18px);
}

.sms-switch input:focus-visible + span {
  outline: 3px solid rgba(49, 87, 200, .2);
  outline-offset: 2px;
}

.sms-button {
  min-width: 68px;
  height: 36px;
  padding: 0 13px;
  border: 1px solid #d7deea;
  border-radius: 7px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.sms-button:hover:not(:disabled) {
  border-color: #aab6c7;
  background: #f8fafc;
}

.sms-button:focus-visible {
  outline: 3px solid rgba(49, 87, 200, .18);
  outline-offset: 2px;
}

.sms-button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.sms-button--primary {
  border-color: var(--sms-primary);
  background: var(--sms-primary);
  color: #fff;
}

.sms-button--primary:hover:not(:disabled) {
  border-color: var(--sms-primary-hover);
  background: var(--sms-primary-hover);
}

.sms-log-header {
  padding-bottom: 14px;
}

.sms-log-toolbar {
  justify-content: flex-start;
  padding: 14px 20px;
  background: #fbfcfe;
}

.sms-search-field {
  width: min(320px, 100%);
}

.sms-log-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding-top: 19px;
}

.sms-error {
  margin: 0 20px 12px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 7px;
  background: #fff1f2;
  color: #b91c1c;
  font-size: 12px;
}

.sms-table-shell {
  width: 100%;
  min-height: 220px;
  overflow: auto;
}

.sms-log-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

.sms-log-table th,
.sms-log-table td {
  padding: 11px 14px;
  border-top: 1px solid #edf1f6;
  text-align: left;
}

.sms-log-table th {
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.sms-log-table th:nth-child(1) { width: 150px; }
.sms-log-table th:nth-child(2) { width: auto; }
.sms-log-table th:nth-child(3) { width: 120px; }
.sms-log-table th:nth-child(4) { width: 180px; }

.sms-log-table td {
  color: #334155;
  font-size: 13px;
}

.sms-log-table tbody tr:hover {
  background: #fbfdff;
}

.sms-phone,
.sms-time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sms-phone {
  color: #3157c8 !important;
  font-weight: 700;
}

.sms-content {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sms-time {
  color: #64748b !important;
}

.sms-status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.sms-status--success { background: #ecfdf3; color: #168454; }
.sms-status--danger { background: #fff1f2; color: #c2414b; }
.sms-status--pending { background: #fff7ed; color: #b45309; }

.sms-table-empty {
  height: 160px;
  color: #94a3b8 !important;
  text-align: center !important;
}

.sms-pagination {
  min-height: 54px;
  padding: 8px 20px;
  border-top: 1px solid #edf1f6;
  color: #64748b;
  font-size: 12px;
}

.sms-pagination > div {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid #dbe2ec;
  border-radius: 6px;
}

.sms-page-button {
  width: 38px;
  height: 32px;
  border: 0;
  border-right: 1px solid #e5eaf1;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  font-size: 17px;
}

.sms-page-button:last-child { border-right: 0; }
.sms-page-button.is-current { background: #f3f6ff; color: #3157c8; font-size: 13px; font-weight: 750; }
.sms-page-button:disabled { color: #cbd5e1; cursor: not-allowed; }
.sms-page-button:focus-visible { position: relative; outline: 2px solid #667eea; outline-offset: -2px; }

@media (max-width: 980px) {
  .sms-settings-content { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .sms-page-header,
  .sms-card__header,
  .sms-log-toolbar { align-items: stretch; flex-direction: column; }
  .sms-page-header .sms-button { width: 100%; }
  .sms-form-grid { grid-template-columns: 1fr; }
  .sms-log-actions { padding-top: 0; }
  .sms-log-actions .sms-button { flex: 1; }
  .sms-pagination { align-items: flex-start; flex-direction: column; }
}
