/* KONAS Lead Capture — Mobile-first UI */
:root {
  /* PT TIRTA MEDICAL INDONESIA */
  --primary: #0077B6;
  --primary-dark: #005a8c;
  --primary-light: #e8f4fc;
  --accent: #F48C06;
  --accent-red: #D90429;
  --danger: #D90429;
  --warning: #f59e0b;
  --success: #10b981;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(15, 76, 129, 0.08);
  --header-h: 64px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #f1f5f9; padding: 0.15em 0.4em; border-radius: 4px; font-size: 0.9em; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.header-inner { display: flex; align-items: center; min-height: var(--header-h); }
.brand {
  display: flex; align-items: center; gap: 0.75rem;
  color: inherit; text-decoration: none;
}
.brand:hover { text-decoration: none; opacity: 0.95; }
.brand-icon {
  width: 42px; height: 42px;
  background: rgba(255,255,255,.2);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.25rem;
}
.brand-icon.lg { width: 56px; height: 56px; font-size: 1.5rem; margin: 0 auto 1rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 1.1rem; }
.brand-text small { opacity: 0.85; font-size: 0.75rem; }

/* Hero */
.hero {
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--bg) 100%);
  padding: 2rem 0 1.5rem;
  text-align: center;
}
.hero h1 { margin: 0 0 0.5rem; font-size: clamp(1.5rem, 4vw, 2rem); color: var(--primary-dark); }
.hero p { margin: 0; color: var(--text-muted); max-width: 560px; margin-inline: auto; }

/* Forms */
.section-form { padding: 1.5rem 0 3rem; padding-bottom: calc(3rem + var(--safe-bottom)); }
.lead-form { max-width: 900px; margin: 0 auto; }
.form-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.form-section legend {
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0 0.25rem;
  color: var(--primary-dark);
}
.form-group { margin-bottom: 1rem; }
.form-group:last-child { margin-bottom: 0; }
.form-row {
  display: grid;
  gap: 1rem;
}
@media (min-width: 600px) {
  .form-row { grid-template-columns: 1fr 1fr; }
}
label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.35rem; }
.required { color: var(--danger); }
.hint { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 1rem; }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.15);
}
textarea { resize: vertical; min-height: 80px; }

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
@media (min-width: 480px) { .product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .product-grid { grid-template-columns: repeat(4, 1fr); gap: 1rem; } }

.product-card { cursor: pointer; position: relative; }
.product-card input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.product-card-inner {
  position: relative;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.product-card:active .product-card-inner { transform: scale(0.98); }
.product-card input:checked + .product-card-inner {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 168, 150, 0.2);
}
.product-card.is-selected .product-card-inner {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 168, 150, 0.2);
}
.product-image {
  position: relative;
  aspect-ratio: 4/3;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product-image img { width: 100%; height: 100%; object-fit: cover; }
.product-placeholder {
  color: #94a3b8;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.product-placeholder svg { width: 48px; height: 48px; }
.product-placeholder.sm { font-size: 0.75rem; min-height: 100px; }
.product-name {
  padding: 0.6rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  flex: 1;
}
.product-select-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border: 2px solid #cbd5e1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}
.product-select-btn:hover {
  border-color: var(--primary);
  transform: scale(1.08);
}
.product-select-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.product-select-icon {
  width: 14px;
  height: 14px;
  opacity: 0;
  transition: opacity 0.15s;
}
.product-select-btn[aria-pressed="true"] .product-select-icon {
  opacity: 1;
}
.product-view-hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: rgba(0, 90, 140, 0.72);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.product-view-hint svg {
  width: 28px;
  height: 28px;
}
.product-card:hover .product-view-hint,
.product-card:focus-within .product-view-hint {
  opacity: 1;
}
.check-indicator {
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.product-card input:checked + .product-card-inner .check-indicator { display: flex; }

.other-note-group { margin-top: 1rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--primary-light); text-decoration: none; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.btn-lg { padding: 0.9rem 1.5rem; font-size: 1.05rem; width: 100%; }
.btn-block { width: 100%; }
@media (min-width: 480px) { .btn-lg { width: auto; min-width: 220px; } }
.form-actions { text-align: center; margin-top: 1.5rem; }

/* Alerts */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* Success */
.section-success { padding: 3rem 1rem; }
.success-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  max-width: 480px;
  margin: 0 auto;
}
.success-icon {
  width: 72px; height: 72px;
  background: var(--success);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1.25rem;
}

/* Footer */
.site-footer {
  padding: 1.5rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.page-public { display: flex; flex-direction: column; min-height: 100dvh; }
.main-content { flex: 1; }

/* Admin */
.page-admin { background: #f1f5f9; min-height: 100dvh; }
.admin-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  height: 60px;
  background: #fff;
  color: var(--text);
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 3px solid var(--primary);
  box-shadow: 0 2px 12px rgba(0, 119, 182, 0.08);
}
.admin-brand {
  color: var(--primary-dark);
  font-weight: 700;
  text-decoration: none;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.admin-brand:hover { text-decoration: none; opacity: 0.9; }
.admin-brand-logo {
  height: 36px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}
.admin-brand-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}
.admin-user { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; }
.admin-user .btn-ghost { color: var(--primary); border-color: var(--border); }
.nav-toggle span { background: var(--primary-dark); }

.nav-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
}
@media (min-width: 900px) { .nav-toggle { display: none; } }

.admin-shell { display: flex; min-height: calc(100dvh - 56px); }
.admin-nav {
  position: fixed;
  left: 0; top: 56px;
  width: 260px;
  height: calc(100dvh - 56px);
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 1rem 0;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  z-index: 150;
  overflow-y: auto;
}
.admin-nav.open { transform: translateX(0); }
@media (min-width: 900px) {
  .admin-nav {
    position: sticky;
    transform: none;
    flex-shrink: 0;
  }
}
.nav-overlay {
  display: none;
  position: fixed;
  inset: 56px 0 0 0;
  background: rgba(0,0,0,.4);
  z-index: 140;
}
.nav-overlay.show { display: block; }
@media (min-width: 900px) { .nav-overlay { display: none !important; } }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.nav-link:hover { background: var(--bg); text-decoration: none; }
.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--accent);
  font-weight: 600;
}

