:root {
    --ink: #17211b;
    --muted: #66746b;
    --paper: #fffaf1;
    --panel: #ffffff;
    --line: #e7ddcc;
    --accent: #e76f51;
    --accent-dark: #ba4d32;
    --leaf: #2f7d5f;
    --leaf-soft: #e7f2ec;
    --sky: #eaf5f7;
    --shadow: 0 24px 70px rgba(41, 33, 20, .13);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    min-width: 0;
}

html {
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--ink);
    font-family: "Avenir Next", "Trebuchet MS", Verdana, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(231, 111, 81, .16), transparent 32rem),
        radial-gradient(circle at 80% 10%, rgba(47, 125, 95, .14), transparent 28rem),
        linear-gradient(135deg, var(--paper), #f5efe2);
}

a {
    color: inherit;
}

.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 56px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    padding: 10px 16px;
    border: 1px solid rgba(231, 221, 204, .8);
    border-radius: 22px;
    background: rgba(255, 255, 255, .78);
    backdrop-filter: blur(12px);
    box-shadow: 0 12px 32px rgba(41, 33, 20, .06);
}

.brand {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
    font-weight: 800;
    letter-spacing: -.03em;
}

.brand-logo {
    display: block;
    width: 110px;
    height: auto;
    border-radius: 14px;
    object-fit: contain;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 16px;
    background: var(--ink);
    color: white;
    box-shadow: 0 12px 28px rgba(23, 33, 27, .18);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.nav a,
.nav button,
.btn,
.btn-secondary,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.nav a,
.btn-secondary {
    background: rgba(255, 255, 255, .72);
    color: var(--ink);
    border: 1px solid var(--line);
}

.btn {
    background: var(--accent);
    color: white;
    box-shadow: 0 14px 30px rgba(231, 111, 81, .24);
}

.btn:hover {
    background: var(--accent-dark);
}

.btn-danger {
    background: #243027;
    color: #fff;
}

.card {
    border: 1px solid rgba(231, 221, 204, .88);
    border-radius: 30px;
    background: rgba(255, 255, 255, .84);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.card-pad {
    padding: clamp(22px, 4vw, 36px);
}

.hero {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 26px;
    align-items: stretch;
}

.login-hero {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 26px;
    align-items: stretch;
    max-width: none;
    margin: 0;
}

.login-page .topbar {
    display: none;
}

.login-page .shell {
    width: min(920px, calc(100% - 32px));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 28px 0 40px;
}

.login-page .alert {
    margin-bottom: 18px;
}

.login-page-wrap {
    width: 100%;
}

.login-panel {
    overflow: hidden;
    border-radius: 28px;
    background: rgba(255, 255, 255, .94);
    box-shadow:
        0 28px 80px rgba(41, 33, 20, .12),
        0 2px 0 rgba(255, 255, 255, .8) inset;
}

.login-panel-logo {
    display: block;
    width: 72px;
    height: auto;
    object-fit: contain;
}

.login-panel-body {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    align-items: stretch;
}

.login-panel-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    padding: clamp(28px, 4vw, 42px);
    background:
        radial-gradient(circle at top left, rgba(231, 111, 81, .12), transparent 18rem),
        radial-gradient(circle at 85% 20%, rgba(47, 125, 95, .14), transparent 16rem),
        linear-gradient(180deg, #fffaf3, #f7f2e8);
    border-right: 1px solid rgba(231, 221, 204, .85);
}

.login-panel-brand h1 {
    max-width: 14ch;
    font-size: clamp(1.85rem, 3.4vw, 2.65rem);
    line-height: 1.02;
}

.login-panel-brand .lead {
    max-width: 34ch;
    margin: 0;
    color: #55635a;
    font-size: 1rem;
    line-height: 1.55;
}

.login-feature-list {
    display: grid;
    gap: 10px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}

.login-feature-list li {
    position: relative;
    padding-left: 22px;
    color: #3f4d44;
    font-size: .92rem;
    font-weight: 700;
    line-height: 1.4;
}

.login-feature-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: .45em;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--leaf), #4fa07a);
    box-shadow: 0 0 0 3px rgba(47, 125, 95, .14);
}

.login-panel-form {
    display: grid;
    gap: 16px;
    align-content: center;
    padding: clamp(28px, 4vw, 42px);
    background: #fff;
}

.login-card-heading h2 {
    margin-top: 4px;
    font-size: clamp(1.35rem, 2.2vw, 1.75rem);
}

.login-remember {
    margin-top: -2px;
}

.login-submit {
    width: 100%;
    min-height: 48px;
    margin-top: 4px;
    font-size: 1rem;
}

.hero-copy {
    padding: clamp(28px, 6vw, 54px);
}

.login-copy {
    padding: clamp(28px, 6vw, 54px);
}

.login-copy h1 {
    max-width: none;
    font-size: clamp(2rem, 4.2vw, 3.2rem);
    line-height: .98;
}

.login-copy .lead {
    max-width: none;
    margin-top: 0;
}

.login-card {
    display: grid;
    gap: 18px;
    min-height: auto;
    padding: clamp(22px, 4vw, 36px);
    border-radius: 30px;
}

.login-card-heading {
    margin-bottom: 6px;
}

.login-card-heading .muted {
    margin: 10px 0 0;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--leaf);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .14em;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    margin: 0;
    letter-spacing: -.045em;
    line-height: .98;
}

h1 {
    font-size: clamp(1.9rem, 3.6vw, 3rem);
}

h2 {
    font-size: clamp(1.4rem, 2.4vw, 2rem);
}

h3 {
    font-size: 1.25rem;
}

.lead {
    color: var(--muted);
    font-size: clamp(.95rem, 1.4vw, 1.08rem);
    line-height: 1.7;
}

.grid {
    display: grid;
    gap: 18px;
}

.page-stack {
    display: grid;
    gap: clamp(18px, 4vw, 24px);
}

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

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

.stat {
    padding: 22px;
    border-radius: 24px;
    background: var(--panel);
    border: 1px solid var(--line);
}

.stat strong {
    display: block;
    margin-top: 8px;
    font-size: 2rem;
    letter-spacing: -.05em;
}

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

.form {
    display: grid;
    gap: 18px;
}

.code-generation-form {
    margin-top: 24px;
    gap: 10px;
}

.code-generation-row {
    display: grid;
    grid-template-columns: minmax(140px, 0.9fr) minmax(220px, 1.4fr) auto;
    gap: 16px;
    align-items: end;
}

.code-generation-action {
    min-width: 180px;
}

.code-generation-action .btn {
    width: 100%;
    min-height: 48px;
    white-space: nowrap;
}

.code-generation-action-label {
    display: block;
    visibility: hidden;
    user-select: none;
}

.code-generation-hint {
    margin: 0;
    max-width: 42rem;
}

.batch-guide-card {
    background:
        linear-gradient(180deg, rgba(47, 125, 95, 0.08), rgba(255, 255, 255, 0.92)),
        #fff;
}

.batch-guide-steps {
    margin: 16px 0 0;
    padding-left: 1.2rem;
    display: grid;
    gap: 10px;
    color: #2a372f;
    line-height: 1.45;
}

.batch-guide-note {
    margin: 16px 0 0;
    color: #55635a;
    font-size: .95rem;
}

