html, body { margin: 0; }

.content { padding-top: 0.5rem; }

.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }

.form-section + .form-section { margin-top: 1.5rem; }

/* Navbar logo: uploaded logos can be any aspect ratio, so cap the height only (CC-070). */
.brand-logo { height: 32px; width: auto; max-width: 140px; object-fit: contain; }

/* Phones (CC-071): a wide table scrolls inside itself instead of stretching the page.
   A global net rather than per-page wrappers; .table-responsive pages are unaffected. */
@media (max-width: 576px) {
    article.content table:not(.table-responsive table) { display: block; overflow-x: auto; white-space: nowrap; }
    article.content h1 { font-size: 1.6rem; }
}

/* ---- Brand (CC-089): the logo's orange #F07C00 with black, like the logo itself. ----
   White on this orange is only ~2.9:1, so filled orange always carries near-black text.
   Text links use a deeper orange in light mode to stay readable on white. */
:root {
    --tb-orange: #F07C00;
    --tb-orange-hover: #FF8F1F;
    --tb-orange-active: #D46D00;
    --tb-ink: #141414;
    --bs-primary: #F07C00;
    --bs-primary-rgb: 240, 124, 0;
    --bs-link-color: #B35A00;
    --bs-link-color-rgb: 179, 90, 0;
    --bs-link-hover-color: #8A4500;
    --bs-link-hover-color-rgb: 138, 69, 0;
    --bs-primary-text-emphasis: #8A4500;
    --bs-primary-bg-subtle: #FDEBD6;
    --bs-primary-border-subtle: #F9C68C;
    --bs-focus-ring-color: rgba(240, 124, 0, .3);
}
[data-bs-theme="dark"] {
    --bs-link-color: #FF9A2E;
    --bs-link-color-rgb: 255, 154, 46;
    --bs-link-hover-color: #FFB766;
    --bs-link-hover-color-rgb: 255, 183, 102;
    --bs-primary-text-emphasis: #FFB766;
    --bs-primary-bg-subtle: #3A2105;
    --bs-primary-border-subtle: #7A4200;
}

