:root {
    --primary-color: #0b6636;
    --primary-hover: #084d28;
    --text-dark: #111827;
    --text-muted: #4b5563;
    --bg-soft: #f7f9f8;
    --border-color: #e5e7eb;
    --font-family: 'Inter', sans-serif;
}

.portal-auth-gated:not(.portal-auth-ready) {
    visibility: hidden;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-dark);
    background: #ffffff;
    overflow-x: hidden;
    /* Break long words rather than let them widen the page. `anywhere` (not
       `break-word`) is required: only `anywhere` shrinks an element's
       min-content size, which is what stops a grid or flex track from
       stretching to fit one long word. */
    overflow-wrap: anywhere;
}

/* Layout guard — every page stays within the device width.
   Grid and flex children default to `min-width: auto`, meaning they refuse to
   shrink below their content. One long unbreakable string (a location name, a
   registration number, an error message) therefore stretches its whole
   ancestor chain and pushes the layout off-screen on mobile. Clearing that
   minimum lets tracks shrink to the space actually available.
   Deliberate minimums still win: this selector scores 0-1-0, so any
   `min-width` set through a class (.sale-otp-row .btn, .portal-action-grid em,
   …) outranks it. */
body * { min-width: 0; }

/* Media and form controls size from their content, so they need the same
   ceiling — a wide image or a <select> with a long option would otherwise
   set the page width. */
img, svg, video, canvas, iframe, select, input, textarea { max-width: 100%; }