.admin-main {
  flex: 1;
  padding: 1.25rem;
  min-width: 0;
  width: 100%;
}
@media (min-width: 900px) { .admin-main { padding: 1.5rem 2rem; } }

.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin: 0 0 0.25rem; font-size: 1.5rem; }
.page-header p { margin: 0; color: var(--text-muted); }
.page-header-flex {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-value { display: block; font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-muted); }
.stat-warning .stat-value { color: var(--warning); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.card-header h2 { margin: 0; font-size: 1.1rem; }
.card-form { max-width: 640px; }
.card-info h2 { margin-top: 0; }

.empty-state { color: var(--text-muted); text-align: center; padding: 2rem; }

/* Tables — responsive cards on mobile */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table th { font-weight: 600; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }

@media (max-width: 700px) {
  .data-table thead { display: none; }
  .data-table tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    background: #fff;
  }
  .data-table td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border: none;
    padding: 0.5rem 0.75rem;
  }
  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
  }
  .data-table td:empty::before { display: none; }
}

.badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.5rem 0; }
.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-muted { background: #f1f5f9; color: #64748b; }
.badge-info { background: #dbeafe; color: #1e40af; }

.product-admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 600px) { .product-admin-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .product-admin-grid { grid-template-columns: repeat(3, 1fr); } }

.product-admin-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.product-admin-image {
  aspect-ratio: 16/10;
  background: #f1f5f9;
  overflow: hidden;
}
.product-admin-image img { width: 100%; height: 100%; object-fit: cover; }
.product-admin-body { padding: 1rem; }
.product-admin-body h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.meta { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 0.75rem; }
.card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.inline-form { display: inline; }

.current-image { margin-bottom: 0.75rem; }
.current-image img { max-width: 200px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.current-brochure { margin-bottom: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }
.current-brochure a { color: var(--primary); font-weight: 500; }
.remove-brochure { font-size: 0.9rem; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  padding-top: 1.75rem;
}
.checkbox-label input { width: auto; }

.detail-grid {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 768px) { .detail-grid { grid-template-columns: 1fr 1fr; } }
.detail-list { margin: 0; }
.detail-list dt { font-weight: 600; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.75rem; }
.detail-list dt:first-child { margin-top: 0; }
.detail-list dd { margin: 0.15rem 0 0; }
.product-list-detail { list-style: none; padding: 0; margin: 0; }
.product-list-detail li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.other-note { margin-top: 1rem; padding: 0.75rem; background: var(--primary-light); border-radius: var(--radius-sm); }

.setup-steps { padding-left: 1.25rem; }
.setup-steps li { margin-bottom: 0.5rem; }
.migration-info p { margin: 0.25rem 0; }
.migration-run { margin-top: 1rem; }

/* Login */
.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(160deg, var(--primary-light) 0%, #fff 40%, var(--primary) 100%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.login-header { text-align: center; margin-bottom: 1.5rem; }
.login-logo {
  height: 48px;
  width: auto;
  max-width: 200px;
  margin: 0 auto 1rem;
  object-fit: contain;
}
.login-header h1 { margin: 0 0 0.25rem; font-size: 1.5rem; color: var(--primary-dark); }
.login-header p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.login-tagline {
  font-family: 'Kaushan Script', cursive;
  color: var(--accent-red, #D90429) !important;
  font-size: 1rem !important;
}
.login-hint { font-size: 0.8rem; color: var(--text-muted); text-align: center; margin: 1rem 0 0; }
.back-link { display: block; text-align: center; margin-top: 1rem; font-size: 0.9rem; }

/* ——— Admin: Pengaturan WhatsApp ——— */
.page-settings .admin-main { max-width: 1100px; }
.settings-page-header { margin-bottom: 1.5rem; }
.settings-page-header h1 { margin: 0 0 0.25rem; }
.page-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 400;
}
.settings-alert {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}
.settings-alert p { margin: 0.25rem 0 0; font-size: 0.9rem; }
.settings-alert-icon { font-size: 1.25rem; flex-shrink: 0; }

.settings-layout {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}
@media (min-width: 960px) {
  .settings-layout {
    grid-template-columns: 1fr min(320px, 34%);
  }
}

.settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.settings-card:last-child { margin-bottom: 0; }
.settings-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, var(--primary-light) 0%, #fff 100%);
  border-bottom: 1px solid var(--border);
}
.settings-card-head--compact {
  padding: 1rem 1.25rem;
  background: #f8fafc;
}
.settings-card-head h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--primary-dark);
}
.settings-card-head p {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}
.settings-card-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 119, 182, 0.08);
}
.settings-card-icon--wa {
  background: #25D366;
  color: #fff;
  border-color: #1da851;
}
.settings-card-icon--test {
  background: var(--primary-light);
  color: var(--primary);
}
.settings-card-body {
  padding: 1.25rem 1.5rem 1.5rem;
}
.settings-card-body .form-group { margin-bottom: 1.25rem; }
.settings-card-body .form-group:last-child { margin-bottom: 0; }

