/* ===== WhatsApp Gateway — Shared Styles ===== */
@property --border-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

:root {
  --bg: #0f1419;
  --bg-card: #1a2332;
  --bg-input: #111827;
  --border: #2d3748;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --primary: #25d366;
  --primary-dark: #128c7e;
  --primary-glow: rgba(37, 211, 102, 0.25);
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #22c55e;
  --info: #3b82f6;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  --card-glass: rgba(26, 35, 50, 0.72);
  --card-border-glow: rgba(37, 211, 102, 0.12);
  --radius-lg: 16px;
  --surface-hover: rgba(255, 255, 255, 0.03);
  --code-bg: #0d1117;
  --code-block-bg: #1a1f2e;
  --schema-th-bg: #141824;
  --dialog-surface: linear-gradient(165deg, #1e2a3d 0%, #151c28 100%);
  --dialog-overlay-bg: rgba(8, 12, 18, 0.72);
  --dialog-inset: rgba(255, 255, 255, 0.04);
  --bg-gradient-1: rgba(37, 211, 102, 0.06);
  --bg-gradient-2: rgba(18, 140, 126, 0.06);
  --syntax-key: #79c0ff;
  --syntax-string: #a5d6ff;
  --syntax-number: #ffa657;
  --syntax-boolean: #ff7b72;
  --syntax-null: #8b949e;
  --hl-key: #e2e8f0;
  --hl-string: #7ee787;
  --hl-number: #79c0ff;
  --hl-boolean: #ff7b72;
  --hl-null: #8b949e;
  --example-val: #7ee787;
  --code-2xx-fg: #7ee787;
  --code-4xx-fg: #fbbf24;
  --code-5xx-fg: #f87171;
  --nav-path-active: rgba(37, 211, 102, 0.75);
  --btn-on-primary: #fff;
  --scrollbar-size: 10px;
  --scrollbar-track: rgba(37, 211, 102, 0.1);
  --scrollbar-thumb: var(--primary);
  --scrollbar-thumb-hover: var(--primary-dark);
  --grid-line: rgba(255, 255, 255, 0.025);
  --surface: #1a2332;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #eef2f7;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --border: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary-glow: rgba(37, 211, 102, 0.22);
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
  --surface-hover: rgba(15, 23, 42, 0.04);
  --code-bg: #f1f5f9;
  --code-block-bg: #f8fafc;
  --schema-th-bg: #e2e8f0;
  --dialog-surface: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
  --dialog-overlay-bg: rgba(15, 23, 42, 0.45);
  --dialog-inset: rgba(15, 23, 42, 0.04);
  --bg-gradient-1: rgba(37, 211, 102, 0.08);
  --bg-gradient-2: rgba(18, 140, 126, 0.06);
  --syntax-key: #0369a1;
  --syntax-string: #15803d;
  --syntax-number: #c2410c;
  --syntax-boolean: #dc2626;
  --syntax-null: #64748b;
  --hl-key: #0f172a;
  --hl-string: #15803d;
  --hl-number: #0369a1;
  --hl-boolean: #dc2626;
  --hl-null: #64748b;
  --example-val: #15803d;
  --code-2xx-fg: #15803d;
  --code-4xx-fg: #b45309;
  --code-5xx-fg: #dc2626;
  --nav-path-active: #128c7e;
  --btn-on-primary: #fff;
  --card-glass: rgba(255, 255, 255, 0.88);
  --card-border-glow: rgba(37, 211, 102, 0.2);
  --grid-line: rgba(15, 23, 42, 0.045);
  --scrollbar-track: rgba(37, 211, 102, 0.14);
  --surface: #ffffff;
  color-scheme: light;
}

[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse at 20% 20%, var(--bg-gradient-1) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, var(--bg-gradient-2) 0%, transparent 50%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  transition: background-color 0.35s ease, color 0.35s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* Default scrollbar — hijau (Firefox + WebKit) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--scrollbar-thumb), var(--scrollbar-thumb-hover));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb);
}

*::-webkit-scrollbar-corner {
  background: var(--scrollbar-track);
}

/* Background pattern */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 20%, var(--bg-gradient-1) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, var(--bg-gradient-2) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.45s ease;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 20%, transparent 100%);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  position: relative;
  z-index: 1;
}

.container.wide {
  max-width: 1200px;
}

/* Halaman Template WA — lebar penuh area konten */
.wa-page-content {
  max-width: none;
  width: 100%;
  padding: 0 0.75rem 1rem;
}

@media (min-width: 901px) {
  .wa-page-content {
    padding-left: 1rem;
    padding-right: 1rem;
    padding-bottom: 1.25rem;
  }
}

/* Header & Brand */
.header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 0.5rem;
}

.brand-mark {
  margin-bottom: 0.85rem;
}

.brand-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow:
    0 8px 28px var(--primary-glow),
    0 0 0 1px var(--card-border-glow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.brand-mark:hover .brand-logo {
  transform: translateY(-2px) scale(1.03);
}

.brand-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-dark);
  background: rgba(37, 211, 102, 0.12);
  border: 1px solid var(--card-border-glow);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  margin-bottom: 0.65rem;
}

.brand-badge--sm {
  font-size: 0.62rem;
  margin-bottom: 0.35rem;
  display: inline-block;
}

