:root {
    --pine: #16382f;
    --pine-deep: #0d241e;
    --yellow: #f0c84b;
    --rust: #c65a2e;
    --paper: #e4ebe6;
    --ink: #1a1916;
    --metal: #5e6b64;
    --stamp: #b42318;
    --open: #1e7a4d;
    --sealed: #8a5a12;
    --label: #f7f8f4;
    --line: #c5d0c9;
    --display: "Barlow Condensed", "Arial Narrow", sans-serif;
    --body: "Outfit", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 8%, rgba(240, 200, 75, 0.18), transparent 28%),
        var(--paper);
    color: var(--ink);
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.45;
}

a { color: inherit; }

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

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
    outline: 3px solid var(--yellow);
    outline-offset: 2px;
}

.shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.side {
    background: var(--pine);
    color: #f4f7f5;
    padding: 1.4rem 1rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.brand {
    display: grid;
    gap: 0.15rem;
    padding: 0 0.4rem;
}

.brand strong {
    font-family: var(--display);
    font-size: 2rem;
    letter-spacing: 0.12em;
    font-weight: 700;
    line-height: 0.9;
}

.brand span {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--yellow);
}

.nav {
    display: grid;
    gap: 0.25rem;
}

.nav a {
    text-decoration: none;
    padding: 0.55rem 0.7rem;
    border-left: 3px solid transparent;
    color: #d7e4de;
}

.nav a.is-active,
.nav a:hover {
    background: rgba(255, 255, 255, 0.06);
    border-left-color: var(--yellow);
    color: white;
}

.side-user {
    margin-top: auto;
    display: grid;
    gap: 0.6rem;
    padding: 0 0.4rem;
    font-size: 0.92rem;
}

.side-user form { margin: 0; }

.main {
    padding: 1.6rem clamp(1rem, 3vw, 2.4rem) 3rem;
    max-width: 1180px;
}

.toast {
    background: var(--pine);
    color: white;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.slip {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.4rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    margin: 0 0 0.2rem;
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--metal);
}

h1, h2, h3 {
    font-family: var(--display);
    font-weight: 650;
    letter-spacing: 0.02em;
    line-height: 0.95;
    margin: 0;
}

h1 { font-size: clamp(2.4rem, 5vw, 4.2rem); text-transform: uppercase; }

h2 { font-size: 1.8rem; }

.lede { margin: 0.45rem 0 0; max-width: 38rem; color: var(--metal); }

.actions, .row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.btn, button.btn, a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: var(--rust);
    color: white;
    text-decoration: none;
    border: 1px solid var(--rust);
    padding: 0.62rem 0.9rem;
    font-family: var(--display);
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
}

.btn.secondary {
    background: transparent;
    color: var(--pine);
    border-color: var(--pine);
}

.btn.quiet {
    background: transparent;
    color: var(--stamp);
    border-color: transparent;
    padding-inline: 0.4rem;
}

.tally {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border: 1px solid var(--pine);
    background: var(--label);
    margin-bottom: 1.4rem;
}

.tally div {
    padding: 0.8rem 0.9rem;
    border-right: 1px solid var(--line);
}

.tally div:last-child { border-right: 0; }

.tally span {
    display: block;
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--metal);
}

.tally strong {
    font-family: var(--display);
    font-size: 2.2rem;
    font-weight: 650;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.9rem;
}

.label {
    background: var(--label);
    color: var(--ink);
    text-decoration: none;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-height: 150px;
    border: 1px solid #d7d4c8;
    box-shadow: 4px 4px 0 rgba(22, 56, 47, 0.12);
}

.label-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.label.has-photo > .row-thumb {
    width: 96px;
    height: auto;
    min-height: 150px;
    align-self: stretch;
    object-fit: cover;
    flex: none;
    background: #d7d4c8;
}

.label__band {
    background: var(--yellow);
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: center;
    padding: 0.35rem 0.7rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.label__body { padding: 0.85rem 0.85rem 0.4rem; display: grid; gap: 0.3rem; }

.label__body p { margin: 0; color: var(--metal); }

.label__perf {
    margin-top: auto;
    height: 14px;
    background-image: radial-gradient(circle, var(--paper) 4px, transparent 4.5px);
    background-size: 16px 14px;
    background-position: center;
    border-top: 1px dashed #cfc8b6;
}

.crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0 0 0.8rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--metal);
}

.crumbs a { color: var(--pine); }

.sheet {
    background: var(--label);
    border: 1px solid #d7d4c8;
    padding: 1rem;
    display: grid;
    gap: 0.8rem;
    max-width: 680px;
}

.field { display: grid; gap: 0.28rem; }

.field span, .check span {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--metal);
}

.choice {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem 1.2rem;
}

.choice label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--body);
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink);
}

.choice input { width: auto; }

.field input, .field textarea, .field select, .inline input, .inline select {
    width: 100%;
    border: 1px solid #c8c2b2;
    background: white;
    padding: 0.65rem 0.7rem;
}

.field textarea { min-height: 90px; resize: vertical; }

.field small, .alert { color: var(--stamp); }

.alert {
    background: #fde8e4;
    padding: 0.7rem 0.8rem;
    margin: 0;
}

.split { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 1rem; align-items: start; }

.stack { display: grid; gap: 0.7rem; }

.meta { color: var(--metal); margin: 0.35rem 0 0; }

.pill {
    display: inline-flex;
    align-items: center;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.15rem 0.4rem;
    border: 1px solid currentColor;
}

