/* Demo Auction — styles (release 5.5)
   Palette: harbor blue (trust), brass (live bidding), paper (calm background) */
:root {
  --paper: #F7F8F6;
  --surface: #FFFFFF;
  --ink: #1C2330;
  --muted: #5B6575;
  --line: #DCE1E6;
  --harbor: #0E4D64;
  --harbor-dark: #0A3A4C;
  --harbor-soft: #E3EEF2;
  --brass: #B8862B;
  --brass-soft: #F6EBD3;
  --danger: #B3261E;
  --danger-soft: #FBE7E5;
  --ok: #2E7D4F;
  --ok-soft: #E2F2E8;
  --radius-sm: 6px;
  --radius: 10px;
  --tap: 48px;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.boot { padding: 2rem; color: var(--muted); }

/* ---------- Layout ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1rem; background: var(--harbor); color: #fff;
}
.brand { font-weight: 800; font-stretch: 115%; font-size: 1.15rem; letter-spacing: .01em; margin-right: auto; }
.topbar .who { font-size: .9rem; opacity: .9; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbtn {
  min-height: 40px; padding: 0 .8rem; border: 1px solid rgba(255,255,255,.45); border-radius: var(--radius);
  background: transparent; color: #fff; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.topbtn:hover { background: rgba(255,255,255,.12); }
@media (max-width: 420px) { .topbar .who { display: none; } }
.bell {
  position: relative; min-width: var(--tap); height: var(--tap); border: 0; border-radius: var(--radius);
  background: rgba(255,255,255,.12); color: #fff; cursor: pointer; font-size: 1.2rem;
}
.bell .count {
  position: absolute; top: 4px; right: 4px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: var(--brass); color: #fff; font-size: .75rem; font-weight: 700; line-height: 20px;
}
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 1rem 1rem 6.5rem; }

/* Main tabs: bottom bar on phones, top row on larger screens */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar button {
  flex: 1; min-height: 60px; border: 0; background: none; cursor: pointer;
  font-weight: 700; font-size: .74rem; line-height: 1.15; letter-spacing: .02em; color: var(--muted);
  border-top: 3px solid transparent; padding: .3rem .2rem;
}
.tabbar button[aria-current="page"] { color: var(--harbor); border-top-color: var(--harbor); background: var(--harbor-soft); }
@media (min-width: 820px) {
  .tabbar { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 68px); bottom: auto; border-top: 0; border-bottom: 1px solid var(--line); padding: 0 1rem; justify-content: center; }
  .tabbar button { flex: 0 0 auto; padding: 0 1.5rem; min-height: 52px; font-size: .9rem; border-top: 0; border-bottom: 3px solid transparent; }
  .tabbar button[aria-current="page"] { border-bottom-color: var(--harbor); }
  main { padding-bottom: 2rem; }
}

