/* Area Aste (riservata ai DEVELOPER): tutte le regole sono limitate a body.auction-area. */

.auction-area {
  --auction-green: #2f7d4a;
  --auction-green-soft: #e3f2e6;
  --auction-blue: #2c5d8f;
  --auction-blue-soft: #e4eef8;
  --auction-red: #922f20;
  --auction-red-soft: #fff1ed;
  --auction-surface: #fffdf7;
}

.auction-area > .container { width: min(1760px, calc(100vw - 2.5rem)); margin: 1.75rem auto 2.5rem; }
.auction-area .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.auction-area .warehouse-list { padding-inline: 1.5rem; }

/* Intestazione */
.auction-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(1rem, 2vw, 1.6rem) clamp(1rem, 2.5vw, 2rem);
  border-radius: 22px;
  background: radial-gradient(circle at 92% -20%, rgba(244,196,48,.35), transparent 42%), linear-gradient(135deg, #1b1a17, #2a281f 60%, #3a3420);
  color: #fff;
  box-shadow: 0 22px 60px rgba(17,17,15,.22);
}
.auction-hero__top { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; }
.auction-hero__eyebrow { display: inline-flex; align-items: center; gap: .45rem; margin: 0; color: var(--yellow); font-size: .78rem; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.auction-hero__eyebrow .icon { width: 1.05rem; height: 1.05rem; }
.auction-hero h1 { margin: .3rem 0 0; font-size: clamp(1.8rem, 3.2vw, 2.6rem); line-height: 1.05; }
.auction-hero__actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.auction-hero__actions .ui-button--secondary { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.28); color: #fff; }
.auction-hero__actions .ui-button--secondary:hover { background: rgba(255,255,255,.16); border-color: var(--yellow); }

.auction-kpis { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: .75rem; margin-top: 1.1rem; }
.auction-kpi { display: grid; gap: .3rem; align-content: start; padding: .8rem 1rem; border: 1px solid rgba(255,255,255,.12); border-radius: 16px; background: rgba(255,255,255,.06); backdrop-filter: blur(4px); }
.auction-kpi > span { color: #cfc8b3; font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.auction-kpi > strong { font-size: clamp(1.4rem, 2.2vw, 1.95rem); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.auction-kpi > strong small { color: #cfc8b3; font-size: .95rem; font-weight: 600; }
.auction-kpi > small { color: #a9a28d; font-size: .78rem; }
.auction-kpi--club { background: var(--yellow); border-color: var(--yellow); color: var(--black); }
.auction-kpi--club > span, .auction-kpi--club > small { color: #5c4a00; }
.auction-progress { height: 9px; margin: .25rem 0 .1rem; border-radius: 99px; background: rgba(255,255,255,.14); overflow: hidden; }
.auction-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #7fc98f, #b6e3a6); }

/* Passi iniziali */
.auction-onboarding { margin-top: 1.5rem; padding: clamp(1.25rem, 3vw, 2.25rem); border: 2px dashed #d8cda8; border-radius: 22px; background: var(--auction-surface); }
.auction-onboarding h2 { margin: 0 0 1.25rem; }
.auction-onboarding ol { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.auction-onboarding li { display: grid; gap: .5rem; justify-items: start; padding: 1.25rem; border: 1px solid var(--line); border-radius: 16px; background: #fff; counter-increment: step; }
.auction-onboarding li::before { content: counter(step); display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--yellow); font-weight: 900; }
.auction-onboarding li span { color: var(--muted); }

/* Pannello lotti */
.auction-board { margin-top: 1.25rem; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: 0 18px 55px rgba(23,33,27,.08); overflow: clip; }
.auction-toolbar { display: flex; align-items: center; gap: .85rem 1.25rem; flex-wrap: wrap; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--auction-surface); }
.auction-segments { display: inline-flex; padding: .25rem; border-radius: 12px; background: #efe9d8; }
.auction-segment { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem .9rem; border-radius: 9px; color: var(--ink); font-size: .88rem; font-weight: 750; text-decoration: none; white-space: nowrap; }
.auction-segment b { min-width: 1.6rem; padding: .1rem .4rem; border-radius: 99px; background: rgba(0,0,0,.07); font-size: .75rem; text-align: center; }
.auction-segment:hover { background: rgba(255,255,255,.6); }
.auction-segment[aria-current=page] { background: var(--black); color: #fff; }
.auction-segment[aria-current=page] b { background: var(--yellow); color: var(--black); }

.auction-filters { display: flex; flex: 1; align-items: center; gap: .6rem; flex-wrap: wrap; min-width: 0; }
.auction-filter { position: relative; flex: 1 1 170px; min-width: 0; }
.auction-filter--search .icon { position: absolute; left: .8rem; top: 50%; width: 1rem; height: 1rem; transform: translateY(-50%); color: var(--muted); }
.auction-filter input, .auction-filter select { padding: .6rem .8rem; border-radius: 10px; font-size: .9rem; }
.auction-filter--search input { padding-left: 2.25rem; }
.auction-filters input[type=submit] { padding: .62rem 1.1rem; }
.auction-filters .ui-button { min-height: 40px; padding-block: .55rem; }

.auction-table { min-width: 1180px; font-size: .9rem; }
.auction-table th, .auction-table td { padding: .7rem .75rem; vertical-align: middle; }
.auction-table thead th { position: sticky; top: 0; z-index: 2; background: #faf7ee; box-shadow: inset 0 -1px 0 var(--line); white-space: nowrap; }
.auction-table tfoot th { position: sticky; bottom: 0; z-index: 2; padding-block: .9rem; background: var(--black); color: #fff; font-size: .82rem; letter-spacing: .02em; text-transform: none; font-variant-numeric: tabular-nums; }
.auction-table tfoot th:first-child { color: #cfc8b3; }
.auction-table tfoot th:nth-child(3) { color: var(--yellow); }
.auction-table tbody tr { transition: background .12s ease; }
.auction-table tbody tr:nth-child(even) { background: #fcfbf7; }
.auction-table tbody tr:hover { background: var(--yellow-soft); }
.auction-table tbody tr.is-sold td:first-child { box-shadow: inset 4px 0 0 var(--auction-green); }

.auction-position { width: 3.5rem; color: var(--muted); font-weight: 800; font-variant-numeric: tabular-nums; }
.auction-lot-name { min-width: 260px; }
.auction-lot-name strong { display: block; line-height: 1.3; }
.auction-lot-name span { display: flex; gap: .45rem; margin-top: .2rem; font-size: .75rem; color: var(--muted); }
.auction-lot-name b { font-weight: 700; font-variant-numeric: tabular-nums; }
.auction-lot-name em { padding: 0 .45rem; border-radius: 99px; background: #efe9d8; font-style: normal; font-weight: 700; }
.auction-money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.auction-money--strong { font-weight: 800; }
.auction-money--club { font-weight: 800; color: #7a5d00; }
tr.is-open .auction-money--strong, tr.is-open .auction-money--club { color: #b9b3a3; font-weight: 400; }

.auction-rule { display: inline-block; padding: .25rem .6rem; border-radius: 99px; font-size: .75rem; font-weight: 800; white-space: nowrap; }
.auction-rule--dado_giallo { background: var(--yellow-soft); color: #6b5300; }
.auction-rule--cascadia { background: var(--auction-blue-soft); color: var(--auction-blue); }
.auction-rule--full_club { background: #2a281f; color: var(--yellow); }
.auction-status { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 800; white-space: nowrap; color: var(--muted); }
.auction-status::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: #c9c3b2; }
tr.is-sold .auction-status { color: var(--auction-green); }
tr.is-sold .auction-status::before { background: var(--auction-green); box-shadow: 0 0 0 3px var(--auction-green-soft); }

.auction-row-actions { width: 1%; white-space: nowrap; text-align: right; }
.auction-row-actions form.button_to { display: inline-block; margin-left: .3rem; }
.auction-row-actions .ui-button { min-height: 34px; padding: .45rem .55rem; }
.auction-danger { border-color: #e1b2aa; background: var(--auction-red-soft); color: var(--auction-red); cursor: pointer; font: inherit; }

.auction-empty { padding: 3.5rem 1rem; text-align: center; }
.auction-empty strong, .auction-empty span { display: block; margin-bottom: .35rem; }
.auction-empty span { color: var(--muted); margin-bottom: 1rem; }
.auction-empty .ui-button { margin-top: .75rem; }

[data-cascadia-percentage][hidden] { display: none; }

@media (max-width: 1100px) {
  .auction-kpis { grid-template-columns: repeat(2, 1fr); }
  .auction-kpi--progress { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .auction-area > .container { width: calc(100vw - 1.5rem); margin-top: 1rem; }
  .auction-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .auction-kpi { padding: .7rem .8rem; }
  .auction-kpi > small { display: none; }
  .auction-kpi--progress > small { display: block; }
  .auction-segments { width: 100%; overflow-x: auto; }
  .auction-filter { flex-basis: 100%; }
}

/* Importazione lotti da testo */
.auction-hero--compact .auction-hero__top { align-items: center; }
.lot-import { display: grid; grid-template-columns: minmax(360px, 5fr) 7fr; gap: 1.25rem; margin-top: 1.25rem; align-items: start; }
.lot-import__form, .lot-import__preview { border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: 0 18px 55px rgba(23,33,27,.08); }
.lot-import__form { display: grid; gap: 1.1rem; padding: 1.5rem; }
.lot-import__form label { display: block; margin-bottom: .35rem; font-weight: 800; font-size: .88rem; }
.lot-import__form .muted { margin: .4rem 0 0; font-size: .85rem; }
.lot-import__form .actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.lot-import__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.lot-import__text { width: 100%; min-height: 22rem; padding: .9rem 1rem; border: 1px solid #bbb8b0; border-radius: 12px; background: var(--auction-surface); font: .92rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
.lot-import__text:focus { outline: 3px solid rgba(244,196,48,.35); border-color: var(--yellow-dark); }
.lot-import__preview { overflow: hidden; }
.lot-import__summary { display: grid; gap: .2rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--auction-surface); }
.lot-import__summary strong { font-size: 1.25rem; }
.lot-import__summary span { color: var(--muted); font-size: .88rem; }
.lot-import__table { min-width: 0; }
.lot-import__table tr.is-error { background: var(--auction-red-soft); color: var(--auction-red); }
.lot-import__table tr.is-error td:first-child { box-shadow: inset 4px 0 0 var(--auction-red); }
.lot-import__table tr.is-ok td:last-child { color: var(--auction-green); font-weight: 800; }
.lot-import__auto { margin-left: .35rem; padding: .05rem .4rem; border-radius: 99px; background: #efe9d8; color: var(--muted); font-size: .68rem; font-weight: 800; }
.lot-import__guide { padding: 1.5rem; }
.lot-import__guide h2 { margin-top: 0; }
.lot-import__guide dl { display: grid; grid-template-columns: max-content 1fr; gap: .6rem 1rem; margin: 0 0 1rem; }
.lot-import__guide dt code { padding: .2rem .5rem; border-radius: 7px; background: var(--yellow-soft); }
.lot-import__guide dd { margin: 0; color: var(--muted); }
@media (max-width: 1000px) { .lot-import { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .lot-import__fields, .lot-import__guide dl { grid-template-columns: 1fr; } }
.auction-onboarding__actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Importazione venditori */
.seller-import { display: block; }
.seller-import__toolbar { justify-content: space-between; }
.seller-import__check { display: inline-flex; align-items: center; gap: .5rem; font-size: .9rem; font-weight: 750; cursor: pointer; }
.seller-import__check input, .seller-import__table input[type=checkbox] { width: 1.15rem; height: 1.15rem; padding: 0; accent-color: var(--black); cursor: pointer; }
.seller-import__counter { margin-left: auto; color: var(--muted); font-size: .88rem; font-weight: 750; }
.seller-import__table { min-width: 860px; }
.seller-import__table td:first-child { width: 2.5rem; text-align: center; }
.seller-import__table label { cursor: pointer; }
.seller-import__table tr.is-present { color: var(--muted); background: #f4f1e8; }
.seller-import__table tr.is-present .auction-status::before { background: #c9c3b2; }
.seller-import__table tr.is-available .auction-status { color: var(--auction-green); }
.seller-import__table tr.is-available .auction-status::before { background: var(--auction-green); }
.seller-import__table tr.is-available:has(input:checked) { background: var(--yellow-soft); }
.seller-import__date { color: var(--muted); }
@media (max-width: 700px) { .seller-import__counter { margin-left: 0; } }
.lot-import__tag { grid-column: 1 / -1; }
.lot-import__code { white-space: nowrap; font-weight: 800; font-variant-numeric: tabular-nums; }
.lot-import__form .lot-import__option { display: flex; align-items: center; gap: .5rem; margin: .6rem 0 0; font-weight: 700; cursor: pointer; }
.lot-import__form .lot-import__option input { width: 1.1rem; height: 1.1rem; padding: 0; accent-color: var(--black); }

/* Intestazione richiudibile della pagina lotti */
.auction-hero__summary { display: none; flex-wrap: wrap; gap: .3rem 1.1rem; margin: 0; color: #cfc8b3; font-size: .88rem; font-variant-numeric: tabular-nums; }
.auction-hero__summary b { color: #fff; }
.auction-hero__summary-club b { color: var(--yellow); }
.auction-hero__toggle { min-width: 42px; padding-inline: .7rem; }
.auction-hero__toggle .icon { transition: transform .2s ease; }
.auction-hero.is-collapsed { padding-block: .7rem; border-radius: 16px; }
.auction-hero.is-collapsed .auction-hero__top { align-items: center; }
.auction-hero.is-collapsed .auction-hero__title { display: flex; align-items: baseline; flex-wrap: wrap; gap: .25rem 1.25rem; }
.auction-hero.is-collapsed .auction-hero__eyebrow { display: none; }
.auction-hero.is-collapsed h1 { margin: 0; font-size: 1.35rem; }
.auction-hero.is-collapsed .auction-hero__summary { display: flex; }
.auction-hero.is-collapsed .auction-kpis { display: none; }
.auction-hero.is-collapsed .auction-hero__toggle .icon { transform: rotate(180deg); }
.auction-hero.is-collapsed .auction-hero__actions .ui-button { min-height: 36px; padding-block: .45rem; }
.auction-hero.is-collapsed .auction-hero__top { flex-wrap: nowrap; }
.auction-hero.is-collapsed .auction-hero__title { min-width: 0; }
.auction-hero.is-collapsed .auction-hero__actions { flex-wrap: nowrap; flex-shrink: 0; }
.auction-hero.is-collapsed .auction-hero__actions .ui-button--secondary span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.auction-hero.is-collapsed .auction-hero__actions .ui-button--secondary { padding-inline: .7rem; }
@media (max-width: 900px) { .auction-hero.is-collapsed .auction-hero__top { flex-wrap: wrap; } }

/* Lista lotti adattiva, senza scorrimento orizzontale. */
.auction-lots-table { width: 100%; min-width: 0; table-layout: fixed; }
.auction-lots-table th, .auction-lots-table td { padding: .65rem .4rem; overflow-wrap: anywhere; white-space: normal; }
.auction-lots-table thead th { white-space: normal; }
.auction-lots-table th:first-child { width: 4%; }
.auction-lots-table th:nth-child(2) { width: 19%; }
.auction-lots-table th:nth-child(6) { width: 13%; }
.auction-lots-table th:last-child { width: 44px; }
.auction-lots-table .auction-lot-name { min-width: 0; }
.auction-lots-table .auction-lot-name span { flex-wrap: wrap; }
.auction-lots-table .auction-rule, .auction-lots-table .auction-status { white-space: normal; }
.auction-lots-table .auction-status::before { flex-shrink: 0; }
.auction-lots-table .auction-sale-buyer, .auction-lots-table .auction-sale-price { width: 100%; min-width: 0; padding: .45rem .35rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; }
.auction-sale-price { text-align: right; }
.auction-sale-form { margin: 0; }
.auction-lot-actions { display: flex; justify-content: flex-end; }
.auction-lot-actions > .ui-button { width: 34px; min-height: 34px; padding: .4rem; cursor: pointer; }
.auction-lot-actions__buttons { position: fixed; inset: auto; width: 220px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; margin: 0; padding: .4rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); box-shadow: 0 12px 36px rgba(0,0,0,.2); }
.auction-lot-actions__buttons:popover-open { display: grid; gap: .2rem; }
.auction-lot-actions__buttons .ui-button { display: flex; justify-content: flex-start; gap: .65rem; width: 100%; min-height: 42px; padding: .6rem .75rem; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; }
.auction-lot-actions__buttons .ui-button:hover, .auction-lot-actions__buttons .ui-button:focus-visible { background: var(--yellow-soft); }
.auction-lot-actions__buttons .auction-sale-form .ui-button { background: var(--yellow-soft); font-weight: 750; }
.auction-lot-actions__buttons .auction-danger { color: var(--auction-red); }
.auction-lot-actions__buttons .auction-danger:hover, .auction-lot-actions__buttons .auction-danger:focus-visible { background: var(--auction-red-soft); }
.auction-lot-actions__buttons .icon { flex-shrink: 0; }
.auction-lot-actions__buttons form.button_to { display: block; margin: 0; }

@media (max-width: 1100px) {
  .auction-lots-table, .auction-lots-table tbody { display: block; }
  .auction-lots-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .auction-lots-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 1rem; padding: 1rem; border-bottom: 1px solid var(--line); }
  .auction-lots-table tbody td { display: block; width: auto; min-width: 0; padding: 0; text-align: left; }
  .auction-lots-table tbody td::before { content: attr(data-label); display: block; margin-bottom: .2rem; color: var(--muted); font-size: .72rem; font-weight: 700; }
  .auction-lots-table tbody .auction-lot-name { grid-column: 1 / -1; grid-row: 1; }
  .auction-lots-table tbody .auction-lot-name strong { font-size: 1.05rem; }
  .auction-lots-table tbody tr.is-sold { box-shadow: inset 4px 0 0 var(--auction-green); }
  .auction-lots-table tbody tr.is-sold td:first-child { box-shadow: none; }
  .auction-lots-table .auction-sale-price { text-align: left; }
  .auction-lots-table .auction-row-actions { grid-column: 1 / -1; }
  .auction-lots-table .auction-row-actions::before { display: none; }
  .auction-lot-actions { justify-content: flex-start; }
  .auction-lots-table .auction-empty { grid-column: 1 / -1; }
  .auction-lots-table tfoot { display: block; background: var(--black); }
  .auction-lots-table tfoot tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: .75rem; }
  .auction-lots-table tfoot th { position: static; width: auto; text-align: left; }
  .auction-lots-table tfoot th:first-child { grid-column: 1 / -1; }
  .auction-lots-table tfoot th:nth-child(2)::before { content: "Incasso"; }
  .auction-lots-table tfoot th:nth-child(3)::before { content: "Quota Club"; }
  .auction-lots-table tfoot th:nth-child(4)::before { content: "Al venditore"; }
  .auction-lots-table tfoot th::before { display: block; margin-bottom: .25rem; font-size: .7rem; }
  .auction-lots-table tfoot th:last-child { display: none; }
}
