:root {
    --pink: #ff6fae;
    --pink-dark: #e84e93;
    --pink-light: #ffe1ef;
    --cream: #fff8fb;
    --text: #3d2b35;
    --muted: #8a6b7a;
    --white: #ffffff;
    --danger: #ff4d6d;
    --shadow: 0 18px 45px rgba(204, 93, 142, 0.18);
    --radius: 24px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, #ffe1ef 0, transparent 35%),
        radial-gradient(circle at bottom right, #ffd6ec 0, transparent 30%),
        linear-gradient(135deg, #fff8fb, #fff0f7);
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 36px 6vw 24px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--pink-dark);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 12px;
    font-weight: 700;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(32px, 5vw, 58px);
    line-height: 1;
}

.subtitle {
    color: var(--muted);
    margin-bottom: 0;
}

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

.btn {
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--pink), var(--pink-dark));
    color: white;
    box-shadow: 0 12px 25px rgba(232, 78, 147, 0.28);
}

.btn-light {
    background: white;
    color: var(--pink-dark);
    box-shadow: 0 8px 22px rgba(204, 93, 142, 0.12);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin: 18px 0 24px;
}

.stat-card {
    padding: 22px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    text-align: center;
}

.stat-card span {
    display: block;
    font-size: 34px;
    font-weight: 900;
    color: var(--pink-dark);
}

.stat-card p {
    margin-bottom: 0;
    color: var(--muted);
}

.toolbar {
    display: grid;
    grid-template-columns: 1fr 170px 210px 180px auto;
    gap: 14px;
    margin-bottom: 28px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #f4bdd6;
    border-radius: 16px;
    padding: 13px 14px;
    font: inherit;
    color: var(--text);
    background: rgba(255, 255, 255, 0.85);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--pink);
    box-shadow: 0 0 0 4px rgba(255, 111, 174, 0.15);
}

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

.card {
    position: relative;
    overflow: hidden;
    border-radius: 28px;
    background: white;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 24px 55px rgba(204, 93, 142, 0.24);
}

.card-image {
    height: 260px;
    background: linear-gradient(135deg, #ffe1ef, #fff8fb);
    background-size: cover;
    background-position: center;
}

.card-body {
    padding: 16px;
}

.card-title {
    margin-bottom: 6px;
    font-size: 18px;
    font-weight: 900;
}

.card-meta {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 0;
}

.favorite-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--pink-dark);
    font-size: 21px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.type-pill {
    display: inline-flex;
    margin-bottom: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--pink-light);
    color: var(--pink-dark);
    font-size: 12px;
    font-weight: 800;
}

.empty-state {
    display: none;
    margin-top: 40px;
    text-align: center;
    padding: 60px 20px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.7);
    box-shadow: var(--shadow);
}

.empty-icon {
    font-size: 54px;
    margin-bottom: 12px;
}

/* MODALES */

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.open {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(61, 43, 53, 0.45);
    backdrop-filter: blur(8px);
}

.modal-content,
.details-content {
    position: relative;
    z-index: 2;
    width: min(760px, 96vw);
    max-height: 92vh;
    overflow-y: auto;
    padding: 28px;
    border-radius: 32px;
    background: var(--cream);
    box-shadow: 0 35px 80px rgba(61, 43, 53, 0.32);
}

.details-content {
    width: min(1000px, 96vw);
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: white;
    color: var(--pink-dark);
    font-size: 26px;
    cursor: pointer;
}

.image-preview {
    height: 230px;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    border-radius: 24px;
    background: linear-gradient(135deg, #ffe1ef, #fff);
    border: 2px dashed #f4bdd6;
    color: var(--muted);
    background-size: cover;
    background-position: center;
}

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

label {
    display: block;
    margin-bottom: 14px;
    color: var(--muted);
    font-weight: 700;
    font-size: 14px;
}

label input,
label select,
label textarea {
    margin-top: 6px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-label input {
    width: auto;
}

.modal-actions,
.details-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 18px;
}

.details-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}

.details-image {
    min-height: 560px;
    border-radius: 28px;
    background: linear-gradient(135deg, #ffe1ef, #fff);
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 0 1px rgba(255, 111, 174, 0.12);
    cursor: zoom-in;
}

.details-info h2 {
    font-size: 34px;
    margin-bottom: 12px;
}

.details-description {
    color: var(--muted);
    line-height: 1.6;
}

.details-list {
    display: grid;
    gap: 10px;
    margin: 20px 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 14px;
    border-radius: 16px;
    background: white;
}

.detail-row strong {
    color: var(--pink-dark);
}

.details-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    padding: 7px 11px;
    border-radius: 999px;
    background: var(--pink-light);
    color: var(--pink-dark);
    font-size: 13px;
    font-weight: 700;
}

.zoomed-image {
    background-size: contain !important;
    background-repeat: no-repeat;
    background-color: #fff8fb;
}

