/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ────────────────────────────────────────────────────────────────── */
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #f5f5f5; color: #1a1a1a; min-height: 100vh; padding: 16px;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: #fff; border-radius: 12px; padding: 20px; margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* ── Typography ──────────────────────────────────────────────────────────── */
h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 20px; }
h2 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }
h3 { font-size: .88rem; font-weight: 700; color: #475569; margin: 18px 0 10px; text-transform: uppercase; letter-spacing: .04em; }

/* ── State classes ───────────────────────────────────────────────────────── */
.empty   { color: #64748b; padding: 32px 0; text-align: center; font-size: .95rem; }
.error   { color: #dc2626; padding: 12px 0; font-size: .9rem; }
.loading { color: #64748b; padding: 24px 0; text-align: center; }
.status-msg { font-size: .82rem; color: #64748b; margin-top: 8px; min-height: 1.2em; }
.status-msg.ok  { color: #16a34a; }
.status-msg.err { color: #dc2626; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
label {
  display: block; font-size: .82rem; font-weight: 600;
  color: #475569; margin-bottom: 5px;
}
input[type=text],
input[type=email],
input[type=password],
input[type=tel],
input[type=number] {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid #ddd; border-radius: 8px;
  font-size: .92rem; outline: none; box-sizing: border-box;
  font-family: inherit; transition: border-color .15s;
}
/* Add spacing only when a label precedes an input (form context) */
label + input[type=text],
label + input[type=email],
label + input[type=password],
label + input[type=tel],
label + input[type=number] { margin-bottom: 14px; }
input[type=text]:focus,
input[type=email]:focus,
input[type=password]:focus,
input[type=tel]:focus,
input[type=number]:focus {
  border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ── Section header ──────────────────────────────────────────────────────── */
.section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.section-header h2 { margin: 0; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 1000; align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal, .modal-box {
  background: #fff; border-radius: 14px; padding: 24px; width: 100%;
  max-width: 680px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-box { max-width: 380px; }
.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.modal-title { font-size: 1rem; font-weight: 700; line-height: 1.4; }
.modal-close {
  border: none; background: none; cursor: pointer; color: #64748b;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 6px;
}
.modal-close:hover { color: #1a1a1a; background: rgba(0,0,0,.06); }

/* ── Icon tab / nav button ───────────────────────────────────────────────── */
.top-tab {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
  color: #475569; background: #fff; border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: background .12s, color .12s, border-color .12s;
  flex-shrink: 0; text-decoration: none;
}
.top-tab:hover { background: #f8fafc; color: #1e40af; border-color: #93c5fd; }
.top-tab.active { background: #eff6ff; color: #2563eb; border-color: #93c5fd; }
.top-tab.danger { color: #dc2626; }
.top-tab.danger:hover { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  body { padding: 10px; }
  h1 { font-size: 1.2rem; margin-bottom: 14px; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal, .modal-box {
    border-radius: 14px 14px 0 0; max-width: 100%;
    max-height: 92vh; padding: 20px 16px;
  }
}


/* ── Utility helpers (generated by security-fix 6) ─────────────── */
.u-hidden        { display: none; }
.u-flex-1        { flex: 1; }
.u-ml-auto       { margin-left: auto; }
.u-pointer       { cursor: pointer; }
.u-mb-0          { margin-bottom: 0; }
.u-w-0           { width: 0%; }

/* Honeypot: off-screen */
.u-offscreen {
  position: absolute; left: -9999px;
  width: 1px; height: 1px; opacity: 0;
}
/* WCAG screen-reader only */
.u-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* SVG icon base (replaces icons.js inline style) */
.svg-icon { display: block; pointer-events: none; flex-shrink: 0; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.page-footer {
  text-align: center; padding: 24px 16px 20px;
  margin-top: 8px; font-size: .82rem; color: #64748b;
  border-top: 1px solid #e2e8f0;
}
.footer-cat-link {
  color: #2563eb; text-decoration: none;
  padding: 3px 10px; border: 1px solid #e2e8f0;
  border-radius: 6px; font-size: .78rem;
}
.footer-cat-link:hover { background: #eff6ff; border-color: #93c5fd; }