.brand-title {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary) 120%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .brand-title {
  background: linear-gradient(135deg, #0f172a 0%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Brand gradient — sidebar & login */
.sidebar-brand-text strong,
.login-brand-text strong {
  background: linear-gradient(135deg, var(--text) 0%, var(--primary) 52%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-brand-text span,
.login-brand-text span {
  background: linear-gradient(135deg, var(--text-muted) 0%, #3dd68c 65%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .sidebar-brand-text strong,
[data-theme="light"] .login-brand-text strong {
  background: linear-gradient(135deg, #0f172a 0%, #128c7e 48%, #25d366 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .sidebar-brand-text span,
[data-theme="light"] .login-brand-text span {
  background: linear-gradient(135deg, #64748b 0%, #128c7e 72%, #1a9f5c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle,
.header p {
  color: var(--text-muted);
  margin-top: 0.35rem;
  font-size: 0.92rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.header-brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 4px 16px var(--primary-glow);
  flex-shrink: 0;
}

.header-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 20px var(--primary-glow);
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Nav links */
.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-wrap: nowrap;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 0.22s ease;
  background: transparent;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-link:hover:not(.active) {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--surface-hover);
}

.nav-link.active {
  color: var(--btn-on-primary);
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 4px 16px var(--primary-glow);
}

/* Dashboard grid */
.dash-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Cards */
.card {
  position: relative;
  background: var(--card-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 0;
  transition:
    background-color 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease,
    transform 0.25s ease;
  overflow: hidden;
  isolation: isolate;
}

/* Border hijau berputar — card interaktif */
.card-interactive {
  --border-angle: 0deg;
  border-color: transparent;
}

.card-interactive::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(
    from var(--border-angle),
    transparent 0deg,
    transparent 220deg,
    var(--primary-dark) 265deg,
    var(--primary) 295deg,
    #6ee7a0 320deg,
    transparent 360deg
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  animation: card-border-spin 3.5s linear infinite;
  pointer-events: none;
  z-index: 0;
  opacity: 0.9;
}

.card-interactive > * {
  position: relative;
  z-index: 1;
}

@keyframes card-border-spin {
  to {
    --border-angle: 360deg;
  }
}

.card-interactive:hover {
  box-shadow: var(--shadow), 0 0 24px var(--primary-glow);
}

.card-interactive:hover::before {
  opacity: 1;
  padding: 2.5px;
}

.card-auth {
  background: linear-gradient(180deg, var(--card-glass) 0%, var(--bg-card) 100%);
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card-title--header-action {
  justify-content: space-between;
}

.card-title-main {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.status-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card-title-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(37, 211, 102, 0.1);
  color: var(--primary);
  border: 1px solid var(--card-border-glow);
}

.card-title-icon svg {
  width: 16px;
  height: 16px;
}

.card-title-icon--wa {
  background: rgba(37, 211, 102, 0.15);
}

.card-title-icon--status {
  color: var(--info);
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.2);
}

.card-title-icon--info {
  color: var(--warning);
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.2);
}

.card-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-badge .pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.status-connected {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-connected .pulse {
  background: var(--success);
}

.status-disconnected,
.status-error {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-disconnected .pulse,
.status-error .pulse {
  background: var(--danger);
}

.status-connecting,
.status-reconnecting,
.status-waiting_for_qr {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-connecting .pulse,
.status-reconnecting .pulse,
.status-waiting_for_qr .pulse {
  background: var(--warning);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* QR Section */
.qr-section {
  text-align: center;
  padding: 1rem 0;
}

.qr-wrapper {
  display: inline-block;
  background: #fff;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(37, 211, 102, 0.2);
  margin: 1rem 0;
  position: relative;
}

.qr-wrapper::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--radius-lg) + 2px);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  z-index: -1;
  opacity: 0.35;
}

.qr-wrapper img {
  display: block;
  width: 240px;
  height: 240px;
}

.qr-hint {
  color: var(--text-muted);
  font-size: 0.875rem;
  max-width: 320px;
  margin: 0 auto;
}

.connected-message {
  text-align: center;
  padding: 2rem 1rem;
}

.connected-message h3 {
  color: var(--success);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}

.connected-message h3.wa-status-title--muted {
  color: var(--text);
}

.wa-phone-badge {
  display: inline-block;
  background: rgba(37, 211, 102, 0.12);
  color: var(--primary);
  border: 1px solid var(--card-border-glow);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0.4rem 0 0.8rem;
  letter-spacing: 0.02em;
}

.connected-message p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.55;
}

.connected-actions {
  margin-top: 1.25rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.connected-actions .btn {
  min-width: 180px;
}

/* WhatsApp status icon — connected / loading */
.wa-status-icon {
  position: relative;
  width: 88px;
  height: 88px;
  margin: 0 auto 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wa-status-badge {
  position: relative;
  z-index: 2;
  width: 72px;
  height: 72px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow:
    0 10px 32px var(--primary-glow),
    0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}

.wa-status-badge--muted {
  background: var(--bg-input);
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--primary);
}

.wa-status-icon--connected .wa-status-badge {
  color: #fff;
}

.wa-check-svg {
  width: 52px;
  height: 52px;
}

.wa-check-circle {
  opacity: 0.35;
  transform-origin: center;
}

.wa-check-path {
  stroke: #fff;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
}

.connected-message.wa-replay .wa-check-path {
  stroke-dashoffset: 48;
  animation: wa-check-draw 0.55s cubic-bezier(0.65, 0, 0.45, 1) 0.15s forwards;
}

.connected-message.wa-replay .wa-check-circle {
  animation: wa-circle-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes wa-check-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes wa-circle-pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 0.35; }
}

.wa-status-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--primary);
  opacity: 0;
  animation: wa-status-pulse 2.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.wa-status-pulse--delay {
  animation-delay: 1.2s;
}

@keyframes wa-status-pulse {
  0% {
    transform: scale(0.82);
    opacity: 0.55;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

.wa-spinner-svg {
  width: 44px;
  height: 44px;
  animation: wa-spin 1s linear infinite;
}

@keyframes wa-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .wa-status-pulse,
  .wa-spinner-svg,
  .wa-check-path,
  .wa-check-circle,
  .card-interactive::before {
    animation: none !important;
  }

  .card-interactive {
    border-color: var(--border);
  }

  .card-interactive::before {
    opacity: 0;
  }

  .wa-check-path {
    stroke-dashoffset: 0;
  }
}

/* Legacy — keep if referenced elsewhere */
.connected-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--btn-on-primary);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-secondary:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.25);
}

.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* Form elements */
.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* JSON Viewer */
.json-viewer {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.7;
  overflow-x: auto;
  max-height: 320px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.json-viewer.empty {
  color: var(--text-muted);
  font-style: italic;
  font-family: var(--font);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 140px;
  text-align: center;
  padding: 2rem 1rem;
}

.json-key { color: var(--syntax-key); }
.json-string { color: var(--syntax-string); }
.json-number { color: var(--syntax-number); }
.json-boolean { color: var(--syntax-boolean); }
.json-null { color: var(--syntax-null); }

/* Grid layout for API tester */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

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

  .container {
    padding: 1.25rem 1rem;
  }

  .header h1 {
    font-size: 1.4rem;
  }
}

/* Endpoint tabs */
.endpoint-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--mono);
  transition: all 0.2s;
}

.tab-btn.active {
  background: rgba(37, 211, 102, 0.12);
  border-color: var(--primary);
  color: var(--primary);
}

.method-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-right: 0.35rem;
}

.method-post { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.method-get { background: rgba(59, 130, 246, 0.2); color: var(--info); }

/* Footer */
.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.footer-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(37, 211, 102, 0.12);
  color: var(--primary-dark);
  border: 1px solid var(--card-border-glow);
}

/* Info list — dashboard */
.info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
  transition: border-color 0.2s, background 0.2s;
}

.info-item:hover {
  border-color: var(--card-border-glow);
  background: rgba(37, 211, 102, 0.05);
}

.info-item-icon {
  font-size: 1.1rem;
  line-height: 1.4;
  flex-shrink: 0;
}

.inline-code {
  font-family: var(--mono);
  font-size: 0.82em;
  color: var(--primary-dark);
  background: rgba(37, 211, 102, 0.1);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.text-link {
  color: var(--primary-dark);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.text-link:hover {
  border-bottom-color: var(--primary);
}

.api-page .card {
  margin-bottom: 1.25rem;
}

.api-page .api-main .card {
  margin-bottom: 0;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}

/* Header compact — API Tester, Terminal, dll. */
.header-compact {
  text-align: left;
  margin-bottom: 1.25rem;
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.header-compact h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  -webkit-text-fill-color: unset;
  background: none;
  color: var(--text);
}

.header-brand h1 {
  margin-top: 0.15rem;
}

.header-compact p {
  margin-top: 0.15rem;
  font-size: 0.88rem;
}

.header-compact .nav-links {
  margin-top: 0;
  justify-content: flex-end;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.header-compact .nav-link {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Connection bar */
.connection-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.connection-wa-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 211, 102, 0.12);
  color: var(--primary);
  border: 1px solid var(--card-border-glow);
  flex-shrink: 0;
}

.connection-wa-icon svg {
  width: 18px;
  height: 18px;
}

.connection-bar-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.connection-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.connection-bar-actions {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

.qr-mini {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.65rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.qr-mini-frame {
  background: #fff;
  padding: 3px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.qr-mini img {
  display: block;
  width: 52px;
  height: 52px;
  border-radius: 4px;
}

.qr-mini-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Layout */
.api-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.api-main {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.api-sidebar {
  padding: 0;
  overflow: hidden;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
}

.sidebar-head {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.endpoint-count {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(37, 211, 102, 0.12);
  border: 1px solid var(--card-border-glow);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-family: var(--mono);
}

.sidebar-search-wrap {
  position: relative;
}

.sidebar-search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.sidebar-search {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.82rem;
  font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sidebar-search::placeholder {
  color: var(--text-muted);
}

.sidebar-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.endpoint-nav {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex: 1;
}

.nav-group {
  border-bottom: 1px solid var(--border);
}

.nav-group:last-child {
  border-bottom: none;
}

.nav-group-label {
  padding: 0.55rem 1rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.nav-group-label.tag-wa {
  color: var(--primary);
}

.nav-group-label.tag-hris {
  color: var(--warning);
}

.nav-empty {
  padding: 1.25rem 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0.75rem 1rem;
  border: none;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.nav-item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 1.5rem;
}

.nav-label {
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  color: inherit;
  line-height: 1.3;
  flex: 1;
}

.nav-item.active .nav-label {
  color: var(--text);
}

.nav-path {
  display: block;
  width: 100%;
  padding-left: 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--text-muted);
  opacity: 0.85;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.nav-item.active .nav-path {
  color: var(--nav-path-active);
  opacity: 1;
}

.nav-item-row .method-badge {
  flex-shrink: 0;
}

.nav-item:last-child {
  border-bottom: none;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(37, 211, 102, 0.14), rgba(37, 211, 102, 0.06));
  color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
}

.api-fade-in {
  animation: apiFadeIn 0.28s ease-out;
}

@keyframes apiFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Endpoint doc */
.endpoint-doc {
  padding: 0;
  overflow: hidden;
  min-width: 0;
}

.endpoint-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  word-wrap: break-word;
}

.tag-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--info);
  background: rgba(59, 130, 246, 0.12);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.tag-badge.tag-wa {
  color: var(--primary);
  background: rgba(37, 211, 102, 0.12);
  border-color: var(--card-border-glow);
}

.tag-badge.tag-hris {
  color: var(--warning);
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.25);
}

.endpoint-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.method-lg {
  font-size: 0.85rem !important;
  padding: 0.35rem 0.65rem !important;
}

.endpoint-path {
  font-family: var(--mono);
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 600;
  word-break: break-all;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.endpoint-summary {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0.5rem 0 0.35rem;
}

.endpoint-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.65;
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
}

.endpoint-alt-paths {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.endpoint-alt-paths code {
  font-size: 0.8rem;
}

.doc-section {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  min-width: 0;
  overflow: hidden;
}

.doc-section:last-child {
  border-bottom: none;
}

.doc-heading {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
  color: var(--text);
}

.api-page .card {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.content-type {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  overflow-wrap: break-word;
  word-break: break-word;
}

.no-params {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Code tabs — Example Value | Schema */
.code-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}

.code-tab {
  padding: 0.45rem 0.85rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}

.code-tab:hover {
  color: var(--text);
}

.code-tab.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

/* Code block — Swagger dark style */
.code-block {
  background: var(--code-block-bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  overflow-x: auto;
  max-width: 100%;
}

.code-pre {
  margin: 0;
  padding: 1rem 1.15rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.code-pre .hl-key,
.code-pre .hl-string,
.code-pre .hl-number,
.code-pre .hl-boolean,
.code-pre .hl-null {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Swagger-like syntax colors */
.hl-key { color: var(--hl-key); }
.hl-string { color: var(--hl-string); }
.hl-number { color: var(--hl-number); }
.hl-boolean { color: var(--hl-boolean); }
.hl-null { color: var(--hl-null); }

/* Schema table */
.schema-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
  table-layout: fixed;
}

.schema-table th,
.schema-table td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.schema-table th {
  background: var(--schema-th-bg);
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.schema-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-muted);
}

.schema-table tr:last-child td {
  border-bottom: none;
}

.schema-table code {
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.example-val {
  color: var(--example-val) !important;
  white-space: pre-wrap;
  word-break: break-word;
}

.req {
  color: var(--danger);
  font-size: 0.72rem;
  font-weight: 600;
}

.type-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--info);
  background: rgba(59, 130, 246, 0.12);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-family: var(--mono);
}

/* Responses */
.response-item {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.response-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.response-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.response-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.5;
}

.http-code {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  min-width: 3rem;
  text-align: center;
}

.code-2xx { background: rgba(34, 197, 94, 0.18); color: var(--code-2xx-fg); }
.code-4xx { background: rgba(245, 158, 11, 0.18); color: var(--code-4xx-fg); }
.code-5xx { background: rgba(239, 68, 68, 0.18); color: var(--code-5xx-fg); }
.code-err { background: rgba(239, 68, 68, 0.18); color: var(--code-5xx-fg); }

/* Try it out */
.try-section {
  margin-top: 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-icon svg {
  width: 14px;
  height: 14px;
}

.section-icon--play {
  background: rgba(37, 211, 102, 0.12);
  color: var(--primary);
  border: 1px solid var(--card-border-glow);
}

.section-icon--response {
  background: rgba(59, 130, 246, 0.12);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.section-header h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.try-section-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0;
  font-weight: 400;
}

.try-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.api-try-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.api-try-meta span {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(37, 211, 102, 0.08);
  border: 1px solid rgba(37, 211, 102, 0.15);
}

.api-try-fields {
  display: grid;
  gap: 0.75rem;
}

.api-try-empty {
  padding: 0.5rem 0;
}

.api-field-card {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
  transition: border-color 0.15s ease;
}

.api-field-card.is-required {
  border-left: 3px solid var(--primary);
}

.api-field-card.is-json {
  grid-column: 1 / -1;
}

.api-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.api-field-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.api-field-req {
  color: var(--danger);
  font-weight: 700;
}

.api-field-type {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  background: rgba(37, 211, 102, 0.1);
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
}

.api-field-key {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.api-field-control {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
}

.api-field-control--code {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.45;
  min-height: 6rem;
}

.api-field-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.api-field-control--error {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2) !important;
}

.api-field-tools {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.35rem;
}

.api-field-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}

@media (min-width: 720px) {
  .api-try-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.section-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(37, 211, 102, 0.12);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(37, 211, 102, 0.25);
}

.try-url {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1rem;
  flex-wrap: nowrap;
  max-width: 100%;
  overflow: hidden;
}

.try-url-path,
.try-url code {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text);
  word-break: break-all;
  overflow-wrap: anywhere;
  flex: 1;
  min-width: 0;
  line-height: 1.5;
}

.execute-row {
  display: flex;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.btn-execute {
  flex: 1;
  padding: 0.85rem 1.25rem;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.btn-icon {
  gap: 0.3rem;
  white-space: nowrap;
}

.btn-icon svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.btn-icon-only {
  padding: 0.4rem;
  min-width: 0;
  min-height: 34px;
  width: 34px;
  justify-content: center;
}

.btn-sm.btn-icon:not(.btn-icon-only) {
  padding: 0.35rem 0.65rem;
  min-height: 34px;
  font-size: 0.78rem;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 0.35rem 0.55rem;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--primary);
  background: var(--surface-hover);
  border-color: var(--border);
}

.btn-ghost.copied,
.btn-secondary.copied {
  color: var(--success);
  border-color: var(--success);
}

.response-card .code-tabs {
  margin: 0 -1.5rem;
  padding: 0 1.5rem;
}

.api-page .try-section,
.api-page .response-card {
  padding: 1.25rem 1.5rem;
}

.empty-state-icon {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--border);
  font-style: normal;
  line-height: 1;
}

.footer-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--primary);
  background: rgba(37, 211, 102, 0.1);
  border: 1px solid var(--card-border-glow);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.response-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.response-time {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--mono);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}

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

@media (max-width: 900px) {
  .api-layout {
    grid-template-columns: 1fr;
  }

  .api-sidebar {
    position: static;
  }
}

/* ===== Mobile / HP ===== */
@media (max-width: 640px) {
  .container {
    padding: 1rem max(0.875rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-bottom)) max(0.875rem, env(safe-area-inset-right));
  }

  .app-page-content {
    padding-top: 0;
  }

  .card {
    padding: 1rem;
    margin-bottom: 1rem;
    overflow: hidden;
  }

  .status-badge {
    max-width: 100%;
    word-break: break-word;
  }

  .header {
    margin-bottom: 1.5rem;
  }

  .header h1 {
    font-size: 1.35rem;
  }

  .header p {
    font-size: 0.875rem;
  }

  .header-icon {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
  }

  .btn {
    min-height: 44px;
  }

  .btn-icon-only,
  .btn-ghost.btn-sm {
    min-height: 34px;
    min-width: 34px;
  }

  .btn-sm {
    min-height: 40px;
    padding: 0.5rem 0.75rem;
  }

  .status-row {
    flex-direction: column;
    align-items: stretch;
  }

  .status-row .btn {
    width: 100%;
  }

  /* API Tester header */
  .header-compact .header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .header-compact h1 {
    font-size: 1.25rem;
  }

  .header-compact .nav-links {
    width: 100%;
    justify-content: stretch;
    gap: 0.5rem;
  }

  .header-compact .nav-link {
    flex: 1;
    text-align: center;
    padding: 0.55rem 0.5rem;
  }

  .header-compact .nav-link-btn-icon {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
  }

  .nav-links .nav-link-btn-icon {
    flex: 0 0 auto;
  }

  /* Connection bar — baris penuh, tombol tidak terpotong */
  .connection-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 1rem;
  }

  .connection-bar-left {
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
  }

  .connection-bar-actions {
    margin-left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .connection-bar-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .qr-mini {
    width: 100%;
    justify-content: center;
    padding: 0.5rem 0;
  }

  /* Endpoint doc */
  .endpoint-header,
  .doc-section {
    padding: 1rem;
  }

  .endpoint-path {
    font-size: 0.9rem;
  }

  .endpoint-summary {
    font-size: 1.05rem;
  }

  .endpoint-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .section-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .try-url {
    flex-wrap: wrap;
  }

  .try-url .method-badge {
    align-self: flex-start;
  }

  .execute-row {
    flex-direction: column;
  }

  .execute-row .btn-secondary {
    width: 100%;
  }

  .api-sidebar {
    max-height: none;
  }

  .api-page .try-section,
  .api-page .response-card {
    padding: 1rem;
  }

  .response-card .code-tabs {
    margin: 0 -1rem;
    padding: 0 1rem;
  }

  /* Schema table — scroll horizontal */
  .doc-section {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .schema-table {
    min-width: 520px;
    font-size: 0.78rem;
  }

  .schema-table th,
  .schema-table td {
    padding: 0.5rem 0.6rem;
  }

  .code-pre {
    font-size: 0.78rem;
    padding: 0.85rem;
  }

  .json-viewer {
    font-size: 0.78rem;
    max-height: 280px;
  }

  .response-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-item {
    padding: 0.75rem 0.85rem;
  }

  .nav-path {
    font-size: 0.65rem;
  }

  .qr-wrapper img {
    width: min(240px, 70vw);
    height: min(240px, 70vw);
  }

  .footer {
    font-size: 0.75rem;
    margin-top: 1.5rem;
  }
}

@media (max-width: 380px) {
  .connection-bar-actions {
    grid-template-columns: 1fr;
  }

  .status-badge {
    font-size: 0.8rem;
    padding: 0.45rem 0.75rem;
  }
}

/* ===== CBI Dialog (custom SweetAlert) ===== */
body.cbi-dialog-open {
  overflow: hidden;
}

.cbi-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  padding: max(1.25rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
  background: var(--dialog-overlay-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.cbi-dialog-overlay.cbi-dialog-show {
  opacity: 1;
}

.cbi-dialog-overlay.cbi-dialog-hide {
  opacity: 0;
}

.cbi-dialog {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--dialog-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem 1.5rem 1.35rem;
  box-shadow:
    var(--shadow),
    0 0 0 1px var(--dialog-inset) inset;
  text-align: center;
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
  outline: none;
}

.cbi-dialog-show .cbi-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.cbi-dialog-hide .cbi-dialog {
  transform: scale(0.95) translateY(8px);
  opacity: 0;
}

.cbi-dialog-glow {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 80px;
  background: radial-gradient(ellipse, var(--primary-glow) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.6;
}

.cbi-dialog-icon-wrap {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.cbi-dialog-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.cbi-dialog-icon-warning {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.15);
}

.cbi-dialog-icon-danger {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.15);
}

.cbi-dialog-icon-success {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.12);
  box-shadow: 0 0 24px rgba(37, 211, 102, 0.2);
}

.cbi-dialog-icon-error {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
}

.cbi-dialog-icon-info {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.12);
}

.cbi-dialog-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.cbi-dialog-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.35rem;
}

.cbi-dialog-actions {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
}

.cbi-dialog-btn {
  flex: 1;
  min-height: 44px;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.cbi-dialog-btn:active {
  transform: scale(0.98);
}

.cbi-dialog-btn-cancel {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
}

.cbi-dialog-btn-cancel:hover {
  border-color: var(--text-muted);
  background: var(--surface-hover);
}

.cbi-dialog-btn-confirm.cbi-dialog-btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--btn-on-primary);
  box-shadow: 0 4px 16px var(--primary-glow);
}

.cbi-dialog-btn-confirm.cbi-dialog-btn-primary:hover {
  box-shadow: 0 6px 20px var(--primary-glow);
}

.cbi-dialog-btn-confirm.cbi-dialog-btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: var(--btn-on-primary);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.cbi-dialog-btn-confirm.cbi-dialog-btn-danger:hover {
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

@media (max-width: 380px) {
  .cbi-dialog-actions {
    flex-direction: column-reverse;
  }

  .cbi-dialog-btn {
    width: 100%;
  }
}

/* ===== Theme toggle ===== */
.theme-toggle {
  --toggle-sun: #fbbf24;
  --toggle-moon: #818cf8;
  --toggle-glow: rgba(251, 191, 36, 0.35);

  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  z-index: 100;
  width: 46px;
  height: 46px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle-track {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition:
    background-color 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease,
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toggle:hover .theme-toggle-track {
  border-color: var(--primary);
  transform: scale(1.06);
  box-shadow: 0 6px 24px var(--primary-glow);
}

.theme-toggle:active .theme-toggle-track {
  transform: scale(0.94);
}

.theme-toggle-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--primary);
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
}

.theme-toggle.is-pulsing .theme-toggle-ring {
  animation: theme-ring-pulse 0.52s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes theme-ring-pulse {
  0% {
    opacity: 0.75;
    transform: scale(0.85);
  }
  100% {
    opacity: 0;
    transform: scale(1.45);
  }
}

.theme-toggle-icons {
  position: relative;
  width: 22px;
  height: 22px;
}

.theme-icon {
  position: absolute;
  inset: 0;
  width: 22px;
  height: 22px;
  transition:
    transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.35s ease;
}

.theme-icon-sun {
  color: var(--toggle-sun);
  filter: drop-shadow(0 0 6px var(--toggle-glow));
}

.theme-icon-moon {
  color: var(--toggle-moon);
  filter: drop-shadow(0 0 6px rgba(129, 140, 248, 0.45));
}

/* Dark mode — tampilkan matahari (aksi: ke light) */
html:not([data-theme="light"]) .theme-icon-sun {
  transform: rotate(0deg) scale(1);
  opacity: 1;
}

html:not([data-theme="light"]) .theme-icon-moon {
  transform: rotate(-120deg) scale(0.2);
  opacity: 0;
}

/* Light mode — tampilkan bulan (aksi: ke dark) */
[data-theme="light"] .theme-toggle {
  --toggle-glow: rgba(129, 140, 248, 0.35);
}

[data-theme="light"] .theme-icon-sun {
  transform: rotate(120deg) scale(0.2);
  opacity: 0;
}

[data-theme="light"] .theme-icon-moon {
  transform: rotate(0deg) scale(1);
  opacity: 1;
}

[data-theme="light"] .theme-toggle-track {
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.1);
}

/* Transisi global saat ganti tema */
@media (prefers-reduced-motion: no-preference) {
  html.theme-transitioning *,
  html.theme-transitioning *::before,
  html.theme-transitioning *::after {
    transition-duration: 0.42s !important;
    transition-timing-function: ease !important;
    transition-property:
      background-color,
      background,
      border-color,
      color,
      fill,
      stroke,
      box-shadow,
      opacity !important;
  }

  html.theme-transitioning .theme-icon {
    transition-property: transform, opacity, color, filter !important;
    transition-duration: 0.55s !important;
    transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  }

  /* AG Grid besar: jangan ikut animasi tema agar toggle tidak patah-patah */
  html.theme-transitioning .wa-ag-theme,
  html.theme-transitioning .wa-ag-theme *,
  html.theme-transitioning .ag-root-wrapper,
  html.theme-transitioning .ag-root-wrapper *,
  html.theme-transitioning .ag-center-cols-container,
  html.theme-transitioning .ag-center-cols-container *,
  html.theme-transitioning .ag-header,
  html.theme-transitioning .ag-header * {
    transition: none !important;
    animation: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.theme-transitioning *,
  html.theme-transitioning *::before,
  html.theme-transitioning *::after,
  .theme-icon,
  .theme-toggle-track,
  .api-fade-in,
  .card-interactive::before {
    transition: none !important;
    animation: none !important;
  }
}

/* ===== Login ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-wrap {
  width: 100%;
  max-width: 400px;
  padding: 0.25rem;
  position: relative;
  z-index: 1;
}

.login-card {
  padding: 2rem 1.75rem 1.65rem;
  margin-bottom: 0;
}

.login-brand {
  text-align: center;
  margin-bottom: 1.65rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.login-brand-row {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  text-align: left;
  margin-bottom: 0.85rem;
}

.login-brand-logo {
  flex-shrink: 0;
  line-height: 0;
}

.login-brand-logo img {
  display: block;
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.login-brand-text strong {
  display: block;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.login-brand-text span {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.login-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--danger);
  font-size: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.login-submit {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem;
  font-size: 0.95rem;
}

.login-footer-note {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 1rem;
  line-height: 1.5;
}

/* ===== PWA Install Button ===== */
.pwa-install-wrap.hidden {
  display: none !important;
}

.pwa-install-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0 0.85rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pwa-install-divider::before,
.pwa-install-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.pwa-install-btn {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.78rem 0.9rem;
  border-radius: 16px;
  border: 1px solid rgba(37, 211, 102, 0.22);
  background:
    linear-gradient(145deg, rgba(26, 35, 50, 0.92) 0%, rgba(15, 20, 28, 0.88) 100%);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-align: left;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 8px 24px rgba(0, 0, 0, 0.22);
  transition:
    transform 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
    box-shadow 0.22s ease,
    border-color 0.22s ease;
}

[data-theme="light"] .pwa-install-btn {
  background: linear-gradient(145deg, #ffffff 0%, #f4faf7 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 8px 22px rgba(15, 23, 42, 0.08);
}

.pwa-install-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.45), rgba(18, 140, 126, 0.08) 55%, transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.65;
}

.pwa-install-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 25%, rgba(37, 211, 102, 0.07) 50%, transparent 75%);
  transform: translateX(-130%);
  transition: transform 0.6s ease;
  pointer-events: none;
}

.pwa-install-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 211, 102, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 14px 34px var(--primary-glow);
}

.pwa-install-btn:hover::before {
  transform: translateX(130%);
}

.pwa-install-btn:active {
  transform: translateY(0);
}

.pwa-install-btn.hidden {
  display: none !important;
}

.pwa-install-btn__logo {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  z-index: 1;
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(37, 211, 102, 0.18);
}

.pwa-install-btn__logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pwa-install-btn__text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
  flex: 1;
  position: relative;
  z-index: 1;
}

.pwa-install-btn__text strong {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
  background: none;
  -webkit-text-fill-color: unset;
}

.pwa-install-btn__text small {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-install-btn__action {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  box-shadow: 0 4px 14px var(--primary-glow);
  position: relative;
  z-index: 1;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.pwa-install-btn__action svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

.pwa-install-btn:hover .pwa-install-btn__action {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--primary-glow);
}

.pwa-install-btn--login {
  margin-top: 0;
}

.pwa-install-btn--sidebar {
  margin-bottom: 0.5rem;
  padding: 0.65rem 0.72rem;
  gap: 0.7rem;
}

.pwa-install-btn--sidebar .pwa-install-btn__logo {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 10px;
}

.pwa-install-btn--sidebar .pwa-install-btn__action {
  display: none;
}

.pwa-install-btn--sidebar .pwa-install-btn__text strong {
  font-size: 0.86rem;
}

.pwa-install-btn--sidebar .pwa-install-btn__text small {
  font-size: 0.68rem;
}

.app-sidebar.is-collapsed .pwa-install-btn--sidebar,
html.sidebar-collapsed .app-sidebar .pwa-install-btn--sidebar {
  justify-content: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.app-sidebar.is-collapsed .pwa-install-btn--sidebar .pwa-install-btn__text,
html.sidebar-collapsed .app-sidebar .pwa-install-btn--sidebar .pwa-install-btn__text {
  display: none;
}

/* ===== PWA Install Sidebar (collapse saja, tanpa tutup) ===== */
.pwa-install-wrap {
  margin-bottom: 0.65rem;
  position: relative;
  min-height: 2.15rem;
}

.pwa-install-wrap.is-collapsed {
  display: flex;
  justify-content: flex-start;
}

.pwa-install-wrap__panel {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  opacity: 1;
  transform: translateY(0) scale(1);
  transform-origin: left bottom;
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.28s ease;
}

.pwa-install-wrap__panel .pwa-install-btn--sidebar {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.pwa-install-wrap__collapse {
  flex-shrink: 0;
  width: 1.65rem;
  height: 1.65rem;
  margin-top: 0.45rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.pwa-install-wrap__collapse svg {
  width: 0.95rem;
  height: 0.95rem;
}

.pwa-install-wrap__collapse:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text);
}

[data-theme="dark"] .pwa-install-wrap__collapse:hover {
  background: rgba(255, 255, 255, 0.06);
}

.pwa-install-wrap__chip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0.28rem;
  border: 1px solid rgba(37, 211, 102, 0.28);
  border-radius: 10px;
  background: rgba(37, 211, 102, 0.06);
  cursor: pointer;
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform-origin: left top;
  transform: translate(-2px, -8px) scale(0.9);
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.28s ease;
}

.pwa-install-wrap__chip img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.pwa-install-wrap__chip:hover {
  background: rgba(37, 211, 102, 0.12);
  border-color: rgba(37, 211, 102, 0.45);
  transform: translateY(-1px);
}

.pwa-install-wrap.is-collapsed .pwa-install-wrap__panel {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-4px, -12px) scale(0.94);
}

.pwa-install-wrap.is-collapsed .pwa-install-wrap__chip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(0, 0) scale(1);
}

