:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #14213d;
  --muted: #68778d;
  --line: #dfe6f1;
  --accent: #146c94;
  --accent-2: #19a7ce;
  --danger: #b42318;
  --ok: #157347;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
.topbar { display: flex; gap: 24px; justify-content: space-between; align-items: center; padding: 28px clamp(16px, 3vw, 42px); background: linear-gradient(135deg, #102a43, #146c94); color: #fff; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(26px, 4vw, 42px); }
h2 { margin-bottom: 10px; font-size: 20px; }
h3 { margin-bottom: 8px; font-size: 15px; }
.eyebrow { margin-bottom: 8px; color: #b9e8f7; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; }
.muted { color: var(--muted); }
.topbar .muted { color: #dbeafe; }
.auth-card { width: min(360px, 100%); padding: 16px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); border-radius: 18px; }
.layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 22px clamp(14px, 3vw, 42px) 42px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 8px 24px rgba(15, 23, 42, .06); }
.panel.wide { grid-column: 1 / -1; }
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 12px; }
.stats div { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #f8fafc; }
.stats strong { display: block; font-size: 26px; }
.stats span { color: var(--muted); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
label { display: block; font-weight: 700; font-size: 13px; color: #334155; margin: 10px 0; }
input, textarea, select { width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; background: #fff; color: var(--ink); }
textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: auto; margin: 0; }
button { border: 0; border-radius: 12px; padding: 10px 14px; background: var(--accent); color: #fff; font-weight: 800; cursor: pointer; }
button.secondary { background: #e8eef7; color: var(--ink); }
button.danger { background: #fee4e2; color: var(--danger); }
button:hover { filter: brightness(.97); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.output { max-height: 280px; overflow: auto; padding: 12px; border-radius: 12px; background: #0f172a; color: #d1e7ff; font-size: 12px; white-space: pre-wrap; }
.list { display: grid; gap: 10px; margin-top: 12px; }
.item { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fbfdff; }
.item-head { display: flex; gap: 10px; justify-content: space-between; align-items: start; }
.item-title { font-weight: 850; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 800; background: #e8eef7; color: #334155; }
.badge.ok { background: #dcfce7; color: var(--ok); }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.danger { background: #fee4e2; color: var(--danger); }
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.copy-box { margin-top: 14px; display: grid; gap: 6px; padding: 12px; border-radius: 14px; background: #eff6ff; border: 1px solid #bfdbfe; }
.copy-box span { font-weight: 800; color: #1e3a8a; }
code { word-break: break-all; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.compact .item { font-size: 13px; }
@media (max-width: 900px) { .topbar { flex-direction: column; align-items: stretch; } .layout, .two-col { grid-template-columns: 1fr; } .form-grid, .stats { grid-template-columns: 1fr; } }

.top-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.top-links a { color: #fff; text-decoration: none; font-weight: 800; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.12); padding: 8px 11px; border-radius: 999px; }
.auth-help { margin: 10px 0 0; color: #e0f2fe; font-size: 12px; line-height: 1.45; }
.auth-help code { color: #fff; font-weight: 800; }
.doc-layout { max-width: 1180px; margin: 0 auto; padding: 24px clamp(14px, 3vw, 42px) 52px; }
.doc-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; align-items: start; }
.doc-nav { position: sticky; top: 16px; display: grid; gap: 8px; }
.doc-nav a { display: block; padding: 9px 11px; border-radius: 10px; color: var(--ink); background: #f8fafc; border: 1px solid var(--line); text-decoration: none; font-weight: 750; font-size: 13px; }
.doc-content { display: grid; gap: 18px; }
.doc-content .panel { scroll-margin-top: 20px; }
.doc-content ol, .doc-content ul { padding-left: 22px; line-height: 1.7; }
.doc-content li { margin-bottom: 6px; }
.callout { border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 14px; padding: 12px 14px; margin: 12px 0; }
.callout.warn { border-color: #fde68a; background: #fffbeb; }
.key-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.key-table th, .key-table td { border: 1px solid var(--line); padding: 10px; vertical-align: top; text-align: left; }
.key-table th { background: #f8fafc; }
.code-block { display: block; background: #0f172a; color: #d1e7ff; padding: 12px; border-radius: 12px; white-space: pre-wrap; overflow-x: auto; }
@media (max-width: 900px) { .doc-grid { grid-template-columns: 1fr; } .doc-nav { position: static; } }
.qr-preview { margin-top: 12px; }
.qr-card { display: inline-grid; gap: 8px; max-width: 280px; padding: 14px; border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 16px; text-align: center; }
.qr-card img { width: 240px; height: 240px; object-fit: contain; background: #fff; padding: 10px; border-radius: 12px; border: 1px solid var(--line); }
.qr-card p { margin: 0; font-size: 13px; color: var(--muted); }
.safety-stats strong { font-size: 20px; }
.error-text { margin-top: 8px; color: var(--danger); font-size: 12px; font-weight: 700; }
.compact-actions { margin: 8px 0 0; }
.compact-actions button { padding: 8px 10px; }
#wahaBaseUrl { font-size: 14px; }


/* v1.2.2 Admin notification/toast system */
.toast-region {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 9999;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 28px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-left-width: 6px;
  border-radius: 16px;
  padding: 12px 42px 12px 14px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
  position: relative;
  animation: toast-in .18s ease-out;
}
.toast strong { font-size: 14px; }
.toast span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.toast button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  padding: 0;
  background: #eef2f7;
  color: var(--ink);
}
.toast.info { border-left-color: var(--accent-2); }
.toast.message { border-left-color: #7c3aed; }
.toast.success { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
.notification-panel { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.small-head h3 { margin-bottom: 4px; }
.notification-list { display: grid; gap: 8px; margin-top: 10px; max-height: 220px; overflow: auto; }
.notification-item {
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fbfdff;
}
.notification-item.info { border-left-color: var(--accent-2); }
.notification-item.message { border-left-color: #7c3aed; }
.notification-item.success { border-left-color: var(--ok); }
.notification-item.error { border-left-color: var(--danger); }
.notification-item strong { display: block; font-size: 13px; }
.notification-item span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.notification-item code { display: block; margin-top: 5px; color: var(--ink); font-size: 12px; }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@media (max-width: 700px) { .toast-region { left: 14px; right: 14px; top: 12px; width: auto; } }

/* v1.2.3 Diagnostics and readable timestamps */
.callout.ok { border-color: #bbf7d0; background: #f0fdf4; }
.mini-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 12px; }
.diagnostics-output { display: grid; gap: 10px; margin-top: 12px; }
.diagnostics-output h4 { margin: 12px 0 4px; }
.diagnostics-output ul { margin-top: 6px; line-height: 1.6; }
@media (max-width: 900px) { .mini-stats { grid-template-columns: 1fr; } }
