/* Shared by the matrix page (index.html) and the single-mating page (pair.html), so the two
   read as one app: same header, cards, controls, messages and headline stats. Page-specific
   layout stays in each page. */

:root {
  --ink: #1a1a1a;
  --muted: #6b7280;
  --faint: #9ca3af;
  --line: #e2e5e9;
  --line-soft: #eef0f2;
  --field-line: #d8dce1;
  --bg: #f6f7f8;
  --panel: #fff;
  --sunken: #f9fafb;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --accent-line: #a5b4fc;
  --accent-ink: #4338ca;
  --content: 960px;   /* width of the form cards and the single-mating result */
}

* { box-sizing: border-box; }
body { margin: 0; font: 13px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       color: var(--ink); background: var(--bg); }

/* ---- header: app name, one tab per page, gem-api status ---------------------------------- */
.topbar { background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: stretch; gap: 22px; padding: 0 22px; min-height: 48px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; font-weight: 700; font-size: 14px; color: var(--ink); text-decoration: none; }
.pages { display: flex; gap: 4px; }
.pages a { display: flex; align-items: center; padding: 0 10px; color: var(--muted); text-decoration: none;
           border-bottom: 2px solid transparent; font-weight: 500; }
.pages a:hover { color: var(--ink); }
.pages a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.api { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
         background: var(--line-soft); color: var(--muted); }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.bad { background: #fee2e2; color: #991b1b; }

/* ---- page ------------------------------------------------------------------------------ */
main { padding: 26px 22px 60px; }
h1 { font-size: 18px; margin: 0 0 4px; letter-spacing: .01em; }
.lede { color: var(--muted); font-size: 12.5px; margin: 0 0 18px; max-width: var(--content); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; }
.panel.form { max-width: var(--content); }
.result { margin-top: 16px; }

/* Two side-by-side halves: sire and dam. */
.sides { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) { .sides { grid-template-columns: 1fr; } }
.side-title { font-size: 12px; margin: 0 0 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
h3 { font-size: 12px; margin: 22px 0 0; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* ---- controls -------------------------------------------------------------------------- */
label { display: block; font-size: 11px; color: var(--muted); margin: 0 0 3px; }
input, select, textarea { font: inherit; font-size: 13px; padding: 6px 9px; border: 1px solid var(--field-line);
                          border-radius: 6px; background: #fff; color: inherit; width: 100%; }
textarea { font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c7d2fe; outline-offset: -1px; border-color: var(--accent-line); }

.actions { margin-top: 14px; display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.actions .depth { width: 230px; }
.btn { font: inherit; padding: 6px 12px; border: 1px solid var(--field-line); border-radius: 6px;
       background: #fff; color: var(--ink); cursor: pointer; }
.btn:hover { background: var(--sunken); }
.btn-primary { font: inherit; font-weight: 600; padding: 7px 18px; border: 0; border-radius: 6px;
               background: var(--accent); color: #fff; cursor: pointer; }
.btn-primary:disabled { background: var(--accent-line); cursor: progress; }
.hint { color: var(--faint); font-size: 11.5px; }
.actions .hint { padding-bottom: 7px; }
.form .hint.below { margin-top: 10px; }

/* BHID / Registration switch on each side of the single-mating form. */
.seg { display: flex; gap: 4px; margin-bottom: 10px; }
.seg button { font: inherit; font-size: 11px; padding: 3px 9px; border: 1px solid var(--line); background: var(--sunken);
              border-radius: 5px; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); font-weight: 600; }

/* ---- messages -------------------------------------------------------------------------- */
.err { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: 6px;
       padding: 9px 12px; font-size: 12.5px; white-space: pre-wrap; max-width: var(--content); }
.note { background: #fffbeb; border: 1px solid #fde68a; color: #78350f; border-radius: 6px;
        padding: 8px 11px; margin-top: 10px; font-size: 12px; }

/* ---- headline figures ------------------------------------------------------------------ */
.headline { display: flex; gap: 26px; align-items: baseline; flex-wrap: wrap; }
.stat .k { font-size: 11px; color: var(--muted); }
.stat .v { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- plain tables, styled to sit next to AG Grid's ------------------------------------- */
.tablewrap { margin-top: 8px; border: 1px solid var(--line); border-radius: 6px; overflow-x: auto; }
.tablewrap table { border-collapse: collapse; width: 100%; font-size: 12px; }
.tablewrap th, .tablewrap td { text-align: left; padding: 5px 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.tablewrap th { background: var(--sunken); font-size: 11px; font-weight: 600; color: var(--ink); border-bottom-color: var(--line); }
.tablewrap tr:last-child td { border-bottom: 0; }
.tablewrap .num { text-align: right; font-variant-numeric: tabular-nums; }