.app-sidebar.is-collapsed .pwa-install-wrap__collapse,
html.sidebar-collapsed .app-sidebar .pwa-install-wrap__collapse {
  display: none;
}

.app-sidebar.is-collapsed .pwa-install-wrap.is-collapsed,
html.sidebar-collapsed .app-sidebar .pwa-install-wrap.is-collapsed {
  justify-content: center;
}

@media (max-width: 380px) {
  .login-brand-row {
    flex-direction: column;
    text-align: center;
  }

  .login-brand-text {
    text-align: center;
  }
}

.nav-link-btn {
  cursor: pointer;
  font-family: inherit;
  background: transparent;
  color: var(--text-muted);
}

.nav-link-btn:hover {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.08);
}

.nav-link-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  padding: 0;
  flex: 0 0 auto;
  border-radius: 50%;
}

.nav-link-btn-icon:hover,
.nav-link.nav-link-btn-icon:hover:not(.active) {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.12);
}

.nav-link-btn-icon svg {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

.header-compact .nav-link-btn {
  margin: 0;
}

/* ===== CBI Loader (icon transparan + overlay) ===== */
body.cbi-loader-active {
  overflow: hidden;
}

.cbi-loader {
  position: fixed;
  inset: 0;
  z-index: 9997;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.cbi-loader.cbi-loader-show {
  opacity: 1;
  visibility: visible;
}

.cbi-loader-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 18, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

[data-theme="light"] .cbi-loader-backdrop {
  background: rgba(238, 242, 247, 0.55);
}

.cbi-loader-box {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.75rem 2rem 1.5rem;
  border-radius: 20px;
  background: rgba(26, 35, 50, 0.35);
  border: 1px solid rgba(37, 211, 102, 0.15);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
}

.cbi-loader-spinner {
  position: relative;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cbi-loader-orbit {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--primary);
  border-right-color: rgba(37, 211, 102, 0.35);
  animation: cbi-loader-spin 1.15s linear infinite;
  opacity: 0.75;
  pointer-events: none;
}

.cbi-loader-orbit--sm {
  inset: -4px;
}

[data-theme="light"] .cbi-loader-box {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(37, 211, 102, 0.2);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.1);
}

.cbi-loader-icon {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  opacity: 0.72;
  animation: cbi-loader-pulse 1.6s ease-in-out infinite;
  filter: drop-shadow(0 4px 16px rgba(37, 211, 102, 0.25));
}

.cbi-loader-icon--sm {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  opacity: 0.68;
}

.cbi-loader-text {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin: 0;
  text-align: center;
}

.cbi-loader-spinner--sm {
  width: 72px;
  height: 72px;
}

.cbi-inline-loader {
  margin: 0 auto 1.25rem;
  display: flex;
  justify-content: center;
}

.cbi-inline-loader .cbi-loader-orbit--sm {
  inset: -2px;
}

@keyframes cbi-loader-spin {
  to { transform: rotate(360deg); }
}

@keyframes cbi-loader-pulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(0.94);
  }
  50% {
    opacity: 0.88;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cbi-loader-orbit,
  .cbi-loader-icon {
    animation: none !important;
  }

  .cbi-loader-icon {
    opacity: 0.8;
  }
}

