:root {
    --ink: #24302f;
    --muted: #6d7a72;
    --line: #e4d9c8;
    --paper: #fff7ea;
    --panel: #ffffff;
    --mint: #2f9a73;
    --mint-dark: #206d51;
    --rose: #ef735f;
    --amber: #f2b950;
    --blue: #4b83b6;
    --shadow: 0 18px 45px rgba(78, 50, 27, .14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: Arial, Helvetica, sans-serif;
    letter-spacing: 0;
}

body::before {
    content: "";
    position: fixed;
    right: 4vw;
    bottom: 3vh;
    z-index: -1;
    width: min(280px, 46vw);
    aspect-ratio: 1;
    background: url("paw_heart_deco.png") center / contain no-repeat;
    opacity: .72;
    pointer-events: none;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
}

.landing-page {
    background: var(--paper);
}

.landing-hero {
    position: relative;
    min-height: 78vh;
    display: flex;
    align-items: center;
    padding: 38px max(24px, 7vw);
    background:
        linear-gradient(90deg, rgba(255, 247, 234, .97) 0%, rgba(255, 247, 234, .89) 42%, rgba(255, 247, 234, .18) 74%),
        url("sample/perro-demo.png") center 38% / cover no-repeat;
}

.landing-copy {
    width: min(590px, 100%);
}

.landing-logo {
    width: min(430px, 88vw);
    margin-bottom: 24px;
}

.landing-copy h1 {
    max-width: 560px;
    font-size: clamp(2.7rem, 6vw, 5.4rem);
}

.landing-copy > p {
    max-width: 570px;
    margin: 20px 0 0;
    color: #465148;
    font-size: 1.18rem;
    line-height: 1.55;
}

.landing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 26px;
}

.landing-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    width: min(1120px, calc(100% - 36px));
    margin: 0 auto;
    padding: 34px 0 48px;
}

.landing-steps > div {
    border-top: 4px solid var(--amber);
    padding-top: 16px;
}

.landing-steps span {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    background: var(--mint);
    color: #fff;
    font-weight: 800;
}

.landing-steps h2 {
    margin-top: 12px;
}

.landing-steps p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.brand-logo {
    display: block;
    width: min(360px, 86vw);
    height: auto;
}

.public-brand {
    margin: 0 0 14px;
}

.lost-banner {
    display: grid;
    gap: 6px;
    margin: 0 0 16px;
    padding: 14px 16px;
    border: 2px solid #cf2f1f;
    border-radius: 16px;
    background: #fff0eb;
    color: #7f1d12;
    box-shadow: 0 12px 30px rgba(207, 47, 31, .18);
}

.lost-banner strong {
    font-size: 1.1rem;
    letter-spacing: .08em;
}

.lost-banner span {
    font-size: 1rem;
    line-height: 1.35;
}

.admin-logo {
    width: min(300px, 72vw);
    margin: 0 auto;
}

.login-logo {
    width: min(340px, 82vw);
    margin: 0 auto 14px;
}

.public-page {
    background:
        radial-gradient(circle at 12% 0%, rgba(242, 185, 80, .24), transparent 260px),
        linear-gradient(180deg, rgba(47, 154, 115, .13), transparent 430px),
        var(--paper);
}

.pet-profile {
    width: min(1120px, calc(100% - 28px));
    margin: 0 auto;
    padding: 22px 0 36px;
}

.hero {
    min-height: 70vh;
    display: grid;
    grid-template-columns: minmax(0, 1.04fr) minmax(300px, .96fr);
    align-items: center;
    gap: 34px;
}

.hero-photo {
    position: relative;
    overflow: hidden;
    border: 5px solid #fff;
    border-radius: 16px;
    box-shadow: var(--shadow);
    aspect-ratio: 4 / 3;
    background: #f3e4ce;
}