.batch-focus-banner {
    display: grid;
    gap: 4px;
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid #cfe3d8;
    border-radius: 14px;
    background: #f3faf6;
}

.batch-focus-kicker {
    color: #2f7d5f;
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.newest-batch-badge {
    margin-left: 8px;
    background: #2f7d5f;
    color: #fff;
}

tr.is-newest-batch td,
.inventory-row.is-newest-batch {
    background: rgba(47, 125, 95, 0.05);
}

.admin-codes-page .shell {
    width: min(1180px, calc(100% - 28px));
}

.inventory-header {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) auto;
    gap: 20px;
    align-items: start;
    margin-bottom: 22px;
}

.inventory-header h2 {
    margin: 0;
    font-size: clamp(1.7rem, 2.4vw, 2.15rem);
    letter-spacing: -.04em;
}

.inventory-sub {
    margin: 8px 0 0;
    max-width: 34rem;
    color: var(--muted);
    line-height: 1.5;
}

.inventory-header-meta {
    display: grid;
    gap: 12px;
    justify-items: end;
}

.inventory-stat {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f4f7f5;
    color: #55635a;
    font-size: .84rem;
    font-weight: 700;
}

.inventory-stat strong {
    color: var(--ink);
    font-size: 1.05rem;
}

.inventory-status-nav {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px;
    border: 1px solid #e4dac8;
    border-radius: 999px;
    background: #fff;
}

.inventory-chip {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    color: #314039;
    font-size: .86rem;
    font-weight: 700;
    text-decoration: none;
    transition: background .18s ease, color .18s ease;
}

.inventory-chip:hover {
    background: #f4f7f5;
}

.inventory-chip.is-active {
    background: #2f7d5f;
    color: #fff;
}

.inventory-print-btn {
    min-height: 40px;
    padding: 0 16px;
}

.inventory-batch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 0 0 18px;
}

.inventory-batch-card {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px solid #e2d7c5;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,244,236,.92));
    color: inherit;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(41, 33, 20, .04);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.inventory-batch-card:hover {
    transform: translateY(-2px);
    border-color: #c9dfd2;
    box-shadow: 0 14px 28px rgba(41, 33, 20, .08);
}

.inventory-batch-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.inventory-batch-flags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
}

.inventory-batch-range {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .92rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

.inventory-batch-flag {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: #e7f2ec;
    color: #2f7d5f;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.inventory-batch-flag.is-lock {
    background: #efe8da;
    color: #6b5a3a;
}

.inventory-batch-count {
    font-size: 1.35rem;
    letter-spacing: -.04em;
}

.inventory-batch-name,
.inventory-batch-shape {
    color: #66746b;
    font-size: .82rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.inventory-batch-shape {
    font-weight: 700;
    color: #3d5c4c;
}

.inventory-batch-card.is-newest {
    border-color: #2f7d5f;
}

.inventory-batch-card.is-active {
    border-color: #2f7d5f;
    background: linear-gradient(180deg, #2f7d5f, #276b51);
    color: #fff;
    box-shadow: 0 16px 32px rgba(47, 125, 95, .28);
}

.inventory-batch-card.is-active .inventory-batch-name,
.inventory-batch-card.is-active .inventory-batch-shape,
.inventory-batch-card.is-active .inventory-batch-flag {
    color: rgba(255, 255, 255, .88);
}

.inventory-batch-card.is-active .inventory-batch-flag {
    background: rgba(255, 255, 255, .16);
}

.inventory-batch-card.is-active .inventory-batch-flag.is-lock {
    background: rgba(255, 255, 255, .22);
}

.inventory-active-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid #cfe3d8;
    border-radius: 14px;
    background: #f3faf6;
}

.inventory-active-bar > div {
    display: grid;
    gap: 2px;
}

.inventory-active-kicker {
    color: #2f7d5f;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.inventory-clear-link {
    color: #2f7d5f;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.inventory-list {
    display: grid;
    gap: 10px;
}

.inventory-row {
    display: grid;
    grid-template-columns:
        minmax(150px, 0.85fr)
        minmax(140px, 1fr)
        minmax(120px, 0.9fr)
        auto;
    gap: 14px 16px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid #eadfcd;
    border-radius: 18px;
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.inventory-list.is-batch-filtered .inventory-row {
    grid-template-columns:
        minmax(150px, 0.9fr)
        minmax(140px, 1.1fr)
        auto;
}

.inventory-row:hover {
    border-color: #d2e5da;
    box-shadow: 0 10px 24px rgba(41, 33, 20, .06);
}

.inventory-row-main,
.inventory-row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.inventory-row-actions {
    justify-content: flex-end;
}

.inventory-row-batch,
.inventory-row-pet {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.inventory-row-label {
    color: #8a948c;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.inventory-row-pet a {
    color: #24312a;
    font-weight: 700;
    text-decoration: none;
}

.inventory-row-pet a:hover {
    color: #2f7d5f;
    text-decoration: underline;
}

.tag-id {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 10px;
    background: #17211b;
    color: #fff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .9rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.batch-cell-name {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 800;
    color: #24312a;
    overflow-wrap: anywhere;
}

.batch-cell-meta {
    color: #66746b;
    font-size: .78rem;
}

.newest-batch-badge {
    background: #2f7d5f;
    color: #fff;
}

.inventory-empty {
    display: grid;
    gap: 10px;
    justify-items: start;
    padding: 28px 18px;
    border: 1px dashed #ddd0bc;
    border-radius: 18px;
    background: #fffdf8;
}

.inventory-empty .btn-secondary {
    margin-top: 4px;
}

.inventory-delete-panel {
    margin-top: 22px;
    padding: 18px;
    border: 1px solid #eadfcd;
    border-radius: 18px;
    background: #fffdf8;
}

.inventory-delete-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.inventory-delete-kicker {
    margin: 0 0 4px;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--accent-dark);
}

.inventory-delete-copy h3 {
    margin: 0;
    font-size: 1.15rem;
    line-height: 1.2;
}

.inventory-delete-copy .muted {
    margin: 6px 0 0;
    font-size: .9rem;
    line-height: 1.4;
}

.inventory-delete-all-btn {
    min-height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    font-size: .9rem;
    white-space: nowrap;
}

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

.inventory-delete-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid #eadfcd;
    border-radius: 14px;
    background: #fff;
}

.inventory-delete-item.is-protected {
    background: #f7f5f0;
    opacity: .92;
}

.inventory-delete-item-copy {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.inventory-delete-range {
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--ink);
}

.inventory-delete-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.inventory-delete-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: #efe8da;
    color: #4a574f;
    font-size: .75rem;
    font-weight: 700;
}

.inventory-delete-chip.is-shape {
    background: var(--leaf-soft);
    color: var(--leaf);
}

.inventory-delete-chip.is-warn {
    background: #ffe8df;
    color: #8d341f;
}

.inventory-delete-item .btn-danger,
.inventory-delete-item-btn {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 800;
    white-space: nowrap;
}

.inventory-delete-locked {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: #efe8da;
    color: #6b5a3a;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

@media (max-width: 640px) {
    .inventory-delete-header {
        flex-direction: column;
        align-items: stretch;
    }

    .inventory-delete-all-btn,
    .inventory-delete-item .btn-danger,
    .inventory-delete-item-btn {
        width: 100%;
    }

    .inventory-delete-item {
        flex-direction: column;
        align-items: stretch;
    }
}

.form-action-field {
    align-self: end;
}

@media (max-width: 980px) {
    .inventory-header {
        grid-template-columns: 1fr;
    }

    .inventory-header-meta {
        justify-items: start;
        width: 100%;
    }

    .inventory-row,
    .inventory-list.is-batch-filtered .inventory-row {
        grid-template-columns: 1fr 1fr;
    }

    .inventory-row-actions {
        grid-column: 1 / -1;
        justify-content: stretch;
    }

    .inventory-row-actions .copy-url-btn,
    .inventory-row-actions .nfc-done-btn,
    .inventory-row-actions .nfc-undo-btn,
    .inventory-row-actions .delete-code-btn {
        flex: 1;
    }
}

@media (max-width: 640px) {
    .inventory-batch-grid {
        grid-template-columns: 1fr;
    }

    .inventory-row,
    .inventory-list.is-batch-filtered .inventory-row {
        grid-template-columns: 1fr;
    }

    .inventory-status-nav,
    .inventory-print-btn,
    .inventory-row-actions .copy-url-btn,
    .inventory-row-actions .nfc-done-btn,
    .inventory-row-actions .nfc-undo-btn,
    .inventory-row-actions .delete-code-btn {
        width: 100%;
        justify-content: center;
    }

    .inventory-active-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

.field {
    display: grid;
    gap: 8px;
}

label {
    color: #38443c;
    font-size: .88rem;
    font-weight: 800;
}

input,
textarea,
select {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid #ded2bf;
    border-radius: 16px;
    background: #fffdf8;
    color: var(--ink);
    font: inherit;
}

input[type="checkbox"] {
    width: 20px;
    min-height: 20px;
    height: 20px;
    padding: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    color: #38443c;
    cursor: pointer;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    outline: 3px solid rgba(47, 125, 95, .18);
    border-color: var(--leaf);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: .78rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--leaf-soft);
    color: var(--leaf);
    font-weight: 800;
}

.badge.used {
    background: #ffe8df;
    color: var(--accent-dark);
}

.nfc-helper-card {
    background: linear-gradient(180deg, rgba(255, 250, 241, .95), rgba(255, 255, 255, .92));
}

.nfc-steps {
    display: grid;
    gap: 8px;
    margin: 16px 0 20px;
    padding-left: 20px;
    color: #4a574f;
    line-height: 1.5;
}

.nfc-export-form {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr) minmax(0, 0.9fr) auto;
    gap: 14px;
    align-items: end;
}

.url-cell a {
    display: inline-block;
    max-width: 28rem;
    word-break: break-all;
}

.copy-url-btn,
.nfc-done-btn,
.nfc-undo-btn {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: .78rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.copy-url-btn:hover {
    border-color: var(--leaf);
    color: var(--leaf);
}

.nfc-done-btn {
    background: var(--leaf);
    border-color: var(--leaf);
    color: #fff;
}

.nfc-done-btn:hover {
    filter: brightness(0.95);
}

.nfc-undo-btn {
    border-color: #d7c4a8;
    color: #7a5a2a;
    background: #fff8ee;
}

.nfc-undo-btn:hover {
    border-color: #b8894a;
}

.nfc-write-form {
    display: inline;
    margin: 0;
}

.badge.nfc-written-badge {
    background: #e7f4ec;
    color: #1f6b3a;
    border: 1px solid #b9dfc6;
}

.badge.nfc-pending-badge {
    background: #fff4e5;
    color: #8a5a12;
    border: 1px solid #f0d2a0;
}

.inventory-row.is-nfc-written {
    opacity: 0.92;
}

.inventory-batch-nfc {
    display: block;
    margin-top: 4px;
    font-size: .72rem;
    font-weight: 700;
    color: #5a6b62;
}

.alert {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 18px;
    background: var(--leaf-soft);
    border: 1px solid #c9e0d2;
}

.alert.error {
    background: #fff0ec;
    border-color: #f3c4b5;
    color: #8d341f;
}

.toast-stack {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 9999;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100vw - 24px));
    pointer-events: none;
}