.settings-form-row-2 {
  margin-top: 0.25rem;
}
@media (min-width: 600px) {
  .settings-form-row-2 { grid-template-columns: 1fr 1fr; }
}

.field-hint {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.field-hint--ok {
  color: var(--success);
  font-weight: 500;
}
.optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.settings-input {
  background: #f8fafc;
}
.settings-input:focus {
  background: #fff;
}
.settings-input--mono {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.85rem;
}

.settings-toggle-row {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px dashed var(--border);
}
.settings-toggle {
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  user-select: none;
}
.settings-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.settings-toggle-track {
  flex-shrink: 0;
  width: 52px;
  height: 28px;
  background: #cbd5e1;
  border-radius: 999px;
  position: relative;
  transition: background 0.2s;
}
.settings-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s;
}
.settings-toggle input:checked + .settings-toggle-track {
  background: #25D366;
}
.settings-toggle input:checked + .settings-toggle-track::after {
  transform: translateX(24px);
}
.settings-toggle input:focus-visible + .settings-toggle-track {
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.35);
}
.settings-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.settings-toggle-text strong {
  font-size: 0.95rem;
  color: var(--text);
}
.settings-toggle-text small {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

.settings-api-badge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.75rem 1rem;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.settings-api-badge-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.settings-api-badge code {
  font-size: 0.78rem;
  word-break: break-all;
  background: transparent;
  padding: 0;
  color: var(--primary-dark);
}

.settings-url-preview {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.settings-url-preview-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.settings-url-preview code {
  display: block;
  font-size: 0.75rem;
  word-break: break-all;
  line-height: 1.45;
  background: transparent;
  padding: 0;
  color: var(--text);
}

.settings-placeholders {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.settings-placeholders-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.settings-tag {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: ui-monospace, monospace;
  padding: 0.2rem 0.5rem;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 6px;
  border: 1px solid rgba(0, 119, 182, 0.15);
}

.settings-form-footer {
  padding-top: 0.25rem;
}
.settings-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  justify-content: center;
}
@media (min-width: 480px) {
  .settings-save-btn { width: auto; min-width: 220px; }
}

.settings-aside {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.settings-card--test .settings-test-form {
  padding: 0 1.25rem 1.25rem;
}
.settings-card--test .settings-card-head--compact {
  margin-bottom: 0;
}
.settings-test-btn {
  width: 100%;
  justify-content: center;
  border: 1.5px dashed var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.settings-test-btn:hover {
  background: var(--primary-light);
  text-decoration: none;
}

.settings-card--log .settings-card-head--compact h2 {
  margin: 0;
  font-size: 0.95rem;
}
.settings-log {
  margin: 0 1.25rem 1.25rem;
  padding: 0.875rem 1rem;
  font-size: 0.72rem;
  line-height: 1.5;
  overflow: auto;
  max-height: 180px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, monospace;
}

.page-settings .card-form { max-width: none; }