/* Identification and spotted-report tools */
.tool-page { min-height: 760px; padding: clamp(2.5rem, 6vw, 5.5rem) 0; background: radial-gradient(circle at 85% 10%, #dcefe3 0, transparent 28%), linear-gradient(145deg, #f7faf8, #eef5f0); }
.tool-shell { width: min(1080px, 92vw); margin: 0 auto; }
.tool-shell-narrow { width: min(560px, 92vw); }
.tool-back { display: inline-block; margin-bottom: 1.8rem; color: var(--primary-color); font-weight: 700; }
.tool-heading { max-width: 720px; margin-bottom: 2rem; }
.tool-heading h1 { margin: .35rem 0 .65rem; font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1; }
.tool-heading p { color: var(--text-muted); font-size: 1.08rem; line-height: 1.65; }
.tool-kicker { color: var(--primary-color); font-size: .75rem; font-weight: 800; letter-spacing: .12em; }
.tool-kicker.warning { color: #a65d05; }
.tool-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(260px, .75fr); gap: 1.5rem; align-items: start; }
.tool-card, .tool-guide, .results-panel { background: rgba(255,255,255,.94); border: 1px solid rgba(11,102,54,.12); border-radius: 24px; box-shadow: 0 18px 55px rgba(13,54,31,.09); }
.tool-form { padding: clamp(1.3rem, 4vw, 2.2rem); display: grid; gap: 1.1rem; }
.tool-form label { display: grid; gap: .5rem; font-weight: 700; font-size: .9rem; }
.tool-form input:not([type=file]), .tool-form select, .tool-form textarea { width: 100%; border: 1px solid #cfd9d3; border-radius: 12px; padding: .85rem .95rem; background: white; color: var(--text-dark); font: inherit; }
.tool-form input:focus, .tool-form select:focus, .tool-form textarea:focus { outline: 3px solid rgba(11,102,54,.12); border-color: var(--primary-color); }
.tool-form input:disabled, .tool-form select:disabled, .tool-form textarea:disabled { background: #f2f5f3; color: #8b978f; cursor: not-allowed; }
.tool-step { display: flex; align-items: center; gap: .8rem; margin-top: .25rem; }
.tool-step > span { display: grid; place-items: center; flex: 0 0 2.15rem; height: 2.15rem; border-radius: 50%; background: #e6f3eb; color: var(--primary-color); font-weight: 800; }
.tool-step div { display: grid; gap: .15rem; }
.tool-step small, .upload-zone span, .image-preview small, .character-count { color: #6b7280; font-weight: 500; }
.upload-zone { min-height: 155px; place-items: center; align-content: center; text-align: center; padding: 1.5rem; border: 2px dashed #8fb49e; border-radius: 18px; background: #f6fbf8; cursor: pointer; transition: .2s ease; }
.upload-zone:hover { border-color: var(--primary-color); background: #edf8f1; }
.upload-zone input { max-width: 100%; margin-top: .65rem; font-weight: 500; }
.image-preview { display: flex; align-items: center; gap: .9rem; padding: .8rem; border-radius: 14px; background: #eef8f2; color: #07572d; }
.image-preview img { width: 74px; height: 74px; object-fit: cover; border-radius: 11px; }
.image-preview div { display: grid; gap: .25rem; }

/* Cattle coat preview shown under the colour picker on Find Owner, Report Spotted and Register.
   Solid colours show three separate shade tiles; Mixed Pattern shows one drawn coat. */
.coat-preview { display: flex; flex-direction: column; gap: .5rem; margin-top: -.35rem; padding: .55rem .7rem; border-radius: 12px; background: #f4f7f5; border: 1px solid #dfe7e2; }
.coat-preview-swatches { display: flex; gap: 6px; }
.coat-preview-swatch { flex: 1 1 0; min-width: 0; height: 56px; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.12); background: #fff; }
.coat-preview-swatch svg { display: block; width: 100%; height: 100%; }
.coat-preview-label { font-weight: 700; font-size: .9rem; color: var(--text-dark, #1f2a24); }
.tool-message { padding: .9rem 1rem; border-radius: 12px; background: #edf8f1; color: #07572d; line-height: 1.45; }
.tool-message.error { background: #fff0ef; color: #a52a20; }
.tool-message.info { background: #fff7e7; color: #865008; }
.tool-location-note { margin: -.4rem 0 .9rem; padding: .7rem .9rem; border-radius: 10px; background: #edf8f1; color: #07572d; font-size: .92rem; line-height: 1.4; }
.tool-location-note-error { background: #fff0ef; color: #a52a20; }
.error-text { color: #a52a20; }
.portal-payment-list { display: grid; gap: .75rem; }
.portal-payment-row { display: flex; justify-content: space-between; gap: 1rem; padding: .9rem 1rem; border: 1px solid #e5ece8; border-radius: 14px; background: #fff; }
.portal-payment-row div { display: grid; gap: .2rem; }
.portal-payment-row small { color: #6b7280; }
.tool-submit { width: 100%; border-radius: 12px; cursor: pointer; }
.tool-submit:disabled { opacity: .6; cursor: wait; }
.account-switch { display: grid; justify-items: center; gap: .65rem; padding-top: .8rem; border-top: 1px solid #e5ece8; color: #66736b; font-size: .9rem; }
.account-switch .btn { width: 100%; border-radius: 12px; }
.phone-field-row { display: grid; grid-template-columns: 120px minmax(0,1fr); gap: .65rem; }
.phone-field-row select, .phone-field-row input { width: 100%; border: 1px solid #cfd9d3; border-radius: 12px; padding: .85rem .8rem; background: white; color: var(--text-dark); font: inherit; }
.field-error { min-height: 1em; color: #a52a20; font-size: .76rem; font-weight: 600; }
.account-note { padding: .8rem; border-radius: 11px; background: #eef7f1; color: #496156; font-size: .82rem; line-height: 1.5; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.tool-guide { padding: 2rem; position: sticky; top: 105px; }
.tool-guide h2 { margin: .8rem 0 1rem; font-size: 1.25rem; }
.tool-guide ul { padding-left: 1.1rem; display: grid; gap: .8rem; color: var(--text-muted); line-height: 1.5; }
.guide-icon { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 14px; background: #e6f3eb; color: var(--primary-color); font-size: 1.6rem; font-weight: 800; }
.warning-guide .guide-icon { background: #fff2d9; color: #a65d05; }
.tool-form fieldset { border: 0; display: grid; gap: 1.1rem; }
.tool-form fieldset:disabled { opacity: .52; }
.character-count { text-align: right; font-size: .78rem; }
.results-panel { margin-top: 1.5rem; padding: clamp(1.3rem, 4vw, 2.2rem); }
.results-panel { grid-column: 1 / -1; order: 3; }
.results-panel h2 { margin-bottom: 1rem; }
.match-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 1rem; }
.match-card { overflow: hidden; border: 1px solid var(--border-color); border-radius: 16px; }
.match-card img { width: 100%; height: 170px; object-fit: cover; object-position: center; background: #eef3f0; }
.match-body { padding: 1rem; display: grid; gap: .35rem; }
.match-confidence { color: var(--primary-color); font-weight: 800; }
.results-panel .tool-message.error { margin: 0; }
.results-panel .tool-message.error strong { display: block; margin-bottom: .25rem; font-size: 1.02rem; }

@media (max-width: 600px) {
    .tool-grid { grid-template-columns: 1fr; }
    .tool-guide { position: static; order: 3; }
    .results-panel { order: 2; margin-top: 0; }
}

/* Signed-in farmer portal */
.portal-body { min-height: 100vh; background: #f1f6f3; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.portal-topbar { position: sticky; top: 0; z-index: 50; height: 72px; padding: env(safe-area-inset-top) max(4vw, 18px) 0; display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.96); border-bottom: 1px solid #dbe6df; backdrop-filter: blur(12px); }
.portal-brand { display: flex; align-items: center; gap: .55rem; color: #07572d; letter-spacing: .04em; }
.portal-brand img { width: 28px; height: 38px; }
.portal-logout, .portal-link-button, .portal-back, .portal-section-heading button { border: 0; background: transparent; color: var(--primary-color); font: inherit; font-weight: 700; cursor: pointer; }
.portal-back { display: inline-block; width: fit-content; text-align: left; justify-self: start; margin-bottom: .55rem; }
.portal-section-heading .portal-back { margin-bottom: 0; }
.portal-main { min-height: calc(100vh - 72px); }
.portal-screen { width: min(940px, 92vw); margin: 0 auto; padding: clamp(1.5rem, 5vw, 3rem) 0; display: grid; gap: 1.8rem; }
.portal-welcome { color: white; border-radius: 25px; padding: clamp(1.5rem, 5vw, 2.8rem); background: linear-gradient(125deg, #064c29, #0b7740); box-shadow: 0 18px 40px rgba(5,70,36,.2); }
.portal-welcome p { color: #bfe5cd; font-weight: 600; }
.portal-welcome h1 { margin: .25rem 0 .45rem; font-size: clamp(2rem, 6vw, 3.4rem); }
.portal-welcome span { color: #e0f2e6; }
.portal-welcome-title-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .35rem 0 .75rem; }
.portal-welcome-title-row h1 { margin: 0 auto 0 0; }
.portal-welcome-title-row .btn { flex: 0 0 auto; }
@media (max-width: 600px) {
    .portal-welcome-title-row { align-items: flex-start; flex-direction: column; gap: .75rem; }
    .portal-welcome-title-row h1 { margin-right: 0; font-size: 1.55rem; white-space: normal; }
    .portal-welcome-title-row .btn { padding: .55rem .7rem; font-size: .72rem; white-space: nowrap; }
}
.portal-welcome-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.portal-welcome-text { min-width: 0; }
.portal-language-select {
    flex: 0 0 auto;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255,255,255,.16) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23e0f2e6'%3E%3Cpath d='M5.25 7.5 10 12.25 14.75 7.5H5.25Z'/%3E%3C/svg%3E") no-repeat right .6rem center / 16px;
    border: 1px solid rgba(255,255,255,.35);
    color: white;
    font: inherit;
    font-weight: 600;
    font-size: .85rem;
    padding: .5rem 2rem .5rem .9rem;
    border-radius: 999px;
    cursor: pointer;
}
.portal-language-select:hover { background-color: rgba(255,255,255,.24); }
.portal-language-select:focus-visible { outline: 2px solid white; outline-offset: 2px; }
.portal-language-select option { color: #0b3d1f; }
@media (max-width: 600px) {
    .portal-welcome-row { flex-wrap: wrap; }
    .portal-language-select { font-size: .78rem; padding: .4rem 1.7rem .4rem .75rem; }
}
.portal-summary { margin: -3.5rem auto 0; width: min(750px, 88%); display: grid; grid-template-columns: repeat(3,1fr); background: white; border-radius: 18px; padding: 1rem; box-shadow: 0 10px 30px rgba(15,50,29,.12); }
.portal-summary div { display: grid; place-items: center; gap: .2rem; border-right: 1px solid #e5ece8; }
.portal-summary div:last-child { border: 0; }
.portal-summary strong { color: var(--primary-color); font-size: 1.5rem; }
.portal-summary span { color: #6b7280; font-size: .75rem; text-align: center; }
.portal-summary.access-summary { margin: 0; width: 100%; grid-template-columns: repeat(2,1fr); box-shadow: none; border: 1px solid #e5ece8; }
.portal-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.portal-section-heading .btn { flex: 0 0 auto; white-space: nowrap; }
.portal-section-heading .portal-link-button { flex: 0 0 auto; white-space: nowrap; }
.portal-section-heading h2, .portal-view > h2 { font-size: 1.35rem; }
.portal-section-heading > div { display: grid; gap: .55rem; }
.portal-kraal-name { margin: 0; font-weight: 800; color: #132a1d; }
.portal-action-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: .8rem; }
.portal-action-grid a, .portal-action-grid button { min-height: 115px; padding: .8rem; display: grid; place-items: center; align-content: center; gap: .65rem; border: 1px solid #dce7e0; border-radius: 17px; background: white; color: #163524; font: inherit; font-weight: 700; text-align: center; cursor: pointer; box-shadow: 0 7px 18px rgba(12,60,34,.05); }
.portal-action-grid b { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: #e7f4ec; color: var(--primary-color); font-size: 1.35rem; }
.portal-action-grid em { min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center; border-radius: 99px; background: #c52d26; color: white; font-size: .65rem; font-style: normal; font-weight: 800; }
.portal-view { min-width: 0; }
.portal-card { padding: clamp(1.2rem, 4vw, 2rem); border: 1px solid #dce7e0; border-radius: 20px; background: white; box-shadow: 0 10px 30px rgba(14,57,34,.06); }
.portal-form { display: grid; gap: 1rem; }
.portal-form label { display: grid; gap: .45rem; color: #30483a; font-size: .88rem; font-weight: 700; }
.portal-form input:not([type=checkbox]), .portal-form select, .portal-form textarea, .portal-search { width: 100%; padding: .82rem .9rem; border: 1px solid #ccd9d1; border-radius: 11px; background: white; color: #132a1d; font: inherit; }
.portal-form-row { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.portal-form-row > .btn { align-self: end; }
.portal-search { margin-bottom: 1rem; }
.portal-cattle-list { display: grid; gap: .7rem; }
.portal-transfer-heading { margin-top: 1.7rem; }
.portal-transfer-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; border: 1px solid #dae5de; border-radius: 16px; background: white; flex-wrap: wrap; }
.portal-transfer-card > div:first-child { display: grid; gap: .25rem; }
.portal-transfer-card small { color: #68766d; }
.portal-transfer-card > div:last-child { display: flex; gap: .5rem; }
.portal-transfer-card .btn { border-radius: 10px; padding: .6rem .8rem; cursor: pointer; }
.portal-transfer-card > div.portal-transfer-otp:last-child { display: grid; flex-basis: 100%; width: 100%; min-width: 0; box-sizing: border-box; padding-top: .75rem; border-top: 1px solid #eef2ef; }
article.portal-transfer-card > div.admin-user-actions { flex-wrap: wrap; }
article.portal-transfer-card > div.admin-user-actions .btn { flex: 1 1 auto; }
.portal-transfer-otp > div:last-child { display: flex; gap: .5rem; }
.portal-cattle-card { width: 100%; display: grid; grid-template-columns: 68px minmax(0,1fr) auto; align-items: center; gap: .9rem; padding: .75rem; border: 1px solid #dae5de; border-radius: 16px; background: white; color: #173123; text-align: left; font: inherit; cursor: pointer; }
.portal-cattle-card > span:nth-child(2) { min-width: 0; display: grid; gap: .2rem; }
.portal-cattle-card small { color: #647267; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-cattle-card em { padding: .35rem .55rem; border-radius: 999px; background: #e8f4ec; color: #086237; font-size: .72rem; font-style: normal; font-weight: 800; }
.portal-cattle-card.owner-summary-card { grid-template-columns: minmax(0,1fr) auto; }
.portal-cattle-card.owner-summary-card > span:first-child { min-width: 0; display: grid; gap: .2rem; }
.fraud-detection-row { grid-template-columns: minmax(0,1fr) auto auto; cursor: default; }
.fraud-detection-row > span:first-child { min-width: 0; display: grid; gap: .2rem; }
.fraud-detection-row .btn { text-decoration: none; }
.verified-badge { display: inline-flex; align-items: center; gap: .25rem; margin-left: .35rem; padding: .15rem .45rem; border-radius: 999px; background: #e8f4ec; color: #086237; font-size: .68rem; font-weight: 900; vertical-align: middle; }
.verified-badge.large { font-size: .78rem; padding: .25rem .6rem; }
.cattle-photo { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 13px; background: #eaf3ed; color: #0b6636; font-size: 1.8rem; overflow: hidden; }
.cattle-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center; background: #eaf3ed; }
.portal-empty, .portal-loading { padding: 2.5rem 1rem; display: grid; justify-items: center; gap: .65rem; text-align: center; color: #68776d; background: white; border-radius: 16px; }
.portal-empty b { font-size: 2.5rem; color: #8bad98; }
.portal-muted { color: #6b766f; margin: .4rem 0 1rem; line-height: 1.5; }
.portal-detail-hero { min-height: 240px; position: relative; overflow: hidden; display: flex; align-items: end; padding: 1.5rem; border-radius: 24px; background: linear-gradient(135deg,#184f31,#092d1b); color: white; }
.portal-detail-hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; background: #0f3523; }
.portal-detail-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(9,45,27,.88), rgba(9,45,27,0) 65%); pointer-events: none; }
.portal-detail-hero > span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 5rem; opacity: .3; }
.portal-detail-hero > div { position: relative; z-index: 1; text-shadow: 0 1px 10px #000; }
.portal-detail-hero h2 { font-size: 2.4rem; margin: .2rem 0; }
.portal-details-grid { margin: 1rem 0; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1rem; }
.portal-details-grid div { display: grid; gap: .3rem; }
.portal-details-grid small { color: #738077; }
/* Warning shown while a cattle has not yet proven it can be matched from its nose photos. */
.identifiable-warning { display: grid; gap: .8rem; margin: 1rem 0; padding: 1rem; border: 2px solid #d9534f; border-radius: 14px; background: #fff5f5; }
.identifiable-warning strong { color: #a52a20; }
.identifiable-warning p { margin-top: .3rem; color: #7d4741; line-height: 1.5; }
.activate-reasons { margin: .5rem 0 0 1.1rem; display: grid; gap: .4rem; line-height: 1.45; }
.identifiable-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.identifiable-activate, .identifiable-clear { cursor: pointer; }
.identifiable-clear { border-color: #a5564f; color: #a5564f; background: transparent; }
.identifiable-activate input { position: absolute; width: 1px; height: 1px; opacity: 0; }
/* Type-to-filter replacement for long district/location pickers. The native select stays in
   the DOM holding the value, so it is hidden rather than removed. */
.searchable-select { position: relative; }
.searchable-select-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.searchable-select-input { width: 100%; padding: .82rem .9rem; border: 1px solid #ccd9d1; border-radius: 11px; background: white; color: #132a1d; font: inherit; }
.searchable-select-input.select-menu-input { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23667'%3E%3Cpath d='m4 6 4 4 4-4H4Z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .85rem center; background-size: 1rem; }
.searchable-select.is-disabled .searchable-select-input { background-color: #f2f5f3; color: #8b978f; cursor: not-allowed; }
.searchable-select-list { position: absolute; z-index: 70; left: 0; right: 0; top: calc(100% + .3rem); max-height: 15rem; margin: 0; padding: .25rem; overflow-y: auto; list-style: none; border: 1px solid #cddbd2; border-radius: 12px; background: white; box-shadow: 0 14px 34px rgba(10,45,25,.16); }
.searchable-select-option { padding: .7rem .75rem; border-radius: 8px; color: #23372c; line-height: 1.35; cursor: pointer; }
.searchable-select-option.is-active { background: #e8f4ec; }
.searchable-select-option.is-selected { font-weight: 700; }
.searchable-select-empty { padding: .8rem .75rem; color: #75837a; }
.portal-detail-actions { display: grid; grid-template-columns: repeat(3,1fr); gap: .7rem; margin: 1rem 0 1.8rem; }
.portal-detail-actions button { padding: .85rem; border: 1px solid #9bb3a4; border-radius: 12px; background: white; color: #07572d; font: inherit; font-weight: 700; cursor: pointer; }
.sale-shell { display: grid; gap: 1.25rem; max-width: 640px; }
.sale-shell h2 { font-size: 1.45rem; }
.sale-cattle-card { display: flex; align-items: center; gap: 1rem; padding: 1rem; border: 1px solid #dce7e0; border-radius: 14px; background: white; box-shadow: 0 8px 22px rgba(14,57,34,.05); }
.sale-cattle-card > div { display: grid; gap: .25rem; min-width: 0; }
.sale-cattle-card strong { color: #173123; font-size: 1.05rem; }
.sale-cattle-card small { color: #66736b; }
.sale-cattle-photo { flex: 0 0 80px; width: 80px; height: 80px; border-radius: 10px; }
.sale-info-banner { display: flex; align-items: flex-start; gap: .55rem; padding: .75rem; border-radius: 10px; background: #e7f4ec; color: #064c29; line-height: 1.45; }
.sale-info-banner b { display: grid; place-items: center; flex: 0 0 20px; height: 20px; border-radius: 50%; background: #0b6636; color: white; font-size: .76rem; font-family: Georgia, serif; }
.sale-warning-banner { background: #fff3df; color: #7b4a08; }
.sale-warning-banner b { background: #b6610d; font-family: inherit; }
.sale-form-card { gap: 1.15rem; border-radius: 14px; box-shadow: 0 8px 24px rgba(14,57,34,.06); }
.sale-form-card label { color: #30483a; font-size: .9rem; }
.sale-price-field { display: flex; align-items: center; min-height: 48px; border: 1px solid #ccd9d1; border-radius: 11px; background: white; overflow: hidden; }
.sale-price-field span { min-width: 48px; padding-left: .9rem; color: #66736b; font-weight: 800; }
.sale-price-field input { min-width: 0; border: 0 !important; padding-left: .25rem !important; }
.sale-price-field input:focus { outline: 0; }
.sale-price-preview { color: var(--primary-color); font-weight: 700; }
.sale-toggle { display: flex !important; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; border-radius: 10px; background: #f1f6f3; }
.sale-toggle span { display: grid; gap: .15rem; }
.sale-toggle small { color: #66736b; font-weight: 500; }
.sale-toggle input { width: 44px; height: 24px; accent-color: var(--primary-color); cursor: pointer; }
.sale-submit, .sale-danger-action { width: 100%; height: 56px; border-radius: 12px; cursor: pointer; }
.sale-danger-action { border-color: #a13a2f; color: #a13a2f; }
.cattle-access-banner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.cattle-access-banner strong { color: #132a1d; }
.cattle-access-banner p { margin: .2rem 0 0; }
.cattle-access-banner .btn { flex: 0 0 auto; white-space: nowrap; }
.chiefdom-hub-grid { margin-top: 1rem; }

/* Hero card: icon avatar + title/subtitle, with a stats strip below (Chiefdom/Village/Owner overview pages). */
.portal-hero { display: grid; gap: 1.1rem; }
.portal-hero-top { display: flex; align-items: center; gap: .9rem; }
.portal-hero-icon { width: 52px; height: 52px; border-radius: 50%; background: #e8f4ec; display: grid; place-items: center; font-size: 1.5rem; flex: 0 0 auto; }
.portal-hero-top h2 { margin: 0; }
.portal-hero-top .portal-muted { margin: .15rem 0 0; }
.portal-hero-stats { display: flex; gap: 1.75rem; flex-wrap: wrap; padding-top: 1rem; border-top: 1px solid #e5ece8; }
.portal-hero-stats > div { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.portal-hero-stat-icon { width: 40px; height: 40px; border-radius: 12px; background: #e8f4ec; display: grid; place-items: center; font-size: 1.15rem; flex: 0 0 auto; }
.portal-hero-stats small { display: block; color: #6b7280; font-size: .72rem; }
.portal-hero-stats strong { display: block; color: var(--primary-color); font-size: 1.2rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chiefdom-section-heading { margin: 1.5rem 0 .7rem; color: var(--primary-color); font-size: 1.1rem; font-weight: 800; }

/* Clickable row list: icon avatar + name/stats + chevron (villages, community members). */
.chiefdom-row-list { display: grid; gap: .7rem; }
.chiefdom-row { width: 100%; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: .9rem; padding: .8rem 1rem; border: 1px solid #dae5de; border-radius: 16px; background: white; color: #173123; text-align: left; font: inherit; cursor: pointer; transition: border-color .15s ease, transform .15s ease; }
.chiefdom-row:hover, .chiefdom-row:focus-visible { border-color: var(--primary-color); transform: translateY(-1px); }
.chiefdom-row-icon { width: 42px; height: 42px; border-radius: 50%; background: #eef6f1; display: grid; place-items: center; font-size: 1.2rem; flex: 0 0 auto; }
.chiefdom-row-body { min-width: 0; display: grid; gap: .25rem; }
.chiefdom-row-body strong { color: #132a1d; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chiefdom-row-stats { display: flex; gap: 1rem; flex-wrap: wrap; color: #6b7280; font-size: .78rem; }
.chiefdom-row-chevron { color: var(--primary-color); font-size: 1.3rem; font-weight: 700; }

.portal-info-banner { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; border-radius: 12px; background: #eef6f1; color: #2f4a3a; font-size: .85rem; margin: 0 0 .9rem; }
.portal-info-banner span { color: var(--primary-color); font-weight: 700; }

.owner-cattle-card { display: grid; gap: .65rem; padding: .9rem; }
.owner-cattle-header { display: grid; gap: .15rem; }
.owner-cattle-header strong { color: #132a1d; font-size: 1rem; }
.owner-cattle-header small { color: #647267; }

.chiefdom-footer-note { display: flex; align-items: center; gap: .8rem; margin-top: 1.5rem; color: #8a978f; font-size: .8rem; }
.chiefdom-footer-note::before, .chiefdom-footer-note::after { content: ''; flex: 1; height: 1px; background: #dfe8e2; }
.owner-cattle-thumbs { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
.owner-cattle-thumb { aspect-ratio: 4/3; display: grid; place-items: center; border-radius: 10px; background: #eaf3ed; color: #0b6636; font-size: 1.4rem; overflow: hidden; }
.owner-cattle-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.chiefdom-notice-card { display: grid; gap: .4rem; }
.chiefdom-notice-heading { margin: 0; color: var(--primary-color); font-weight: 800; letter-spacing: .02em; text-transform: uppercase; font-size: .78rem; }
.chiefdom-notice-meta { margin: 0; color: #30483a; font-weight: 700; }
.chiefdom-notice-message { margin: 0; color: #132a1d; line-height: 1.55; white-space: pre-wrap; }
.chiefdom-notice-recipients { display: grid; gap: .6rem; }
.chiefdom-notice-recipient { display: flex !important; align-items: center; gap: .8rem; padding: .8rem 1rem; border: 1px solid #dae5de; border-radius: 12px; background: white; cursor: pointer; }
.chiefdom-notice-recipient input { width: 20px; height: 20px; accent-color: var(--primary-color); cursor: pointer; }
.chiefdom-notice-recipient span { display: grid; gap: .1rem; }
.chiefdom-notice-recipient small { color: #66736b; }
.chiefdom-link-option { display: flex; align-items: center; justify-content: space-between; gap: .8rem; width: 100%; padding: .8rem 1rem; border: 1px solid #dae5de; border-radius: 12px; background: white; cursor: pointer; font: inherit; text-align: left; }
.chiefdom-link-option span:first-child { display: grid; gap: .1rem; }
.chiefdom-link-option small { color: #66736b; }
.chiefdom-link-option.current { border-color: var(--primary-color); background: #eef6f1; cursor: default; }
.chiefdom-link-option:disabled:not(.current) { opacity: .6; cursor: wait; }

/* Chiefdom explorer — the village, member, and cattle drill-downs share the
   calmer, image-led mobile treatment used by the Chiefdom overview. */
body:has(.chiefdom-experience) { background: #fff; }
body:has(.chiefdom-experience) .portal-topbar { display: none; }
body:has(.chiefdom-experience) .portal-main { min-height: 100vh; }
body:has(.chiefdom-experience) .portal-screen { width: min(760px, 94vw); padding: 1rem 0 calc(94px + env(safe-area-inset-bottom)); }
.chiefdom-experience { display: grid; gap: 1.25rem; }
.chiefdom-page-header { display: grid; grid-template-columns: 42px 38px minmax(0, 1fr) 42px; align-items: center; gap: .65rem; min-height: 50px; }
.chiefdom-page-header h1 { color: #073d20; font-size: clamp(1.08rem, 5vw, 1.6rem); font-weight: 800; line-height: 1.1; text-align: center; white-space: nowrap; }
.chiefdom-page-logo { width: 34px; height: 34px; }
.chiefdom-header-action { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #173123; cursor: pointer; }
.chiefdom-header-action:hover, .chiefdom-header-action:focus-visible { background: #edf5ef; outline: 0; }
.chiefdom-header-action svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.chiefdom-relationship-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1rem; border: 1px solid #e4ebe5; border-radius: 16px; background: #f9fcf9; }
.chiefdom-relationship-card > div { display: grid; gap: .2rem; }
.chiefdom-relationship-card small { color: #65766b; font-size: .77rem; }
.chiefdom-relationship-card strong { color: #173123; }
.chiefdom-feature-hero { position: relative; isolation: isolate; min-height: 292px; display: flex; flex-direction: column; justify-content: space-between; gap: 1.2rem; padding: clamp(1.25rem, 5vw, 2rem); overflow: hidden; border: 1px solid #e1e9e2; border-radius: 23px; box-shadow: 0 12px 28px rgba(13, 60, 32, .11); background-position: center; background-size: cover; }
.chiefdom-feature-hero::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(253,255,251,.98) 0%, rgba(251,254,249,.96) 47%, rgba(248,253,247,.22) 100%); }
.chiefdom-feature-hero--chief { background-image: url('/images/hero-marketplace.png'); }
.chiefdom-feature-hero--village { background-image: url('/images/phone-app-in-bush.png'); }
.chiefdom-feature-hero--member { background-image: url('/images/phone-app-in-bush.png'); }
.chiefdom-feature-copy { display: flex; align-items: center; gap: .9rem; position: relative; z-index: 1; }
.chiefdom-round-icon { width: 68px; height: 68px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: #e9f3e8; color: #1e6b2c; font-size: 2rem; font-family: Georgia, serif; box-shadow: inset 0 0 0 1px rgba(15, 95, 42, .06); }
.chiefdom-round-icon--chief { background: #177436; color: white; }
.chiefdom-round-icon--member svg, .chiefdom-row-icon--member svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.chiefdom-feature-copy h2 { margin: 0; color: #063b1d; font-size: clamp(1.55rem, 7vw, 2.35rem); line-height: 1.08; letter-spacing: -.025em; }
.chiefdom-feature-copy p { margin: .35rem 0 0; color: #58685d; font-size: clamp(.9rem, 3.8vw, 1.1rem); line-height: 1.35; }
.chiefdom-feature-stats { position: relative; z-index: 1; width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .9rem .55rem; border-radius: 20px; background: rgba(255,255,255,.94); box-shadow: 0 7px 20px rgba(11, 54, 27, .08); backdrop-filter: blur(8px); }
.chiefdom-feature-stats--with-notices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chiefdom-feature-stats > div { display: flex; align-items: center; justify-content: center; gap: .65rem; min-width: 0; padding: .2rem .65rem; }
.chiefdom-feature-stats > div + div { border-left: 1px solid #dce6dd; }
.chiefdom-stat-icon { width: 45px; height: 45px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; color: #177436; background: #eef6ed; }
.chiefdom-stat-icon svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.chiefdom-stat-icon .cattle-icon { width: 27px; height: 27px; }
.chiefdom-feature-stats small { display: block; color: #6b7172; font-size: .73rem; white-space: nowrap; }
.chiefdom-feature-stats strong { display: block; overflow: hidden; color: #167233; font-size: clamp(1.45rem, 6vw, 2.1rem); line-height: 1.05; text-overflow: ellipsis; white-space: nowrap; }
.chiefdom-feature-stats--member { max-width: 470px; }
.chiefdom-feature-stats--member > div { justify-content: flex-start; }
.chiefdom-feature-stats--member strong { font-size: clamp(1.25rem, 5vw, 1.7rem); }
.chiefdom-section-heading { margin: .2rem 0 -.45rem; color: #073d20; font-size: clamp(1.3rem, 5.5vw, 1.75rem); letter-spacing: -.02em; }
.chiefdom-row-list { gap: .8rem; }
.chiefdom-row { min-height: 82px; padding: .8rem 1rem; border: 1px solid #edf0ed; border-radius: 18px; box-shadow: 0 5px 14px rgba(12, 54, 31, .07); }
.chiefdom-row:hover, .chiefdom-row:focus-visible { border-color: #a9ccb3; box-shadow: 0 9px 22px rgba(12, 54, 31, .1); }
.chiefdom-row-icon { width: 52px; height: 52px; color: #38702a; background: #edf5e9; font-size: 1.8rem; font-family: Georgia, serif; }
.chiefdom-village-row { grid-template-columns: 52px minmax(0, 1fr) auto auto; gap: .75rem; }
.chiefdom-village-row > strong { overflow: hidden; color: #142a1b; font-size: clamp(.92rem, 4.4vw, 1.2rem); text-overflow: ellipsis; white-space: nowrap; }
.chiefdom-village-metrics { display: flex; align-items: center; gap: .85rem; color: #1a2820; font-size: clamp(.77rem, 3.5vw, .98rem); white-space: nowrap; }
.chiefdom-village-metrics > span { display: inline-flex; align-items: center; gap: .22rem; }
.chiefdom-village-metrics svg, .chiefdom-village-metrics .cattle-icon { width: 18px; height: 18px; flex: 0 0 auto; color: #177436; }
.chiefdom-village-metrics svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.chiefdom-village-metrics small { color: #6b7172; font-size: inherit; }
.chiefdom-row-chevron { font-size: 2.3rem; font-weight: 400; line-height: .6; }
.chiefdom-member-row { grid-template-columns: 52px minmax(0, 1fr) auto; min-height: 92px; }
.chiefdom-row-icon--member { font-size: 0; }
.chiefdom-member-row .chiefdom-row-body { gap: .32rem; }
.chiefdom-member-row .chiefdom-row-body strong { font-size: clamp(1rem, 4.8vw, 1.3rem); }
.chiefdom-member-row .chiefdom-row-stats { color: #70747a; font-size: .88rem; }
.portal-info-banner { margin: -.15rem 0 -.1rem; border-radius: 16px; background: #f1f7ef; color: #71767c; font-size: .86rem; }
.chiefdom-footer-note { justify-content: center; margin-top: .25rem; color: #78827a; }
.chiefdom-footer-note span { color: #167233; font-size: 1.35rem; }
.chiefdom-cattle-list { gap: .95rem; }
.chiefdom-cattle-card { display: grid; gap: .8rem; padding: .85rem; border-color: #edf0ed; border-radius: 19px; box-shadow: 0 5px 14px rgba(12, 54, 31, .07); }
.chiefdom-cattle-card .owner-cattle-thumbs { gap: .45rem; }
.chiefdom-cattle-card .owner-cattle-thumb { aspect-ratio: 1.4; border-radius: 12px; }
.chiefdom-cattle-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem .9rem; margin: 0; padding: .1rem .2rem; }
.chiefdom-cattle-details div { min-width: 0; }
.chiefdom-cattle-details dt { color: #71777b; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.chiefdom-cattle-details dd { margin: .18rem 0 0; overflow: hidden; color: #173123; font-size: .94rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 450px) {
    .chiefdom-page-header { grid-template-columns: 36px 32px minmax(0, 1fr) 36px; gap: .4rem; }
    .chiefdom-header-action { width: 36px; height: 36px; }
    .chiefdom-page-logo { width: 29px; height: 29px; }
    .chiefdom-feature-hero { min-height: 270px; padding: 1.05rem; }
    .chiefdom-round-icon { width: 57px; height: 57px; font-size: 1.7rem; }
    .chiefdom-feature-stats { padding: .75rem .3rem; }
    .chiefdom-feature-stats > div { gap: .45rem; padding: .2rem .45rem; }
    .chiefdom-stat-icon { width: 38px; height: 38px; border-radius: 11px; }
    .chiefdom-stat-icon svg, .chiefdom-stat-icon .cattle-icon { width: 23px; height: 23px; }
    .chiefdom-village-row { grid-template-columns: 45px minmax(0, 1fr) auto auto; gap: .55rem; padding: .7rem; }
    .chiefdom-row-icon { width: 45px; height: 45px; }
    .chiefdom-village-metrics { gap: .5rem; font-size: .73rem; }
    .chiefdom-village-metrics svg, .chiefdom-village-metrics .cattle-icon { width: 15px; height: 15px; }
    .chiefdom-village-metrics small { display: none; }
    .chiefdom-cattle-card { padding: .7rem; gap: .65rem; }
}

/* Let the chiefdom explorer use the available room on tablets and desktops
   without changing the compact, single-column mobile experience. */
@media (min-width: 601px) {
    body:has(.chiefdom-experience) .portal-screen {
        width: min(1140px, calc(100% - 64px));
        padding: 2rem 0 calc(108px + env(safe-area-inset-bottom));
    }

    .chiefdom-experience { gap: 1.6rem; }
    .chiefdom-page-header { grid-template-columns: 46px 42px minmax(0, 1fr) 46px; max-width: 900px; margin: 0 auto; }
    .chiefdom-feature-hero { min-height: 330px; padding: 2rem 2.2rem; border-radius: 26px; background-position: center right; }
    .chiefdom-feature-copy h2 { font-size: clamp(2rem, 4vw, 3rem); }
    .chiefdom-feature-stats { width: 100%; }
    .chiefdom-section-heading { margin-top: .25rem; font-size: 1.75rem; }

    .chiefdom-village-list,
    .chiefdom-member-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
    .chiefdom-row { min-height: 96px; }
    .chiefdom-village-row { grid-template-columns: 54px minmax(0, 1fr) auto; }
    .chiefdom-village-metrics { grid-column: 2; grid-row: 2; font-size: .88rem; }
    .chiefdom-village-row .chiefdom-row-chevron { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
    .chiefdom-member-row { min-height: 104px; }

    .chiefdom-cattle-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
    .chiefdom-cattle-card { padding: 1rem; }
    .chiefdom-cattle-card .owner-cattle-thumb { aspect-ratio: 1.45; }
    .chiefdom-cattle-details { gap: .75rem 1.15rem; padding: .2rem .3rem; }
    .chiefdom-cattle-details dt { font-size: .76rem; }
    .chiefdom-cattle-details dd { font-size: 1rem; }
}

@media (min-width: 1000px) {
    .chiefdom-village-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .chiefdom-feature-hero { min-height: 360px; }
    .chiefdom-feature-stats { width: 100%; }
}
.portal-photo-grid { display: grid; grid-template-columns: 1fr; gap: .8rem; }
.display-photo-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.identification-photo-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.photo-group-heading { margin-top: 1.5rem; }
.admin-photo-groups { display: grid; gap: 1.5rem; }
.admin-photo-group { display: grid; gap: .7rem; }
.admin-photo-group .portal-muted { margin: 0; }
.portal-photo-slot { display: grid; gap: .35rem; cursor: pointer; }
.portal-photo-slot.locked { cursor: default; }
.portal-photo-slot > span { aspect-ratio: 4/3; display: grid; place-items: center; overflow: hidden; border: 2px dashed #91ad9b; border-radius: 14px; background: white; color: #0b6636; font-size: 2rem; }
.portal-photo-slot.locked > span { border-style: solid; border-color: #d5ded8; background: #f8faf8; }
.portal-photo-slot img { width: 100%; height: 100%; object-fit: cover; object-position: center; background: #f4f8f5; }
.portal-photo-slot small { color: #758078; font-size: .7rem; }
.portal-photo-slot input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.portal-photo-slot .photo-slot-message { min-height: 2.2em; padding: .45rem .55rem; border-radius: 8px; font-size: .72rem; font-weight: 700; line-height: 1.35; }
.photo-slot-message.info { background: #fff5df; color: #80500b; }
.photo-slot-message.error { background: #fff0ef; color: #a52a20; }
.photo-slot-message.success { background: #e8f5ed; color: #07572d; }
.portal-dialog { width: min(620px, 92vw); max-height: 88vh; margin: auto; padding: clamp(1.2rem,4vw,2rem); border: 0; border-radius: 22px; box-shadow: 0 25px 80px #0b2418aa; overflow: auto; }
.portal-dialog::backdrop { background: rgba(4,24,13,.65); backdrop-filter: blur(3px); }
.dialog-close { float: right; border: 0; background: #edf2ef; border-radius: 50%; width: 36px; height: 36px; font-size: 1.4rem; cursor: pointer; }
.portal-dialog h2 { margin: .3rem 0 1.2rem; }
.recipient-result { width: 100%; display: flex; justify-content: space-between; padding: .8rem; border: 1px solid #d4e0d8; background: #f8fbf9; cursor: pointer; }
.recipient-result small { color: #67756c; }
.selected-recipient { padding: .8rem; border-radius: 10px; background: #e8f5ed; color: #07572d; font-weight: 700; }
.portal-bottom-nav { position: fixed; z-index: 60; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(560px, 94vw); display: grid; grid-template-columns: repeat(4,1fr); padding: .45rem; border: 1px solid #d7e1db; border-radius: 19px; background: rgba(255,255,255,.96); box-shadow: 0 14px 40px rgba(5,45,24,.2); backdrop-filter: blur(12px); }
.shepskey-loading-overlay { display: none; position: fixed; inset: 0; z-index: 9999; align-items: center; justify-content: center; background: rgba(4,24,13,.35); backdrop-filter: blur(1px); }
.shepskey-loading-overlay.is-visible { display: flex; }
.shepskey-loading-spinner { width: 48px; height: 48px; border: 5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: shepskey-spin .8s linear infinite; }
@keyframes shepskey-spin { to { transform: rotate(360deg); } }
.portal-bottom-nav a { position: relative; min-height: 48px; display: grid; place-items: center; align-content: center; gap: .15rem; color: #4f6457; text-decoration: none; }
.portal-bottom-nav a:hover, .portal-bottom-nav a.active { color: var(--primary-color); }
.portal-nav-icon { width: 24px; height: 24px; fill: currentColor; }
.portal-bottom-nav a.active .portal-nav-icon { width: 27px; height: 27px; }
.portal-bottom-nav span { font-size: .65rem; font-weight: 700; }
.portal-bottom-nav em { position: absolute; top: 1px; left: calc(50% + 8px); min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; border-radius: 99px; background: #c52d26; color: white; font-size: .6rem; font-style: normal; font-weight: 800; }
.notification-filters { display: flex; gap: .5rem; overflow-x: auto; padding: .4rem 0 1rem; }
.notification-filters button { flex: 0 0 auto; border: 1px solid #cddbd2; border-radius: 99px; padding: .55rem .8rem; background: white; color: #405549; font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; }
.notification-filters button.active { border-color: #07572d; background: #07572d; color: white; }
.notification-list { display: grid; gap: .65rem; }
.notification-card { width: 100%; display: grid; grid-template-columns: 48px minmax(0,1fr) 10px; gap: .8rem; align-items: start; padding: 1rem; border: 1px solid #d9e4dd; border-radius: 14px; background: white; color: #173123; text-align: left; font: inherit; cursor: pointer; box-shadow: 0 2px 8px rgba(13,55,32,.06); }
.notification-card.unread { background: #eaf6ee; border-color: #bcd7c5; }
.notification-card > span:nth-child(2) { min-width: 0; }
.notification-card p { margin: .3rem 0 .45rem; color: #5d6e63; line-height: 1.4; }
.notification-card small, .notification-detail-card time { color: #7a887f; font-size: .76rem; }
.notification-card i { width: 8px; height: 8px; margin-top: .35rem; border-radius: 50%; background: #08713d; }
.notification-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: #e4f2e9; color: #08713d; font-size: 1.25rem; font-weight: 800; }
.notification-icon.type-transfer_request { background: #e9effc; color: #315fba; }
.notification-icon.type-lost_report, .notification-icon.type-spotted_report, .notification-icon.type-found_match { background: #fff0e5; color: #b65b15; }
.notification-detail-card { margin-top: 1rem; padding: clamp(1.2rem,4vw,2rem); }
.notification-detail-card h2 { margin: .45rem 0 .7rem; }
.notification-detail-card > p:not(.notification-type) { color: #526359; line-height: 1.6; }
.notification-type { margin: 1rem 0 0; color: #08713d; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.notification-related { display: grid; gap: .25rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid #dde6e0; text-transform: capitalize; }
.notification-report-photo { width: 100%; height: clamp(220px,42vw,380px); display: grid; place-items: center; overflow: hidden; border-radius: 14px; background: #e4f2e9; color: #08713d; font-size: 3rem; }
.notification-report-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center; background: #e4f2e9; }
.notification-report-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.notification-report-heading .notification-type { margin-top: 0; }
.notification-report-heading > strong { padding: .4rem .7rem; border: 1px solid #efb17f; border-radius: 8px; background: #fff2e8; color: #a84e0a; font-size: .72rem; text-transform: capitalize; }
.notification-report-facts { display: grid; grid-template-columns: repeat(3,1fr); gap: .8rem; margin-top: 1.2rem; }
.notification-report-facts div { display: grid; gap: .3rem; padding: .8rem; border-radius: 10px; background: #f5f8f6; }
.notification-report-facts small { color: #718078; font-size: .7rem; font-weight: 700; text-transform: uppercase; }
.notification-report-facts span { overflow-wrap: anywhere; font-weight: 600; }
.notification-description { margin-top: 1.25rem; }
.notification-description h3 { margin-bottom: .35rem; }
.notification-description p, .notification-reporter { color: #5e6d64; line-height: 1.55; }
.notification-reporter { padding-top: 1rem; border-top: 1px solid #dde6e0; font-size: .82rem; }

@media (max-width: 600px) {
    .portal-screen { width: min(100% - 28px, 940px); }
    .portal-action-grid { grid-template-columns: repeat(2,1fr); }
    .portal-summary { width: 94%; margin-top: -2.25rem; }
    .portal-details-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .portal-detail-actions { grid-template-columns: 1fr; }
    .portal-cattle-card { grid-template-columns: 58px minmax(0,1fr); }
    .portal-transfer-card { align-items: stretch; flex-direction: column; flex-wrap: nowrap; }
    .portal-transfer-card > div:last-child .btn { flex: 1; }
    .portal-transfer-card > div.admin-user-actions .btn { flex: 1 1 calc(50% - .25rem); }
    .portal-cattle-card em { grid-column: 2; justify-self: start; }
    .fraud-detection-row { grid-template-columns: 1fr; justify-items: start; gap: .5rem; }
    .cattle-photo { width: 58px; height: 58px; grid-row: span 2; }
    .tool-page[data-cattle-tool] { padding-top: 1.5rem; }
    .phone-field-row { grid-template-columns: 105px minmax(0,1fr); }
    .notification-report-facts { grid-template-columns: 1fr; }
}

/* Supported responsive contract: small screen is 393-600 CSS pixels; large
   screen begins at 601px. Widths below 393px are outside the current pass. */
@media (min-width: 601px) {
    .portal-form-row { grid-template-columns: 1fr 1fr; }
    .identification-photo-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

/* iOS Safari zooms into any form control it focuses whose font-size is under
   16px, and it never zooms back out on blur — the page is left enlarged and
   hanging off the side of the screen until the user pinches out. Chrome on
   Android does not do this, which is why the symptom is iPhone-only.
   Our text controls take `font: inherit` from labels set at .88–.9rem
   (14.1–14.4px), so they all trip it. 16px is the exact threshold that
   disables the behaviour; it beats the alternative fix of `maximum-scale=1`
   on the viewport tag, which would also block deliberate pinch-zoom.
   Kept to coarse pointers so the desktop form design is untouched, and placed
   last so it outranks the `font: inherit` rules above. */
@media (pointer: coarse) {
    input:not([type=checkbox]):not([type=radio]):not([type=file]),
    select:not([hidden]),
    textarea:not([hidden]) { font-size: 16px; }
}

a {
    color: inherit;
    text-decoration: none;
}

.page-container {
    width: min(1180px, 92vw);
    margin: 0 auto;
}

/* Shared button styles for nav and content sections */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 0.8rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-outline {
    background: #ffffff;
    border-color: #1f2937;
    color: #1f2937;
}

.btn-outline:hover {
    background: #f9fafb;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #ffffff;
    border-bottom: 1px solid rgba(17, 24, 39, 0.05);
}

.nav-container {
    width: min(1180px, 92vw);
    margin: 0 auto;
    min-height: 82px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.logo-mark {
    width: 2.25rem;
    height: 2.75rem;
    object-fit: contain;
    display: block;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.logo-text strong {
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

.logo-text span {
    color: #6b7280;
    font-size: 0.72rem;
}

.nav-links {
    display: inline-flex;
    align-items: center;
    gap: 1.6rem;
    font-weight: 500;
}

.nav-links a {
    color: #1f2937;
}

.nav-links a.active {
    color: var(--primary-color);
    font-weight: 600;
}

.mobile-menu-toggle,
.mobile-menu {
    display: none;
}

.mobile-menu-toggle {
    align-items: center;
    gap: 0.55rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: #ffffff;
    color: var(--text-dark);
    padding: 0.65rem 0.9rem;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
}

.hamburger-lines {
    width: 1.1rem;
    display: inline-flex;
    flex-direction: column;
    gap: 0.22rem;
}

.hamburger-lines span {
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.mobile-menu {
    width: min(1180px, 92vw);
    margin: 0 auto;
    padding: 0 0 1rem;
}

.mobile-menu a {
    display: flex;
    align-items: center;
    min-height: 44px;
    border-top: 1px solid rgba(17, 24, 39, 0.08);
    color: #1f2937;
    font-weight: 600;
}

.mobile-menu a.active {
    color: var(--primary-color);
}

.mobile-menu .btn {
    width: 100%;
    margin-top: 0.8rem;
    min-height: auto;
    border-top: 0;
    color: #ffffff;
}

.hero-section {
    position: relative;
    background: var(--bg-soft);
    min-height: clamp(520px, 75vh, 700px);
    overflow: visible;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.75) 33%, rgba(255, 255, 255, 0) 60%);
    z-index: 1;
}

.hero-inner {
    position: relative;
    z-index: 2;
    min-height: clamp(520px, 75vh, 700px);
    display: flex;
    align-items: center;
}

.hero-content {
    max-width: 560px;
}

.hero-pill {
    display: inline-block;
    background: #ecf8f0;
    color: var(--primary-color);
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
}

.hero-content h1 {
    font-size: clamp(2.2rem, 5vw, 4.1rem);
    line-height: 1.04;
    margin-bottom: 1.1rem;
}

.hero-content h1 span {
    color: var(--primary-color);
}

.hero-description {
    font-size: 1.3rem;
    color: #374151;
    max-width: 540px;
    margin-bottom: 1.4rem;
}

.hero-actions {
    display: flex;
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.hero-trust {
    color: #374151;
    font-size: 1rem;
}

.hero-main-img,
.ai-banner img,
.download-bg {
    width: 100%;
    display: block;
}

.hero-main-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.section {
    padding: 3.75rem 0;
}

.section.light {
    background: #ffffff;
}

.section-label {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.section-title {
    text-align: center;
    font-size: clamp(1.8rem, 2.6vw, 2.55rem);
    line-height: 1.2;
    margin-bottom: 2rem;
}

.section-title.left {
    text-align: left;
    margin-bottom: 0;
}

.feature-grid,
.steps-grid,
.listing-grid,
.stats-grid {
    display: grid;
    gap: 1.1rem;
}

.feature-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.feature-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.3rem;
    box-shadow: 0 8px 22px rgba(17, 24, 39, 0.05);
}

.feature-card h3 {
    margin-bottom: 0.6rem;
    font-size: 1.15rem;
}

.feature-card p,
.step-item p,
.listing-body p,
.stat-item span {
    color: var(--text-muted);
    line-height: 1.45;
}

.steps-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.step-item {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.2rem;
    background: #ffffff;
}

.step-number {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.7rem;
    color: #ffffff;
    font-weight: 700;
    background: var(--primary-color);
}

.step-item h3 {
    margin-bottom: 0.45rem;
}

.listings-section {
    background: #f8faf9;
}

.section-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.listing-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.listing-card {
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: #ffffff;
}

.listing-card img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    object-position: center;
    background: #eef3f0;
}

.listing-body {
    padding: 1rem;
}

.listing-body h3 {
    margin-bottom: 0.3rem;
}

.listing-meta {
    margin-top: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.listing-meta span {
    font-size: 0.78rem;
    color: var(--primary-color);
    background: #e8f4ed;
    border-radius: 999px;
    padding: 0.28rem 0.6rem;
}

.ai-banner {
    position: relative;
    flex: 1 1 auto;
    height: clamp(260px, 28vw, 340px);
    min-height: 0;
    background: #071612;
    overflow: hidden;
}

.ai-impact-section {
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.ai-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-copy-wrap {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    background: linear-gradient(90deg, rgba(2, 12, 9, 0.04) 0%, rgba(2, 12, 9, 0.14) 34%, rgba(2, 12, 9, 0.72) 58%, rgba(2, 12, 9, 0.88) 100%);
}

.ai-copy {
    color: #ffffff;
    padding-left: min(52vw, 620px);
}

.ai-copy .section-label {
    text-align: left;
    color: #2bc471;
}

.ai-copy h2 {
    font-size: clamp(1.8rem, 2.7vw, 3rem);
    line-height: 1.15;
    margin-bottom: 0.75rem;
}

.ai-copy p {
    max-width: 620px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.05rem;
    line-height: 1.55;
}

.ai-process-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    max-width: 650px;
    margin-top: 2rem;
}

.ai-process-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.ai-process-item > span {
    width: 2.9rem;
    height: 2.9rem;
    flex: 0 0 2.9rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.ai-process-item strong {
    display: block;
    margin-bottom: 0.15rem;
    color: #ffffff;
}

.ai-process-item p {
    max-width: none;
    color: rgba(255, 255, 255, 0.84);
    font-size: 0.84rem;
    line-height: 1.25;
}

.impact-stats-wrap {
    padding: 1.35rem 0 1.5rem;
    border-top: 1px solid rgba(17, 24, 39, 0.08);
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-item {
    text-align: center;
}

.stat-item strong {
    display: block;
    font-size: 2.2rem;
    margin-bottom: 0.35rem;
}

.download-section {
    position: relative;
    height: clamp(220px, 21vw, 290px);
    overflow: hidden;
}

.download-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 42%;
}

.download-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(11, 102, 54, 0.94) 0%, rgba(11, 102, 54, 0.82) 34%, rgba(11, 102, 54, 0.38) 62%, rgba(11, 102, 54, 0.05) 100%);
}

.download-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    color: #ffffff;
}

.download-content h2 {
    max-width: 560px;
    font-size: clamp(1.6rem, 2.2vw, 2.35rem);
    line-height: 1.1;
    margin-bottom: 0.65rem;
}

.download-content p {
    max-width: 520px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
}

.store-links {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.store-links a {
    display: inline-flex;
    align-items: center;
    border-radius: 6px;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.store-links a:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.store-badge {
    display: block;
    width: clamp(132px, 14vw, 150px);
    height: auto;
}

.site-footer {
    background: radial-gradient(circle at top right, rgba(22, 163, 74, 0.22), transparent 36%),
        linear-gradient(120deg, #032f22 0%, #064b35 55%, #032f22 100%);
    color: #ffffff;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.45fr 0.8fr 0.85fr 0.75fr;
    gap: 3rem;
    padding: 2.8rem 0 2.4rem;
}

.footer-brand p {
    max-width: 310px;
    margin-top: 0.9rem;
    color: #d1fae5;
    font-size: 0.9rem;
    line-height: 1.5;
}

.site-footer .logo-text strong {
    color: #ffffff;
}

.site-footer .logo-text span {
    color: #d1fae5;
}

.footer-logo .logo-mark {
    filter: brightness(0) invert(1);
}

.site-footer h2 {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    font-weight: 800;
}

.footer-link-list {
    display: grid;
    gap: 0.65rem;
}

.footer-link-list a {
    color: #d1fae5;
    font-size: 0.9rem;
}

.footer-link-list a:hover {
    color: #ffffff;
}

.footer-social-links {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 800;
}

.footer-social-links a {
    width: 2.35rem;
    height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    text-transform: uppercase;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding: 1rem 0 1.25rem;
    color: #d1fae5;
    text-align: center;
    font-size: 0.85rem;
}

@media (max-width: 600px) {
    .hero-section,
    .hero-inner {
        min-height: clamp(480px, 72vh, 620px);
    }

    .ai-copy h2 {
        font-size: clamp(1.6rem, 3vw, 2.25rem);
    }

    .ai-process-grid {
        max-width: 580px;
    }

    .feature-grid,
    .listing-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: 1.6rem;
    }
}

@media (max-width: 600px) {
    .nav-links,
    .nav-cta {
        display: none;
    }

    .navbar {
        position: sticky;
    }

    .nav-container {
        min-height: 70px;
    }

    .logo-mark {
        width: 1.9rem;
        height: 2.35rem;
    }

    .logo-text strong {
        font-size: 0.95rem;
    }

    .logo-text span {
        font-size: 0.66rem;
    }

    .mobile-menu-toggle {
        display: inline-flex;
    }

    .mobile-menu.is-open {
        display: block;
    }

    .steps-grid,
    .feature-grid,
    .listing-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .section-heading-row {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 1.8rem;
        text-align: center;
    }

    .footer-brand p {
        margin-right: auto;
        margin-left: auto;
    }

    .footer-logo {
        justify-content: center;
    }

    .section-title.left {
        text-align: center;
        margin-bottom: 0.5rem;
    }

    .section {
        padding: 2.8rem 0;
    }

    .stat-item {
        text-align: center;
    }

    .hero-section,
    .hero-inner {
        min-height: 500px;
    }

    .hero-overlay {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.76) 56%, rgba(255, 255, 255, 0.45) 100%);
    }

    .hero-content h1 {
        font-size: clamp(1.9rem, 8vw, 2.5rem);
    }

    .hero-description {
        font-size: 1rem;
    }

    .hero-actions {
        flex-wrap: wrap;
    }

    .ai-banner {
        height: 460px;
    }

    .ai-copy-wrap {
        align-items: center;
        padding: 1.4rem 0;
        text-align: center;
    }

    .ai-copy h2 {
        margin-bottom: 0.55rem;
    }

    .ai-copy p {
        max-width: none;
        font-size: 0.95rem;
        line-height: 1.42;
    }

    .ai-copy {
        padding-left: 0;
    }

    .ai-copy .section-label {
        text-align: center;
    }

    .ai-process-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-top: 1.2rem;
    }

    .ai-process-item > span {
        width: 2.35rem;
        height: 2.35rem;
        flex-basis: 2.35rem;
    }

    .ai-process-item {
        justify-content: center;
        text-align: left;
    }

    .download-section,
    .download-bg {
        height: 350px;
    }

    .download-bg {
        width: 100%;
        max-width: 100%;
        object-position: 68% center;
    }

    .download-overlay {
        background: linear-gradient(180deg, rgba(11, 102, 54, 0.94) 0%, rgba(11, 102, 54, 0.8) 48%, rgba(11, 102, 54, 0.24) 100%);
    }

    .download-content {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .store-links {
        width: 100%;
        justify-content: center;
    }

    .footer-social-links {
        justify-content: center;
        flex-wrap: wrap;
    }
}