.toast {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 10px;
    padding: 14px 14px 14px 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 18px 40px rgba(41, 33, 20, .14);
    pointer-events: auto;
    animation: toast-in .24s ease;
}

.toast.is-leaving {
    animation: toast-out .2s ease forwards;
}

.toast-success {
    border-color: #c9e0d2;
    background: #f4fbf7;
}

.toast-error {
    border-color: #f3c4b5;
    background: #fff4f0;
}

.toast-warning {
    border-color: #efd9a5;
    background: #fff9ea;
}

.toast-info {
    border-color: #c8dde8;
    background: #f3f9fc;
}

.toast-confirm {
    grid-template-columns: auto 1fr;
}

.toast-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(23, 33, 27, .52);
    backdrop-filter: blur(4px);
    animation: toast-in .2s ease;
}

.toast-confirm-dialog {
    width: min(420px, 100%);
    display: grid;
    gap: 10px;
    justify-items: center;
    padding: 24px 22px 18px;
    border: 1px solid #eadfcd;
    border-radius: 22px;
    background: #fffdf8;
    box-shadow: 0 24px 60px rgba(23, 33, 27, .28);
    text-align: center;
}

.toast-confirm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: #fff0ec;
    color: #8d341f;
    font-size: 1.15rem;
    font-weight: 800;
}

.toast-confirm-title {
    margin: 0;
    font-size: 1.2rem;
    letter-spacing: -.02em;
    color: #17211b;
}

.toast-confirm-message {
    margin: 0;
    color: #314039;
    line-height: 1.45;
    font-size: .95rem;
}

.toast-confirm-detail {
    margin: 0;
    padding: 10px 12px;
    width: 100%;
    border-radius: 12px;
    background: #f4f1ea;
    color: #66746b;
    font-size: .82rem;
    line-height: 1.4;
}

.toast-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 6px;
}

.toast-confirm-actions .toast-btn {
    min-width: 120px;
    flex: 1;
}

body.toast-confirm-open {
    overflow: hidden;
}

.toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(23, 33, 27, .08);
    font-size: .9rem;
    font-weight: 800;
    line-height: 1;
}

.toast-success .toast-icon {
    background: var(--leaf-soft);
    color: var(--leaf);
}

.toast-error .toast-icon {
    background: #ffe4dc;
    color: var(--accent-dark);
}

.toast-warning .toast-icon {
    background: #fff0c7;
    color: #9a6b00;
}

.toast-message {
    margin: 4px 0 0;
    font-size: .95rem;
    line-height: 1.45;
    color: var(--ink);
}

.toast-close {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
}

.toast-body {
    min-width: 0;
}

.toast-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.toast-btn {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 12px;
    font: inherit;
    font-size: .85rem;
    font-weight: 800;
    cursor: pointer;
}

.toast-btn-danger {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.toast-btn-muted {
    background: #fff;
    color: var(--ink);
}

.delete-code-btn,
.table-action-btn {
    border: 1px solid #efc8bc;
    border-radius: 999px;
    padding: 6px 10px;
    background: #fff5f2;
    color: var(--accent-dark);
    font: inherit;
    font-size: .82rem;
    font-weight: 800;
    cursor: pointer;
}

.delete-code-btn:disabled,
.table-action-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.batch-delete-form {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) auto;
    gap: 12px;
    align-items: end;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(-6px) scale(.98);
    }
}