/* RESPONSIVE */

@media (max-width: 800px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }

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

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

    .form-grid,
    .details-layout {
        grid-template-columns: 1fr;
    }

    .details-image {
        min-height: 360px;
    }
}

.backup-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: -10px 0 28px;
    padding: 14px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.62);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.import-label {
    display: inline-flex;
    margin: 0;
    align-items: center;
    justify-content: center;
}

.storage-status {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.inventory-panel {
    margin-bottom: 32px;
    padding: 24px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.inventory-panel[hidden] {
    display: none;
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.inventory-header h2 {
    margin-bottom: 6px;
}

.inventory-header p {
    color: var(--muted);
    margin-bottom: 0;
}

.inventory-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.inventory-mini-stat {
    padding: 18px;
    border-radius: 22px;
    background: white;
    text-align: center;
}

.inventory-mini-stat strong {
    display: block;
    color: var(--pink-dark);
    font-size: 28px;
}

.inventory-mini-stat span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.inventory-card {
    padding: 18px;
    border-radius: 22px;
    background: white;
}

.inventory-card h3 {
    margin-bottom: 14px;
    color: var(--text);
}

.inventory-wide {
    margin-top: 16px;
}

.inventory-line {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
}

.inventory-label {
    font-weight: 800;
    color: var(--text);
}

.inventory-count {
    color: var(--pink-dark);
    font-weight: 900;
}

.inventory-bar {
    grid-column: 1 / -1;
    height: 8px;
    border-radius: 999px;
    background: var(--pink-light);
    overflow: hidden;
}

.inventory-bar span {
    display: block;
    height: 100%;
    width: var(--bar-width);
    border-radius: inherit;
    background: linear-gradient(135deg, var(--pink), var(--pink-dark));
}

.inventory-empty {
    color: var(--muted);
    margin-bottom: 0;
}

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

.inventory-missing-item {
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-radius: 16px;
    background: var(--cream);
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.inventory-missing-item strong {
    color: var(--pink-dark);
}

.inventory-missing-item span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.auth-view {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, #ffe1ef 0, transparent 35%),
        radial-gradient(circle at bottom right, #ffd6ec 0, transparent 30%),
        linear-gradient(135deg, #fff8fb, #fff0f7);
}

.auth-card {
    width: min(520px, 94vw);
    padding: 34px;
    border-radius: 34px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.auth-logo {
    width: 74px;
    height: 74px;
    display: grid;
    place-items: center;
    margin-bottom: 18px;
    border-radius: 26px;
    background: var(--pink-light);
    font-size: 38px;
}

.auth-card h1 {
    margin-bottom: 10px;
}

.auth-form {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid #f4bdd6;
}

.auth-form h2 {
    font-size: 20px;
    margin-bottom: 16px;
}

.guest-form {
    margin-top: 18px;
}

.auth-message {
    display: none;
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 16px;
    background: #fff0f7;
    color: var(--pink-dark);
    font-weight: 800;
}

.auth-message.show {
    display: block;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.role-badge {
    padding: 9px 12px;
    border-radius: 999px;
    background: white;
    color: var(--pink-dark);
    font-size: 13px;
    font-weight: 900;
    box-shadow: 0 8px 22px rgba(204, 93, 142, 0.12);
}

body.guest-mode #openAddModal,
body.guest-mode #openAddModalEmpty,
body.guest-mode #exportBackupBtn,
body.guest-mode .import-label,
body.guest-mode #persistStorageBtn {
    display: none;
}

.gallery-upload-block {
    margin: 18px 0;
    padding: 18px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.65);
    box-shadow: 0 8px 22px rgba(204, 93, 142, 0.10);
}

.gallery-upload-header h3 {
    margin: 0 0 12px;
}

.gallery-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.gallery-empty {
    grid-column: 1 / -1;
    color: var(--muted);
    margin: 0;
    font-weight: 700;
}

.gallery-preview-item {
    position: relative;
    height: 110px;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(135deg, #ffe1ef, #fff);
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 0 1px rgba(255, 111, 174, 0.14);
}

.gallery-remove-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--pink-dark);
    font-weight: 900;
    cursor: pointer;
}

.form-help {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.details-media {
    display: grid;
    gap: 16px;
}

.details-gallery {
    padding: 14px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.7);
}

.details-gallery p {
    margin-bottom: 10px;
    color: var(--pink-dark);
    font-weight: 900;
}

.details-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}

.details-gallery-thumb {
    height: 130px;
    border-radius: 18px;
    background-size: cover;
    background-position: center;
    background-color: #fff8fb;
    cursor: zoom-in;
    box-shadow: inset 0 0 0 1px rgba(255, 111, 174, 0.14);
}

.details-gallery-thumb.zoomed-image {
    grid-column: 1 / -1;
    height: 420px;
    background-size: contain;
    background-repeat: no-repeat;
}