/* Shared by every portal page, so they read as one app: header, cards, controls,
   messages, tables. Page-specific layout stays in each page.

   Colors and type come from the GEM design system in static/brand/tokens.css,
   which is a copy of gem-landing's brand/ (itself built from the Sept 2026 brand
   guide). The --gem-* tokens are the source of truth; the short names below are
   this app's roles, mapped onto them, so the rest of the CSS did not have to
   change when the brand did. */

@import url("brand/tokens.css");

:root {
  --ink: var(--gem-ozark);            /* Ozark Pasture  #11312B */
  --muted: var(--gem-ink-muted);
  --faint: var(--gem-ozark-2);
  --line: var(--gem-border);
  --line-soft: #EEF0EE;
  --field-line: #D6DBD8;
  --bg: var(--gem-surface-alt);       /* warm off-white, so white panels lift */
  --panel: var(--gem-white);
  --sunken: #F7F6F2;
  --accent: var(--gem-river);         /* Elk River: links, focus, selection  */
  --accent-soft: var(--gem-river-4);
  --accent-line: var(--gem-river-2);
  --accent-ink: #00655B;
  --cta: var(--gem-gold);             /* Branded Gold: the one primary button */
  --cta-ink: var(--gem-ozark);        /* brand rule: ozark type on gold       */
  --content: 960px;
}

* { box-sizing: border-box; }
body { margin: 0; font: 13px/1.5 var(--gem-font-body);
       color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }

/* ---- header: app name, one tab per page, gem-api status ---------------------------------- */
.topbar { background: var(--gem-ozark); }
.topbar-inner { display: flex; align-items: stretch; gap: 22px; padding: 0 22px; min-height: 52px; flex-wrap: wrap; }

/* The lockup, horizontal for a 52px bar: gold gem over nothing, wordmark beside
   it. The stacked primary logo is on the sign-in pages, where it has room. */
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.brand img.mark { height: 21px; width: auto; display: block; }
.brand img.word { height: 15px; width: auto; display: block; }
.brand .app { padding-left: 10px; margin-left: 2px; border-left: 1px solid rgba(255,255,255,.22);
              font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
              color: var(--gem-ozark-3); }

.pages { display: flex; gap: 4px; }
.pages a { display: flex; align-items: center; padding: 0 10px; color: var(--gem-ozark-4); text-decoration: none;
           border-bottom: 2px solid transparent; font-weight: 500; }
.pages a:hover { color: #fff; }
.pages a[aria-current="page"] { color: #fff; border-bottom-color: var(--gem-gold); font-weight: 600; }
.api { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--gem-ozark-4); }
.topbar .btn { background: transparent; border-color: rgba(255,255,255,.28); color: #fff; }
.topbar .btn:hover { background: rgba(255,255,255,.12); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
         background: rgba(255,255,255,.12); color: var(--gem-ozark-4); }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.bad { background: #fee2e2; color: #991b1b; }

/* ---- page ------------------------------------------------------------------------------ */
a { color: var(--gem-link); text-underline-offset: 2px; }
a:hover { color: var(--gem-ozark); }

main { padding: 26px 22px 60px; }
h1 { font-family: var(--gem-font-display); font-weight: var(--gem-weight-display);
     font-size: 20px; margin: 0 0 4px; letter-spacing: 0; }
.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 var(--gem-river-3); 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; text-decoration: none; display: inline-flex;
       align-items: center; white-space: nowrap; }
.btn:hover { background: var(--sunken); }
.btn-primary { font: inherit; font-weight: 700; padding: 7px 18px; border: 0; border-radius: 6px;
               background: var(--cta); color: var(--cta-ink); cursor: pointer; }
.btn-primary:hover { background: var(--gem-gold-1); }
.btn-primary:disabled { background: var(--gem-gold-3); color: var(--gem-ozark-1); 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; }

/* ---- phones ---------------------------------------------------------------------------
   Touch wants bigger targets than a mouse, and 22px of side padding is a lot of a
   375px screen. Nothing here changes the desktop layout. */
@media (max-width: 860px) {
  main { padding: 18px 16px 48px; }
  .topbar-inner { padding: 0 16px; gap: 14px; }
  .btn { padding: 9px 13px; }
  .btn-primary { padding: 10px 18px; }
  .pages a { padding: 0 12px; }
  input, select, textarea { font-size: 16px; }   /* iOS zooms in on anything smaller */
  .api { font-size: 11px; }
}

/* Phones: the header has to fit one row, so the things that are only labels go.
   The ranch name is kept -- it is how someone checks whose data they are looking
   at -- but it stops wrapping and takes an ellipsis instead. */
@media (max-width: 520px) {
  .topbar-inner { gap: 10px; min-height: 48px; padding: 0 12px; }
  .brand .app { display: none; }
  .pages { display: none; }
  /* The right-hand group wraps within itself rather than pushing the page wide. */
  .api { gap: 5px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
  .api .who { max-width: 7.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .btn { padding: 7px 10px; }
  /* The date badge is what tips the header onto a second row on any phone, and
     the chat page says the data is a day old in its own opening line. */
  .topbar .badge { display: none; }
  main { padding: 16px 14px 44px; }
}

@media (max-width: 400px) {
  .api .who { max-width: 6.5rem; }
}

/* ---- 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; }