.pet-photo {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 30px;
    background: var(--sky);
}

.profile-card {
    max-width: 720px;
    margin: 0 auto;
}

.profile-rescue {
    display: grid;
    gap: 20px;
}

.finder-id-banner {
    padding: clamp(20px, 4vw, 28px);
    border: 2px solid #f2c6b4;
    border-radius: 28px;
    background: linear-gradient(135deg, #fff4ec, #fffaf1);
    box-shadow: 0 18px 44px rgba(231, 111, 81, .14);
}

.finder-id-kicker {
    margin: 0 0 8px;
    color: var(--accent-dark);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.finder-id-lead {
    margin: 0 0 16px;
    color: #5f4a3f;
    font-size: clamp(.95rem, 2.2vw, 1.05rem);
    line-height: 1.55;
}

.finder-id-mark {
    margin: 0;
    color: var(--ink);
    font-size: clamp(1.45rem, 4.8vw, 2rem);
    font-weight: 900;
    line-height: 1.25;
    letter-spacing: -.02em;
}

.finder-id-color {
    display: grid;
    gap: 6px;
    margin: 14px 0 0;
    padding-top: 14px;
    border-top: 1px solid rgba(231, 111, 81, .22);
}

.finder-id-color span {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.finder-id-color strong {
    color: var(--ink);
    font-size: clamp(1.1rem, 3.2vw, 1.35rem);
    line-height: 1.35;
}

.field-hint {
    margin: 0;
    font-size: .86rem;
    line-height: 1.5;
}

.profile-page .app-topbar {
    justify-content: center;
}

.profile-page .app-topbar .brand {
    margin: 0 auto;
}

.profile-hero-card {
    display: grid;
    grid-template-columns: minmax(280px, .9fr) minmax(0, 1.1fr);
    gap: clamp(18px, 4vw, 34px);
    align-items: stretch;
    overflow: hidden;
    border: 1px solid rgba(231, 221, 204, .88);
    border-radius: 38px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .93), rgba(255, 250, 241, .82)),
        radial-gradient(circle at 10% 10%, rgba(231, 111, 81, .18), transparent 22rem);
    box-shadow: var(--shadow);
}

.profile-photo-wrap {
    position: relative;
    min-height: 100%;
    padding: clamp(14px, 2vw, 20px);
}

.profile-photo {
    width: 100%;
    height: 100%;
    min-height: 380px;
    object-fit: cover;
    border-radius: 28px;
    background: var(--sky);
    box-shadow: 0 24px 60px rgba(23, 33, 27, .16);
}

.profile-photo-empty {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    padding: 28px;
    text-align: center;
}

.profile-photo-empty span {
    color: var(--muted);
}

.rescue-badge {
    position: absolute;
    left: clamp(26px, 4vw, 38px);
    bottom: clamp(26px, 4vw, 38px);
    display: inline-flex;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(23, 33, 27, .9);
    color: #fff;
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.profile-hero-copy {
    display: grid;
    align-content: center;
    gap: 20px;
    padding: clamp(24px, 5vw, 48px) clamp(22px, 5vw, 54px) clamp(28px, 5vw, 52px) 0;
}

.profile-hero-copy h1 {
    font-size: clamp(2rem, 4.2vw, 3.35rem);
}

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

.contact-strip > div,
.info-panel,
.profile-footer-card {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .82);
    box-shadow: 0 16px 36px rgba(41, 33, 20, .08);
}

.contact-strip > div {
    padding: 16px;
    border-radius: 22px;
}

.contact-strip span,
.contact-strip strong {
    display: block;
}

.contact-strip strong {
    margin-top: 6px;
    overflow-wrap: anywhere;
    font-size: 1.1rem;
}

.rescue-actions {
    margin-top: 0;
}

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

.info-panel {
    padding: clamp(20px, 3vw, 28px);
    border-radius: 28px;
}

.important-panel {
    background: linear-gradient(135deg, #fff5ef, rgba(255, 255, 255, .86));
    border-color: #f1c9ba;
}

.panel-kicker {
    display: inline-flex;
    margin-bottom: 12px;
    color: var(--leaf);
    font-size: .74rem;
    font-weight: 900;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.detail-list {
    display: grid;
    gap: 12px;
    margin: 18px 0 0;
}

.detail-list div {
    display: grid;
    grid-template-columns: minmax(120px, .42fr) minmax(0, 1fr);
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.detail-list div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.detail-list dt {
    color: var(--muted);
    font-weight: 800;
}

.detail-list dd {
    margin: 0;
    font-weight: 800;
}

.panel-button {
    margin-top: 12px;
}

.rescue-steps {
    display: grid;
    gap: 10px;
    margin: 18px 0 0;
    padding-left: 1.2rem;
    color: var(--muted);
}

.rescue-steps li {
    padding-left: 4px;
}

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

.profile-owner-tools {
    display: flex;
    justify-content: center;
    margin: 8px 0 20px;
}

.profile-footer-card {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 18px;
    border-radius: 26px;
}

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

.profile-footer-card strong {
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.profile-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 22px;
}

.print-sheet {
    overflow: hidden;
}

.print-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.print-title {
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: .95;
}

.print-hero .lead {
    max-width: 58ch;
}

.print-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 28px;
    flex-shrink: 0;
}

.print-actions a,
.print-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .76);
    color: var(--ink);
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.print-actions button {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

.production-print-page {
    width: min(100%, 210mm);
    margin: 0 auto;
    overflow: visible;
}

.production-print-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.production-sheet-page {
    width: min(100%, 210mm);
    margin: 0 auto 24px;
    padding: 11mm;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow);
    box-sizing: border-box;
}

.production-sheet-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
    gap: 0;
    width: 100%;
    aspect-ratio: 210 / 245;
}

.production-sheet-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 0;
    overflow: visible;
    text-align: center;
}

.production-tag-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    overflow: visible;
}

.production-top-label {
    margin: 0;
    width: 100%;
    color: #111;
    font-size: 1.5mm;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .01em;
    text-align: center;
    text-transform: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.production-qr-wrap {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    line-height: 0;
}

.production-qr {
    display: block;
    width: 100%;
    height: 100%;
}

.production-qr-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 22%;
    height: 22%;
    object-fit: contain;
    border-radius: 2mm;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.production-serial {
    margin: 0;
    font-size: 2.2mm;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .04em;
    text-align: center;
    flex-shrink: 0;
    overflow: visible;
}

.production-export-card .production-export-form {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, .8fr) auto auto;
    gap: 12px;
    align-items: end;
    margin-top: 18px;
}

.mockup-export-card .mockup-export-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 22px;
}

.mockup-export-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
    align-items: end;
}

.mockup-export-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.mockup-export-actions .btn,
.mockup-export-actions .btn-secondary {
    min-width: 168px;
    text-align: center;
}

.mockup-shapes-block {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid rgba(47, 58, 48, .1);
}

.mockup-shapes-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px 16px;
    margin-bottom: 14px;
}

.mockup-shapes-heading h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #243028;
}