/* ===== Terminal Monitor ===== */
.terminal-body {
  min-height: 100vh;
}

.terminal-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-shell .terminal-page {
  min-height: 0;
  flex: 1;
}

.terminal-page .terminal-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.terminal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--code-bg);
}

.terminal-toolbar-left,
.terminal-toolbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.terminal-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.terminal-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.terminal-filter-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.terminal-filter-actions .btn-ghost {
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.terminal-filter-actions .btn-ghost:hover {
  color: var(--text);
}

.terminal-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8125rem;
  font-weight: 600;
}

.terminal-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.terminal-status--connecting .terminal-status-dot {
  background: var(--warning);
  animation: terminal-pulse 1.2s ease-in-out infinite;
}

.terminal-status--live .terminal-status-dot {
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.55);
}

.terminal-status--error .terminal-status-dot {
  background: var(--danger);
}

.terminal-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.terminal-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.terminal-filter input {
  accent-color: var(--primary);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
}

.terminal-output {
  flex: 1;
  min-height: 420px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding: 0.85rem 1rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.55;
  background: var(--code-bg);
  scroll-behavior: smooth;
}

.terminal-welcome {
  color: var(--text-muted);
  font-style: italic;
}

.terminal-line {
  display: flex;
  gap: 0.75rem;
  padding: 0.1rem 0;
  word-break: break-word;
}

