:root {
  --bg: #fafafa;
  --fg: #222;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-contrast: #fff;
  --secondary: #64748b;
  --danger: #dc2626;
  --card: #fff;
  --border: #e5e7eb;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, 'Apple Color Emoji', 'Segoe UI Emoji'; background: var(--bg); color: var(--fg); }
.container { max-width: 760px; margin: 24px auto; padding: 0 16px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.btn { appearance: none; border: 1px solid transparent; border-radius: 6px; padding: 8px 12px; cursor: pointer; font-size: 14px; }
.btn-primary { background: var(--primary); color: var(--primary-contrast); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.muted { color: var(--muted); margin-top: 8px; white-space: pre-wrap; }
.alert { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.form-row { display: flex; flex-direction: column; margin: 10px 0; }
label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text] { padding: 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; }
.footer { text-align: center; color: var(--muted); margin-top: 16px; }

/* loading overlay */
.loading { position: fixed; inset: 0; background: rgba(0,0,0,0.35); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.loading-box { background: #fff; border-radius: 10px; padding: 16px 20px; min-width: 260px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); text-align: center; }
.loading-text { margin-top: 8px; color: var(--fg); }
.spinner { width: 28px; height: 28px; border: 3px solid #e5e7eb; border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
