:root {
  --bg:         #0f1117;
  --surface:    #1a1d27;
  --border:     #2a2d3a;
  --text:       #e8eaf0;
  --muted:      #8b8fa8;
  --accent:     #0a66c2;
  --accent-h:   #0958a8;
  --success:    #22c55e;
  --danger:     #ef4444;
  --radius:     10px;
}
[data-theme="light"] {
  --bg:       #f4f6fb;
  --surface:  #ffffff;
  --border:   #dde1ed;
  --text:     #111827;
  --muted:    #6b7280;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ─── */
.container { max-width: 720px; margin: 0 auto; padding: 24px 20px; }

/* ─── Header ─── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
}
.logo svg { flex-shrink: 0; color: var(--accent); }
.header-right { display: flex; align-items: center; gap: 10px; }

/* ─── Badges ─── */
.badge {
  font-size: 12px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 20px;
}
.badge-connected    { background: #14532d22; color: var(--success); border: 1px solid #22c55e44; }
.badge-disconnected { background: #7f1d1d22; color: #f87171;       border: 1px solid #ef444444; }

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}
.card h2 { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.card p  { color: var(--muted); font-size: 14px; margin-bottom: 16px; }

/* ─── Form ─── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--muted); }
.field input, .field select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary  { background: var(--accent);  color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-h); }
.btn-ghost    { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.btn-danger   { background: transparent; color: var(--danger); border: 1px solid #ef444444; }
.btn-danger:hover:not(:disabled) { background: #ef444411; }
.btn-sm       { padding: 6px 12px; font-size: 13px; }

/* ─── Flash ─── */
.flash {
  display: none;
  padding: 10px 14px;
  border-radius: 7px;
  font-size: 13px;
  margin-bottom: 16px;
}
.flash.ok    { background: #14532d22; color: var(--success); border: 1px solid #22c55e44; display: block; }
.flash.error { background: #7f1d1d22; color: #f87171;       border: 1px solid #ef444444; display: block; }

/* ─── Loading ─── */
.loading-center { display: flex; justify-content: center; padding: 60px 0; }
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Connected state ─── */
.connected-info { display: flex; align-items: center; gap: 12px; }
.li-icon { color: var(--accent); }
.connected-text h3 { font-size: 15px; font-weight: 600; }
.connected-text p  { color: var(--muted); font-size: 13px; margin: 0; }
.action-row { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }

/* ─── Steps ─── */
.steps { list-style: none; counter-reset: step; }
.steps li {
  counter-increment: step;
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--muted);
}
.steps li::before {
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-top: 1px;
}

/* ─── Theme toggle ─── */
.theme-btn {
  background: none; border: 1px solid var(--border);
  color: var(--muted); cursor: pointer;
  border-radius: 6px; padding: 4px 8px; font-size: 14px;
}
.theme-btn:hover { border-color: var(--accent); }

/* ─── Index page ─── */
.hero { text-align: center; padding: 40px 0 32px; }
.hero h1 { font-size: 26px; font-weight: 700; margin-bottom: 12px; }
.hero p   { color: var(--muted); font-size: 15px; max-width: 520px; margin: 0 auto; }
.features { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 28px 0; }
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.feature-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.feature-card p  { font-size: 13px; color: var(--muted); margin: 0; }
.feature-icon { font-size: 22px; margin-bottom: 8px; }
.setup-steps { counter-reset: s; list-style: none; }
.setup-steps li {
  counter-increment: s;
  display: flex; gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.setup-steps li:last-child { border-bottom: none; }
.setup-steps li::before {
  content: counter(s);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff; font-size: 12px; font-weight: 700;
}
.setup-steps .step-body strong { display: block; font-size: 14px; margin-bottom: 3px; }
.setup-steps .step-body span   { color: var(--muted); font-size: 13px; }
footer {
  text-align: center;
  padding: 28px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}
footer a { margin: 0 8px; }
@media (max-width: 500px) {
  .features { grid-template-columns: 1fr; }
}

/* ─── Policy pages ─── */
.policy-body h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.policy-body .updated { font-size: 13px; color: var(--muted); margin-bottom: 28px; }
.policy-body h2 { font-size: 16px; font-weight: 600; margin: 24px 0 8px; }
.policy-body p, .policy-body li { font-size: 14px; color: var(--muted); line-height: 1.7; }
.policy-body ul { padding-left: 20px; margin: 8px 0; }
.policy-body a { color: var(--accent); }