.hero-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-lost-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: min(72%, 360px);
    padding: 14px 18px;
    border: 4px solid rgba(255, 255, 255, .80);
    border-radius: 18px;
    background: rgba(207, 47, 31, .50);
    color: rgba(255, 255, 255, .92);
    font-size: clamp(1.7rem, 6vw, 3.5rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: .12em;
    text-align: center;
    text-shadow: 0 2px 10px rgba(80, 0, 0, .20);
    transform: translate(-50%, -50%) rotate(-12deg);
    box-shadow: 0 8px 24px rgba(36, 48, 47, .18);
    backdrop-filter: blur(1px);
}

.status {
    margin: 0 0 10px;
    color: var(--rose);
    font-size: .86rem;
    font-weight: 700;
    text-transform: uppercase;
}

h1, h2 {
    margin: 0;
    line-height: 1.05;
}

h1 {
    font-size: clamp(3rem, 7vw, 6rem);
    color: #27332d;
}

h2 {
    font-size: 1.1rem;
}

.lead {
    margin: 18px 0 0;
    color: #465148;
    font-size: 1.25rem;
    line-height: 1.48;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.btn {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

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

.btn.disabled {
    border-color: #ddd2c2;
    background: #efe7dc;
    color: var(--muted);
    cursor: not-allowed;
    opacity: .78;
}

.privacy-note {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: .95rem;
    line-height: 1.45;
}

.location-modal {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(36, 48, 47, .34);
}

.location-modal.is-hidden {
    display: none;
}

.location-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: min(430px, 100%);
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 252, 245, .98);
    box-shadow: 0 14px 36px rgba(28, 37, 44, .22);
}

.location-card strong,
.location-card span {
    display: block;
}

.location-card span {
    margin-top: 3px;
    color: var(--muted);
    font-size: .9rem;
}

.text-button {
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--line);
}

.info-grid article,
.owner-band > div {
    min-height: 92px;
    padding: 14px;
    background: #fffdf8;
}

.info-grid span,
.owner-band span {
    display: block;
    margin-bottom: 8px;
    color: var(--mint-dark);
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.info-grid strong,
.owner-band strong {
    font-size: 1rem;
    line-height: 1.25;
}

.detail-band,
.owner-band {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: 22px;
}

.detail-band > div {
    padding: 20px;
    border-left: 5px solid var(--amber);
    border-radius: 0 14px 14px 0;
    background: rgba(255, 253, 248, .82);
}

.detail-band p {
    margin: 10px 0 0;
    color: #465148;
    line-height: 1.5;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-top: 24px;
}

.gallery figure,
.photo-list figure {
    margin: 0;
}

.gallery img,
.photo-list img {
    width: 100%;
    aspect-ratio: 4 / 3;
    border: 4px solid #fff;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 10px 24px rgba(78, 50, 27, .10);
}

.gallery figcaption {
    margin-top: 7px;
    color: var(--muted);
    font-size: .9rem;
}

.owner-band {
    overflow: hidden;
    gap: 1px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--line);
}

.hero-owner {
    grid-template-columns: repeat(2, 1fr);
    margin-top: 14px;
}

.hero-owner > div {
    min-height: 74px;
    padding: 12px;
}

.admin-page {
    background:
        radial-gradient(circle at 0 0, rgba(239, 115, 95, .13), transparent 300px),
        #fff7ea;
}

.admin-header {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
    align-items: center;
    gap: 18px;
    padding: 22px min(28px, 4vw);
    border-bottom: 1px solid var(--line);
    background: #fffdf8;
}

.admin-title {
    grid-column: 1;
    justify-self: start;
    text-align: left;
}

.admin-header .admin-logo {
    grid-column: 2;
    justify-self: center;
}

.admin-header h1 {
    font-size: 2.2rem;
}

.admin-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    grid-column: 3;
    justify-self: end;
}

.admin-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
    gap: 18px;
    width: min(1220px, calc(100% - 28px));
    margin: 22px auto 40px;
}

.panel,
.login-box {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fffdf8;
    box-shadow: 0 10px 28px rgba(78, 50, 27, .08);
}

.panel {
    padding: 18px;
}

.panel h2 {
    margin-bottom: 16px;
}

