:root {
    --ink: #1b2420;
    --paper: #f3ece1;
    --paper-2: #fffaf3;
    --rail: #17211d;
    --accent: #c45c26;
    --accent-2: #2f6f4e;
    --line: #d8cbb8;
    --muted: #6b645b;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: Outfit, sans-serif;
    background: var(--paper);
    color: var(--ink);
}

.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.rail {
    background: var(--rail);
    color: #f4efe6;
    padding: 1.4rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.brand { display: flex; gap: .8rem; align-items: center; color: inherit; text-decoration: none; }
.brand-mark {
    font-family: Fraunces, serif;
    background: var(--accent);
    width: 2.4rem; height: 2.4rem;
    display: grid; place-items: center;
    border-radius: .5rem;
    font-weight: 700;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { color: #c9c0b4; font-size: .75rem; }
.nav { display: flex; flex-direction: column; gap: .2rem; }
.nav a {
    color: #efe7db;
    text-decoration: none;
    padding: .55rem .7rem;
    border-radius: .45rem;
}
.nav a.is-active, .nav a:hover { background: rgba(255,255,255,.08); }
.nav-label {
    margin-top: 1rem;
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #9c9488;
    padding: 0 .7rem;
}
.stage { padding: 2rem; max-width: 1100px; }
h1, h2, .display { font-family: Fraunces, serif; font-weight: 700; margin: 0 0 .4rem; }
.lede { color: var(--muted); margin: 0 0 1.4rem; }
.toolbar { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-end; margin-bottom: 1.2rem; flex-wrap: wrap; }
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent); color: white; text-decoration: none;
    border: 0; border-radius: .5rem; padding: .65rem 1rem; font: inherit; cursor: pointer;
}
.btn.secondary { background: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: #8b2e2e; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.card, .panel {
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: .9rem;
    padding: 1rem 1.1rem;
}
.card strong { font-family: Fraunces, serif; font-size: 1.8rem; display: block; }
.table { width: 100%; border-collapse: collapse; background: var(--paper-2); border-radius: .9rem; overflow: hidden; }
.table th, .table td { text-align: left; padding: .75rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.badge { display: inline-block; border-radius: 999px; padding: .15rem .55rem; font-size: .78rem; font-weight: 500; }
.badge.sale    { background: #dceee3; color: #21553a; }
.badge.sold    { background: #e8e8ee; color: #44445a; }
.badge.retired { background: #fde8c8; color: #7a4100; }
.badge.returned{ background: #d6eaf8; color: #154068; }
.badge.nonconf { background: #f5d5d5; color: #7a1010; }
/* paginazione */
.pagination { display: flex; gap: .4rem; align-items: center; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; height: 2rem; padding: 0 .5rem; border-radius: .45rem; font-size: .85rem; text-decoration: none; border: 1px solid var(--line); color: var(--ink); }
.pagination a:hover { background: var(--paper-2); }
.pagination .current { background: var(--accent, #2a5af5); color: #fff; border-color: transparent; font-weight: 600; }
.pagination .dots { border: none; color: var(--muted); }
.pagination-info { text-align: center; font-size: .82rem; color: var(--muted); margin-bottom: .5rem; }
.form { display: grid; gap: 1rem; max-width: 680px; }
.form div { display: grid; gap: .35rem; }
.form label { font-weight: 600; }
.form input, .form select, .form textarea {
    font: inherit; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: .5rem; background: white;
}
.form textarea { min-height: 90px; }
.help-text { font-size: .85rem; color: var(--muted); }
.filters { display: grid; grid-template-columns: 2fr repeat(4, 1fr) auto; gap: .6rem; margin-bottom: 1rem; }
.filters input, .filters select { width: 100%; font: inherit; padding: .55rem .6rem; border: 1px solid var(--line); border-radius: .5rem; }
.flash { padding: .8rem 1rem; border-radius: .6rem; margin-bottom: 1rem; }
.flash-success { background: #dceee3; }
.flash-error { background: #f3d9d4; }
.muted { color: var(--muted); }
.photos { display: flex; gap: .6rem; flex-wrap: wrap; }
.photos img { width: 120px; height: 120px; object-fit: cover; border-radius: .5rem; border: 1px solid var(--line); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .8rem; margin: 1rem 0; }
.code { font-family: ui-monospace, monospace; background: #efe6d8; padding: .2rem .45rem; border-radius: .3rem; }
.scan-frame { width: 100%; max-width: 420px; min-height: 280px; background: #111; border-radius: .8rem; overflow: hidden; }
.scan-result { margin-top: 1rem; }
@media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .rail { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .filters { grid-template-columns: 1fr 1fr; }
    .stage { padding: 1rem; }
}