.terminal-line--divider,
.terminal-cat--divider {
  justify-content: center;
}

.terminal-time {
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0.75;
  font-size: 0.75rem;
  min-width: 4.5rem;
}

.terminal-text {
  flex: 1;
  white-space: pre-wrap;
}

.terminal-text--divider {
  color: var(--text-muted);
  opacity: 0.45;
  flex: none;
}

.terminal-line--success .terminal-text {
  color: var(--success);
}

.terminal-line--error .terminal-text {
  color: var(--danger);
}

.terminal-line--warn .terminal-text {
  color: var(--warning);
}

.terminal-cat--incoming .terminal-text {
  color: var(--info);
}

.terminal-cat--whatsapp .terminal-text {
  color: #6ee7b7;
}

.terminal-cat--puk .terminal-text {
  color: #c4b5fd;
}

.terminal-cat--api .terminal-text {
  color: var(--syntax-key);
}

[data-theme="light"] .terminal-cat--whatsapp .terminal-text {
  color: #047857;
}

[data-theme="light"] .terminal-cat--puk .terminal-text {
  color: #6d28d9;
}

@keyframes terminal-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (max-width: 768px) {
  .terminal-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .terminal-toolbar-left,
  .terminal-toolbar-right {
    justify-content: center;
  }

  .terminal-output {
    min-height: 320px;
    max-height: calc(100vh - 280px);
    font-size: 0.75rem;
  }

  .terminal-time {
    min-width: 4rem;
  }
}

/* ── WA Template Editor ── */
.wa-tipe-summary {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.placeholder-panel {
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  background: var(--surface-hover);
}

.placeholder-panel-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
}

.placeholder-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.placeholder-chip {
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.placeholder-chip:hover {
  border-color: var(--primary);
  background: var(--primary-glow);
}

.wa-variant-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.wa-variant-card {
  padding: 1rem;
}

.wa-variant-card--inactive {
  opacity: 0.72;
}

.wa-variant-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.wa-variant-id {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.wa-variant-status {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.wa-variant-status.is-active {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.wa-variant-status.is-inactive {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}

.wa-variant-preview {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text);
  max-height: 240px;
  overflow: auto;
}

.wa-template-textarea {
  width: 100%;
  min-height: 220px;
  padding: 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.82rem;
  line-height: 1.5;
  resize: vertical;
}

.wa-template-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.wa-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.65rem 0;
  font-size: 0.85rem;
}

.wa-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.wa-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  margin-top: 0.85rem;
}

.wa-toolbar-hint {
  font-size: 0.8rem;
}

.wa-empty-hint,
.wa-empty-state {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.wa-empty-state {
  padding: 1.25rem;
  text-align: center;
}

.wa-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.wa-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.wa-toast--success {
  border-color: var(--success);
}

.wa-toast--error {
  border-color: var(--danger);
}

.wa-toast--warning {
  border-color: var(--warning);
}

.wa-ag-grid-wrap {
  padding: 0.5rem 0.35rem 0.85rem;
  width: 100%;
}

.wa-ag-theme {
  --ag-background-color: var(--bg-card);
  --ag-foreground-color: var(--text);
  --ag-data-color: var(--text);
  --ag-border-color: var(--border);
  --ag-secondary-border-color: var(--border);
  --ag-header-background-color: var(--schema-th-bg);
  --ag-header-foreground-color: var(--text);
  --ag-odd-row-background-color: rgba(255, 255, 255, 0.02);
  --ag-row-hover-color: var(--surface-hover);
  --ag-selected-row-background-color: rgba(37, 211, 102, 0.12);
  --ag-font-family: var(--font);
  --ag-font-size: 13px;
  --ag-grid-size: 6px;
  --ag-list-item-height: 28px;
  --ag-control-panel-background-color: var(--bg-card);
  --ag-input-focus-border-color: var(--primary);
  --ag-input-border-color: var(--border);
  --ag-input-background-color: var(--bg-input);
  --ag-checkbox-background-color: var(--bg-input);
  --ag-checkbox-checked-color: var(--primary);
  --ag-menu-background-color: var(--bg-card);
  --ag-menu-border-color: var(--border);
  --ag-popup-shadow: var(--shadow);
  --ag-alpine-active-color: var(--primary);
  --ag-header-column-resize-handle-color: var(--border);
  --ag-disabled-foreground-color: var(--text-muted);
  --ag-subheader-background-color: var(--schema-th-bg);
  width: 100%;
  height: min(74vh, 820px);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  color-scheme: dark;
}

[data-theme="light"] .wa-ag-theme,
.wa-ag-theme.wa-ag-theme--light {
  --ag-odd-row-background-color: rgba(15, 23, 42, 0.02);
  --ag-selected-row-background-color: rgba(37, 211, 102, 0.15);
  --ag-row-hover-color: rgba(15, 23, 42, 0.05);
  color-scheme: light;
}

.wa-ag-theme .ag-root-wrapper,
.wa-ag-theme .ag-root-wrapper-body,
.wa-ag-theme .ag-body-viewport,
.wa-ag-theme .ag-center-cols-viewport,
.wa-ag-theme .ag-center-cols-container {
  background-color: var(--bg-card);
  color: var(--text);
}

.wa-ag-theme .ag-row {
  background-color: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
}

.wa-ag-theme .ag-row-odd {
  background-color: var(--ag-odd-row-background-color);
}

.wa-ag-theme .ag-row-hover:not(.ag-full-width-row)::before,
.wa-ag-theme .ag-row-hover.ag-full-width-row.ag-row-group::before {
  background-color: var(--ag-row-hover-color);
}

.wa-ag-theme .ag-cell {
  color: var(--text);
  line-height: 1.45;
}

.wa-ag-theme .ag-tooltip {
  display: none !important;
}

.wa-ag-theme .ag-root-wrapper {
  border: none;
}

.wa-ag-theme .ag-header {
  border-bottom: 1px solid var(--border);
  background-color: var(--schema-th-bg);
}

.wa-ag-theme .ag-header-row {
  background-color: var(--schema-th-bg);
}

.wa-ag-theme .ag-header-cell,
.wa-ag-theme .ag-header-group-cell {
  font-weight: 600;
  font-size: 0.8rem;
  background-color: var(--schema-th-bg);
  color: var(--text);
}

.wa-ag-theme .ag-floating-filter {
  padding: 0 6px 6px;
  background-color: var(--schema-th-bg);
}

.wa-ag-theme .ag-floating-filter-body {
  height: 100%;
}

.wa-ag-theme .ag-floating-filter-input input,
.wa-ag-theme .ag-floating-filter-body input,
.wa-ag-theme .ag-text-field-input {
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  color-scheme: inherit;
  min-height: 30px;
  box-shadow: none;
}

.wa-ag-theme .ag-floating-filter-input input:focus,
.wa-ag-theme .ag-floating-filter-body input:focus,
.wa-ag-theme .ag-text-field-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.wa-ag-theme .ag-paging-panel {
  border-top: 1px solid var(--border);
  background-color: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem 0.5rem;
  row-gap: 0.4rem;
  min-height: 42px;
  height: auto;
}

.wa-ag-theme .ag-paging-page-size {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.wa-ag-theme .ag-paging-row-summary-panel,
.wa-ag-theme .ag-paging-page-summary-panel {
  white-space: nowrap;
}

.wa-ag-theme .ag-paging-button {
  color: var(--text);
}

.wa-ag-theme .ag-paging-button.ag-disabled {
  color: var(--text-muted);
  opacity: 0.45;
}

.wa-ag-theme .ag-picker-field-wrapper {
  background: var(--bg-input);
  border-color: var(--border);
  color: var(--text);
}

.wa-ag-theme .ag-cell code {
  font-size: 0.78rem;
}

.wa-ag-theme .ag-body-viewport,
.wa-ag-theme .ag-center-cols-viewport,
.wa-ag-theme .ag-body-vertical-scroll-viewport,
.wa-ag-theme .ag-body-horizontal-scroll-viewport {
  scrollbar-width: thin;
  scrollbar-color: var(--primary) rgba(37, 211, 102, 0.1);
}

.wa-ag-theme .ag-body-viewport::-webkit-scrollbar,
.wa-ag-theme .ag-center-cols-viewport::-webkit-scrollbar,
.wa-ag-theme .ag-body-vertical-scroll-viewport::-webkit-scrollbar,
.wa-ag-theme .ag-body-horizontal-scroll-viewport::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.wa-ag-theme .ag-body-viewport::-webkit-scrollbar-track,
.wa-ag-theme .ag-center-cols-viewport::-webkit-scrollbar-track,
.wa-ag-theme .ag-body-vertical-scroll-viewport::-webkit-scrollbar-track,
.wa-ag-theme .ag-body-horizontal-scroll-viewport::-webkit-scrollbar-track {
  background: rgba(37, 211, 102, 0.08);
  border-radius: 999px;
}

.wa-ag-theme .ag-body-viewport::-webkit-scrollbar-thumb,
.wa-ag-theme .ag-center-cols-viewport::-webkit-scrollbar-thumb,
.wa-ag-theme .ag-body-vertical-scroll-viewport::-webkit-scrollbar-thumb,
.wa-ag-theme .ag-body-horizontal-scroll-viewport::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.wa-ag-theme .ag-body-viewport::-webkit-scrollbar-thumb:hover,
.wa-ag-theme .ag-center-cols-viewport::-webkit-scrollbar-thumb:hover,
.wa-ag-theme .ag-body-vertical-scroll-viewport::-webkit-scrollbar-thumb:hover,
.wa-ag-theme .ag-body-horizontal-scroll-viewport::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

.wa-ag-theme .ag-body-vertical-scroll,
.wa-ag-theme .ag-body-horizontal-scroll {
  background: rgba(37, 211, 102, 0.06);
}

.wa-ag-theme .ag-body-vertical-scroll-viewport,
.wa-ag-theme .ag-body-horizontal-scroll-viewport {
  background: rgba(37, 211, 102, 0.04);
}

.wa-ag-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  height: 100%;
}

.wa-ag-actions .btn {
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
}

/* ===== Template form modal ===== */
.wa-tpl-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.wa-tpl-modal.hidden {
  display: none;
}

.wa-tpl-panel {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
  max-height: min(92vh, 880px);
  display: flex;
  flex-direction: column;
  background: var(--dialog-surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow:
    var(--shadow),
    0 0 0 1px var(--dialog-inset) inset;
  overflow: hidden;
  animation: wa-tpl-in 0.22s ease;
}

@keyframes wa-tpl-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.wa-tpl-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.35rem 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--dialog-inset) 0%, transparent 100%);
}

