/* =============================================================
   WABook — "Sprout" design system
   Cool slate neutrals + warm clay accent
   Be Vietnam Pro UI · Fraunces display · JetBrains Mono
   ============================================================= */

:root {
  /* Surfaces */
  --bg: #f6f7f9;
  --bg-deep: #eceef2;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f0f1f4;

  /* Text */
  --ink: #0e1017;
  --ink-2: #4a4f5b;
  --ink-3: #7d8492;
  --ink-4: #9aa1ad;

  /* Borders */
  --line: #e3e6ec;
  --line-strong: #d4d8e0;
  --card-edge: #e8ebf1;

  /* Accent — warm clay (consistent with previous brand) */
  --accent: #c96442;
  --accent-hover: #b35434;
  --accent-soft: rgba(201, 100, 66, 0.08);
  --accent-soft-strong: rgba(201, 100, 66, 0.14);

  /* Status */
  --success: #2c7a3d;
  --success-soft: #e0eee3;
  --success-dot: #3aa56b;
  --warning: #b06a14;
  --warning-soft: #fff7ed;
  --warning-edge: #f4dcb8;
  --warning-ink: #5e3f0b;
  --warning-dot: #d99720;
  --danger: #b91c1c;
  --danger-soft: #fdf6f6;
  --danger-edge: #f0d4d4;
  --danger-ink: #7a2222;
  --info-bg: #f0f4ff;
  --info-edge: #d8e0f5;
  --info-ink: #1d2c5a;
  --info-accent: #3a5cff;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(14, 16, 23, 0.04);
  --shadow-sm: 0 2px 6px rgba(14, 16, 23, 0.06), 0 1px 2px rgba(14, 16, 23, 0.03);
  --shadow-md: 0 8px 24px rgba(14, 16, 23, 0.08), 0 2px 6px rgba(14, 16, 23, 0.04);
  --shadow-lg: 0 18px 48px rgba(14, 16, 23, 0.12), 0 4px 12px rgba(14, 16, 23, 0.05);

  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Be Vietnam Pro', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;

  /* Sizing */
  --r-sm: 8px;
  --r: 10px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 9999px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}

h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 8px;
}
h1 { font-size: 22px; line-height: 1.2; }
h2 { font-size: 18px; line-height: 1.25; font-weight: 700; }
h3 { font-size: 14.5px; line-height: 1.3; font-weight: 700; }

p {
  margin: 0 0 12px;
  color: var(--ink-2);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-deep);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--ink);
}

/* =============================================================
   Buttons
   ============================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: var(--r);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.12s ease;
  white-space: nowrap;
  letter-spacing: -0.005em;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  background: var(--ink);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: #000; }

.btn-accent {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.btn-accent:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-deep);
  color: var(--ink);
}
.btn-secondary:hover:not(:disabled) { background: var(--line); }

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-deep);
  color: var(--ink);
}

.btn-danger {
  background: #c33;
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #a82828; }

.btn-link {
  background: transparent;
  color: var(--accent);
  padding: 4px 8px;
}
.btn-link:hover:not(:disabled) { text-decoration: underline; }

.btn-large {
  padding: 11px 18px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* =============================================================
   Forms
   ============================================================= */

.field { margin-bottom: 14px; }
.field label {
  display: block;
  margin-bottom: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--ink-4); }
textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.5;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* =============================================================
   Cards
   ============================================================= */

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 24px;
  margin-bottom: 14px;
}
.card-soft {
  background: var(--bg-deep);
  border-color: transparent;
}
.card-compact { padding: 18px 20px; }

/* =============================================================
   Pills
   ============================================================= */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--r-sm);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.pill.neutral { background: var(--bg-deep); color: var(--ink-2); }
.pill.neutral .pill-dot { background: var(--ink-4); }
.pill.connected, .pill.success { background: rgba(58, 165, 107, 0.12); color: #1f6a3d; }
.pill.connected .pill-dot, .pill.success .pill-dot { background: var(--success-dot); }
.pill.connecting, .pill.warn { background: rgba(217, 151, 32, 0.14); color: var(--warning); }
.pill.connecting .pill-dot, .pill.warn .pill-dot { background: var(--warning-dot); }
.pill.disconnected { background: var(--bg-deep); color: var(--ink-2); }
.pill.disconnected .pill-dot { background: var(--ink-4); }
.pill.accent { background: var(--accent-soft-strong); color: var(--accent); }
.pill.accent .pill-dot { background: var(--accent); }
.pill.danger { background: #fde8e8; color: #9a2a2a; }
.pill.danger .pill-dot { background: #c33; }

/* =============================================================
   Toasts
   ============================================================= */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--r);
  font-size: 13px;
  z-index: 1000;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  max-width: 380px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); }
.toast-error { background: #c33; }

/* =============================================================
   Layout helpers
   ============================================================= */

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mt-4 { margin-top: 18px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 14px; }