/* Sub-tabs inside a tab */
.subtabs { display: flex; gap: .5rem; overflow-x: auto; margin: 0 0 1rem; padding-bottom: .25rem; }
.subtabs button {
  flex: 0 0 auto; min-height: 44px; padding: 0 1rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap;
}
.subtabs button[aria-current="true"] { background: var(--harbor); border-color: var(--harbor); color: #fff; }
.subtabs .badge { margin-left: .35rem; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .75rem; }
h1 { font-size: 1.5rem; font-stretch: 110%; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .75rem; max-width: 70ch; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 1rem; max-width: 560px; }
.form.wide { max-width: none; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field { display: grid; gap: .35rem; }
.field label { font-weight: 600; font-size: .9rem; }
.field .hint { font-size: .8rem; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; min-height: var(--tap); padding: .6rem .75rem;
  border: 1px solid #B9C2CB; border-radius: var(--radius-sm); background: #fff;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--harbor); outline: 2px solid var(--harbor-soft); }
.full { grid-column: 1 / -1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tap); padding: 0 1.25rem; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; font-weight: 700; text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--harbor); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--harbor-dark); }
.btn-secondary { background: #fff; color: var(--harbor); border-color: var(--harbor); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--harbor); border-color: var(--line); }
.btn-small { min-height: 40px; padding: 0 .85rem; font-size: .875rem; }
.btn-block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .5rem; }   /* generous gap: phone safety */

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--harbor-soft); color: var(--harbor); white-space: nowrap; }
.badge.warn { background: var(--brass-soft); color: #7A5512; }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.good { background: var(--ok-soft); color: var(--ok); }

/* ---------- Auth & gate screens ---------- */
.auth { min-height: 100vh; display: flex; justify-content: center; align-items: flex-start; padding: 2rem 1rem 3rem; }
.auth-card { width: 100%; max-width: 480px; min-width: 0; }
.auth-head { margin-bottom: 1.5rem; }
.auth-head .mark { font-size: 2.2rem; font-weight: 800; font-stretch: 125%; color: var(--harbor); line-height: 1; margin-bottom: .4rem; }
.notice { padding: 1rem; border-radius: var(--radius); background: var(--harbor-soft); margin-bottom: 1rem; }
.notice.warn { background: var(--brass-soft); }
.notice.bad { background: var(--danger-soft); }

/* ---------- Auction list ---------- */
.filters { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; margin-bottom: 1rem; }
.viewtoggle { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.viewtoggle button { flex: 1; min-height: var(--tap); border: 0; background: #fff; cursor: pointer; font-weight: 600; }
.viewtoggle button[aria-pressed="true"] { background: var(--harbor); color: #fff; }

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.lot {
  display: flex; flex-direction: column; text-align: left; padding: 0; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.lot:hover { border-color: var(--harbor); }
.lot .photo { aspect-ratio: 4 / 3; background: var(--harbor-soft); display: grid; place-items: center; color: var(--harbor); font-weight: 700; }
.lot .photo img { width: 100%; height: 100%; object-fit: cover; }
.lot .body { padding: .85rem 1rem 1rem; display: grid; gap: .3rem; }
.lot .code { font-size: .8rem; color: var(--muted); }
.lot .title { font-weight: 700; font-size: 1.05rem; line-height: 1.25; }
.lot .seller { font-size: .85rem; color: var(--muted); }

/* The signature element: price + clock */
.price { font-variant-numeric: tabular-nums; font-weight: 800; font-stretch: 112%; font-size: 1.45rem; color: var(--ink); line-height: 1.1; }
.price-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.clock { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--harbor); }
.clock.soon { color: var(--brass); }
.clock.over { color: var(--muted); }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .7rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #EEF2F4; white-space: nowrap; }
th button { all: unset; cursor: pointer; font-weight: 700; display: inline-flex; gap: .3rem; align-items: center; }
th button:focus-visible { outline: 3px solid var(--brass); }
th .arrow { color: var(--harbor); font-size: .8rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--harbor-soft); }
.changes { max-width: 420px; font-size: .8rem; color: var(--muted); word-break: break-word; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(28,35,48,.55); display: grid; place-items: end center; }
.modal {
  width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 700px) { .modal-back { place-items: center; } .modal { border-radius: var(--radius); } }
.modal-head { display: flex; align-items: start; gap: 1rem; margin-bottom: 1rem; }
.modal-head h2 { margin: 0; flex: 1; }
.close { min-width: var(--tap); min-height: var(--tap); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer; font-size: 1.2rem; }
.doc-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin: .75rem 0; }
.doc { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .5rem; display: grid; gap: .4rem; }
.doc img { border-radius: 4px; max-height: 240px; object-fit: contain; background: #EEF2F4; }

.notif { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.notif.unread .t { font-weight: 700; }
.notif .when { font-size: .78rem; color: var(--muted); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  z-index: 60; max-width: calc(100% - 2rem); padding: .8rem 1.1rem; border-radius: var(--radius);
  background: var(--ink); color: #fff; font-weight: 600; display: none;
}
#toast.show { display: block; }
#toast.bad { background: var(--danger); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Item page & bidding ---------- */
.back { margin-bottom: 1rem; }
.item-page { display: grid; gap: 1.5rem; }
@media (min-width: 900px) { .item-page { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; } }
.gallery .main { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #EEF2F4; border-radius: var(--radius); }
.gallery .noimg { display: grid; place-items: center; color: var(--harbor); font-weight: 700; }
.thumbs { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.thumbs button { padding: 0; border: 2px solid transparent; border-radius: var(--radius-sm); cursor: pointer; background: none; }
.thumbs button[aria-current="true"] { border-color: var(--harbor); }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; }
.thumbs.edit .thumb { display: grid; gap: .3rem; justify-items: center; }
.thumbs.edit img { width: 96px; height: 96px; }

.bidbox { background: var(--surface); border: 2px solid var(--harbor); border-radius: var(--radius); padding: 1.25rem; margin: 1rem 0 1.5rem; display: grid; gap: 1rem; }
.bigclock { display: grid; gap: .1rem; }
.bigclock .clock { font-size: 1.6rem; font-weight: 800; font-stretch: 105%; line-height: 1.2; }
@media (max-width: 420px) { .bigclock .clock { font-size: 1.3rem; } }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem 1rem; margin: 0; }
.facts dt { font-size: .78rem; color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; font-weight: 600; }
.notice.good-n { background: var(--ok-soft); }
.notice.place { font-size: 1.05rem; }
.bidbox .notice { margin-bottom: 0; }

/* Big, well-separated buttons for phones */
.bid-actions { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.btn-big { min-height: 60px; min-width: 150px; font-size: 1.15rem; flex: 1; }
.btn-quick {
  min-height: 60px; min-width: 150px; flex: 1; font-size: 1.15rem; font-variant-numeric: tabular-nums;
  background: var(--brass); color: #fff; border: 0;
}
.btn-quick:hover:not(:disabled) { background: #9C7123; }
.btn-quick .chev { font-size: 1.6rem; line-height: 1; }
.bidform { display: grid; gap: 1rem; }
.bidform input[name="amount"] { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; min-height: 56px; }
.cancel-bid { justify-self: start; margin-top: .25rem; }

.desc { white-space: pre-line; }
.history { list-style: none; padding: 0; margin: 0 0 1rem; }
.history li { padding: .7rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.history li.you { background: var(--harbor-soft); padding-left: .6rem; border-radius: 4px; }

.row-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
[hidden] { display: none !important; }

.list-tools { margin: 0 0 1rem; }

/* ---------- Release 5.3: password Show/Hide ---------- */
.pw { position: relative; display: flex; }
.pw input { padding-right: 5rem; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  min-height: 40px; min-width: 64px; padding: 0 .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--harbor-soft); color: var(--harbor); font-weight: 700; font-size: .85rem; cursor: pointer;
}
.pw-toggle[aria-pressed="true"] { background: var(--harbor); color: #fff; border-color: var(--harbor); }

/* ---------- Release 5.3: picture gallery ---------- */
.lot .photo { position: relative; }
.photo-count {
  position: absolute; right: .5rem; bottom: .5rem; padding: .15rem .5rem; border-radius: 999px;
  background: rgba(28,35,48,.75); color: #fff; font-size: .78rem; font-weight: 700;
}
.gallery-main { position: relative; }
.gallery-main .main-btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; touch-action: pan-y; }
.gallery .nav, .zoom .nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: rgba(28,35,48,.6); color: #fff; font-size: 1.9rem; line-height: 1; cursor: pointer;
}
.gallery .nav:hover, .zoom .nav:hover { background: rgba(28,35,48,.85); }
.nav.prev { left: .5rem; }
.nav.next { right: .5rem; }
.gallery .counter, .zoom .counter {
  position: absolute; left: 50%; bottom: .6rem; transform: translateX(-50%);
  padding: .15rem .65rem; border-radius: 999px; background: rgba(28,35,48,.7); color: #fff;
  font-size: .85rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.gallery-tip { margin: .4rem 0 0; }
.thumbs button { min-width: 48px; min-height: 48px; }
.zoom { position: relative; touch-action: pan-y; }
.zoom img { width: 100%; max-height: 75vh; object-fit: contain; background: #111; border-radius: var(--radius-sm); }
@media (max-width: 480px) { .gallery .thumbs { flex-wrap: nowrap; } .gallery .thumbs img { width: 54px; height: 54px; } }

/* ---------- Release 5.4: opening-screen carousel ---------- */
.auth.with-landing { flex-wrap: wrap; gap: 1.5rem; align-items: flex-start; }
.landing { width: 100%; max-width: 560px; min-width: 0; }
@media (min-width: 1000px) { .auth.with-landing { flex-wrap: nowrap; } .landing { flex: 1 1 560px; } .auth.with-landing .auth-card { flex: 0 1 440px; } }
.carousel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.carousel .slide { position: relative; }
.slide-pic { display: block; width: 100%; padding: 0; border: 0; cursor: pointer; background: var(--harbor-soft); aspect-ratio: 4 / 3; touch-action: pan-y; }
.slide-pic img { width: 100%; height: 100%; object-fit: cover; }
.slide-pic .noimg { display: grid; place-items: center; height: 100%; color: var(--harbor); font-weight: 700; }
.carousel .nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: rgba(28,35,48,.6); color: #fff; font-size: 1.9rem; line-height: 1; cursor: pointer;
}
.carousel .nav:hover { background: rgba(28,35,48,.85); }
.slide-info { padding: 1rem 1.25rem .5rem; display: grid; gap: .45rem; justify-items: start; }
.slide-info h2 { margin: 0; }
.slide-price { display: grid; }
.slide-desc { margin: 0; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.dots { display: flex; justify-content: center; flex-wrap: wrap; gap: .1rem; padding: .25rem .5rem .75rem; }
.dots button { width: 32px; height: 32px; border: 0; background: none; cursor: pointer; position: relative; }
.dots button::after { content: ''; position: absolute; inset: 11px; border-radius: 50%; background: var(--line); }
.dots button[aria-current="true"]::after { background: var(--harbor); inset: 9px; }

/* ---------- Release 5.4: verification banner ---------- */
.verify-wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 1rem 1rem 0; }
.verify-banner { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin: 0; }
.verify-banner span { flex: 1 1 260px; }

/* ---------- Release 5.5: staging (TEST SITE) ---------- */
.env-bar {
  position: relative; z-index: 40; padding: .45rem 1rem; text-align: center;
  background: #B3261E; color: #fff; font-weight: 800; font-size: .9rem; letter-spacing: .02em;
}
.env-staging .topbar { background: #7A1712; }
.env-staging .auth-head .mark::after { content: ' TEST'; color: #B3261E; font-size: .55em; vertical-align: super; }