.wa-tpl-header-text {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  min-width: 0;
}

.wa-tpl-badge {
  flex-shrink: 0;
  margin-top: 0.15rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(37, 211, 102, 0.12);
  border: 1px solid rgba(37, 211, 102, 0.28);
}

.wa-tpl-badge--new {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.28);
}

[data-theme="light"] .wa-tpl-badge--new {
  color: #2563eb;
}

.wa-tpl-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.25;
}

.wa-tpl-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.wa-tpl-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.wa-tpl-close:hover {
  color: var(--text);
  border-color: var(--primary);
  background: var(--surface-hover);
}

.wa-tpl-form {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem 1.35rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.wa-tpl-section {
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.wa-tpl-section-title {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.wa-tpl-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.wa-tpl-section-head .wa-tpl-section-title {
  margin: 0;
}

.wa-tpl-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.wa-tpl-hint code {
  font-size: 0.72rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: var(--code-bg);
  color: var(--hl-string);
}

.wa-tpl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr minmax(110px, 0.85fr);
  gap: 0.75rem;
}

.wa-tpl-field--modules {
  grid-column: 1 / -1;
}

.wa-tpl-field-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Module multi-select picker */
.wa-modpick {
  position: relative;
}

.wa-modpick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
  min-height: 0;
}

.wa-modpick-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  max-width: 100%;
  padding: 0.3rem 0.35rem 0.3rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(37, 211, 102, 0.35);
  background: rgba(37, 211, 102, 0.1);
  font-size: 0.78rem;
}

.wa-modpick-chip-label {
  font-weight: 600;
  color: var(--text);
}

.wa-modpick-chip-meta {
  font-size: 0.68rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: var(--code-bg);
  color: var(--text-muted);
}

.wa-modpick-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.wa-modpick-chip-remove:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.12);
}

.wa-modpick-control {
  position: relative;
}

.wa-modpick-search {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0.7rem;
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
  color-scheme: inherit;
}

.wa-modpick-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.wa-modpick-menu {
  position: absolute;
  z-index: 9100;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 220px;
  overflow-y: auto;
  padding: 0.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.wa-modpick-menu.hidden {
  display: none;
}

.wa-modpick-empty {
  margin: 0;
  padding: 0.65rem 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.wa-modpick-option {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}

.wa-modpick-option:hover,
.wa-modpick-option.is-checked {
  background: var(--surface-hover);
}

.wa-modpick-option input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 0.2rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.wa-modpick-option-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.wa-modpick-option-body strong {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
}

.wa-modpick-option-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.wa-modpick-option-meta code {
  font-size: 0.7rem;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  background: var(--code-bg);
}

.wa-tpl-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: relative;
  min-width: 0;
}

.wa-tpl-field:focus-within {
  z-index: 3;
}

.wa-tpl-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

.wa-tpl-input,
.wa-tpl-select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0.7rem;
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
  color-scheme: inherit;
}

.wa-tpl-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.wa-tpl-input:hover,
.wa-tpl-select:hover {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

.wa-tpl-input:focus,
.wa-tpl-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.wa-tpl-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  padding-right: 2rem;
}

.wa-tpl-section--pesan {
  display: flex;
  flex-direction: column;
}

.wa-field-picker {
  margin-bottom: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.wa-field-picker-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.65rem;
  align-items: end;
}

.wa-field-picker-action {
  padding-bottom: 0.1rem;
}

.wa-field-picker-hint {
  margin: 0.55rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.wa-field-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.wa-field-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(37, 211, 102, 0.1);
  border: 1px solid rgba(37, 211, 102, 0.25);
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s, border-color 0.15s;
}

.wa-field-chip:hover {
  background: rgba(37, 211, 102, 0.18);
  border-color: var(--primary);
}

.wa-field-chip.is-block {
  color: #d97706;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
}

.wa-field-chip.is-block:hover {
  background: rgba(245, 158, 11, 0.2);
}

@media (max-width: 720px) {
  .wa-field-picker-row {
    grid-template-columns: 1fr;
  }
}

.wa-tpl-textarea {
  width: 100%;
  min-height: 240px;
  max-height: 42vh;
  padding: 0.9rem 1rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--code-block-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
  tab-size: 2;
}

.wa-tpl-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.wa-tpl-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.65;
  font-family: var(--font);
}

.wa-tpl-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.65rem;
  padding: 0.9rem 1.35rem 1.15rem;
  border-top: 1px solid var(--border);
  background: var(--dialog-surface);
  flex-shrink: 0;
}

.wa-tpl-footer .btn {
  min-width: 5.5rem;
  padding: 0.5rem 1.1rem;
  font-size: 0.875rem;
}

.wa-tpl-modal .cbi-ac {
  width: 100%;
}

.wa-tpl-modal .cbi-ac-input {
  min-height: 2.5rem;
  padding: 0.5rem 0.7rem;
  font-size: 0.875rem;
  border-radius: 10px;
}

.wa-tpl-modal .cbi-ac-menu {
  z-index: 9100;
  border-radius: 10px;
  padding: 0.3rem;
}

.wa-form-modal .cbi-ac-menu {
  z-index: 260;
}

@media (max-width: 640px) {
  .wa-tpl-modal {
    padding: 0.75rem;
    align-items: flex-end;
  }

  .wa-tpl-panel {
    max-height: 94vh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .wa-tpl-grid {
    grid-template-columns: 1fr 1fr;
  }

  .wa-tpl-field--status {
    grid-column: 1 / -1;
  }

  .wa-ag-theme {
    height: min(58vh, 560px);
  }

  .wa-ag-grid-wrap {
    padding: 0.35rem 0.2rem 0.5rem;
  }

  .wa-table-toolbar {
    padding: 0.75rem 0.65rem;
  }

  .wa-table-toolbar--end {
    justify-content: stretch;
  }

  .wa-table-toolbar-right {
    flex-wrap: wrap;
    justify-content: flex-end;
    width: 100%;
    gap: 0.5rem;
  }

  .wa-row-count {
    flex: 1 1 100%;
    text-align: right;
    font-size: 0.78rem;
  }

  .wa-ag-theme .ag-paging-panel {
    padding: 0.45rem 0.35rem max(0.45rem, env(safe-area-inset-bottom));
    gap: 0.3rem 0.4rem;
  }

  .wa-ag-theme .ag-paging-page-size {
    flex: 1 1 100%;
    justify-content: center;
    margin: 0;
  }

  .wa-ag-theme .ag-paging-row-summary-panel,
  .wa-ag-theme .ag-paging-page-summary-panel {
    font-size: 0.72rem;
  }

  .wa-ag-theme .ag-paging-button {
    min-width: 1.75rem;
    padding: 0.15rem 0.25rem;
  }

  .wa-ag-theme .ag-paging-button .ag-icon {
    transform: scale(0.9);
  }
}

/* legacy form modal aliases — keep for safety */
.wa-form-modal {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.wa-form-modal.hidden {
  display: none;
}

.wa-form-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(90vh, 820px);
  display: flex;
  flex-direction: column;
  background: var(--dialog-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow-x: hidden;
  overflow-y: auto;
}

.wa-form-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.wa-form-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.wa-form-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.wa-form-body {
  padding: 1rem 1.15rem;
  overflow: visible;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.wa-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  position: relative;
}

.wa-form-field:focus-within {
  z-index: 2;
}

.wa-form-field--full {
  grid-column: 1 / -1;
}

.wa-form-field .wa-input,
.wa-form-field .wa-select,
.wa-form-field .wa-template-textarea {
  width: 100%;
}

.wa-form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1.15rem;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: var(--dialog-surface);
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .wa-form-body {
    grid-template-columns: 1fr;
  }
}

/* ── WA Template Table toolbar ── */
.wa-table-card {
  padding: 0;
  overflow: hidden;
}

.wa-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.wa-table-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 200px;
}

.wa-table-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.wa-table-toolbar--end {
  justify-content: flex-end;
}

.wa-select,
.wa-search {
  font-family: var(--font);
  font-size: 0.85rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  color-scheme: dark;
}

.wa-select option {
  background-color: var(--bg-card);
  color: var(--text);
}

[data-theme="light"] .wa-select {
  color-scheme: light;
}

[data-theme="light"] .wa-select option {
  background-color: #ffffff;
  color: var(--text);
}

.wa-select optgroup {
  font-weight: 600;
  font-style: normal;
  color: var(--text-muted);
  background: var(--bg-input);
}

