:root {
  color-scheme: dark;

  --bg: #09090b;
  --surface: #111113;
  --surface-2: #18181b;
  --surface-3: #1f1f23;
  --ink: #ededef;
  --ink-2: #c4c4cc;
  --muted: #8b8b94;
  --faint: #5c5c66;
  --line: #222226;
  --line-2: #2f2f35;

  --brand: #3ecf8e;
  --brand-hover: #5ad9a0;
  --brand-ink: #7ee8b5;
  --brand-soft: rgb(62 207 142 / 0.1);
  --brand-line: rgb(62 207 142 / 0.28);

  --warn: #f2b84b;
  --warn-soft: rgb(242 184 75 / 0.1);
  --danger: #f47174;
  --danger-soft: rgb(244 113 116 / 0.1);
  --danger-line: rgb(244 113 116 / 0.3);
  --info: #7ea6ff;
  --info-soft: rgb(126 166 255 / 0.1);

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 0 rgb(255 255 255 / 0.03) inset;
  --shadow: 0 1px 0 rgb(255 255 255 / 0.04) inset, 0 24px 48px -24px rgb(0 0 0 / 0.7);
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: rgb(62 207 142 / 0.3); color: #fff; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -0.025em; font-weight: 600; }
p { margin: 0; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font-weight: 500; font-size: 14px; text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .05s;
  background: var(--surface-2); color: var(--ink);
}
.btn:hover { background: var(--surface-3); border-color: #3a3a41; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-primary:hover { background: #fff; border-color: #fff; }
.btn-dark { background: var(--surface-2); border-color: var(--line-2); color: var(--ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgb(255 255 255 / 0.05); border-color: transparent; color: var(--ink); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger-line); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn .spinner { width: 16px; height: 16px; }

.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field small, .hint { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 12px;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238b8b94' stroke-width='1.6' viewBox='0 0 12 12'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.select option { background: var(--surface-2); }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:hover, .select:hover, .textarea:hover { border-color: #3a3a41; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgb(62 207 142 / 0.14);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--line-2);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--brand-soft); color: var(--brand-ink); border-color: var(--brand-line); }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: rgb(242 184 75 / .25); }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.badge.info { background: var(--info-soft); color: var(--info); border-color: rgb(126 166 255 / .25); }

.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.wa-chat { background: #0b141a; border-radius: var(--radius); padding: 14px; }
.wa-bubble {
  position: relative; max-width: 100%;
  background: #202c33; border-radius: 0 8px 8px 8px; padding: 7px 10px 20px;
  font-size: 13.5px; line-height: 1.45; color: #e9edef;
  box-shadow: 0 1px 0.5px rgb(0 0 0 / 0.25);
  white-space: pre-wrap; word-break: break-word;
}
.wa-bubble + .wa-bubble { margin-top: 8px; }
.wa-bubble a { color: #53bdeb; text-decoration: none; }
.wa-bubble .wa-time { position: absolute; right: 8px; bottom: 4px; font-size: 11px; color: #8696a0; }

.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 380px;
  padding: 12px 14px; border-radius: 10px; background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--line-2); font-size: 14px; box-shadow: var(--shadow); animation: toast-in .2s ease-out;
}
.toast.error { border-color: var(--danger-line); color: #ffd7d8; }
.toast.error::before { content: '!'; font-weight: 700; color: var(--danger); }
.toast.success::before { content: '✓'; font-weight: 700; color: var(--brand); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
