/* FarmHand — plain CSS, light and dark themes. */
:root {
  --bg: #f5f4ef;
  --surface: #ffffff;
  --surface-2: #fafaf6;
  --text: #1d281e;
  --muted: #5b675b;
  --border: #dad9cf;
  --accent: #2e6a39;
  --accent-hover: #24552d;
  --accent-contrast: #ffffff;
  --accent-soft: #e2eee3;
  --warn: #8f5400;
  --warn-soft: #fdf1d9;
  --danger: #b0261d;
  --danger-soft: #fbe4e2;
  --info-soft: #e4eef8;
  --chart-1: #2e6a39;
  --chart-2: #b8741a;
  --chart-3: #3a6d9d;
  --chart-4: #8b4f9e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 20, 0.07);
  color-scheme: light;
}
/* Dark: the browser's setting, unless the person chose light; or their choice of dark (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131915;
    --surface: #1b231d;
    --surface-2: #202a22;
    --text: #e6ebe5;
    --muted: #a2afa1;
    --border: #324034;
    --accent: #7dc48b;
    --accent-hover: #95d4a1;
    --accent-contrast: #0d1a10;
    --accent-soft: #223826;
    --warn: #f0b45a;
    --warn-soft: #3a2b12;
    --danger: #f2877e;
    --danger-soft: #3d1f1c;
    --info-soft: #1e2d3a;
    --chart-1: #7dc48b;
    --chart-2: #e4a44c;
    --chart-3: #80b1df;
    --chart-4: #c89ce1;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131915;
  --surface: #1b231d;
  --surface-2: #202a22;
  --text: #e6ebe5;
  --muted: #a2afa1;
  --border: #324034;
  --accent: #7dc48b;
  --accent-hover: #95d4a1;
  --accent-contrast: #0d1a10;
  --accent-soft: #223826;
  --warn: #f0b45a;
  --warn-soft: #3a2b12;
  --danger: #f2877e;
  --danger-soft: #3d1f1c;
  --info-soft: #1e2d3a;
  --chart-1: #7dc48b;
  --chart-2: #e4a44c;
  --chart-3: #80b1df;
  --chart-4: #c89ce1;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1 { font-size: 1.6rem; margin: 0 0 0.25rem; line-height: 1.25; }
h2 { font-size: 1.2rem; margin: 0 0 0.75rem; }
h3 { font-size: 1rem; margin: 1rem 0 0.5rem; }
p { margin: 0 0 0.75rem; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-size: 0.9em; }
img, svg { max-width: 100%; }

/* Header & navigation */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1000; }
.site-header .inner { max-width: 1240px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 16px; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; padding: 12px 0; }
.brand span { color: var(--accent); }
.ranch-switch { display: flex; align-items: center; gap: 6px; margin: 0; }
.ranch-switch select { font-weight: 700; font-size: 1rem; max-width: 15em; min-height: 36px; padding: 4px 8px; }
.ranch-access { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.ranch-access legend { padding: 0; margin-right: 4px; float: left; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* The record pages wrap onto a second line rather than scrolling out of sight. */
.nav { display: flex; flex-wrap: wrap; gap: 0 2px; flex: 1; }
.nav a { padding: 14px 8px; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; font-size: 0.92rem; }
.nav a:hover { color: var(--text); }
.nav a.current { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
/* The menu at the right: account links, and on phones the record pages too. */
.menu { position: relative; font-size: 0.92rem; }
.menu summary { list-style: none; cursor: pointer; white-space: nowrap; padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; color: var(--text); }
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: ' ▾'; color: var(--muted); }
.menu[open] summary { background: var(--surface-2); }
.menu-phone { display: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 1100; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(20, 30, 20, 0.18); padding: 6px; display: flex; flex-direction: column; }
.menu-panel a, .menu-panel .link-button { display: block; padding: 10px 12px; border-radius: 6px; color: var(--text); text-decoration: none; text-align: left; width: 100%; box-sizing: border-box; }
.menu-panel a:hover, .menu-panel .link-button:hover { background: var(--surface-2); }
.menu-panel form { margin: 0; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.nav-narrow { display: none; }
.link-button { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

main { max-width: 1240px; margin: 0 auto; padding: 20px 16px 48px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head p { color: var(--muted); margin: 0; }
.footer { color: var(--muted); font-size: 0.85rem; text-align: center; padding: 16px; }

/* Cards & layout */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card > :last-child { margin-bottom: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid > .card { margin-bottom: 0; }
.cols-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.cols-2 > * { min-width: 0; }
.stat { font-size: 1.9rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
.stat-sub { color: var(--muted); font-size: 0.9rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 8px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

/* Badges */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.badge-ok { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-info { background: var(--info-soft); color: var(--text); border-color: transparent; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.data th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 600; white-space: nowrap; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tfoot td { font-weight: 700; border-bottom: 0; }
.better { color: var(--accent); font-weight: 600; }
.worse { color: var(--danger); font-weight: 600; }

/* Forms */
form { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 16px; margin-bottom: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
label .hint, .hint { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=email], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: 9px 10px; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; min-height: 42px;
}
input[type=file] { padding: 7px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check input { width: 18px; height: 18px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.inline-form > div { min-width: 140px; flex: 1; }
.filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin-bottom: 12px; }
.filters > div { min-width: 150px; }
.errors { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }
.errors ul { margin: 0; padding-left: 18px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 8px 16px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-contrast); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-small { min-height: 32px; padding: 3px 10px; font-size: 0.875rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Messages */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid transparent; }
.flash-success { background: var(--accent-soft); color: var(--accent); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-info { background: var(--info-soft); }
.notice { background: var(--warn-soft); color: var(--warn); padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.notice a { color: inherit; }

/* Flags & lists */
.flag-list { list-style: none; margin: 0; padding: 0; }
.flag-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.flag-list li:last-child { border-bottom: 0; }

/* Heat stress */
.thi-none { color: var(--accent); }
.thi-mild { color: var(--warn); }
.thi-moderate { color: var(--warn); font-weight: 700; }
.thi-severe { color: var(--danger); font-weight: 700; }
td.thi-cell-mild { background: var(--warn-soft); }
td.thi-cell-moderate { background: var(--warn-soft); font-weight: 700; }
td.thi-cell-severe { background: var(--danger-soft); font-weight: 700; color: var(--danger); }

/* Pedigree */
.pedigree { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 6px 12px; align-items: center; font-size: 0.92rem; }
.pedigree .slot { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; background: var(--surface-2); min-height: 38px; }
.pedigree .slot.empty { color: var(--muted); font-style: italic; }
.pedigree .gen1 { grid-column: 1; } .pedigree .gen2 { grid-column: 2; } .pedigree .gen3 { grid-column: 3; }

/* Maps */
.map { height: 460px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); z-index: 0; }
.map.short { height: 340px; }
.map-locator { height: 380px; cursor: crosshair; }
.input-row { display: flex; gap: 8px; }
.locate-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 8px; }
.input-row input { flex: 1; min-width: 0; }
.fence-event { border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.paddock-label { background: rgba(0, 0, 0, 0.55); border: 0; color: #fff; font-weight: 600; box-shadow: none; }
.paddock-label::before { display: none; }
.leaflet-container a { color: #0a64a4; }

/* Charts: capped width so the text inside the SVG stays a normal size. */
.chart { width: 100%; max-width: 820px; height: auto; display: block; }
.chart-bar { fill: var(--chart-1); }
.chart-bar.alt { fill: var(--chart-2); }
.chart-missing { fill: var(--border); }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-label { fill: var(--muted); font-size: 12px; font-family: inherit; }
.chart-line { stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-series-0 { stroke: var(--chart-1); }
.chart-series-1 { stroke: var(--chart-2); }
.chart-series-2 { stroke: var(--chart-3); }
.chart-series-3 { stroke: var(--chart-4); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
.legend i { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin-right: 4px; }
.legend .s0 { background: var(--chart-1); } .legend .s1 { background: var(--chart-2); } .legend .s2 { background: var(--chart-3); }

/* Progress */
.progress { height: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); }

/* Login */
.auth-box { max-width: 420px; margin: 8vh auto; }
.auth-box.wide-auth { max-width: 560px; margin-top: 4vh; }

/* Ranches and sharing */
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.row-actions form { margin: 0; }
.invite-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 8px 0; border-top: 1px solid var(--border); }
.invite-row:first-of-type { border-top: 0; }
.invite-row p { margin: 0; }
.invite-row .actions { display: flex; gap: 6px; }
.invite-row form { margin: 0; }
.invite-link label { display: block; margin-bottom: 6px; }
.invite-link input { width: 100%; box-sizing: border-box; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }
.inline-form.compact { margin: 0; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 6px 0; border-top: 1px solid var(--border); }
.plain-list li:first-child { border-top: 0; }

/* Community */
.crumbs { font-size: 0.9rem; margin: 0 0 2px; }
.crumbs a { color: var(--muted); }
.search-form { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; max-width: 560px; }
.search-form input { flex: 1; min-width: 0; }
.category-list, .topic-list { list-style: none; margin: 0; padding: 0; }
.category-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 15rem); gap: 4px 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.category-list li:first-child, .topic-list li:first-child { border-top: 0; }
.category-name { font-weight: 600; font-size: 1.02rem; }
.topic-row { display: grid; grid-template-columns: minmax(0, 1fr) 6.5rem minmax(0, 13rem); gap: 4px 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.topic-title { font-weight: 600; margin-right: 4px; }
.topic-row.is-new .topic-title { color: var(--text); }
.topic-row.is-new .topic-title::before { content: '● '; color: var(--accent); }
.topic-count { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pager { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 0 0 16px; }
.pager a, .pager span { padding: 4px 10px; border-radius: 6px; min-width: 2.2em; text-align: center; }
.pager a { border: 1px solid var(--border); text-decoration: none; background: var(--surface); }
.pager .current { background: var(--accent); color: var(--accent-contrast); font-weight: 600; }
.mod-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 12px; margin-bottom: 16px; border: 1px dashed var(--border); border-radius: var(--radius); }
.mod-bar form { margin: 0; }
.mod-bar select { min-height: 32px; padding: 3px 8px; width: auto; }
.post { scroll-margin-top: 72px; }
.post:target { border-color: var(--accent); }
.post-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 8px; }
.post-author { font-weight: 700; }
.post-time { margin-left: auto; text-decoration: none; }
.post-body { overflow-wrap: anywhere; }
.post-body p { margin: 0 0 0.75rem; }
.post-body blockquote { margin: 0 0 0.75rem; padding: 6px 12px; border-left: 3px solid var(--border); color: var(--muted); background: var(--surface-2); border-radius: 0 6px 6px 0; }
.post-body blockquote p:last-child { margin-bottom: 0; }
.post-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-top: 4px; }
.post-actions form { margin: 0; }
.post-actions .report summary { cursor: pointer; color: var(--muted); }
.post-actions .report[open] { flex-basis: 100%; }
.post-actions .report form { margin-top: 6px; }
.category-edit { padding: 8px 0; border-top: 1px solid var(--border); }
.category-edit:first-child { border-top: 0; }
.topic-last time, .category-last time { white-space: nowrap; }
.visitor-nav { flex: 1; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.plain-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.plain-fieldset legend { padding: 0; margin-bottom: 4px; }
.admin-choice { align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--border); }
.admin-choice input { margin-top: 3px; flex: none; }

@media (max-width: 900px) {
  /* Phones: the ranch on the left, everything else in the menu. */
  .site-header .inner { justify-content: space-between; }
  .site-header .brand { padding: 10px 0; }
  .nav-wide, .menu-name { display: none; }
  .menu-phone { display: inline; }
  .nav-narrow { display: flex; flex-direction: column; border-bottom: 1px solid var(--border); margin-bottom: 4px; padding-bottom: 4px; }
  .nav-narrow a[aria-current] { font-weight: 600; background: var(--accent-soft); }
  .menu-panel { position: fixed; left: 8px; right: 8px; top: 56px; max-height: calc(100vh - 72px); overflow-y: auto; }
}
@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .category-list li, .topic-row { grid-template-columns: minmax(0, 1fr) auto; }
  .category-last, .topic-last { grid-column: 1 / -1; }
  .post-time { margin-left: 0; }
  /* Visitors: the site name and buttons on top, their two links below. */
  .visitor-header .inner { flex-wrap: wrap; gap: 0 12px; }
  .visitor-header .actions { margin-left: auto; }
  .visitor-header .visitor-nav { order: 3; flex-basis: 100%; }
  .visitor-header .nav a { padding: 4px 8px 10px; }
  .chart-label { font-size: 18px; }
  .map { height: 360px; }
  .pedigree { grid-template-columns: 1fr; }
  .pedigree .slot { grid-row: auto !important; }
  .pedigree .gen1, .pedigree .gen2, .pedigree .gen3 { grid-column: 1; }
  .pedigree .gen2 { margin-left: 16px; }
  .pedigree .gen3 { margin-left: 32px; }
  .stat { font-size: 1.6rem; }
}
@media print {
  .site-header, .actions, .filters, form .btn { display: none !important; }
  body { background: #fff; }
  .card { border: 0; box-shadow: none; }
}

/* Animal photos */
.page-head-photo { display: flex; align-items: center; gap: 14px; }
.avatar { width: 72px; height: 72px; object-fit: cover; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); }
.avatar-small { width: 32px; height: 32px; vertical-align: middle; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.photo { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo figcaption { display: flex; flex-direction: column; gap: 4px; padding: 8px; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Choosing animals for a group treatment or a sale. */
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 16px; max-height: 360px; overflow-y: auto; padding: 4px 0; }
.check-list .check { margin: 0; }
.money-in { color: #2e6a39; }
.money-out { color: #a33; }
.nav-more { display: flex; flex-direction: column; border-bottom: 1px solid var(--border); margin-bottom: 4px; padding-bottom: 4px; }
.nav-more::before { content: "More"; padding: 6px 12px 2px; font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.nav-more a[aria-current] { font-weight: 600; background: var(--accent-soft); }
.task-overdue { color: var(--danger); font-weight: 600; }
form.inline { display: inline; margin: 0; }
a.card-link { display: block; color: inherit; text-decoration: none; }
a.card-link:hover { border-color: var(--accent); }
a.card-link h2 { color: var(--accent); }

/* Ranch intelligence (IAP). How each figure is known, as a small tag. */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 8px 12px; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; }
.tabs a[aria-current] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.kind { display: inline-block; font-size: 0.72rem; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.kind-measured { border-color: #2e6a39; color: #2e6a39; }
.kind-calculated { border-color: #3a5a8c; color: #3a5a8c; }
.kind-estimated { border-color: #9a6a00; color: #9a6a00; border-style: dashed; }
.kind-observed { border-color: #6b4a8a; color: #6b4a8a; }
.iap-figures { display: grid; grid-template-columns: 1fr; gap: 2px 0; margin: 8px 0 0; }
.iap-figures dt { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
.iap-figures dd { margin: 0; }
.iap-move { font-size: 1.05rem; }
.iap-control { border-left: 4px solid var(--accent); }
.conf-high { background: #2e6a39; color: #fff; }
.conf-medium { background: #9a6a00; color: #fff; }
.conf-low { background: #8a8a8a; color: #fff; }
.status-live { background: #2e6a39; color: #fff; }
.status-record { background: #3a5a8c; color: #fff; }
.status-planned { background: #ddd; color: #333; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .kind-measured { border-color: #7cc48a; color: #7cc48a; }
  :root:not([data-theme="light"]) .kind-calculated { border-color: #8fb1e6; color: #8fb1e6; }
  :root:not([data-theme="light"]) .kind-estimated { border-color: #e2b552; color: #e2b552; }
  :root:not([data-theme="light"]) .kind-observed { border-color: #c4a2e6; color: #c4a2e6; }
}
:root[data-theme="dark"] .kind-measured { border-color: #7cc48a; color: #7cc48a; }
:root[data-theme="dark"] .kind-calculated { border-color: #8fb1e6; color: #8fb1e6; }
:root[data-theme="dark"] .kind-estimated { border-color: #e2b552; color: #e2b552; }
:root[data-theme="dark"] .kind-observed { border-color: #c4a2e6; color: #c4a2e6; }

/* The front page for visitors. */
.home-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: start; margin: 24px 0; }
.home-hero h1 { font-size: 2rem; line-height: 1.2; margin-top: 0; }
.home-hero .lead { font-size: 1.1rem; }
.home-points { padding-left: 1.2em; line-height: 1.7; }
.home-signup { margin-bottom: 0; }
@media (max-width: 800px) { .home-hero { grid-template-columns: 1fr; } .home-hero h1 { font-size: 1.6rem; } }

/* The admin console. */
pre.log { max-height: 60vh; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 0.8rem; background: var(--bg, #f6f6f3); padding: 10px; border-radius: 6px; }
table.secrets td:first-child { width: 40%; }
table.secrets input[type=password], table.secrets input[type=text], table.secrets input[type=email], table.secrets input[type=number] { min-width: 14em; }

/* Light or dark, in the footer. */
.theme-switch { display: inline-flex; gap: 6px; align-items: center; margin-left: 12px; }
.theme-switch select { width: auto; padding: 2px 6px; font-size: 0.85rem; }

/* The stock marketplace */
.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }
.market-grid > .card { margin-bottom: 0; }
a.market-card { display: block; color: inherit; text-decoration: none; }
a.market-card:hover { border-color: var(--accent); }
a.market-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; margin-bottom: 8px; }
a.market-card h3 { margin: 0 0 4px; }
.market-photo { display: block; width: 100%; max-height: 420px; object-fit: cover; border-radius: 6px; margin-bottom: 12px; }

/* Signing in with Google, Apple or Facebook */
.social-buttons { display: grid; gap: 8px; margin: 12px 0; }
.social-buttons .btn { width: 100%; justify-content: center; text-align: center; font-weight: 600; }
.social-apple { background: #000; color: #fff; border-color: #000; }
.social-apple:hover { background: #222; color: #fff; }
.social-facebook { background: #1877f2; color: #fff; border-color: #1877f2; }
.social-facebook:hover { background: #166fe0; color: #fff; }
.social-google { background: #fff; color: #1f1f1f; border-color: #747775; }
.social-buttons .or { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 4px 0 0; font-size: 0.9rem; }
.social-buttons .or::before, .social-buttons .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.auth-signup { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