.wa-select option {
  font-weight: 400;
  color: var(--text);
  background: var(--bg-card);
}

.wa-select--sm,
.wa-input--sm {
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  width: 100%;
}

.wa-input {
  font-family: var(--font);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.wa-search {
  flex: 1;
  min-width: 160px;
  max-width: 320px;
}

.wa-search:focus,
.wa-select:focus,
.wa-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.wa-row-count {
  font-size: 0.82rem;
  white-space: nowrap;
}

.wa-table-wrap {
  overflow-x: auto;
}

.wa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.wa-table th,
.wa-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.wa-table th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface-hover);
}

.wa-table tbody tr:hover:not(.wa-row-editing) {
  background: var(--surface-hover);
}

.wa-row-editing {
  background: rgba(99, 102, 241, 0.06);
}

.wa-table .col-id {
  width: 3rem;
  color: var(--text-muted);
  font-weight: 600;
}

.wa-table .col-module-id {
  width: 6.5rem;
}

.wa-table .col-module {
  width: 10rem;
}

.wa-table .col-tipe {
  width: 11rem;
}

.wa-table .col-status {
  width: 7.5rem;
}

.wa-table .col-aksi {
  width: 9rem;
  white-space: nowrap;
}

.wa-cell-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.wa-pesan-preview {
  display: block;
  line-height: 1.45;
  color: var(--text);
}

.wa-tpl-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.2;
  width: auto;
  height: auto;
}

.wa-tpl-status.is-on {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.wa-tpl-status.is-off {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}

.wa-tpl-status.is-warn {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.wa-template-textarea--table {
  min-height: 88px;
  font-size: 0.8rem;
}

.wa-table-empty,
.wa-table-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem !important;
}

.btn-danger-text {
  color: var(--danger) !important;
}

@media (max-width: 768px) {
  .wa-table .col-modul,
  .wa-table .col-module,
  .wa-table .col-module-id,
  .wa-table .col-tipe {
    min-width: 100px;
  }

  .wa-table .col-pesan {
    min-width: 180px;
  }
}

/* ===== WA Template — docs modal ===== */
body.wa-docs-open {
  overflow: hidden;
}

.wa-docs-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.wa-docs-modal.hidden {
  display: none;
}

.wa-docs-backdrop {
  position: absolute;
  inset: 0;
  background: var(--dialog-overlay-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.wa-docs-panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--dialog-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.wa-docs-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.wa-docs-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.wa-docs-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.wa-docs-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem 1.25rem;
}

.wa-docs-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0.75rem 1.25rem 1rem;
  border-top: 1px solid var(--border);
}

.wa-docs-intro {
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  line-height: 1.55;
}

.wa-docs-bullets {
  margin: 0.65rem 0 0;
  padding-left: 1.15rem;
}

.wa-docs-bullets li + li {
  margin-top: 0.35rem;
}

.wa-docs-module {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.wa-docs-module.is-highlight {
  border-top-color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
  padding-left: 0.75rem;
}

.wa-docs-module-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.85rem;
}

.wa-docs-module-head h3 {
  margin: 0;
  font-size: 1rem;
}

.wa-docs-module-head code {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.wa-docs-tipe {
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.wa-docs-tipe-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin-bottom: 0.4rem;
}

.wa-docs-tipe-id {
  font-size: 0.78rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--primary);
}

.wa-docs-tipe-when {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.wa-docs-placeholders {
  margin-top: 0.65rem;
  font-size: 0.82rem;
}

.wa-docs-placeholders summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 500;
  user-select: none;
}

.wa-docs-placeholder-list {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
}

.wa-docs-placeholder-list li {
  display: grid;
  grid-template-columns: minmax(8rem, 11rem) 1fr;
  gap: 0.5rem 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.wa-docs-placeholder-list li:last-child {
  border-bottom: none;
}

.wa-docs-placeholder-list code {
  font-size: 0.76rem;
  word-break: break-all;
}

.wa-docs-placeholder-list span {
  color: var(--text-muted);
  line-height: 1.4;
}

.wa-docs-muted {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}

@media (max-width: 560px) {
  .wa-docs-placeholder-list li {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

/* ===== App shell + sidebar ===== */
html:has(body.app-shell) {
  height: 100%;
  overflow: hidden;
}

body.app-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.app-shell {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
}

.sidebar-mobile-toggle {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.app-sidebar {
  width: 268px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(37, 211, 102, 0.1) 0%, rgba(18, 140, 126, 0.04) 32%, transparent 58%),
    linear-gradient(135deg, rgba(37, 211, 102, 0.03) 0%, transparent 42%),
    var(--bg-card);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 0.55rem 0.55rem 1rem;
  z-index: 20;
  overflow: hidden;
  transition: width 0.22s ease, padding 0.22s ease;
}

.app-sidebar.is-collapsed,
html.sidebar-collapsed .app-sidebar {
  width: 76px;
  padding: 0.55rem 0.4rem 1rem;
}

.sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.45rem;
  padding-bottom: 0.75rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-collapse {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-top: 0;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    transform 0.22s ease;
}

.sidebar-collapse svg {
  width: 1rem;
  height: 1rem;
  transition: transform 0.22s ease;
}

.sidebar-collapse:hover {
  color: var(--text);
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.08);
}

.app-sidebar.is-collapsed .sidebar-collapse svg,
html.sidebar-collapsed .app-sidebar .sidebar-collapse svg {
  transform: rotate(180deg);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0;
  margin: 0 0 0 -0.1rem;
  border-bottom: none;
  min-width: 0;
  flex: 1;
}

.sidebar-brand-logo {
  flex-shrink: 0;
  line-height: 0;
}

.sidebar-brand-logo img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.sidebar-brand-text strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.sidebar-brand-text span {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.72rem;
  font-weight: 500;
}

.app-sidebar.is-collapsed .sidebar-head,
html.sidebar-collapsed .app-sidebar .sidebar-head {
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
}

.app-sidebar.is-collapsed .sidebar-brand,
html.sidebar-collapsed .app-sidebar .sidebar-brand {
  justify-content: center;
}

.app-sidebar.is-collapsed .sidebar-brand-text,
html.sidebar-collapsed .app-sidebar .sidebar-brand-text,
.app-sidebar.is-collapsed .sidebar-section-label,
html.sidebar-collapsed .app-sidebar .sidebar-section-label,
.app-sidebar.is-collapsed .sidebar-link-label,
html.sidebar-collapsed .app-sidebar .sidebar-link-label,
.app-sidebar.is-collapsed .sidebar-logout span,
html.sidebar-collapsed .app-sidebar .sidebar-logout span {
  display: none;
}

.app-sidebar.is-collapsed .sidebar-collapse,
html.sidebar-collapsed .app-sidebar .sidebar-collapse {
  margin-top: 0;
}

.app-sidebar.is-collapsed .sidebar-link,
html.sidebar-collapsed .app-sidebar .sidebar-link {
  justify-content: center;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
}

.app-sidebar.is-collapsed .sidebar-link.is-active::before,
html.sidebar-collapsed .app-sidebar .sidebar-link.is-active::before {
  display: none;
}

.app-sidebar.is-collapsed .sidebar-logout,
html.sidebar-collapsed .app-sidebar .sidebar-logout {
  padding-left: 0.55rem;
  padding-right: 0.55rem;
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.15rem 0.1rem;
}

.sidebar-section-label {
  margin: 0 0 0.55rem 0.55rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.62rem 0.75rem;
  border-radius: 11px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.sidebar-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-link-icon svg {
  width: 100%;
  height: 100%;
}

.sidebar-link-label {
  line-height: 1.2;
}

.sidebar-link:hover {
  color: var(--text);
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.04);
}

.sidebar-link.is-active {
  color: var(--btn-on-primary);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-color: transparent;
  box-shadow: 0 6px 18px var(--primary-glow);
}

.sidebar-link.is-active .sidebar-link-icon {
  opacity: 1;
}

.sidebar-link.is-active::before {
  content: '';
  position: absolute;
  left: -0.45rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 58%;
  border-radius: 0 4px 4px 0;
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.sidebar-foot {
  padding-top: 0.85rem;
  margin-top: 0.35rem;
  border-top: 1px solid var(--border);
}

.sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.62rem 0.75rem;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}

.sidebar-logout:hover {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.08);
}

.sidebar-logout svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.app-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: opacity 0.2s ease;
}

.app-main.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.app-page-content {
  padding-top: 0;
}

.app-page-body {
  flex: 1 0 auto;
  min-width: 0;
}

.app-page-body--terminal {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

body.terminal-body .app-main {
  overflow-y: hidden;
}

body.terminal-body .app-page-body--terminal {
  flex: 1;
  min-height: 0;
}

.app-page-body--terminal .terminal-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 0;
}

.app-page-body--terminal .terminal-card {
  flex: 1;
  min-height: 0;
}

.app-chrome-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  flex-shrink: 0;
}

.app-chrome-footer {
  position: sticky;
  bottom: 0;
  z-index: 29;
  flex-shrink: 0;
  margin-top: auto;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-card) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  flex-shrink: 0;
}

.app-topbar-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.app-topbar-main {
  min-width: 0;
  flex: 1;
}

.app-topbar-main .brand-badge--sm {
  margin-bottom: 0.12rem;
  padding: 0.12rem 0.45rem;
  font-size: 0.58rem;
  line-height: 1.2;
}

.app-topbar-main h1 {
  margin: 0.1rem 0 0;
  font-size: 1.05rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.app-topbar-main p {
  margin: 0.08rem 0 0;
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.3;
}

.theme-toggle--topbar {
  position: static;
  top: auto;
  right: auto;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  align-self: center;
}

.theme-toggle--topbar .theme-toggle-track {
  width: 34px;
  height: 34px;
}

.theme-toggle--topbar .theme-toggle-icons,
.theme-toggle--topbar .theme-icon {
  width: 18px;
  height: 18px;
}

.app-outlet {
  flex: 1;
  min-height: 0;
  min-width: 0;
  transition: opacity 0.2s ease;
}

.app-outlet.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.app-outlet-error {
  margin: 1.25rem;
  padding: 1.25rem;
}

.app-outlet--terminal {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.app-outlet--terminal .terminal-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 0;
}

.app-shell-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--bg-card) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.app-shell-footer-text {
  min-width: 0;
}