.btn-primary {
    --bs-btn-color: var(--tb-ink);
    --bs-btn-bg: var(--tb-orange);
    --bs-btn-border-color: var(--tb-orange);
    --bs-btn-hover-color: var(--tb-ink);
    --bs-btn-hover-bg: var(--tb-orange-hover);
    --bs-btn-hover-border-color: var(--tb-orange-hover);
    --bs-btn-active-color: var(--tb-ink);
    --bs-btn-active-bg: var(--tb-orange-active);
    --bs-btn-active-border-color: var(--tb-orange-active);
    --bs-btn-disabled-color: var(--tb-ink);
    --bs-btn-disabled-bg: var(--tb-orange);
    --bs-btn-disabled-border-color: var(--tb-orange);
    --bs-btn-focus-shadow-rgb: 240, 124, 0;
    font-weight: 600;
}
.btn-outline-primary {
    --bs-btn-color: var(--bs-link-color);
    --bs-btn-border-color: var(--tb-orange);
    --bs-btn-hover-color: var(--tb-ink);
    --bs-btn-hover-bg: var(--tb-orange);
    --bs-btn-hover-border-color: var(--tb-orange);
    --bs-btn-active-color: var(--tb-ink);
    --bs-btn-active-bg: var(--tb-orange);
    --bs-btn-active-border-color: var(--tb-orange);
    --bs-btn-disabled-color: var(--bs-link-color);
    --bs-btn-disabled-border-color: var(--tb-orange);
    --bs-btn-focus-shadow-rgb: 240, 124, 0;
}
.text-bg-primary { color: var(--tb-ink) !important; background-color: var(--tb-orange) !important; }
.bg-primary { background-color: var(--tb-orange) !important; }
.text-primary { color: var(--bs-link-color) !important; }
.border-primary { border-color: var(--tb-orange) !important; }
.form-check-input:checked { background-color: var(--tb-orange); border-color: var(--tb-orange); }
.form-check-input:focus, .form-control:focus, .form-select:focus { border-color: #F9B061; box-shadow: 0 0 0 .25rem rgba(240, 124, 0, .25); }
.form-switch .form-check-input:focus { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23F9B061'/%3e%3c/svg%3e"); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--tb-orange); --bs-nav-pills-link-active-color: var(--tb-ink); }
.nav-tabs .nav-link.active { border-top: 3px solid var(--tb-orange); }
.pagination { --bs-pagination-active-bg: var(--tb-orange); --bs-pagination-active-border-color: var(--tb-orange); --bs-pagination-active-color: var(--tb-ink); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--tb-orange); --bs-dropdown-link-active-color: var(--tb-ink); }
.progress, .progress-stacked { --bs-progress-bar-bg: var(--tb-orange); }

/* Top bar: near-black like the logo's lettering, an orange rule and orange for the current page. */
.tb-navbar { background-color: var(--tb-ink); border-bottom: 3px solid var(--tb-orange); }
.tb-navbar .nav-link:hover, .tb-navbar .nav-link:focus { color: var(--tb-orange-hover); }
.tb-navbar .nav-link.active, .tb-navbar .nav-link.show { color: var(--tb-orange) !important; }
.tb-navbar .dropdown-menu { --bs-dropdown-bg: #1E1E1E; --bs-dropdown-link-color: #EDEDED; --bs-dropdown-link-hover-bg: #2C2C2C; --bs-dropdown-link-hover-color: #FFF; --bs-dropdown-header-color: var(--tb-orange); }
.tb-navbar .dropdown-item.active { color: var(--tb-ink); }

/* ---- Data-entry forms (survey CC-088, rescue CC-094): numbered section cards, chips, GPS card ---- */
.tb-hero { border-left: 4px solid var(--tb-orange); }
.tb-narrow { max-width: 820px; }
.tb-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--tb-orange); color: var(--tb-ink); font-weight: 700; font-size: 1.15rem;
}
.tb-date { min-width: 190px; }
.tb-section { border: 1px solid var(--bs-border-color-translucent); border-radius: .75rem; overflow: hidden; }
.tb-section-header { display: flex; align-items: center; gap: .75rem; background-color: var(--bs-tertiary-bg); border-bottom: 1px solid var(--bs-border-color-translucent); }
.tb-step {
    flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--tb-ink); color: var(--tb-orange); font-weight: 700;
}
[data-bs-theme="dark"] .tb-step { background: var(--tb-orange); color: var(--tb-ink); }
.tb-form .form-label { font-weight: 500; margin-bottom: .35rem; }
.tb-pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.tb-pills .btn { min-width: 4.5rem; }
/* A selected chip is always orange with near-black text, like the app (the grey "secondary" fill was easy to miss). */
.tb-pills .btn-check:checked + .btn { background-color: var(--tb-orange); border-color: var(--tb-orange); color: var(--tb-ink); font-weight: 600; }
.tb-switch { min-height: calc(1.5em + .75rem + 2px); display: flex; align-items: center; gap: .5rem; }
.tb-switch .form-check-input { width: 2.6em; height: 1.4em; margin-top: 0; }
.tb-gps { border: 1px dashed var(--bs-border-color); border-radius: .75rem; padding: .75rem 1rem; background-color: var(--bs-body-bg); }
.tb-gps-icon { font-size: 1.4rem; }
/* Embedded map, locked until clicked (CC-113, Shared/MapFrame.razor). */
.tb-map-frame { position: relative; width: 100%; border-radius: .5rem; overflow: hidden; }
.tb-map-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.tb-map-cover { position: absolute; inset: 0; border: 0; padding: 0; background: transparent; cursor: pointer; }
.tb-map-hint { position: absolute; right: .5rem; bottom: .5rem; font-size: .75rem; padding: .15rem .5rem; border-radius: 1rem; background: rgba(0,0,0,.55); color: #fff; opacity: 0; transition: opacity .15s; }
.tb-map-cover:hover .tb-map-hint, .tb-map-cover:focus .tb-map-hint { opacity: 1; }
.tb-thumb { width: 110px; text-align: center; }
.tb-thumb-img { width: 100px; height: 100px; object-fit: cover; border-radius: .5rem; border: 1px solid var(--bs-border-color); }
.tb-actions {
    position: sticky; bottom: 0; z-index: 5;
    display: flex; justify-content: flex-end; gap: .5rem;
    padding: .75rem 0; margin-top: .5rem;
    background: linear-gradient(to top, var(--bs-body-bg) 70%, transparent);
}
@media (max-width: 576px) { .tb-actions .btn { flex: 1; } }

/* ---- Printable reports (CC-107): logo + donation QR header; print only the report itself ---- */
.tb-report-header { border-bottom: 3px solid var(--tb-orange); }
.tb-report-logo { height: 84px; width: auto; max-width: 120px; object-fit: contain; }
.tb-report-qr img { width: 96px; height: auto; background: #fff; padding: 2px; border-radius: 4px; }
.tb-brand-text { color: #B35A00; }
[data-bs-theme="dark"] .tb-brand-text { color: var(--tb-orange); }
/* Pick-or-type suggestion list under an input (feeder picker, CC-123). */
.tb-suggest { position: absolute; left: calc(var(--bs-gutter-x) * .5); right: calc(var(--bs-gutter-x) * .5); z-index: 1050; max-height: 18rem; overflow-y: auto; }
@media (max-width: 576px) {
    .tb-report-logo { height: 56px; }
    .tb-report-qr img { width: 72px; }
}
@media print {
    nav.navbar, .d-print-none, .card:has(.form-label) { display: none !important; }
    .tb-report-header { break-inside: avoid; }
    .tb-report-qr img { width: 110px; }
    body { background: #fff !important; }
}

/* CC-134: survey report (wide table) and survey statistics. */
.tb-report-wide th { white-space: nowrap; position: sticky; top: 0; }
.tb-report-wide .tb-wrap { min-width: 9rem; max-width: 16rem; white-space: normal; }
.tb-stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tb-swatch { display: inline-block; width: .75rem; height: .75rem; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.tb-heat td, .tb-heat th { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media print {
    .tb-stat-card, .tb-stat-tile { break-inside: avoid; }
    .tb-report-wide { font-size: 9px; }
}