.pill.open { color: var(--open); }
.pill.sealed { color: var(--sealed); }
.pill.archived { color: var(--stamp); }

.list {
    display: grid;
    gap: 0.55rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.list li, .item-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.7rem;
    align-items: center;
    background: var(--label);
    border: 1px solid #d7d4c8;
    padding: 0.7rem 0.8rem;
}

.list li.has-thumb {
    grid-template-columns: 72px auto minmax(0, 1fr) auto;
}

.row-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    background: #d7d4c8;
}

.qty {
    font-family: var(--display);
    font-size: 1.6rem;
    min-width: 2rem;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.6rem;
}

.photo-grid figure {
    margin: 0;
    background: var(--label);
    border: 1px solid #d7d4c8;
}

.photo-grid img {
    aspect-ratio: 1;
    object-fit: cover;
    width: 100%;
}

.photo-grid figcaption, .photo-grid form { padding: 0.35rem 0.45rem; }

.item-photos { grid-column: 1 / -1; }

.photo-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    align-items: end;
}

.photo-inline figure {
    margin: 0;
    width: 96px;
    background: var(--label);
    border: 1px solid #d7d4c8;
}

.photo-inline img {
    width: 96px;
    height: 96px;
    object-fit: cover;
}

.photo-inline figure form { padding: 0.25rem; }

.photo-inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: end;
    flex: 1;
    min-width: min(100%, 280px);
}

.photo-inline-form .field { flex: 1; min-width: 140px; }

.photo-inline-form small { flex-basis: 100%; color: var(--stamp); }

.field input[type="file"] {
    padding: 0.4rem;
    background: white;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filters input, .filters select { border: 1px solid #c8c2b2; background: white; padding: 0.55rem 0.65rem; }

.pager { display: flex; gap: 0.8rem; align-items: center; margin-top: 1rem; }

.empty {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.45);
    border: 1px dashed var(--metal);
}

.guest {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.guest-card { width: min(440px, 100%); }

.guest-card h1 { font-size: 3.4rem; }

.check { display: flex; gap: 0.5rem; align-items: center; }

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    margin: 1.2rem 0 0.7rem;
}

.print-sheet {
    width: min(420px, 100%);
    margin: 2rem auto;
    background: white;
    border: 2px solid black;
}

@media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .side {
        position: sticky;
        top: 0;
        z-index: 2;
        flex-direction: row;
        align-items: center;
        gap: 0.8rem;
        padding: 0.7rem;
        overflow: auto;
    }
    .nav { display: flex; }
    .side-user { margin-top: 0; display: flex; align-items: center; }
    .tally, .split, .slip { grid-template-columns: 1fr; }
    .tally div { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media print {
    .side, .actions, .no-print { display: none !important; }
    .shell { display: block; }
    body { background: white; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* Căutare rapidă pe Panou */
.quick-search { margin: 0 0 1.2rem; }
.quick-search .filters { margin-bottom: 0.5rem; }
.quick-search .filters input { flex: 1 1 18rem; font-size: 1.05rem; padding: 0.7rem 0.8rem; }
.quick-search #quick-search-results:empty { display: none; }

/* Poză mare la click */
img.row-thumb, .photo-grid img, .photo-inline img, img[data-zoom] { cursor: zoom-in; }
.lightbox-open, .lightbox-open body { overflow: hidden; }
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(13, 36, 30, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 3.5rem;
    cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox__figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    max-width: 100%;
    max-height: 100%;
}
.lightbox__figure img {
    max-width: 100%;
    max-height: calc(100vh - 8rem);
    object-fit: contain;
    background: #0d241e;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}
.lightbox__figure figcaption { color: #f7f8f4; text-align: center; }
.lightbox button {
    position: absolute;
    border: 0;
    background: rgba(247, 248, 244, 0.12);
    color: #f7f8f4;
    font-size: 2rem;
    line-height: 1;
    width: 2.75rem;
    height: 2.75rem;
    cursor: pointer;
}
.lightbox button:hover, .lightbox button:focus-visible { background: var(--yellow); color: var(--ink); }
.lightbox button[hidden] { display: none; }
.lightbox__close { top: 0.75rem; right: 0.75rem; }
.lightbox__prev { left: 0.5rem; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 0.5rem; top: 50%; transform: translateY(-50%); }
.lightbox__count {
    position: absolute;
    top: 1rem;
    left: 1rem;
    color: #f7f8f4;
    font-family: var(--mono);
    font-size: 0.85rem;
}
.lightbox__count[hidden] { display: none; }
@media (max-width: 640px) {
    .lightbox { padding: 3.5rem 0.5rem; }
    .lightbox__nav { top: auto; bottom: 0.75rem; transform: none; }
}

/* Ordinea depozitelor */
.section-links { display: inline-flex; gap: 1rem; }
.order-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.5rem; }
.order-list li {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--label);
    border: 1px solid #d7d4c8;
}
.order-list li.is-dragging { opacity: 0.45; outline: 2px dashed var(--pine); }
.order-list .meta { margin: 0.15rem 0 0; }
.order-handle { cursor: grab; color: var(--metal); font-size: 1.2rem; user-select: none; }
.order-num { font-family: var(--mono); min-width: 2ch; }
.order-buttons { display: inline-flex; gap: 0.35rem; }
.order-buttons .btn { padding: 0.3rem 0.65rem; min-width: 2.5rem; }
.order-buttons .btn:disabled { opacity: 0.35; cursor: default; }