.app-page-content.terminal-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 1rem;
}

.app-page-header {
  margin-bottom: 1.25rem;
}

.app-page-header h1 {
  margin: 0.35rem 0 0;
  font-size: 1.5rem;
}

.app-page-header p {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.wa-docs-module-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  margin-top: 0.35rem;
}

.wa-docs-module-meta code {
  font-size: 0.72rem;
}

.theme-toggle--inset {
  top: 0.85rem;
  right: 0.85rem;
}

.wa-table .col-module-id {
  min-width: 5.5rem;
  white-space: nowrap;
}

.wa-table .col-module {
  min-width: 7rem;
}

.wa-table .col-modul,
.wa-table .col-module,
.wa-table .col-tipe {
  position: relative;
  overflow: visible;
}

/* ===== Autocomplete ===== */
.cbi-ac {
  position: relative;
  width: 100%;
}

.cbi-ac-input {
  width: 100%;
}

.cbi-ac-menu {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.35rem;
}

.cbi-ac-menu.hidden {
  display: none;
}

.cbi-ac-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.84rem;
  cursor: pointer;
}

.cbi-ac-option:hover,
.cbi-ac-option.is-active {
  background: var(--surface-hover);
}

.cbi-ac-option-label {
  font-weight: 500;
  line-height: 1.3;
}

.cbi-ac-option-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--mono);
}

@media (max-width: 900px) {
  html:has(body.app-shell) {
    height: 100%;
    overflow: hidden;
  }

  html,
  body.app-shell {
    overflow: hidden;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
  }

  .app-shell {
    flex-direction: row;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 190;
    background: rgba(5, 10, 18, 0.62);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.26s ease;
  }

  .sidebar-backdrop:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(272px, 86vw) !important;
    max-width: 86vw;
    height: 100vh;
    height: 100dvh;
    z-index: 200;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    transform: translateX(-105%);
    transition: transform 0.26s ease;
    padding: max(1rem, env(safe-area-inset-top)) 0.85rem max(1rem, env(safe-area-inset-bottom)) !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  html.sidebar-mobile-open .app-sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
  }

  html.sidebar-collapsed .app-sidebar .sidebar-brand-text,
  html.sidebar-collapsed .app-sidebar .sidebar-link-label,
  html.sidebar-collapsed .app-sidebar .sidebar-section-label,
  .app-sidebar.is-collapsed .sidebar-brand-text,
  .app-sidebar.is-collapsed .sidebar-link-label,
  .app-sidebar.is-collapsed .sidebar-section-label {
    display: block !important;
  }

  html.sidebar-collapsed .app-sidebar .sidebar-logout span,
  .app-sidebar.is-collapsed .sidebar-logout span {
    display: inline !important;
  }

  .app-sidebar.is-collapsed .sidebar-head,
  html.sidebar-collapsed .app-sidebar .sidebar-head {
    flex-direction: row;
    align-items: flex-start;
  }

  .app-sidebar.is-collapsed .sidebar-link,
  html.sidebar-collapsed .app-sidebar .sidebar-link {
    justify-content: flex-start;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .sidebar-head {
    width: 100%;
    min-width: 0;
    flex: 0 0 auto;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 0.35rem;
  }

  .sidebar-brand {
    min-width: 0;
    flex: 1;
  }

  .sidebar-body {
    flex: 1;
    width: 100%;
    overflow-y: auto;
  }

  .sidebar-menu {
    flex-direction: column !important;
    width: 100%;
  }

  .sidebar-foot {
    width: 100%;
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    padding-top: 0.85rem;
    margin-top: 0.35rem;
  }

  .sidebar-logout span {
    display: inline !important;
  }

  .sidebar-collapse {
    display: none;
  }

  .sidebar-mobile-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: max(0.85rem, env(safe-area-inset-top));
    left: max(0.7rem, env(safe-area-inset-left));
    z-index: 180;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    box-shadow: var(--shadow);
    cursor: pointer;
  }

  .sidebar-mobile-toggle svg {
    width: 1.15rem;
    height: 1.15rem;
  }

  .app-main {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    min-height: 0;
    flex: 1;
  }

  .app-topbar {
    padding: 0.4rem max(0.75rem, env(safe-area-inset-right)) 0.4rem max(3.25rem, calc(env(safe-area-inset-left) + 2.75rem));
    padding-top: max(0.4rem, env(safe-area-inset-top));
  }

  .app-topbar-main h1 {
    font-size: 0.98rem;
    padding-right: 0.35rem;
    word-break: break-word;
  }

  .app-topbar-main p {
    font-size: 0.72rem;
  }

  .app-shell-footer {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .app-page-content {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .container {
    max-width: 100%;
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .app-page-header h1 {
    font-size: 1.25rem;
    line-height: 1.3;
    padding-right: 2.75rem;
    word-break: break-word;
  }

  .app-page-header p {
    font-size: 0.84rem;
  }
}

/* ===== API Tester Admin (wa_api_*) ===== */
body.wa-admin-open {
  overflow: hidden;
}

.wa-admin-modal {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.wa-admin-modal.hidden {
  display: none;
}

.wa-admin-panel {
  position: relative;
  z-index: 1;
  width: min(1080px, 100%);
  max-height: min(92vh, 920px);
  display: flex;
  flex-direction: column;
  background: var(--dialog-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.wa-admin-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0 1.15rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-input);
}

.wa-admin-tab {
  padding: 0.65rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.wa-admin-tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.wa-admin-panel-view {
  display: none;
}

.wa-admin-panel-view.is-active {
  display: block;
}

.wa-admin-guide {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.wa-admin-steps {
  display: grid;
  gap: 0.75rem;
}

.wa-admin-step {
  display: flex;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
}

.wa-admin-step-num {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.wa-admin-step h4 {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
}

.wa-admin-step p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.wa-admin-tip {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  font-size: 0.84rem;
}

.wa-admin-tip summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.wa-admin-tip ul {
  margin: 0.5rem 0 0 1.1rem;
  color: var(--text-muted);
}

.wa-admin-split {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 1rem;
  min-height: 420px;
}

.wa-admin-list-pane {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  background: var(--bg-input);
  overflow: auto;
  max-height: 65vh;
}

.wa-admin-form-pane {
  overflow: auto;
  max-height: 65vh;
  padding-right: 0.25rem;
}

.wa-admin-ep-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.wa-admin-ep-card {
  text-align: left;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.wa-admin-ep-card:hover {
  border-color: rgba(37, 211, 102, 0.35);
}

.wa-admin-ep-card.is-selected {
  border-color: var(--primary);
  background: rgba(37, 211, 102, 0.06);
}

.wa-admin-ep-card.is-off {
  opacity: 0.55;
}

.wa-admin-ep-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.wa-admin-ep-card-tag {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.wa-admin-ep-card-title {
  display: block;
  font-size: 0.86rem;
  margin-bottom: 0.2rem;
}

.wa-admin-ep-card-path {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  word-break: break-all;
}

.wa-admin-ep-card-meta {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.wa-admin-fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem 1rem;
  margin: 0 0 1rem;
}

.wa-admin-fieldset legend {
  padding: 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wa-admin-fieldset--inline {
  padding-bottom: 0.75rem;
}

.wa-admin-span-2 {
  grid-column: span 2;
}

.wa-admin-code {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.45;
}

.wa-admin-json-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.wa-admin-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.wa-admin-fields-intro {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.wa-admin-field-add {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--bg-input);
}

.wa-admin-field-add h4 {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.wa-admin-empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 800px) {
  .wa-admin-split {
    grid-template-columns: 1fr;
  }

  .wa-admin-span-2 {
    grid-column: span 1;
  }
}

.wa-admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.wa-admin-header h2 {
  font-size: 1.1rem;
  margin: 0;
}

.wa-admin-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}

.wa-admin-body {
  overflow: auto;
  padding: 1rem 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.wa-admin-section h3 {
  font-size: 0.95rem;
  margin: 0 0 0.65rem;
}

.wa-admin-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.wa-admin-section-head h3 {
  margin: 0;
}

.wa-admin-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.wa-admin-table tr.is-selected {
  background: rgba(37, 211, 102, 0.08);
}

.wa-admin-table .admin-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 1rem;
}

.admin-actions {
  white-space: nowrap;
}

.wa-admin-table tr.is-editing {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.wa-admin-table tr.is-editing td:first-child {
  box-shadow: inset 3px 0 0 var(--primary);
}

.wa-admin-form .form-group label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.wa-admin-form input,
.wa-admin-form select,
.wa-admin-form textarea {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.85rem;
}

.wa-admin-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  margin: 0.65rem 0;
  font-size: 0.85rem;
}

.wa-admin-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.wa-admin-delete-ep {
  margin-left: auto;
}

.wa-admin-form--inline {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.wa-admin-modal .wa-toast {
  position: absolute;
  top: 4.5rem;
  right: 1rem;
  left: auto;
  bottom: auto;
  z-index: 2;
  width: auto;
  max-width: min(420px, calc(100% - 2rem));
}

/* ===== Kelola Jam Kunjungan ===== */
.jk-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 1rem;
  align-items: start;
}

.jk-form-card,
.jk-preview-card {
  padding: 0;
  overflow: hidden;
}

.jk-card-head {
  padding: 1rem 1.15rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.jk-card-title {
  margin: 0;
  font-size: 1.05rem;
}

.jk-card-desc {
  margin: 0.35rem 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.jk-form {
  padding: 1rem 1.15rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.jk-textarea {
  min-height: 120px;
  font-family: var(--font);
  font-size: 0.88rem;
  line-height: 1.55;
}

.jk-input {
  width: 100%;
  font-family: var(--font);
  font-size: 0.9rem;
}

.jk-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 0.35rem;
}

.jk-wa-preview {
  margin: 0;
  padding: 1rem 1.15rem 1.15rem;
  font-family: var(--font);
  font-size: 0.86rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  background: var(--bg-input);
  border-top: 1px solid var(--border);
  min-height: 220px;
}

@media (max-width: 900px) {
  .jk-layout {
    grid-template-columns: 1fr;
  }
}

