:root {
    --ink: #16241f;
    --muted: #65736d;
    --paper: #f5f1e8;
    --surface: #fffdf8;
    --forest: #174c3a;
    --forest-dark: #10372a;
    --lime: #cfe56a;
    --line: #d8d6ca;
    --danger: #a73535;
    --shadow: 0 18px 50px rgba(22, 36, 31, .09);
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; line-height: 1.55; }
a { color: var(--forest); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, summary, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #789319; outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.15rem, 5vw, 4.7rem); line-height: .98; letter-spacing: -.055em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); letter-spacing: -.03em; }

.site-header { width: min(1180px, calc(100% - 32px)); margin: 0 auto; min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 10px 0; }
.brand { display: flex; flex-shrink: 0; align-items: center; gap: 12px; color: var(--ink); font-weight: 800; text-decoration: none; }
.brand-logo { width: 68px; height: 68px; object-fit: contain; filter: drop-shadow(0 5px 10px rgba(22, 36, 31, .12)); }
.brand-title { white-space: nowrap; }
.site-header nav { display: flex; flex-wrap: wrap; justify-content: flex-end; min-width: 0; align-items: center; gap: 5px; }
.site-header nav form { margin: 0; }
.site-header nav > a, .site-header nav form .link-button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; padding: 8px 10px; border: 1px solid #e1ded3; border-radius: 4px 13px 4px 4px; color: var(--forest); background: rgba(255, 253, 248, .72); font-weight: 700; line-height: 1.15; text-decoration: none; white-space: nowrap; transition: color .18s ease, background-color .18s ease, border-color .18s ease, transform .18s ease; }
.site-header nav > a:hover, .site-header nav > a:focus-visible, .site-header nav form .link-button:hover, .site-header nav form .link-button:focus-visible { color: var(--forest); border-color: var(--line); background: var(--surface); transform: translateY(-1px); }
.site-header nav a[aria-current="page"] { color: white; background: var(--forest); border-color: var(--forest); box-shadow: 0 6px 16px rgba(23, 76, 58, .16); font-weight: 850; text-decoration: none; }
.nav-toggle { display: none; min-height: 44px; padding: 8px 14px; border: 1px solid var(--forest); border-radius: 4px 15px 4px 4px; color: white; background: var(--forest); font: inherit; font-weight: 800; cursor: pointer; box-shadow: 0 6px 16px rgba(23, 76, 58, .14); }
.nav-toggle-icon { width: 1.15em; font-size: 1.2rem; line-height: 1; text-align: center; }
.skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; padding: 10px 14px; color: white; background: var(--forest-dark); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.site-header nav > .admin-link { border-color: #b5c866; background: #edf4d0; }
.site-header nav > .admin-link:hover { border-color: #91aa35; background: #e4efb8; }
.link-button { padding: 0; border: 0; background: none; color: var(--forest); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.page-shell { width: min(1180px, calc(100% - 32px)); margin: 30px auto 80px; }

.hero { min-height: 70vh; display: grid; grid-template-columns: 1.55fr .75fr; gap: clamp(32px, 8vw, 100px); align-items: center; }
.hero .lead { max-width: 700px; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.35rem); }
.hero-card { padding: 36px; color: white; background: var(--forest); border-radius: 4px 46px 4px 4px; box-shadow: var(--shadow); }
.hero-card ol { padding-left: 20px; }
.hero-card li + li { margin-top: 13px; }
.hero-number { color: var(--lime); font-size: 4rem; font-weight: 900; line-height: 1; }
.eyebrow { margin-bottom: 12px; color: #527064; font-size: .78rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.hero-card .eyebrow { color: var(--lime); }
.actions, .form-actions, .card-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.button { display: inline-flex; justify-content: center; align-items: center; min-height: 48px; padding: 12px 22px; border: 1px solid var(--forest); border-radius: 4px 18px 4px 4px; color: white; background: var(--forest); font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; }
.button:hover { color: white; background: var(--forest-dark); }
.button-secondary { color: var(--forest); background: transparent; }
.button-secondary:hover { color: white; border-color: var(--forest-dark); background: var(--forest-dark); }
.button-danger { border-color: var(--danger); background: var(--danger); }
.button-danger:hover { color: white; background: #7d2525; }
.button-small { min-height: 38px; padding: 8px 14px; border-radius: 3px 12px 3px 3px; font-size: .9rem; }

.auth-card { max-width: 860px; margin: 40px auto; padding: clamp(24px, 5vw, 54px); background: var(--surface); border: 1px solid var(--line); border-radius: 5px 42px 5px 5px; box-shadow: var(--shadow); }
.auth-card-narrow { max-width: 560px; }
.section-heading { margin-bottom: 28px; }
.section-heading h1 { margin-bottom: 12px; font-size: clamp(2rem, 5vw, 3.4rem); }
.section-heading p:last-child { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.single-column { grid-template-columns: 1fr; }
.full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-weight: 750; }
.field input, .field select, .field textarea { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #aeb7b2; border-radius: 4px; background: white; color: var(--ink); font: inherit; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid rgba(207, 229, 106, .7); border-color: var(--forest); }
.field small { color: var(--muted); }
.field .field-error { color: var(--danger); font-weight: 700; }
.field [aria-invalid="true"] { border-color: var(--danger); }
.checkbox { display: flex; align-items: flex-start; gap: 10px; }
.checkbox input { margin-top: 5px; }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-links { display: flex; justify-content: space-between; gap: 16px; }

.alert { max-width: 860px; margin: 0 auto 20px; padding: 15px 18px; border-radius: 4px 16px 4px 4px; }
.alert ul { margin-bottom: 0; }
.alert-success { background: #dff0dc; border: 1px solid #9ac391; }
.alert-error { color: #6d1919; background: #f8dddd; border: 1px solid #d9a2a2; }

.dashboard-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin: 50px 0 60px; }
.dashboard-heading h1 { margin-bottom: 14px; font-size: clamp(2.2rem, 6vw, 4.2rem); }
.dashboard-heading p:last-child { color: var(--muted); }
.account-section { margin-bottom: 54px; }
.privacy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.empty-state { padding: 45px; text-align: center; background: var(--surface); border: 1px dashed #9ca9a3; border-radius: 5px 30px 5px 5px; }
.inline-notice { display: grid; gap: 8px; margin: 24px 0; padding: 18px; background: #edf4d0; border: 1px solid #b5c866; border-radius: 4px 20px 4px 4px; }
.inline-notice .button { justify-self: start; margin-top: 4px; }
.inline-notice ul { margin: 4px 0; padding-left: 22px; }
.inline-notice-error { color: #6d1919; background: #f8dddd; border-color: #d9a2a2; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; }
.dog-card { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px 26px 4px 4px; box-shadow: 0 8px 24px rgba(22, 36, 31, .05); }
.dog-card-top { display: flex; align-items: center; gap: 15px; }
.dog-card-top h3 { margin-bottom: 2px; font-size: 1.35rem; }
.dog-card-top p { margin-bottom: 0; color: var(--muted); }
.dog-avatar { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--lime); font-size: 1.4rem; font-weight: 900; }
.dog-card dl { margin: 22px 0; padding-top: 18px; border-top: 1px solid var(--line); }
.dog-card dl div { display: flex; justify-content: space-between; gap: 14px; }
.dog-card dt { color: var(--muted); }
.dog-card dd { margin: 0; font-weight: 700; text-align: right; }
.competition-card { display: flex; flex-direction: column; }
.competition-card h2 { margin-bottom: 10px; }
.competition-card-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; margin-top: auto; }
.competition-detail h1 { font-size: clamp(2.1rem, 5vw, 3.8rem); }
.event-list { display: grid; gap: 10px; margin: 0; padding: 18px; border: 1px solid var(--line); }
.event-list legend { padding: 0 8px; font-weight: 800; }
.event-option { display: flex; align-items: flex-start; gap: 12px; padding: 14px; background: #f4f7ec; border-radius: 4px 14px 4px 4px; cursor: pointer; }
.event-option input { margin-top: 5px; }
.event-option span { display: grid; }
.event-option small { color: var(--muted); }
.event-option .event-eligibility { margin-top: 4px; color: var(--forest); font-weight: 700; }
.event-option-disabled { cursor: not-allowed; opacity: .68; }
.event-option-disabled .event-eligibility { color: var(--danger); }
.button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: .62; }
.cancel-form { display: grid; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.cancel-form input { min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); }
.danger-link { color: var(--danger); text-align: left; }
.documentation { max-width: 900px; margin: 40px auto; }
.documentation-hero { margin-bottom: 28px; }
.documentation-hero h1 { font-size: clamp(2.2rem, 6vw, 4.2rem); }
.documentation-index { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }
.documentation-index a { padding: 8px 12px; background: var(--forest); color: white; border-radius: 3px 12px 3px 3px; text-decoration: none; }
.documentation article { margin-bottom: 18px; padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px 24px 4px 4px; }
.documentation article h2 { font-size: 1.55rem; }
.public-table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); }
.public-table { width: 100%; border-collapse: collapse; }
.public-table th, .public-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; }
.public-table th { background: var(--forest); color: white; }
.results-hero { display: flex; justify-content: space-between; align-items: end; gap: 28px; margin: 48px 0 32px; }
.results-hero h1 { margin-bottom: 12px; font-size: clamp(2.2rem, 6vw, 4.2rem); }
.results-hero p:last-child { color: var(--muted); }
.result-actions { display: grid; justify-items: end; gap: 10px; }
.print-document-header { display: none; }
.live-status { display: flex; align-items: center; gap: 12px; min-width: 220px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px 18px 4px 4px; }
.live-status div { display: grid; }
.live-status small { color: var(--muted); }
.live-dot { width: 12px; height: 12px; border-radius: 50%; background: #2c9b65; box-shadow: 0 0 0 6px rgba(44, 155, 101, .14); }
.result-filters { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(240px, 1.3fr) auto auto; align-items: end; gap: 16px; margin-bottom: 38px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px 24px 4px 4px; }
.result-filters > a { align-self: center; }
.result-section { margin-bottom: 40px; }
.result-section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 14px; }
.result-section-heading h2 { margin-bottom: 0; }
.result-section-heading > span { color: var(--muted); }
.results-table th:first-child, .results-table td:first-child { width: 76px; text-align: center; }
.results-table td { vertical-align: top; }
.results-table td small { display: block; margin-top: 4px; color: var(--muted); white-space: nowrap; }
.rank-cell { color: var(--forest); font-size: 1.35rem; font-weight: 900; }
.muted, .results-updated { color: var(--muted); }
.results-updated { text-align: right; font-size: .9rem; }
.personal-result-filter { display: flex; align-items: end; gap: 18px; max-width: 520px; margin-bottom: 42px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px 20px 4px 4px; }
.personal-result-filter .field { flex: 1; }
.achievement-card .dog-card-top { margin-bottom: 20px; }
.achievement-row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.achievement-row strong { text-align: right; }
.achievement-empty { margin: 18px 0 0; }
.personal-result-card { margin-bottom: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 5px 30px 5px 5px; box-shadow: 0 8px 24px rgba(22, 36, 31, .05); overflow: hidden; }
.personal-result-card > header { display: flex; justify-content: space-between; gap: 24px; padding: 26px; }
.personal-result-card > header h2 { margin-bottom: 8px; }
.personal-result-card > header p:last-child { margin-bottom: 0; color: var(--muted); }
.personal-result-rank { display: grid; min-width: 108px; place-content: center; text-align: center; }
.personal-result-rank strong { color: var(--forest); font-size: 2.4rem; line-height: 1; }
.personal-result-rank span { margin-top: 5px; color: var(--muted); font-size: .8rem; }
.personal-result-table td small { display: block; color: var(--muted); }
.personal-result-card > footer { display: flex; justify-content: space-between; gap: 20px; padding: 18px 26px; background: #f4f7ec; }
.delivery-legend { display: grid; gap: 5px; margin-bottom: 32px; padding: 18px 20px; background: #edf4d0; border: 1px solid #b5c866; border-radius: 4px 20px 4px 4px; }
.notification-card { margin-bottom: 18px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px 26px 4px 4px; box-shadow: 0 8px 24px rgba(22, 36, 31, .05); }
.notification-card > header, .notification-card > footer { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.notification-card > header h2 { margin-bottom: 10px; font-size: 1.45rem; }
.notification-card > ul { margin: 8px 0 22px; padding-left: 22px; }
.notification-card > footer { align-items: center; padding-top: 16px; border-top: 1px solid var(--line); }
.delivery-status { display: inline-flex; flex: none; padding: 5px 10px; border-radius: 999px; font-size: .82rem; font-weight: 850; }
.delivery-status-sent { color: #145738; background: #dff0dc; }
.delivery-status-pending { color: #624b09; background: #fff0bc; }
.delivery-status-failed { color: #7b2020; background: #f8dddd; }
.feedback-status-new { color: #624b09; background: #fff0bc; }
.feedback-status-in_review { color: #174c3a; background: #dcefe8; }
.feedback-status-planned { color: #334c78; background: #e0e8f8; }
.feedback-status-resolved { color: #145738; background: #dff0dc; }
.feedback-status-rejected { color: #6d3030; background: #eee3e3; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 28px; }
.pagination a, .pagination span { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; padding: 8px 12px; }
.pagination [aria-disabled="true"] { color: var(--muted); opacity: .65; }
.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; }

@media (max-width: 1080px) {
    .site-header { min-height: 70px; flex-wrap: wrap; padding: 10px 0 14px; }
    .nav-toggle { display: inline-flex; align-items: center; gap: 8px; }
    .site-header nav { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 2px; padding: 12px; border: 1px solid var(--line); border-radius: 5px 24px 5px 5px; background: var(--surface); box-shadow: var(--shadow); }
    .site-header.nav-enhanced nav { display: none; }
    .site-header.nav-enhanced[data-open="true"] nav { display: grid; }
    .site-header nav > a, .site-header nav form .link-button { width: 100%; min-height: 48px; justify-content: flex-start; padding: 11px 14px; border-color: #e3e0d5; background: #f8f5ed; border-radius: 4px 14px 4px 4px; white-space: normal; }
    .site-header nav > a:hover, .site-header nav > a:focus-visible, .site-header nav form .link-button:hover, .site-header nav form .link-button:focus-visible { color: var(--forest); border-color: #b8c1bc; background: white; transform: none; }
    .site-header nav a[aria-current="page"] { color: white; border-color: var(--forest); background: var(--forest); }
    .site-header nav > .admin-link { border-color: #b5c866; background: #edf4d0; }
    .site-header nav form { grid-column: 1 / -1; width: 100%; margin-top: 3px; padding-top: 11px; border-top: 1px solid var(--line); }
    .site-header nav form .link-button { color: #7b2020; border-color: #ead0d0; background: #fbf1f1; }
}

@media (max-width: 760px) {
    .brand-title { display: none; }
    .brand-logo { width: 54px; height: 54px; }
    .hero { grid-template-columns: 1fr; padding: 35px 0; }
    .form-grid { grid-template-columns: 1fr; }
    .privacy-grid { grid-template-columns: 1fr; }
    .full { grid-column: auto; }
    .dashboard-heading { align-items: flex-start; flex-direction: column; margin-top: 30px; }
    .auth-card { margin-top: 20px; }
    .actions, .form-actions, .card-actions { align-items: stretch; flex-direction: column; }
    .actions .button, .form-actions .button, .card-actions .button, .card-actions form { width: 100%; }
    .empty-state { padding: 30px 20px; }
    .card-grid { grid-template-columns: 1fr; }
    .dog-card { padding: 20px; }
    .dog-card dl div, .achievement-row { align-items: flex-start; flex-direction: column; gap: 3px; }
    .dog-card dd, .achievement-row strong { text-align: left; }
    .results-hero { align-items: flex-start; flex-direction: column; }
    .result-actions { width: 100%; justify-items: stretch; }
    .result-filters { grid-template-columns: 1fr; }
    .result-section-heading { align-items: flex-start; flex-direction: column; }
    .personal-result-card > header, .personal-result-card > footer { align-items: flex-start; flex-direction: column; }
    .personal-result-rank { display: flex; align-items: baseline; gap: 8px; min-width: 0; text-align: left; }
    .personal-result-filter { align-items: stretch; flex-direction: column; }
    .personal-result-filter .button { width: 100%; }
    .notification-card > header, .notification-card > footer { align-items: stretch; flex-direction: column; }
    .notification-card > footer .button { width: 100%; }
}

@media (max-width: 420px) {
    .site-header nav { grid-template-columns: 1fr; }
    .site-header nav form { grid-column: auto; }
}

@page { size: A4 landscape; margin: 12mm; }
@media print {
    body { color: #111; background: white; font-size: 9pt; }
    .site-header, .skip-link, .result-filters, .live-status, .print-action { display: none !important; }
    .page-shell, .documentation { width: 100%; max-width: none; margin: 0; }
    .results-hero, .documentation-hero { display: none; }
    .print-document-header { display: flex; align-items: center; gap: 5mm; margin-bottom: 7mm; padding-bottom: 4mm; border-bottom: 2px solid #174c3a; }
    .print-document-header img { width: 18mm; height: 18mm; object-fit: contain; }
    .print-document-header div { display: grid; gap: 1mm; }
    .print-document-header strong { color: #174c3a; font-size: 17pt; }
    .print-document-header span { font-size: 10pt; }
    .result-section { margin-bottom: 8mm; break-inside: auto; }
    .result-section-heading { margin-bottom: 3mm; break-after: avoid; }
    .result-section-heading .eyebrow { margin-bottom: 1mm; }
    .result-section-heading h2 { font-size: 14pt; }
    .public-table-wrap { overflow: visible; border-color: #555; }
    .public-table { font-size: 8.5pt; }
    .public-table thead { display: table-header-group; }
    .public-table tr { break-inside: avoid; }
    .public-table th, .public-table td { padding: 2.5mm 3mm; border-color: #777; }
    .public-table th { color: white !important; background: #174c3a !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    .results-table td small { white-space: normal; }
    .rank-cell { font-size: 11pt; }
    .results-updated { margin-top: 5mm; color: #444; }
    .printable-document .public-table { font-size: 10pt; }
}
