:root {
    color-scheme: light;
    --blue: #0066cc;
    --blue-dark: #004f9f;
    --ink: #1d1d1f;
    --muted: #6e6e73;
    --line: #d2d2d7;
    --panel: #f5f5f7;
    --white: #ffffff;
    --success: #16833b;
    --warning: #9a5a00;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--white); }
button, input, select, textarea { font: inherit; }
button, ::file-selector-button {
    text-align: center;
    align-content: center;
    padding-block: max(0px, calc(var(--button-pad-y, 1px) - .1em)) calc(var(--button-pad-y, 1px) + .1em);
}
/* Trim the space above capitals, then reserve the leading equally on both sides
   so auto-sized controls keep their hit area. SVG controls use zero padding. */
@supports (text-box: trim-start cap text) {
    button, ::file-selector-button {
        line-height: 1;
        text-box: trim-start cap text;
        padding-block: calc(var(--button-pad-y, 1px) + .25em);
    }
    .feeder-generate-button span { text-box: trim-start cap text; }
}
.button-glyph { display: block; width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.round-control, .modal-close, .stepper button { display: inline-grid; place-items: center; padding: 0; }
.reel-play-mark .button-glyph { fill: currentColor; stroke: none; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, a, input, select, textarea { outline-offset: 3px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(0, 102, 204, .35); }
button:disabled { cursor: not-allowed; opacity: .55; }

.home-shell { width: min(1440px, 100%); margin: 0 auto; padding: 0 32px; }
.hero-header { display: grid; grid-template-columns: 280px minmax(0, 1fr); align-items: center; min-height: 132px; border-bottom: 1px solid var(--line); gap: 40px; }
.wordmark, .admin-wordmark { color: var(--ink); font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 650; letter-spacing: -.055em; }
.wordmark:hover, .admin-wordmark:hover { text-decoration: none; }
.reels-rail { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; }
.reels-track { display: flex; min-width: 0; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.reels-track::-webkit-scrollbar { display: none; }
.round-control { width: 44px; height: 44px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; background: var(--white); color: var(--ink); font-size: 30px; line-height: 1; cursor: pointer; }
.reel-trigger { position: relative; width: 82px; height: 82px; flex: 0 0 auto; padding: 0; overflow: hidden; scroll-snap-align: start; border: 2px solid var(--line); border-radius: 50%; background: var(--panel); cursor: pointer; }
.reel-trigger:hover { border-color: var(--blue); }
.reel-trigger img { display: block; width: 100%; height: 100%; object-fit: cover; }
.reel-play-mark { position: absolute; left: 50%; top: 50%; display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .62); color: var(--white); font-size: 14px; line-height: 1; transform: translate(-50%, -50%); }

.reel-viewer-backdrop { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; padding: 24px 76px; background: rgba(0, 0, 0, .92); }
.reel-viewer { position: relative; display: grid; justify-items: center; gap: 12px; color: var(--white); outline: 0; touch-action: pan-y pinch-zoom; }
.reel-viewer-stage { position: relative; width: min(430px, calc((100vh - 130px) * .5625), calc(100vw - 152px)); max-height: calc(100vh - 130px); aspect-ratio: 9 / 16; overflow: hidden; border: 1px solid #353537; border-radius: 24px; background: #000; }
.reel-viewer-video, .reel-viewer-error-cover { display: block; width: 100%; height: 100%; object-fit: contain; }
.reel-viewer-error-cover { object-fit: cover; opacity: .4; }
.reel-viewer-error { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; text-align: center; }
.reel-viewer h2 { max-width: min(430px, calc(100vw - 152px)); margin: 0; font-size: clamp(1.05rem, 2vw, 1.35rem); line-height: 1.25; text-align: center; }
.reel-viewer-close { position: fixed; right: 24px; top: 24px; display: grid; width: 44px; height: 44px; place-items: center; padding: 0; border: 1px solid #515154; border-radius: 50%; background: #2c2c2e; color: var(--white); cursor: pointer; }
.reel-viewer-previous, .reel-viewer-next { position: fixed; top: 50%; display: grid; place-items: center; padding: 0; border-color: #515154; background: #2c2c2e; color: var(--white); transform: translateY(-50%); }
.reel-viewer-control-icon { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.reel-viewer-previous { left: 24px; }
.reel-viewer-next { right: 24px; }

.discovery-grid { display: grid; grid-template-columns: minmax(330px, .82fr) minmax(480px, 1.18fr); gap: 24px; padding: 48px 0 34px; }
.filter-panel, .charity-panel { background: var(--panel); border-radius: 28px; padding: 30px; }
.charity-panel { display: flex; flex-direction: column; }
.eyebrow { color: var(--blue); font-size: .78rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; margin: 0 0 8px; }
h1, h2, h3, p { overflow-wrap: break-word; hyphens: auto; }
.filter-panel h1 { margin: 0 0 30px; font-size: clamp(2rem, 4vw, 3.8rem); line-height: .98; letter-spacing: -.055em; }
.filter-panel label { display: grid; gap: 8px; color: var(--muted); font-size: .85rem; margin-top: 14px; }
select, input, textarea, .feeding-field-group > .admin-form-grid { width: 100%; border: 1px solid var(--line); border-radius: 14px; background: var(--white); color: var(--ink); padding: 13px 15px; }
select { cursor: pointer; }
@media (forced-colors: none) {
    select:not([multiple]):is(:not([size]), [size="0"], [size="1"]) {
        appearance: none;
        padding-right: 42px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 8'%3E%3Cpath d='m1 1 6 6 6-6' fill='none' stroke='%23424245' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        background-size: 14px 8px;
        background-position: right 15px center;
        background-repeat: no-repeat;
    }
}
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.section-heading h2 { margin: 0; font-size: clamp(1.75rem, 3vw, 2.6rem); letter-spacing: -.04em; }
.charity-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(215px, 1fr); flex: 1; min-height: 0; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
.charity-card { display: flex; flex-direction: column; height: 100%; scroll-snap-align: start; background: var(--white); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.charity-card > .campaign-body { display: flex; flex: 0 0 auto; flex-direction: column; padding: 15px; min-width: 0; gap: 10px; }
.charity-card p { color: var(--muted); font-size: .86rem; margin: 0; }
.charity-image { position: relative; overflow: hidden; min-height: 120px; height: auto; flex: 1 1 auto; display: grid; place-items: center; background: #e8f2fc; color: var(--blue); font-size: 30px; }
.charity-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.charity-card h3 { margin: 0; }
.charity-card h3 a { color: var(--ink); }
.campaign-description { white-space: pre-wrap; overflow-wrap: anywhere; }
.charity-card:not(.campaign-detail-card) .campaign-description { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.campaign-progress { display: grid; gap: 6px; font-size: .88rem; }
.campaign-progress progress { width: 100%; height: 10px; accent-color: var(--blue); }
.campaign-progress small, .campaign-facts dt { color: var(--muted); }
.campaign-facts { margin: 0; display: grid; gap: 6px; font-size: .8rem; }
.campaign-facts div { display: grid; grid-template-columns: minmax(70px, .4fr) minmax(0, 1fr); gap: 10px; }
.campaign-facts dd { margin: 0; overflow-wrap: anywhere; }
.campaign-details-link { font-size: .86rem; }
.charity-strip :is(.campaign-heading, .campaign-amount) { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.charity-strip .campaign-heading h3 { min-width: 0; overflow-wrap: anywhere; }
.charity-strip .campaign-details-link { flex: none; max-width: 48%; text-align: end; }
.charity-strip .campaign-amount .status-pill { flex: none; }
.campaign-help-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; }
.campaign-help-row .charity-help-button { align-self: center; margin: 0; }
.charity-page { padding-top: 30px; padding-bottom: 60px; }
.campaign-page-heading { padding: 32px 0; }
.campaign-page-heading h1 { margin: 0; }
.campaign-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.campaign-grid .charity-image { flex: 0 0 220px; }
.campaign-grid .campaign-body { flex: 1; }
.campaign-grid .charity-help-button { margin-top: auto; }
.campaign-breadcrumb { margin: 24px 0; }
.charity-details { max-width: 1000px; }
.campaign-detail-card .charity-image { flex: none; height: clamp(200px, 40vw, 440px); }
.campaign-detail-card > .campaign-body { padding: clamp(18px, 3vw, 32px); gap: 18px; }
.campaign-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.campaign-gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; }
@media (max-width: 1000px) { .campaign-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 650px) { .campaign-grid, .campaign-gallery { grid-template-columns: minmax(0, 1fr); } }
.text-action { --button-pad-y: 0px; border: 0; padding-inline: 0; background: none; color: var(--blue); cursor: pointer; }
.charity-help-button { align-self: flex-start; margin-top: 10px; }

.animal-section { padding: 30px 0 72px; }
.animal-heading { border-top: 1px solid var(--line); padding-top: 34px; }
.live-indicator { color: #b42318; font-size: .78rem; font-weight: 750; letter-spacing: .08em; }
.live-indicator i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #d92d20; margin-right: 6px; }
.animal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.animal-card { border: 1px solid var(--line); border-radius: 24px; overflow: hidden; background: var(--white); }
.camera-frame { position: relative; aspect-ratio: 4/3; background: #111; }
.camera-frame iframe, .feeding-viewer iframe { display: block; width: 100%; height: 100%; border: 0; }
.camera-label { position: absolute; left: 12px; bottom: 12px; padding: 7px 10px; color: var(--white); background: rgba(0, 0, 0, .72); border-radius: 999px; font-size: .75rem; }
.animal-card-body { display: flex; justify-content: space-between; align-items: end; gap: 14px; padding: 18px; }
.animal-card h3 { margin: 0; font-size: 1.35rem; }
.animal-card p { color: var(--muted); margin: 6px 0 0; font-size: .88rem; }
.primary-button { --button-pad-y: 10px; min-height: 42px; border: 0; border-radius: 999px; background: var(--blue); color: var(--white); padding-inline: 20px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.primary-button:hover { background: var(--blue-dark); }
.primary-button.wide { width: 100%; margin-top: 18px; }
.site-footer { min-height: 90px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; gap: 18px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 18px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 22px; background: rgba(0, 0, 0, .55); overflow-y: auto; }
.modal-card { position: relative; width: min(620px, 100%); max-height: calc(100vh - 44px); overflow-y: auto; background: var(--white); border-radius: 28px; padding: 30px; }
.modal-card.compact { width: min(500px, 100%); }
.modal-card h2[id] { padding-inline-end: 40px; overflow-wrap: anywhere; }
.modal-card h2 { margin: 0; font-size: 2rem; letter-spacing: -.04em; }
.modal-close { position: absolute; right: 16px; top: 16px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--panel); color: var(--ink); font-size: 24px; cursor: pointer; }
.modal-close:hover:not(:disabled) { background: var(--line); }
.modal-lead { color: var(--muted); }
.portion-row, .price-summary { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 18px 0; border-top: 1px solid var(--line); }
.portion-row span, .portion-row small { display: block; }
.portion-row small { color: var(--muted); margin-top: 4px; }
.stepper { display: flex; align-items: center; gap: 15px; }
.stepper button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: var(--white); cursor: pointer; }
.price-summary { align-items: stretch; }
.price-summary span { display: grid; gap: 5px; }
.field-label { display: grid; gap: 8px; margin: 14px 0; color: var(--muted); font-size: .86rem; }
.check-row { display: flex; align-items: start; gap: 10px; margin: 12px 0; font-size: .9rem; }
.check-row input { width: 18px; height: 18px; flex: 0 0 auto; margin: 1px 0 0; }
.form-message { border-left: 3px solid var(--blue); background: var(--panel); padding: 11px 13px; font-size: .88rem; }
.feeding-viewer { aspect-ratio: 4/3; }
.viewer-topline { display: flex; justify-content: space-between; margin-bottom: 12px; }

.legal-page { width: min(880px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 80px; }
.legal-page article { margin-top: 55px; }
.legal-page h1 { font-size: clamp(2.2rem, 6vw, 4.8rem); line-height: 1; letter-spacing: -.055em; }
.legal-page h2 { margin-top: 38px; }
.legal-page article > p { line-height: 1.7; color: #424245; }
.legal-warning { margin-top: 42px; border: 1px solid #f0b429; background: #fff9e8; border-radius: 16px; padding: 18px; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--panel); }
.login-card { width: min(420px, 100%); background: var(--white); border: 1px solid var(--line); border-radius: 26px; padding: 30px; }
.login-card h1 { margin-bottom: 28px; font-size: 2.2rem; letter-spacing: -.04em; }
.login-card label { display: grid; gap: 8px; margin-bottom: 16px; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); background: var(--panel); }
.admin-sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 20px; background: var(--ink); color: var(--white); }
.admin-wordmark { color: var(--white); font-size: 2rem; margin: 0 10px 30px; }
zoo-admin-menu { display: none; }
.admin-sidebar nav { display: grid; gap: 3px; }
.admin-sidebar nav a { color: #d2d2d7; border-radius: 10px; padding: 10px; font-size: .9rem; }
.admin-sidebar nav a:hover { background: #353537; color: var(--white); text-decoration: none; }
.admin-sidebar nav a.active { background: var(--blue); color: var(--white); text-decoration: none; }
.admin-sidebar form { margin-top: auto; }
.admin-sidebar button { --button-pad-y: 10px; width: 100%; border: 1px solid #515154; border-radius: 10px; background: transparent; color: var(--white); padding-inline: 10px; cursor: pointer; }
.admin-content { min-width: 0; padding: 42px; }
.admin-editor-controls { min-inline-size: 0; margin: 0; padding: 0; border: 0; }
.feeding-field-group > legend { margin: 0 0 7px; padding: 0; color: var(--muted); font-size: .84rem; }
.admin-header { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
/* Align the visible title, not the extra space above it in the font's line box. */
.admin-header h1 { margin: -.19em 0 0; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.1; letter-spacing: -.05em; }
.admin-header > span { color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.metric-grid.feeding-totals { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.feeding-period-total { margin-block: 1rem; }
.metric-grid article, .admin-panel { border: 1px solid var(--line); border-radius: 18px; background: var(--white); padding: 22px; }
.metric-grid span { color: var(--muted); font-size: .82rem; }
.metric-grid strong { display: block; margin-top: 16px; font-size: 2rem; }
.admin-panel { margin-top: 20px; }
.admin-panel h2 { margin: 0; }
.admin-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.admin-section-heading p { margin: 7px 0 0; color: var(--muted); line-height: 1.5; }
.admin-form-section { display: grid; gap: 16px; }
.admin-section-heading.device-city-toolbar { align-items: end; flex-wrap: wrap; }
.device-city-toolbar .device-city-filter { width: min(100%, 22rem); margin: 0; }
@media (max-width: 680px) {
    .admin-section-heading.device-city-toolbar { flex-direction: column; align-items: stretch; }
    .device-city-toolbar .device-city-filter { width: 100%; }
}
.admin-record-list { display: grid; gap: 14px; }
.admin-record { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: #fafafa; }
.admin-record-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.admin-record-header strong, .admin-record-header small { display: block; }
.admin-record-header small { margin-top: 4px; color: var(--muted); }
.admin-record-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.admin-delete-confirmation { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: -4px 0 18px; padding: 13px 15px; border: 1px solid #f0b429; border-radius: 12px; background: #fff9e8; }
.admin-delete-confirmation > div { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.admin-form-grid.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.admin-form-grid label, .upload-form label { display: grid; align-content: start; gap: 7px; color: var(--muted); font-size: .84rem; }
.admin-form-grid label small { color: var(--muted); line-height: 1.4; }
.admin-form-grid textarea { resize: vertical; }
.readonly-field { display: grid; gap: 5px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.readonly-field span { color: var(--muted); font-size: .82rem; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.check-field { display: flex !important; align-items: flex-start; gap: 10px !important; color: var(--ink) !important; font-size: .9rem !important; }
.check-field input, .choice-group input { width: 18px; height: 18px; flex: 0 0 auto; margin: 0; }
.choice-group { min-width: 0; margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.choice-group legend { padding: 0 5px; color: var(--muted); font-size: .82rem; }
.choice-group label { display: flex; align-items: center; gap: 8px; margin: 7px 0; color: var(--ink); }
.secondary-button, .danger-button { --button-pad-y: 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--ink); padding-inline: 15px; cursor: pointer; white-space: nowrap; }
.secondary-button:hover { border-color: var(--blue); color: var(--blue); }
.danger-button { --button-pad-y: 7px; color: #b42318; padding-inline: 12px; }
.danger-button:hover { border-color: #b42318; }
.danger-button:disabled { cursor: not-allowed; opacity: .45; }
.secondary-button:disabled { cursor: not-allowed; opacity: .5; }
.compact-list, .nested-list { display: grid; gap: 10px; }
.compact-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.nested-list { padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.nested-list-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.empty-state, .form-notice, .help-text { margin: 0; color: var(--muted); line-height: 1.5; }
.form-notice { padding: 12px 14px; border-left: 3px solid var(--blue); background: #eef6ff; color: var(--ink); }
.safety-panel { border-color: #f0b429; background: #fff9e8; }
.safety-panel > .check-field { margin-block-start: 16px; }
.safety-panel p { margin-bottom: 0; color: #6f4b00; }
.admin-save-bar { position: sticky; bottom: 16px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 24px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, .96); }
zoo-admin-save-errors { min-width: 0; color: #a5221c; overflow-wrap: anywhere; }
zoo-admin-save-errors summary { cursor: pointer; font-weight: 600; }
zoo-admin-save-errors ul { max-height: min(20dvh, 9rem); overflow-y: auto; margin: 6px 0 0; padding-inline-start: 1.4em; }
zoo-admin-save-errors a { text-decoration: underline; }
.admin-save-bar > div { display: grid; gap: 3px; }
.save-message { color: var(--muted); font-size: .84rem; }
.save-message.error { color: #b42318; }
.readiness-list { padding-left: 22px; }
.readiness-list .ok::marker { color: var(--success); }
.readiness-list .warn::marker { color: var(--warning); }
.admin-editor { width: 100%; min-height: 480px; resize: vertical; border-radius: 12px; font: .84rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; tab-size: 2; }
.admin-editor.secret-output { min-height: 150px; margin-top: 16px; }
.admin-actions { display: flex; align-items: center; gap: 14px; margin: 16px 0; }
.data-table-wrap { overflow-x: auto; }
.admin-row-disclosure { display: none; }
@media (max-width: 760px) {
    .admin-compact-table, .admin-compact-table tbody { display: block; width: 100%; }
    .admin-compact-table thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
    .admin-compact-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; padding-block: 12px; border-bottom: 1px solid var(--line); }
    .data-table.admin-compact-table tbody :is(td, th) { min-width: 0; padding: 0; border: 0; overflow-wrap: anywhere; }
    .admin-compact-table tbody tr > :not(:last-child) { grid-column: 1; }
    .admin-compact-table tbody tr > :last-child { grid-column: 2; grid-row: 1 / span 3; text-align: end; }
    .admin-compact-table tbody [data-detail] { display: none; }
    .admin-compact-table tr:has(.admin-row-disclosure[aria-expanded="true"]) > [data-detail] { display: block; grid-column: 1 / -1; order: 1; }
    .admin-compact-table [data-detail]::before { content: attr(data-detail) ": "; color: var(--muted); }
    .admin-row-disclosure { display: block; margin: 4px 0 0 auto; padding: 4px; border: 0; color: var(--blue); background: transparent; font: inherit; cursor: pointer; }
}
.feeder-row-actions { display: inline-flex; align-items: center; gap: 8px; }
.feeder-row-actions button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; }
.feeder-row-actions svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
dialog.feeder-dialog { position: fixed; margin: auto; border: 1px solid var(--line); color: var(--ink); width: min(760px, calc(100% - 32px)); }
.feeder-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.feeder-dialog form { display: grid; gap: 18px; }
.feeder-dialog p { margin: 0; }
dialog.leave-dialog { width: min(480px, calc(100% - 32px)); }
.leave-dialog p { margin: 16px 0 24px; }
.admin-save-bar strong + [role="status"] { font-size: .875rem; }
zoo-admin-leave-guard { display: contents; }
.feeder-copy-field { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; align-content: start; gap: 7px 8px; }
.feeder-copy-field label, .feeder-copy-field [role="status"], .feeder-psk-row { grid-column: 1 / -1; }
.feeder-copy-field input { min-width: 0; font: .9375rem ui-monospace, monospace; }
.feeder-copy-button, .feeder-icon-button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border-radius: 50%; }
.feeder-psk-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.feeder-psk-row input { flex: 1 1 0; }
.feeder-psk-row input::-ms-reveal { display: none; }
.feeder-psk-row input[type="password"] ~ button .eye-slash { display: none; }
.feeder-psk-row button { flex: none; }
.feeder-generate-button { display: inline-flex; align-items: center; justify-content: center; height: 42px; gap: 6px; padding-block: 0; }
@media (max-width: 680px) {
    .feeder-psk-row { gap: 4px; }
    .feeder-generate-button { width: 42px; padding: 0; }
    .feeder-generate-button span { display: none; }
}
.feeder-copy-field [role="status"] { color: var(--muted); font-size: .84rem; }
.feeder-copy-field [role="status"]:empty { position: absolute; }
@media (max-width: 540px) {
    .feeder-copy-field label { grid-area: 1 / 1; }
    .feeder-copy-button { grid-area: 1 / 2; }
    .feeder-copy-field input { grid-area: 2 / 1 / 3 / -1; padding-inline: 6px; font-size: clamp(.75rem, 3.4vw, .9375rem); }
}
@media (max-width: 360px) {
    dialog.feeder-dialog { width: calc(100% - 12px); padding-inline: 12px; }
}
.admin-compact-table tr:has(> td[aria-current="true"]) { background-color: #eef6ff; }
.placement-camera-link + .placement-camera-link { margin-inline-start: .5rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.data-table th, .data-table td { border-bottom: 1px solid var(--line); padding: 11px; text-align: left; vertical-align: top; }
.admin-content .data-table tbody :is(th, td) { vertical-align: middle; }
.data-table thead th { color: var(--muted); font-weight: 600; }
.data-table tbody th[scope="row"] { font-weight: inherit; }
.status-pill { display: inline-block; border-radius: 999px; padding: 5px 9px; background: #e8f2fc; color: var(--blue-dark); font-size: .75rem; }
.upload-form { display: grid; gap: 12px; max-width: 560px; }
.statistics-filters { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 12px; }
.page-loading { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }

.media-library { display: grid; gap: 16px; }
.media-kind-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); }
.media-kind-tabs [role=tab] {
    --button-pad-y: 10px;
    min-height: 44px;
    margin-bottom: -1px;
    padding-inline: 16px;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
}
.media-kind-tabs [role=tab]:enabled { cursor: pointer; }
.media-kind-tabs [aria-selected=false]:enabled:hover { color: var(--ink); }
.media-kind-tabs [aria-selected=true] { color: var(--blue); border-bottom-color: currentColor; }
.media-library-toolbar { display: flex; flex-wrap: wrap; align-items: start; gap: 12px; }
.media-library-upload { min-width: 0; }
.media-upload-progress { display: grid; gap: 4px; margin-block-start: 8px; color: var(--muted); overflow-wrap: anywhere; }
.media-upload-progress progress { max-width: 100%; accent-color: var(--blue); }
.media-upload-trigger { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; overflow: hidden; }
.media-upload-trigger input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
.media-upload-trigger:focus-within { outline: 3px solid rgba(0, 102, 204, .35); outline-offset: 3px; }
.media-upload-trigger:has(input:disabled) { opacity: .55; }
.media-upload-trigger input:disabled { cursor: not-allowed; }
.media-library-search { flex: 1 1 240px; width: auto; min-width: 0; }
.media-library-recovery { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.media-library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 16px; }
.media-library-card { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
.media-library-card.is-selected { border-color: var(--blue); outline: 2px solid #d8ebff; outline-offset: 1px; }
.media-library-card:focus-within { border-color: var(--blue); }
.media-library-preview { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; background: #edf2f7; }
.media-thumbnail { display: block; width: 100%; height: 100%; border: 0; padding: 0; background: none; border-radius: inherit; cursor: zoom-in; }
.media-thumbnail video { pointer-events: none; }
dialog.feeder-dialog.media-asset-viewer { inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; padding: 0; border: 0; border-radius: 0; background: #141414; color: white; }
.media-viewer-content { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 12px; height: 100%; padding: 18px clamp(56px, 6vw, 80px); text-align: center; }
.media-viewer-content p { overflow-wrap: anywhere; }
.media-viewer-original { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
html:has(.media-asset-viewer[open]) { overflow: hidden; }
.media-library-preview img, .media-library-preview video { display: block; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.media-library-unavailable { display: grid; height: 100%; place-items: center; margin: 0; padding: 48px 12px 12px; border: 1px dashed var(--line); border-radius: inherit; color: #b42318; text-align: center; }
.media-library-card-title { margin: 0; font-size: 1rem; line-height: 1.25; text-align: left; overflow-wrap: anywhere; }
.media-library-card-actions { position: absolute; top: 8px; right: 8px; }
.media-library-card-actions .feeder-row-actions { gap: 4px; }
.media-library-card-actions .feeder-row-actions button { width: 32px; height: 32px; }
.media-library-card-actions .feeder-row-actions svg { width: 16px; height: 16px; }
.media-library-card-actions .feeder-row-actions button:focus-visible { outline: 2px solid #0054a6; outline-offset: 2px; box-shadow: 0 0 0 2px #fff; }
.media-edit-info { margin: 0; display: grid; gap: 8px; }
.media-edit-info > div { display: grid; grid-template-columns: minmax(7rem, 30%) minmax(0, 1fr); gap: 12px; }
.media-edit-info dt { color: var(--muted); }
.media-edit-info dd { margin: 0; overflow-wrap: anywhere; }
.media-edit-name-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: .86rem; }
dialog.media-library-modal { width: min(1040px, calc(100% - 48px)); max-height: min(800px, calc(100vh - 48px)); overflow: auto; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); }
.media-library-modal::backdrop { background: rgba(17, 24, 39, .55); }
.media-library-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.media-library-modal-header h2 { margin: 0; }
.media-field { display: grid; gap: 8px; align-content: start; }
.media-field > span:first-child { color: var(--muted); font-size: .84rem; }
.media-field > div { display: flex; flex-wrap: wrap; gap: 8px; }
.media-field-empty { color: var(--muted); }
.media-field-preview { display: block; width: min(100%, 320px); max-height: 220px; border-radius: 10px; background: #edf2f7; object-fit: cover; }
.media-field-thumbnail { display: block; width: 80px; height: 60px; border-radius: 8px; object-fit: cover; }

#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 0 0;
    z-index: 2000;
    padding: 14px 52px 14px 20px;
    background: #b42318;
    color: var(--white);
}
#blazor-error-ui a { color: var(--white); text-decoration: underline; }
#blazor-error-ui .dismiss { position: absolute; top: 10px; right: 18px; cursor: pointer; font-size: 1.25rem; }

.blazor-error-boundary { padding: 16px; background: #b42318; color: var(--white); }
.blazor-error-boundary::after { content: "Произошла ошибка."; }

@media (max-width: 1050px) {
    .discovery-grid { grid-template-columns: minmax(0, 1fr); }
    .animal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero-header { grid-template-columns: 220px minmax(0, 1fr); }
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .statistics-filters { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
}

@media (max-width: 760px) {
    .home-shell { padding: 0 18px; }
    .hero-header { grid-template-columns: 1fr; gap: 18px; padding: 24px 0; }
    .reels-rail { order: 2; justify-content: flex-start; }
    .reels-track { flex: 1; }
    .reel-viewer-backdrop { padding: 0; }
    .reel-viewer { width: 100%; height: 100%; align-content: center; padding: 60px 58px 24px; }
    .reel-viewer-stage { width: min(100%, calc((100vh - 132px) * .5625)); max-height: calc(100vh - 132px); border-radius: 18px; }
    .reel-viewer h2 { max-width: 100%; }
    .reel-viewer-close { right: 12px; top: 12px; }
    .reel-viewer-previous { left: 8px; }
    .reel-viewer-next { right: 8px; }
    .discovery-grid { padding-top: 24px; }
    .section-heading { align-items: flex-start; flex-direction: column; }
    .filter-panel, .charity-panel { padding: 22px; border-radius: 22px; }
    .animal-grid { grid-template-columns: 1fr; }
    .site-footer { align-items: start; flex-direction: column; padding: 28px 0; }
    .admin-shell { display: block; }
    .admin-sidebar { position: static; height: auto; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px 14px; padding: 10px 18px; }
    .admin-sidebar .admin-wordmark { margin: 0; font-size: 1.3rem; }
    zoo-admin-menu:defined { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
    .admin-current-section { font-size: .88rem; line-height: 1.15; text-align: right; overflow-wrap: anywhere; }
    .admin-sidebar zoo-admin-menu button { width: auto; flex: none; }
    .admin-sidebar :is(nav, form) { grid-column: 1 / -1; }
    zoo-admin-menu:defined:has(button[aria-expanded="false"]) ~ :is(nav, form) { display: none; }
    .admin-sidebar nav { grid-template-columns: repeat(2, 1fr); }
    .admin-sidebar form { margin-top: 20px; }
    .admin-content { padding: 18px 18px 25px; }
    .admin-header { align-items: start; flex-direction: column; }
    .admin-form-grid, .admin-form-grid.three-columns { grid-template-columns: 1fr; }
    .span-2, .span-3 { grid-column: span 1; }
    .admin-section-heading, .admin-save-bar { align-items: stretch; flex-direction: column; }
    .admin-record-header, .admin-delete-confirmation { align-items: stretch; flex-direction: column; }
    .admin-record-actions { justify-content: flex-start; }
    .admin-save-bar { bottom: 8px; }
    .admin-save-bar .primary-button { width: 100%; }
}

@media (max-width: 460px) {
    .animal-card-body, .portion-row, .price-summary { align-items: stretch; flex-direction: column; }
    .modal-backdrop { padding: 0; align-items: end; }
    .modal-card { max-height: 94vh; border-radius: 24px 24px 0 0; padding: 24px 18px; }
    .metric-grid, .admin-sidebar nav { grid-template-columns: 1fr; }
    .statistics-filters { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .media-library-grid { grid-template-columns: 1fr; }
    dialog.media-library-modal { width: calc(100% - 24px); max-height: calc(100vh - 24px); padding: 18px; }
    .media-library-modal-header { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}
.feedback-toast {
    position: fixed; inset: calc(max(16px, env(safe-area-inset-top)) + var(--notice-offset, 0px)) max(16px, env(safe-area-inset-right)) auto auto;
    z-index: 3000; box-sizing: border-box; display: block; margin: 0; width: max-content;
    max-width: min(32rem, calc(100vw - 32px)); max-height: 50dvh; overflow: auto;
    padding: 12px 46px 12px 16px; border: 1px solid #90c7a3; border-radius: 14px; background: #edf8f0;
    color: #175932; font: inherit; line-height: 1.4; overflow-wrap: anywhere; text-align: start;
}
.feedback-toast[data-kind="error"] { color: #8c201e; background: #fff1f0; border-color: #e7a49f; }
.feedback-toast::part(close) {
    position: absolute; top: 5px; right: 5px; display: grid; place-items: center;
    width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
    background: transparent; color: inherit; cursor: pointer;
}
.feedback-toast::part(close):hover { background: rgb(0 0 0 / 7%); }
.feedback-toast::part(close):focus-visible { outline: 2px solid currentColor; }
.feedback-toast ul { margin: 4px 0 0; padding-inline-start: 1.25em; }
.field-error { display: block; margin: 3px 0 0; color: #a5221c; font-size: .875rem; line-height: 1.4; text-align: start; }
.field-error::before { content: ""; display: inline-block; width: .42em; height: .42em; margin-inline-end: .5em; border-radius: 50%; background: currentColor; vertical-align: .14em; }
.feeder-copy-field > .field-error { grid-column: 1 / -1; }
.feedback-toast[hidden], .field-error[hidden] { display: none !important; }