.pet-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.pet-tab {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
}

.pet-tab.is-active {
    border-color: var(--rose);
    background: var(--rose);
    color: #fff;
}

.add-pet-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
}

.side-stack {
    display: grid;
    align-content: start;
    gap: 18px;
}

.edit-form {
    display: grid;
    gap: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

label {
    display: grid;
    gap: 7px;
    color: #44514a;
    font-size: .9rem;
    font-weight: 700;
}

input,
textarea {
    width: 100%;
    border: 1px solid #d9cdb9;
    border-radius: 12px;
    padding: 11px 12px;
    color: var(--ink);
    background: #fff;
    font: inherit;
    font-weight: 400;
}

textarea {
    resize: vertical;
}

.wide {
    grid-column: 1 / -1;
}

.toggle-row {
    display: flex;
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.toggle-row input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-ui {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    width: 52px;
    height: 30px;
    border: 1px solid #d9cdb9;
    border-radius: 999px;
    background: #ede4d6;
    transition: background .18s ease, border-color .18s ease;
}

.toggle-ui::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 7px rgba(78, 50, 27, .20);
    transition: transform .18s ease;
}

.toggle-row input:checked + .toggle-ui {
    border-color: var(--mint);
    background: var(--mint);
}

.toggle-row input:checked + .toggle-ui::after {
    transform: translateX(22px);
}

.toggle-row input:focus-visible + .toggle-ui {
    outline: 3px solid rgba(75, 131, 182, .35);
    outline-offset: 2px;
}

.lost-toggle {
    padding: 12px;
    border: 1px solid #f0b2a7;
    border-radius: 12px;
    background: #fff0eb;
    color: #7f1d12;
}

.file-control input {
    padding: 9px;
}

.photo-upload-group {
    display: grid;
    gap: 8px;
}

.field-title {
    color: #44514a;
    font-size: .9rem;
    font-weight: 700;
}

.photo-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.file-action {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid #d9cdb9;
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    font-weight: 700;
    cursor: pointer;
}

.file-action input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.file-icon {
    display: inline-grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 8px;
    background: #fff0eb;
    color: var(--rose);
    font-size: 1rem;
    line-height: 1;
}

.autosave-status {
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
    font-weight: 700;
}

.autosave-status.is-saving {
    color: var(--blue);
}

.autosave-status.is-saved {
    color: var(--mint-dark);
}

.autosave-status.is-error {
    color: #7f1d12;
}

.qr-box {
    display: grid;
    place-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.copy-field {
    margin-top: 12px;
    font-size: .85rem;
}

.photo-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.photo-list a {
    display: inline-block;
    margin-top: 6px;
    color: var(--blue);
    font-size: .86rem;
    font-weight: 700;
}

.photo-list figcaption {
    margin-top: 6px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
}

.scan-list {
    display: grid;
    gap: 8px;
}

.scan-list article {
    display: grid;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.scan-list span {
    color: var(--muted);
}

.alert {
    grid-column: 1 / -1;
    padding: 12px 14px;
    border: 1px solid #e1bcc3;
    border-radius: 12px;
    background: #fff1ee;
    color: #7a2f3a;
    font-weight: 700;
}

.alert.success {
    border-color: #bcded9;
    background: #eefaf7;
    color: var(--mint-dark);
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-box {
    width: min(420px, 100%);
    padding: 24px;
}

.login-box h1 {
    font-size: 2.4rem;
}

.login-box p {
    color: var(--muted);
}

.login-box form {
    display: grid;
    gap: 14px;
}

.text-link {
    display: inline-block;
    margin-top: 14px;
    color: var(--blue);
    font-weight: 700;
    text-decoration: none;
}

.muted {
    color: var(--muted);
}

.control-layout {
    display: grid;
    gap: 18px;
    width: min(1220px, calc(100% - 28px));
    margin: 22px auto 44px;
}

.control-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.status-chip {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
}

.status-chip strong {
    display: inline-grid;
    min-width: 28px;
    min-height: 28px;
    place-items: center;
    border-radius: 999px;
    background: #fff0eb;
    color: var(--rose);
}

.status-chip.is-active {
    border-color: var(--rose);
    background: var(--rose);
    color: #fff;
}

.status-chip.is-active strong {
    background: rgba(255, 255, 255, .22);
    color: #fff;
}

.control-list {
    display: grid;
    gap: 14px;
}

.control-card {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr) 230px;
    align-items: center;
    gap: 18px;
}

.control-qr {
    display: grid;
    place-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.control-qr img {
    width: 128px;
    height: 128px;
}

.control-info {
    min-width: 0;
}

.control-info h2 {
    margin: 6px 0 8px;
    font-size: 1.7rem;
}

.control-info p {
    margin: 5px 0;
    overflow-wrap: anywhere;
}

.print-status {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    padding: 0 10px;
    border-radius: 999px;
    background: #fff0eb;
    color: #994031;
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.status-sent .print-status {
    background: #fff7d9;
    color: #816014;
}

.status-printed .print-status {
    background: #eefaf7;
    color: var(--mint-dark);
}

.control-actions {
    display: grid;
    gap: 8px;
}

.control-actions form {
    margin: 0;
}

.control-actions .btn {
    width: 100%;
}

.empty-state {
    text-align: center;
}

.login-box h2 {
    margin: 6px 0 0;
    font-size: 1.1rem;
}

.register-form {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
    .landing-hero {
        min-height: 76vh;
        align-items: flex-end;
        padding: 28px 18px 42px;
        background:
            linear-gradient(0deg, rgba(255, 247, 234, .98) 0%, rgba(255, 247, 234, .88) 45%, rgba(255, 247, 234, .08) 76%),
            url("sample/perro-demo.png") center 25% / cover no-repeat;
    }

    .landing-logo {
        width: min(390px, 92vw);
        margin: 0 auto 18px;
    }

    .landing-copy {
        text-align: center;
    }

    .landing-actions {
        justify-content: center;
    }

    .landing-steps {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .hero,
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .control-card {
        grid-template-columns: 140px minmax(0, 1fr);
    }

    .control-actions {
        grid-column: 1 / -1;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero {
        min-height: auto;
        padding-top: 8px;
    }

    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .detail-band,
    .owner-band,
    .gallery {
        grid-template-columns: 1fr;
    }

    .admin-header {
        align-items: flex-start;
        grid-template-columns: 1fr;
    }

    .admin-header > div,
    .admin-header .admin-logo,
    .admin-header nav {
        grid-column: 1;
        justify-self: center;
    }

    .admin-title {
        text-align: center;
    }

    .admin-header nav {
        justify-content: center;
    }
}

@media (max-width: 560px) {
    .public-page {
        padding-bottom: 118px;
    }

    .public-brand {
        width: min(430px, 94vw);
        margin: 8px auto 18px;
    }

    .pet-profile,
    .admin-layout {
        width: min(100% - 18px, 1220px);
    }

    .form-grid,
    .info-grid,
    .photo-list,
    .add-pet-form {
        grid-template-columns: 1fr;
    }

    .photo-actions {
        grid-template-columns: 1fr;
    }

    .control-summary,
    .control-actions {
        grid-template-columns: 1fr;
    }

    .status-chip {
        width: 100%;
    }

    .control-card {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .control-qr {
        width: 168px;
        margin: 0 auto;
    }

    .btn {
        width: 100%;
    }

    .public-page .action-row {
        position: fixed;
        right: 9px;
        bottom: 9px;
        left: 9px;
        z-index: 20;
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        margin: 0;
        padding: 9px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: rgba(255, 255, 255, .96);
        box-shadow: 0 12px 30px rgba(28, 37, 44, .20);
    }

    .public-page .btn {
        min-height: 48px;
    }

    .location-card {
        grid-template-columns: 1fr;
        gap: 9px;
        padding: 12px;
    }

    .location-card .btn,
    .location-card .text-button {
        width: 100%;
    }
}