.mockup-shapes-heading p {
    margin: 0;
    font-size: .86rem;
    color: #6a776f;
}

.mockup-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 14px;
}

.mockup-selected-shape {
    margin: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(47, 107, 79, .1);
    border: 1px solid rgba(47, 107, 79, .28);
    color: #1f3d30;
    font-weight: 700;
    font-size: .95rem;
}

.mockup-template-thumb {
    margin: 0;
    padding: 12px 10px 10px;
    text-align: center;
    background: rgba(255, 255, 255, .55);
    border: 2px solid rgba(47, 58, 48, .08);
    border-radius: 16px;
    cursor: pointer;
    width: 100%;
    font: inherit;
    color: inherit;
    display: block;
    position: relative;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.mockup-template-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mockup-template-thumb:hover {
    border-color: rgba(47, 58, 48, .28);
    background: rgba(255, 255, 255, .85);
}

.mockup-template-thumb.is-selected,
.mockup-template-thumb:has(.mockup-template-radio:checked) {
    border-color: #2f6b4f;
    background: rgba(47, 107, 79, .08);
    box-shadow: 0 0 0 3px rgba(47, 107, 79, .18);
}

.mockup-template-thumb.is-locked-shape {
    border-color: #2f6b4f;
    background: rgba(47, 107, 79, .1);
    box-shadow: 0 0 0 3px rgba(47, 107, 79, .2);
}

.mockup-template-thumb.is-disabled-shape {
    opacity: .42;
    cursor: not-allowed;
    filter: grayscale(.35);
    pointer-events: none;
}

.mockup-template-thumb.is-disabled-shape:hover {
    border-color: rgba(47, 58, 48, .12);
    background: rgba(255, 255, 255, .55);
}

.mockup-template-thumb.is-mirrored img {
    transform: scaleX(-1);
}

.mockup-template-thumb img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    background:
        linear-gradient(45deg, #f4efe3 25%, transparent 25%),
        linear-gradient(-45deg, #f4efe3 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f4efe3 75%),
        linear-gradient(-45deg, transparent 75%, #f4efe3 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    border-radius: 12px;
    display: block;
    margin: 0 auto 8px;
    pointer-events: none;
}

.mockup-thumb-caption {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: .78rem;
    color: #5f6d64;
    line-height: 1.25;
}

.mockup-thumb-label {
    font-weight: 700;
    color: #2f3a30;
}

.mockup-thumb-size {
    font-size: .72rem;
    color: #7a877f;
    letter-spacing: .01em;
}

.mockup-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding: 8px 0 32px;
}

.mockup-preview-page {
    width: 100%;
    max-width: none;
}

.mockup-preview-title {
    margin: 0 0 6px;
    font-size: clamp(1.2rem, 2.2vw, 1.55rem);
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.mockup-preview-page .lead {
    margin: 0;
    font-size: .95rem;
    line-height: 1.45;
}

.mockup-preview-page .production-print-toolbar {
    align-items: center;
    gap: 16px 24px;
    margin-bottom: 20px;
}

.mockup-preview-page .print-actions {
    margin-top: 0;
    flex-wrap: wrap;
}

.mockup-preview-cell {
    margin: 0;
    text-align: center;
}

.mockup-preview-cell img {
    width: 100%;
    max-width: 280px;
    height: auto;
    image-rendering: auto;
    -ms-interpolation-mode: bicubic;
    background:
        linear-gradient(45deg, #f4efe3 25%, transparent 25%),
        linear-gradient(-45deg, #f4efe3 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f4efe3 75%),
        linear-gradient(-45deg, transparent 75%, #f4efe3 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    border-radius: 16px;
    display: block;
    margin: 0 auto 8px;
}

.mockup-preview-cell figcaption {
    font-weight: 700;
    letter-spacing: .04em;
}

.production-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.settings-page {
    width: 100%;
    min-width: 0;
}

.settings-hero h1 {
    margin: 0 0 8px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(16px, 3vw, 20px);
    width: 100%;
    min-width: 0;
}

.settings-panel {
    display: grid;
    gap: 20px;
    align-content: start;
    min-width: 0;
}

.settings-panel-header {
    display: grid;
    gap: 6px;
}

.settings-panel-header h2 {
    margin: 0;
}

.settings-account-email {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.settings-form .btn {
    width: 100%;
    justify-content: center;
}

.logo-preview-box {
    display: grid;
    gap: 10px;
    justify-items: center;
    width: 100%;
    padding: clamp(16px, 4vw, 24px);
    border: 1px dashed #ded2bf;
    border-radius: 18px;
    background: #fffdf8;
}

.logo-preview-image {
    width: min(120px, 36vw);
    height: min(120px, 36vw);
    object-fit: contain;
}

@media (max-width: 960px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 780px) {
    .settings-page {
        gap: 16px;
    }

    .settings-panel {
        gap: 16px;
    }

    .settings-form {
        gap: 14px;
    }

    .settings-form input[type="file"] {
        padding: 10px 12px;
        font-size: .88rem;
    }
}

.print-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.print-select-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, .72);
}

.select-btn {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.print-summary div {
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(255, 255, 255, .9), rgba(255, 250, 241, .72));
}

.print-summary span,
.print-summary strong {
    display: block;
}

.print-summary span {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.print-summary strong {
    margin-top: 6px;
    font-size: 1.8rem;
    line-height: 1;
}

.label-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 210px;
    margin: 0 auto;
    padding: 14px 12px 12px;
    gap: 8px;
    border: 1px dashed rgba(23, 33, 27, .24);
    border-radius: 16px;
    background: #fff;
}

.label-brand-logo {
    display: block;
    width: 52px;
    height: auto;
    margin: 0;
    border-radius: 8px;
    object-fit: contain;
}

.label-qr-code {
    display: block;
    width: 100%;
    max-width: 168px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.qr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.qr-label {
    position: relative;
    break-inside: avoid;
    display: grid;
    gap: 10px;
    justify-items: stretch;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 20px;
    text-align: center;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 10px 28px rgba(41, 33, 20, .06);
    overflow: hidden;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.qr-label:hover {
    border-color: rgba(47, 125, 95, .28);
}

.qr-label.is-selected {
    border-color: rgba(47, 125, 95, .55);
    box-shadow: 0 0 0 2px rgba(47, 125, 95, .12), 0 14px 30px rgba(47, 125, 95, .1);
}

.qr-label-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(231, 221, 204, .9);
    background: linear-gradient(180deg, rgba(255, 250, 241, .9), rgba(255, 255, 255, .72));
}

.qr-label.is-used .qr-label-toolbar {
    background: linear-gradient(180deg, rgba(255, 241, 236, .95), rgba(255, 255, 255, .82));
}

.qr-label-select {
    margin: 0;
    font-size: .84rem;
    font-weight: 800;
}

.qr-status {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--leaf-soft);
    color: var(--leaf);
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.qr-status.used {
    background: #ffe8df;
    color: var(--accent-dark);
}

.label-code-id {
    display: block;
    margin: 0;
    padding: 4px 8px;
    border-radius: 6px;
    background: #f4f7f5;
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: #3f4d44;
    line-height: 1.2;
}

.qr-label .label-preview {
    margin-top: 12px;
    margin-bottom: 12px;
}

.qr-label p {
    margin: 0;
    color: var(--muted);
    font-size: .76rem;
    font-weight: 800;
}

.label-print-used {
    display: none;
    margin: 0;
    color: var(--accent-dark);
    font-size: .82rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* Dashboard */
.dashboard-page {
    display: grid;
    gap: 20px;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: end;
}

.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

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

.metric-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(255, 255, 255, .86);
    box-shadow: 0 14px 34px rgba(41, 33, 20, .07);
}

.metric-green {
    background: linear-gradient(135deg, #eaf7f1, rgba(255, 255, 255, .9));
    border-color: #c8e3d4;
}

.metric-orange {
    background: linear-gradient(135deg, #fff1eb, rgba(255, 255, 255, .9));
    border-color: #f2c6b4;
}

.metric-sand {
    background: linear-gradient(135deg, #fff7e8, rgba(255, 255, 255, .9));
    border-color: #e7d4a8;
}

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

.metric-card span {
    color: var(--muted);
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.metric-card strong {
    margin-top: 8px;
    font-size: clamp(1.8rem, 4vw, 2.45rem);
    line-height: 1;
}

.metric-card small {
    margin-top: 8px;
    color: var(--muted);
    line-height: 1.45;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.4fr .9fr .9fr;
    gap: 18px;
    align-items: stretch;
}

.lower-grid {
    grid-template-columns: 1fr 1fr 1fr;
}

.insight-card {
    padding: clamp(18px, 3vw, 26px);
    border: 1px solid var(--line);
    border-radius: 28px;
    background: rgba(255, 255, 255, .86);
    box-shadow: 0 16px 38px rgba(41, 33, 20, .08);
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.panel-head h2 {
    font-size: clamp(1.25rem, 2.2vw, 1.75rem);
}

.mini-pill,
.view-link {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--leaf-soft);
    color: var(--leaf);
    font-size: .76rem;
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
}

.chart-box {
    position: relative;
    height: 220px;
}

.donut-box {
    height: 185px;
}

.compact-chart {
    height: 210px;
}

.legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 12px;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 800;
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 6px;
    border-radius: 999px;
}

.green-dot {
    background: var(--leaf);
}

.sand-dot {
    background: #d4b896;
}

.coverage-list,
.rank-list,
.code-mini-list {
    display: grid;
    gap: 10px;
}

.coverage-list div,
.rank-list div,
.code-mini-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.coverage-list div:last-child,
.rank-list div:last-child,
.code-mini-list div:last-child {
    border-bottom: 0;
}

.coverage-list span,
.rank-list span,
.code-mini-list span {
    color: var(--muted);
    font-weight: 800;
}

.coverage-list strong,
.rank-list strong {
    font-size: 1.15rem;
}

.code-mini-list code,
.dashboard-table code {
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(231, 221, 204, .4);
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: .8rem;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
}

.dashboard-table th {
    padding: 11px 12px;
    background: rgba(231, 221, 204, .2);
    color: var(--muted);
    font-size: .72rem;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.dashboard-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.dashboard-table tr:last-child td {
    border-bottom: 0;
}

.pagination {
    margin-top: 18px;
}

.pagination nav {
    display: grid;
    gap: 12px;
}

.pagination .flex {
    display: flex;
}

.pagination .justify-between {
    justify-content: space-between;
}

.pagination .items-center {
    align-items: center;
}

.pagination .hidden {
    display: none;
}

.pagination svg {
    width: 18px;
    height: 18px;
    max-width: 18px;
    max-height: 18px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    padding: 0 10px;
    border-radius: 999px;
    color: var(--ink);
    font-size: .85rem;
    font-weight: 800;
    text-decoration: none;
}

.pagination a {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .75);
}

.pagination a:hover {
    border-color: var(--leaf);
    color: var(--leaf);
}

.pagination [aria-current="page"] span,
.pagination span[aria-current="page"] {
    background: var(--ink);
    color: #fff;
}

/* ── Tablet: 641–980px ─────────────────────────────── */
@media (min-width: 641px) and (max-width: 980px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .dashboard-actions {
        justify-content: flex-start;
    }

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

    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }

    .lower-grid {
        grid-template-columns: 1fr 1fr;
    }

    .print-hero {
        grid-template-columns: 1fr;
    }

    .print-actions {
        margin-top: 0;
        justify-content: flex-start;
    }

    .mockup-preview-page .production-print-toolbar {
        grid-template-columns: 1fr;
    }

    .mockup-preview-title {
        font-size: 1.25rem;
        line-height: 1.3;
    }
}

@media (max-width: 780px) {
    /* ── layouts that stack ── */
    .hero,
    .login-hero,
    .login-panel-body,
    .profile-hero-card,
    .profile-info-grid,
    .profile-footer-card,
    .grid-2,
    .grid-3,
    .settings-grid,
    .contact-strip,
    .profile-actions {
        grid-template-columns: 1fr;
    }

    /* ── topbar: logo row + nav row ── */
    .topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
        border-radius: 18px;
    }

    .brand {
        display: flex;
        align-items: center;
    }

    .brand-logo {
        width: 100px;
        height: auto;
        max-width: 100px;
    }

    .nav {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
        width: 100%;
    }

    .nav a,
    .nav button {
        flex: 0 0 auto;
        width: auto;
        min-height: 36px;
        padding: 0 14px;
        font-size: .84rem;
    }

    .nav form {
        flex: 0 0 auto;
        display: contents;
    }

    /* ── dashboard ── */
    .dashboard-hero,
    .dashboard-grid,
    .lower-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .dashboard-actions .btn,
    .dashboard-actions .btn-secondary {
        width: 100%;
        justify-content: center;
    }

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

    .panel-head {
        flex-wrap: wrap;
        gap: 8px;
    }

    .chart-box {
        height: 180px;
    }

    .donut-box {
        height: 155px;
    }

    .compact-chart {
        height: 165px;
    }

    /* ── print ── */
    .print-hero,
    .print-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

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

    .print-actions {
        margin-top: 0;
        justify-content: flex-start;
    }

    /* ── NFC export form ── */
    .nfc-export-form,
    .production-export-form,
    .batch-delete-form {
        grid-template-columns: 1fr;
    }

    /* ── pet profile ── */
    .profile-hero-copy {
        padding: 0 22px 28px;
    }

    .profile-photo {
        min-height: 260px;
    }

    /* ── login ── */
    .login-hero {
        margin-top: 4px;
    }

    .login-page .shell {
        min-height: auto;
        justify-content: flex-start;
        padding-top: 16px;
    }

    .login-panel-brand {
        border-right: 0;
        border-bottom: 1px solid rgba(231, 221, 204, .85);
    }

    .login-panel-brand h1 {
        max-width: none;
    }

    .detail-list div {
        grid-template-columns: 1fr;
        gap: 3px;
    }
}

/* ── small mobile ≤460px ─────────────────────────────── */
@media (max-width: 460px) {
    .metric-grid {
        grid-template-columns: 1fr;
    }

    .metric-card strong {
        font-size: 2rem;
    }

    .shell {
        width: calc(100% - 20px);
    }

    .topbar {
        border-radius: 14px;
        padding: 10px 12px;
    }

    .brand-logo {
        width: 86px;
    }

    .nav a,
    .nav button {
        min-height: 32px;
        padding: 0 11px;
        font-size: .8rem;
    }
}

/* Final mobile hardening pass.
   Keep the public/admin pages inside the viewport and separate the app header
   from card-level topbars that reuse the same base class. */
@media (max-width: 780px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
    }

    body {
        position: relative;
    }

    img,
    svg,
    canvas,
    video {
        max-width: 100%;
    }

    .shell {
        width: 100%;
        max-width: 100%;
        padding: 12px;
    }

    .card,
    .insight-card,
    .metric-card,
    .profile-hero-card,
    .info-panel,
    .profile-footer-card,
    .print-sheet,
    .qr-label {
        max-width: 100%;
        border-radius: 22px;
    }

    .card-pad,
    .hero-copy,
    .login-copy,
    .login-card,
    .login-panel-brand,
    .login-panel-form,
    .insight-card,
    .info-panel {
        padding: 20px;
    }

    .app-topbar {
        display: flex;
        width: 100%;
        max-width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 18px;
        padding: 12px;
        overflow: hidden;
    }

    .app-topbar .brand {
        width: auto;
        max-width: 120px;
    }

    .app-topbar .brand-logo {
        display: block;
        width: 100px;
        max-width: 100%;
        height: auto;
    }

    .app-topbar .nav {
        display: flex;
        width: 100%;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
    }

    .app-topbar .nav form {
        display: contents;
    }

    .app-topbar .nav a,
    .app-topbar .nav button {
        flex: 0 1 auto;
        width: auto;
        min-height: 34px;
        padding: 0 12px;
        font-size: .82rem;
        white-space: nowrap;
    }

    .inventory-header {
        grid-template-columns: 1fr;
    }

    .inventory-status-nav {
        justify-content: flex-start;
    }

    .card > .topbar,
    .card-pad > .topbar {
        display: grid;
        grid-template-columns: 1fr;
        align-items: start;
        gap: 14px;
        padding: 0;
        margin-bottom: 18px !important;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
    }

    .card > .topbar .nav,
    .card-pad > .topbar .nav,
    .card > .topbar form.nav,
    .card-pad > .topbar form.nav {
        width: 100%;
        justify-content: flex-start;
    }

    .card > .topbar form.nav,
    .card-pad > .topbar form.nav {
        display: grid;
        grid-template-columns: 1fr;
    }

    .form-action-field {
        align-self: stretch;
    }

    .card > .topbar .nav a,
    .card > .topbar .nav button,
    .card-pad > .topbar .nav a,
    .card-pad > .topbar .nav button {
        width: auto;
    }

    h1 {
        font-size: clamp(1.75rem, 8vw, 2.35rem);
        line-height: 1.02;
    }

    h2 {
        font-size: clamp(1.3rem, 6vw, 1.75rem);
        line-height: 1.05;
    }

    .lead {
        font-size: .98rem;
        line-height: 1.6;
    }

    .hero,
    .dashboard-hero,
    .dashboard-grid,
    .lower-grid,
    .profile-hero-card,
    .profile-info-grid,
    .profile-footer-card,
    .grid-2,
    .grid-3,
    .settings-grid,
    .contact-strip,
    .profile-actions,
    .nfc-export-form,
    .production-export-form,
    .print-hero {
        grid-template-columns: minmax(0, 1fr);
    }

    .dashboard-actions,
    .print-actions,
    .profile-actions,
    .rescue-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
        gap: 10px;
    }

    .dashboard-actions .btn,
    .dashboard-actions .btn-secondary,
    .print-actions a,
    .print-actions button,
    .profile-actions .btn,
    .profile-actions .btn-secondary,
    form > .btn {
        width: 100%;
        justify-content: center;
        white-space: normal;
    }

    .metric-grid,
    .print-summary {
        grid-template-columns: minmax(0, 1fr);
    }

    .dashboard-hero {
        align-items: start;
    }

    .panel-head {
        display: grid;
        grid-template-columns: 1fr;
    }

    .chart-box {
        height: 170px;
    }

    .donut-box,
    .compact-chart {
        height: 150px;
    }

    .coverage-list div,
    .rank-list div,
    .code-mini-list div {
        align-items: flex-start;
    }

    .code-mini-list div {
        display: grid;
        grid-template-columns: 1fr;
    }

    .table-wrap {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-wrap:not(.table-cards-mobile) table {
        min-width: 680px;
    }

    .table-wrap:not(.table-cards-mobile) .dashboard-table {
        min-width: 720px;
    }

    .url-cell a,
    code,
    .dashboard-table code {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .profile-photo-wrap {
        padding: 12px;
    }

    .profile-photo {
        min-height: 240px;
        border-radius: 20px;
    }

    .profile-hero-copy {
        padding: 20px;
    }

    .rescue-badge {
        left: 24px;
        bottom: 24px;
    }

    .print-select-bar {
        align-items: stretch;
    }

    .print-select-bar .check-row,
    .select-btn {
        width: 100%;
        justify-content: center;
    }

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

    .login-page .shell {
        width: 100%;
        padding: 12px;
    }

    .login-panel {
        border-radius: 22px;
    }
}

/* ── Site-wide responsive pass (all pages) ───────────── */
@media (max-width: 980px) {
    .production-export-card .production-export-form,
    .nfc-export-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .production-export-card .production-export-form > .field:last-child,
    .production-export-card .production-export-form > .field:nth-last-child(2),
    .nfc-export-form > button,
    .nfc-export-form > .field:last-child {
        grid-column: 1 / -1;
    }

    .mockup-export-fields {
        grid-template-columns: 1fr;
    }

    .production-export-actions,
    .production-export-actions .btn,
    .mockup-export-actions,
    .mockup-export-actions .btn,
    .mockup-export-actions .btn-secondary,
    .batch-delete-form .btn-danger {
        width: 100%;
    }

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

@media (max-width: 780px) {
    .shell {
        width: 100%;
        max-width: 100%;
        padding:
            max(12px, env(safe-area-inset-top))
            max(12px, env(safe-area-inset-right))
            max(24px, env(safe-area-inset-bottom))
            max(12px, env(safe-area-inset-left));
    }

    .toast-stack {
        top: auto;
        right: max(12px, env(safe-area-inset-right));
        bottom: max(12px, env(safe-area-inset-bottom));
        left: max(12px, env(safe-area-inset-left));
        width: auto;
    }

    .toast {
        grid-template-columns: auto 1fr auto;
    }

    .toast-confirm {
        grid-template-columns: auto 1fr;
    }

    .production-export-card .production-export-form,
    .nfc-export-form,
    .batch-delete-form,
    .code-generation-form,
    .code-generation-row,
    .grid-2,
    .grid-3 {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .code-generation-action-label {
        display: none;
    }

    .production-export-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .card > .topbar .nav a,
    .card > .topbar .nav button,
    .card-pad > .topbar .nav a,
    .card-pad > .topbar .nav button {
        width: 100%;
        justify-content: center;
    }

    .pets-search-form {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        width: 100%;
        gap: 10px;
    }

    .pets-search-form input,
    .pets-search-form button {
        width: 100%;
        min-height: 44px;
    }

    .copy-url-btn,
    .delete-code-btn {
        width: 100%;
        min-height: 40px;
    }

    .pagination nav {
        justify-items: center;
    }

    .pagination .flex {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }

    .insight-card,
    .chart-panel,
    .dashboard-page,
    .settings-page,
    .profile-rescue,
    .production-print-page,
    .print-sheet {
        max-width: 100%;
        overflow: hidden;
    }

    .profile-hero-card {
        grid-template-columns: minmax(0, 1fr);
        border-radius: 24px;
    }

    .contact-strip {
        grid-template-columns: minmax(0, 1fr);
    }

    .production-sheet-page {
        width: 100%;
        padding: 10px;
        border-radius: 16px;
    }

    .production-sheet-grid {
        aspect-ratio: auto;
        grid-template-rows: auto;
        gap: 8px;
    }

    .production-sheet-cell {
        padding: 8px 4px;
    }

    .table-wrap.table-cards-mobile {
        overflow: visible;
    }

    .table-wrap.table-cards-mobile table,
    .table-wrap.table-cards-mobile .dashboard-table {
        min-width: 0 !important;
        width: 100%;
    }

    .table-wrap.table-cards-mobile thead {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        border: 0;
    }

    .table-wrap.table-cards-mobile tbody {
        display: grid;
        gap: 14px;
    }

    .table-wrap.table-cards-mobile tr {
        display: grid;
        gap: 0;
        padding: 16px;
        border: 1px solid var(--line);
        border-radius: 20px;
        background: rgba(255, 255, 255, .82);
        box-shadow: 0 8px 24px rgba(41, 33, 20, .05);
    }

    .table-wrap.table-cards-mobile td {
        display: grid;
        grid-template-columns: minmax(84px, 34%) minmax(0, 1fr);
        gap: 8px 12px;
        padding: 10px 0;
        border-bottom: 1px solid rgba(231, 221, 204, .65);
        align-items: start;
    }

    .table-wrap.table-cards-mobile tr td:last-child {
        border-bottom: 0;
        padding-bottom: 0;
    }

    .table-wrap.table-cards-mobile tr td:first-child {
        padding-top: 0;
    }

    .table-wrap.table-cards-mobile td::before {
        content: attr(data-label);
        font-size: .72rem;
        font-weight: 800;
        letter-spacing: .08em;
        text-transform: uppercase;
        color: var(--muted);
        line-height: 1.35;
    }

    .table-wrap.table-cards-mobile td[colspan] {
        display: block;
        grid-template-columns: 1fr;
        padding: 18px 8px;
        text-align: center;
        border-bottom: 0;
    }

    .table-wrap.table-cards-mobile td[colspan]::before {
        display: none;
    }

    .table-wrap.table-cards-mobile .url-cell a {
        max-width: none;
        word-break: break-word;
    }
}

@media (max-width: 460px) {
    .flow-strip {
        grid-template-columns: 1fr;
    }

    .app-topbar .nav a,
    .app-topbar .nav button,
    .btn,
    .btn-secondary,
    .btn-danger {
        min-height: 44px;
    }

    .card-pad {
        padding: 18px;
    }

    .production-qr-wrap {
        max-width: 100%;
    }
}

@page {
    size: A4 portrait;
    margin: 4mm 5mm;
}

@page production-sheet {
    size: A4 portrait;
    margin: 0;
}

@media print {
    html,
    body {
        margin: 0;
        padding: 0;
        background: white;
    }

    .topbar,
    .no-print {
        display: none !important;
    }

    .shell {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .card,
    .print-sheet {
        margin: 0;
        padding: 0 !important;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }

    .qr-label:not(.print-selected) {
        display: none !important;
    }

    .qr-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 3mm;
        width: 100%;
    }

    .qr-label {
        display: block;
        padding: 1mm 1.5mm 1.2mm;
        border: 1px dashed #777;
        border-radius: 6px;
        box-shadow: none;
        background: #fff;
    }

    .label-preview {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 1mm;
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .label-brand-logo {
        width: 11mm;
        height: auto;
        max-height: none;
        margin: 0;
        border-radius: 1.5mm;
        object-fit: contain;
    }

    .label-qr-code {
        width: 94%;
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .label-code-id {
        margin: 0;
        padding: 0;
        background: transparent;
        font-size: 6pt;
        font-weight: 700;
        letter-spacing: .03em;
        color: #222;
        line-height: 1;
    }

    .label-print-used {
        display: block;
        margin: 0;
        font-size: 6pt;
        line-height: 1;
    }

    .qr-label p.label-caption {
        margin: 0;
        padding: 0;
        font-size: 5.5pt;
        line-height: 1;
    }

    .production-print-toolbar,
    .production-print-page .no-print {
        display: none !important;
    }

    body.production-print-layout {
        margin: 0;
        padding: 0;
        background: #fff;
    }

    body.production-print-layout .production-print-page {
        width: 210mm;
        max-width: 210mm;
        margin: 0 auto;
        padding: 0;
    }

    body.production-print-layout .production-sheet-page {
        page: production-sheet;
        width: 210mm;
        min-height: 297mm;
        height: 297mm;
        margin: 0 auto;
        padding: 11mm;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        box-sizing: border-box;
        background: #fff;
        overflow: visible;
        page-break-after: always;
    }

    body.production-print-layout .production-sheet-page:last-child {
        page-break-after: auto;
    }

    body.production-print-layout .production-sheet-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        grid-template-rows: repeat(5, minmax(0, 1fr));
        gap: 0;
        width: 100%;
        height: 275mm;
        margin: 0 auto;
        overflow: visible;
    }

    body.production-print-layout .production-sheet-cell {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 0;
        padding: 0;
        overflow: visible;
    }

    body.production-print-layout .production-tag-stack {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0;
        overflow: visible;
    }

    body.production-print-layout .production-qr-wrap {
        position: relative;
        flex: 0 0 auto;
    }

    body.production-print-layout .production-qr {
        display: block;
    }

    body.production-print-layout .production-qr-logo {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        object-fit: contain;
        border-radius: 2mm;
    }

    body.production-print-layout .production-top-label {
        margin: 0;
        width: 100%;
        font-size: 1.5mm;
        font-weight: 700;
        line-height: 1;
        letter-spacing: .01em;
        text-align: center;
        color: #111;
        white-space: nowrap;
        flex-shrink: 0;
    }

    body.production-print-layout .production-serial {
        margin: 0;
        font-size: 2.2mm;
        font-weight: 700;
        line-height: 1;
        letter-spacing: .04em;
        text-align: center;
        color: #111;
        flex-shrink: 0;
        overflow: visible;
    }
}

.pets-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.pets-actions form {
    margin: 0;
}

.pets-delete-btn {
    min-height: 34px;
    padding: 0 12px;
    font-size: .82rem;
}

.pets-danger-zone {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-top: 28px;
    padding: 18px;
    border: 1px solid #f3c4b5;
    border-radius: 18px;
    background: #fff6f3;
}

.pets-danger-zone h2 {
    margin: 0;
    font-size: 1.15rem;
}

.pets-danger-zone .muted {
    margin: 6px 0 0;
}

@media (max-width: 640px) {
    .pets-danger-zone {
        flex-direction: column;
        align-items: stretch;
    }

    .pets-danger-zone .btn-danger,
    .pets-actions .pets-delete-btn {
        width: 100%;
    }
}
