/* EFFEDUEO Inventory — componenti specifici dell'inventario (colori dal tema). */

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.count { font: 600 .8rem/1 var(--font-sans); color: var(--muted); background: var(--surface-2); border-radius: 99px; padding: 3px 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head .card-title { margin: 0; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toolbar p { margin: 0; }
.narrow-lg { max-width: 760px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.desc { margin: 8px 0 0; }
.empty { text-align: center; display: grid; justify-items: center; gap: 6px; padding: 32px 22px; }
.empty-ico { width: 44px; height: 44px; color: var(--primary-hover); }
.empty p { max-width: 56ch; }

/* Percorso */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-size: .92rem; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumb-sep { width: 14px; height: 14px; color: var(--muted); }

/* Albero */
.tree-card { padding: 10px 12px; }
.tree { list-style: none; margin: 0; padding: 0; }
.tree li a {
    display: grid; grid-template-columns: 20px 1fr auto auto; gap: 10px; align-items: center;
    padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none;
}
.tree li a:hover { background: var(--surface-2); }
.tree .ico { color: var(--primary-hover); }
.tree .t-site a { font-weight: 700; }
.tree .t-room a { font-weight: 600; }
.tree .t-container .ico { color: #8a5a2b; }
.tree-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-type { font-size: .75rem; color: var(--muted); }
.tree-count { font: 600 .78rem/1 var(--font-sans); min-width: 2.2em; text-align: center; padding: 4px 6px; border-radius: 99px;
              background: var(--primary); color: var(--primary-ink); }
.tree-count.is-zero { background: transparent; color: var(--muted); }
.tree .lvl-1 { padding-left: 22px; } .tree .lvl-2 { padding-left: 44px; } .tree .lvl-3 { padding-left: 66px; }
.tree .lvl-4 { padding-left: 88px; } .tree .lvl-5 { padding-left: 110px; } .tree .lvl-6 { padding-left: 132px; }
.tree .lvl-7, .tree .lvl-8 { padding-left: 154px; }

/* Testata posto / oggetto */
.place-head, .item-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; border-top: 6px solid var(--primary); }
.place-head.t-container { border-top-color: #b07a3c; }
.place-id { display: flex; gap: 14px; align-items: flex-start; }
.place-ico { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--primary-hover); flex: none; }
.place-ico .ico { width: 26px; height: 26px; }
.eyebrow code { font-size: .85rem; letter-spacing: .08em; color: var(--text); background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }
.item-facts { flex: 1; min-width: 260px; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 8px 0; }
.facts div { display: grid; gap: 2px; }
.facts span { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.facts strong { font-size: 1.05rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.tag { font-size: .8rem; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); text-decoration: none; }

/* Contenuto di un posto */
.children { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.child { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
         background: var(--surface-2); color: var(--text); text-decoration: none; }
.child:hover { border-color: var(--border-strong); background: #efe0c2; }
.child .ico { color: var(--primary-hover); }
.child span { display: grid; min-width: 0; }
.child strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.child small { color: var(--muted); font-size: .8rem; }

/* Elenco oggetti */
.list-card { padding: 6px 10px; }
.items { list-style: none; margin: 0; padding: 0; }
.items li + li { border-top: 1px solid var(--border); }
.item-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 10px 6px; color: var(--text); text-decoration: none; border-radius: 8px; }
.item-row:hover { background: var(--surface-2); }
.thumb { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--border-strong); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-main { display: grid; min-width: 0; }
.item-main strong, .item-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-side { display: grid; justify-items: end; gap: 4px; }
.qty { font-size: .85rem; color: var(--muted); }
.st-in_uso { background: var(--info-soft); color: var(--info); }
.st-in_deposito { background: var(--surface-2); color: var(--muted); }
.st-da_valutare { background: var(--warning-soft); color: var(--warning); }
.st-in_campagna { background: #efe3f5; color: #6b3d82; }
.st-uscito { background: #ece9e4; color: #6f6a62; text-decoration: line-through; }

/* Filtri e paginazione */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; padding: 14px; }
.filters .field { min-width: 160px; }
.filters .grow { flex: 1 1 260px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; }

/* Panoramica */
.hero-search { display: flex; gap: 10px; margin: 14px 0 12px; }
.hero-search input { flex: 1; }
.hero .actions { margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-tile { display: grid; gap: 4px; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
             box-shadow: var(--shadow); color: var(--muted); text-decoration: none; font-size: .9rem; }
a.stat-tile:hover { border-color: var(--border-strong); }

/* Foto e allegati */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.shot { position: relative; margin: 0; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot-del { position: absolute; top: 6px; right: 6px; }
.icon-del { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
            background: rgba(255, 252, 245, .9); color: var(--danger); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.icon-del .ico { width: 16px; height: 16px; }
.video { margin-bottom: 14px; }
.video video { width: 100%; max-height: 420px; border-radius: 8px; background: #000; }
.file-list { list-style: none; margin: 0 0 14px; padding: 0; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; flex-wrap: wrap; }
.file-row a, .file-row > span { display: inline-flex; align-items: center; gap: 6px; }
.file-row form { margin-left: auto; }
.uploader { margin: 0; }
.drop { display: flex; align-items: center; gap: 12px; padding: 16px; border: 2px dashed var(--border-strong); border-radius: var(--radius);
        cursor: pointer; background: var(--surface-2); position: relative; }
.drop:hover, .drop.is-busy { border-color: var(--primary-hover); }
.drop > span { display: grid; }
.drop small { color: var(--muted); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .ico { width: 28px; height: 28px; color: var(--primary-hover); }

/* Storico */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 130px 1fr auto; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.timeline li:last-child { border-bottom: 0; }
.when { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Form tipi di posto */
.types { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.types legend { font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.type-opt input { position: absolute; opacity: 0; }
.type-opt span { display: grid; grid-template-columns: 22px 1fr; gap: 0 8px; padding: 10px 12px; border: 1px solid var(--border-strong);
                 border-radius: var(--radius-sm); cursor: pointer; background: #fff; height: 100%; }
.type-opt span .ico { grid-row: span 2; color: var(--primary-hover); }
.type-opt small { color: var(--muted); font-size: .75rem; line-height: 1.3; }
.type-opt input:checked + span { border-color: var(--primary-hover); background: #fbf0d9; box-shadow: inset 0 0 0 1px var(--primary-hover); }
.type-opt input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }

@media (max-width: 960px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .row-3, .types { grid-template-columns: 1fr 1fr; }
    .timeline li { grid-template-columns: 1fr; gap: 2px; }
    .hero-search { flex-direction: column; }
    .tree .lvl-1 { padding-left: 14px; } .tree .lvl-2 { padding-left: 28px; } .tree .lvl-3 { padding-left: 42px; }
    .tree .lvl-4 { padding-left: 56px; } .tree .lvl-5 { padding-left: 70px; } .tree .lvl-6, .tree .lvl-7, .tree .lvl-8 { padding-left: 84px; }
    .tree li a { grid-template-columns: 20px 1fr auto; }
    .tree-type { display: none; }
    .filters .field { min-width: 0; flex: 1 1 100%; }
}

/* ------------------------------------------------------------------ dettagli tecnici e vendita */
.row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.group { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; display: grid; gap: 12px; }
.group legend { font-weight: 600; font-size: .9rem; padding: 0 6px; }
.group legend small { font-weight: 400; color: var(--muted); }
.group-sale { background: #fdf6e8; border-color: var(--border-strong); }
.check { display: flex; align-items: center; gap: 10px; font-size: .95rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary-hover); flex: none; }
.filters .check { min-height: 44px; }
.badge .ico { width: 12px; height: 12px; display: inline; vertical-align: -2px; }
.badge-sale { background: #fbefd6; color: #8a5a10; }
.badge-inv { background: #e6f0e0; color: #3f6421; }
.pill { margin-left: auto; font-style: normal; font: 700 .72rem/1 var(--font-sans); background: var(--primary); color: var(--primary-ink);
        border-radius: 99px; padding: 3px 7px; }
.mode-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted);
             border: 1px solid var(--border); border-radius: 99px; padding: 4px 10px; background: var(--surface); }
.mode-pill .ico { width: 14px; height: 14px; }
.tech { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0 0; font-size: .92rem; }
.tech dt { color: var(--muted); }
.tech dd { margin: 0; }
.holds, .lines { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: .92rem; }
.lines li { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--border); }
.lines li:last-child { border-bottom: 0; }
.text-danger { color: var(--danger); }
.quote { margin: 10px 0 0; padding: 10px 14px; border-left: 4px solid var(--primary); background: var(--surface-2); border-radius: 0 8px 8px 0; }

/* stati delle righe di vendita */
.line-cart, .line-expired, .line-cancelled { background: #ece9e4; color: #6f6a62; }
.line-requested { background: var(--warning-soft); color: var(--warning); }
.line-accepted { background: var(--info-soft); color: var(--info); }
.line-rejected { background: var(--danger-soft); color: var(--danger); }
.line-delivered { background: var(--success-soft); color: var(--success); }

/* richiesta lato gestione */
.req-lines { list-style: none; margin: 0; padding: 0; }
.req-line { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--border); background: none; color: inherit; }
.req-line:last-child { border-bottom: 0; }
.req-main { display: grid; gap: 3px; min-width: 0; }
.where { font-size: .85rem; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.where .ico { width: 14px; height: 14px; }
.req-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 6px 4px; border-top: 2px solid var(--border); margin-top: 6px; }
.cart-total strong { font: 600 1.3rem/1 var(--font-serif); }

/* portafoglio */
.ledger { list-style: none; margin: 14px 0 0; padding: 0; font-size: .9rem; }
.ledger li { display: grid; grid-template-columns: 120px 1fr auto; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.ledger .pos { color: var(--success); }
.ledger .neg { color: var(--danger); }

/* scelta della modalità all'accesso */
.modes { display: grid; gap: 10px; }
.mode { width: 100%; display: flex; gap: 14px; align-items: center; text-align: left; padding: 16px; cursor: pointer;
        border: 1px solid var(--border-strong); border-radius: var(--radius); background: #fff; font: inherit; color: var(--text); }
.mode:hover { border-color: var(--primary-hover); background: #fdf6e8; }
.mode span { display: grid; gap: 2px; }
.mode small { color: var(--muted); font-size: .85rem; }
.mode-ico { width: 32px; height: 32px; color: var(--primary-hover); flex: none; }
.mode-shop .mode-ico { color: var(--brand); }

/* ------------------------------------------------------------------ vetrina (modalità acquisto) */
body.shop { min-height: 100vh; display: flex; flex-direction: column; }
.shop-mode { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 7px 16px; font-size: .85rem;
             background: var(--brand); color: #fff; text-align: center; }
.shop-mode .ico { width: 16px; height: 16px; flex: none; }
.shop-bar { display: flex; align-items: center; gap: 18px; padding: 12px 24px; flex-wrap: wrap; color: var(--side-text);
            background: repeating-linear-gradient(90deg, rgba(255, 236, 200, .018) 0 1px, transparent 1px 6px), linear-gradient(180deg, var(--side-bg), var(--side-bg-2)); }
.shop-brand { padding: 0; }
.shop-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.shop-nav a { color: var(--side-text); text-decoration: none; padding: 8px 12px; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; }
.shop-nav a .ico { width: 18px; height: 18px; }
.shop-nav a:hover, .shop-nav a.is-active { background: rgba(226, 164, 60, .18); }
.shop-me { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.shop-me .muted { color: var(--side-muted); }
.shop-me .btn-ghost { color: var(--side-text); border-color: rgba(243, 229, 201, .3); }
.shop-me .btn-ghost:hover { background: rgba(243, 229, 201, .1); }
.wallet { background: #e6f0e0; color: #3f6421; font-weight: 700; font-size: .85rem; border-radius: 99px; padding: 5px 12px; }
.shop-content { margin: 0 auto; max-width: 1180px; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.product { display: grid; grid-template-rows: auto 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
           overflow: hidden; color: var(--text); text-decoration: none; box-shadow: var(--shadow); }
.product:hover { border-color: var(--border-strong); }
.product-img { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; color: var(--border-strong); }
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.product-img .ico { width: 40px; height: 40px; }
.product-body { display: grid; gap: 4px; padding: 12px 14px 14px; align-content: start; }
.product-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 6px; }
.price { font: 700 1.1rem/1.1 var(--font-sans); color: var(--text); }
.price.big { font: 600 2rem/1.1 var(--font-serif); }
.price.is-tbd { font-size: .95rem; font-weight: 600; color: var(--muted); }
.product-page { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.buy-box { position: sticky; top: 16px; display: grid; gap: 8px; }
.cart-row { display: grid; grid-template-columns: 56px 1fr auto auto auto; gap: 12px; align-items: center; padding: 10px 6px; }
.qty-input { width: 80px !important; }
.sub { font-weight: 700; min-width: 90px; text-align: right; }

@media (max-width: 860px) {
    .row-2 { grid-template-columns: 1fr; }
    .product-page { grid-template-columns: 1fr; }
    .buy-box { position: static; }
    .cart-row { grid-template-columns: 56px 1fr; }
    .cart-row form, .cart-row .sub { grid-column: 2; }
    .shop-bar { padding: 10px 16px; }
    .shop-me { margin-left: 0; width: 100%; }
    .ledger li { grid-template-columns: 1fr auto; }
    .ledger .when { grid-column: 1 / -1; }
    .mode-pill { display: none; }
}

/* ------------------------------------------------------------------ lettore di codici */
.scan-btn { display: inline-flex; margin-left: 8px; }
.mode-pill + .scan-btn { margin-left: 8px; }
.topbar .scan-btn:only-of-type { margin-left: auto; }
.btn-big { min-height: 56px; font-size: 1.05rem; padding: 0 24px; }
.btn-scan { padding: 0 10px; flex: none; }
.input-scan { display: flex; gap: 6px; }
.input-scan input { flex: 1; min-width: 0; }
.ico-xs { width: 13px; height: 13px; display: inline; vertical-align: -2px; }
body.scan-open { overflow: hidden; }
.scan-overlay { position: fixed; inset: 0; z-index: 100; background: #120c06; color: #f3e5c9; display: flex; flex-direction: column;
                padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.scan-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; }
.scan-close { background: rgba(255, 255, 255, .12); color: #fff; border: 0; border-radius: 50%; width: 40px; height: 40px; font-size: 1.1rem; cursor: pointer; }
.scan-view { position: relative; flex: 1; overflow: hidden; display: grid; place-items: center; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; width: 80%; height: 60%; max-width: 520px; max-height: 340px; border: 3px solid var(--primary);
              border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45); }
.scan-hint { text-align: center; padding: 10px 16px 0; margin: 0; font-size: .9rem; color: #d9c6a3; }
.scan-manual { display: flex; gap: 8px; padding: 12px 16px 18px; }
.scan-manual input { flex: 1; }
.scan-page { text-align: center; display: grid; justify-items: center; gap: 10px; padding: 32px 22px; }
.scan-type { justify-content: center; }

/* ------------------------------------------------------------------ libreria */
.row-name { display: flex; gap: 14px; align-items: end; }
.row-name .field:first-child { width: 150px; flex: none; }
.row-name .grow { flex: 1; }
.group-book { background: #f3f0e6; }
.check-card { border-top: 6px solid var(--brand); }
.check-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.check-actions form { flex: 1; min-width: 240px; }
.check-actions form input { flex: 1; }
.verdict { border-top: 6px solid; }
.verdict-yes { border-top-color: var(--success); }
.verdict-no { border-top-color: var(--primary); }
.verdict-title { display: flex; align-items: center; gap: 10px; font: 600 1.4rem/1.2 var(--font-serif); margin: 0 0 10px; }
.verdict-yes .verdict-title .ico { color: var(--success); width: 28px; height: 28px; }
.verdict-no .verdict-title .ico { color: var(--primary-hover); width: 28px; height: 28px; }
.book-meta { display: grid; gap: 2px; padding: 12px 14px; margin: 10px 0 14px; background: var(--surface-2); border-radius: 8px; }
.book-thumb img { object-fit: cover; }
.book-facts { margin-bottom: 6px; }

/* ------------------------------------------------------------------ portafoglio: tipi */
.wallet-sum { list-style: none; margin: 0 0 12px; padding: 0; font-size: .88rem; display: grid; gap: 2px; color: var(--muted); }
.wallet-op { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.wallet-op summary { cursor: pointer; }
.wallet-op form { margin-top: 10px; }
.wk-purchase_eur { background: var(--info-soft); color: var(--info); }
.wk-contribution { background: var(--success-soft); color: var(--success); }
.wk-shop { background: var(--warning-soft); color: var(--warning); }
.wk-fee { background: #efe3f5; color: #6b3d82; }

@media (max-width: 860px) {
    .row-name { flex-direction: column; align-items: stretch; }
    .row-name .field:first-child { width: auto; }
    .topbar .scan-btn { margin-left: auto; }
    .btn-big { width: 100%; }
}
