:root {
  --navy: #16284A;
  --navy-2: #22396A;
  --paper: #F4F6F9;
  --surface: #FFFFFF;
  --brass: #A87416;
  --brass-soft: #F3E6CC;
  --ink: #1A1F2B;
  --slate: #586174;
  --line: #D9DEE6;
  --good: #1F6B47;
  --good-soft: #E1F0E8;
  --bad: #A2392A;
  --bad-soft: #F7E4E0;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: var(--navy-2); }
a:hover { color: var(--accent-text); }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* Header: white bar so any logo reads well, brand colour stripe on top */
.masthead { background: var(--surface); border-top: 6px solid var(--navy); border-bottom: 1px solid var(--line); }
.masthead-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--navy); }
.brand:hover { color: var(--navy-2); }
.brand-logo { height: 44px; width: auto; max-width: 180px; object-fit: contain; display: block; }
.brand-name { font-family: var(--serif); font-size: 1.3rem; letter-spacing: .01em; }
.brand-logo + .brand-name { padding-left: 14px; border-left: 1px solid var(--line); font-size: 1.15rem; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a, .nav .linkish { color: var(--slate); text-decoration: none; padding: 8px 12px; border-radius: 6px; font-size: .95rem; }
.nav a:hover, .nav .linkish:hover { color: var(--navy); background: var(--primary-soft); }
.nav a.on { color: var(--navy); font-weight: 600; box-shadow: inset 0 -3px 0 var(--brass); border-radius: 0; background: none; }
.auth-logo { text-align: center; margin: 8px 0 -4px; }
.auth-logo img { max-height: 72px; max-width: 260px; }

main.wrap { padding-top: 28px; padding-bottom: 48px; min-height: 70vh; }
.foot { color: var(--slate); font-size: .85rem; padding-bottom: 32px; }

/* Type */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h2.section { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); }
.lede { color: var(--slate); font-size: 1.05rem; max-width: 62ch; margin: 0 0 24px; }
.small { font-size: .875rem; }
.muted, tr.muted td { color: var(--slate); }
.nowrap { white-space: nowrap; }
.crumb { margin: 0 0 16px; font-size: .9rem; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 6px; margin-bottom: 20px; border-left: 4px solid var(--slate); background: var(--surface); }
.flash.ok { border-color: var(--good); background: var(--good-soft); }
.flash.error { border-color: var(--bad); background: var(--bad-soft); }

/* Buttons and forms */
.btn { display: inline-block; font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--navy-2); color: var(--navy-2); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: var(--on-primary); }
.btn.primary:hover { background: var(--navy-2); color: var(--on-primary); }
.btn.big { padding: 12px 24px; font-size: 1.05rem; }
.btn[disabled] { opacity: .6; cursor: wait; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--navy-2); cursor: pointer; text-decoration: underline; }
.linkish.danger { color: var(--bad); }
form.inline { display: inline; margin: 0; }
.stack { display: grid; gap: 16px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
label.check input { margin-top: 4px; }
input, textarea, select { font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid #BFC6D2; border-radius: 6px; background: #fff; color: var(--ink); width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { resize: vertical; }
fieldset.status { border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px 16px; display: grid; gap: 10px; }
legend { font-weight: 600; padding: 0 6px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.panel.wide { max-width: 760px; margin-bottom: 32px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.notice { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; color: var(--slate); }

/* Auth */
.auth { max-width: 420px; margin: 24px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 32px; }
.auth h1 { font-size: 1.8rem; }

/* Lot cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.lot { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; color: inherit; text-decoration: none; }
.lot:hover { border-color: var(--navy-2); color: inherit; }
.lot:hover h3 { color: var(--navy-2); }
.lot-photo { aspect-ratio: 4 / 3; background: var(--primary-soft); display: grid; place-items: center; overflow: hidden; }
.lot-photo img { width: 100%; height: 100%; object-fit: cover; }
.lot-placeholder { font-family: var(--serif); font-size: 1.6rem; color: var(--navy); opacity: .45; }
.lot-placeholder.big { font-size: 3rem; }
.lot-body { padding: 14px 16px 16px; display: grid; gap: 2px; }
.lot-meta { color: var(--slate); font-size: .85rem; }
.lot h3 { margin: 0 0 6px; }
.price { font-family: var(--serif); font-size: 1.6rem; font-variant-numeric: tabular-nums lining-nums; color: var(--ink); }
.price.muted { color: var(--slate); font-size: 1.25rem; }
.lot-foot { color: var(--slate); font-size: .85rem; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.state-closed, .state-ended { opacity: .85; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--navy-2); }
.countdown.urgent { color: var(--bad); }

/* Item page */
.item { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 36px; align-items: start; }
.item-photo { background: var(--primary-soft); border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.item-photo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.item-side h1 { margin-bottom: 20px; }
.board { background: var(--navy); color: var(--on-primary); border-radius: 12px; padding: 22px 24px 20px; }
.board-label { color: var(--on-primary); opacity: .75; font-size: .9rem; }
.board-price { font-family: var(--serif); font-size: clamp(2.6rem, 6vw, 3.6rem); line-height: 1.1; font-variant-numeric: tabular-nums lining-nums; padding-bottom: 10px; border-bottom: 3px solid var(--brass); display: inline-block; margin: 4px 0 14px; }
.board-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--on-primary); opacity: .9; font-size: .95rem; }
.board-row strong { font-weight: 700; }
.clock { margin-top: 12px; font-size: 1.15rem; color: var(--on-primary); }
.clock.urgent { color: #FFB4A6; }
.board.flash-update .board-price { animation: pricebump .9s ease-out; }
@keyframes pricebump { 0% { color: var(--brass); } 100% { color: var(--on-primary); } }
.standing { margin: 16px 0 0; font-weight: 600; min-height: 1.5em; color: var(--bad); }
.standing.leading { color: var(--good); }
.standing:empty { display: none; }
.bid-form { margin-top: 20px; display: grid; gap: 12px; }
.bid-row { display: flex; gap: 12px; }
.bid-row input { font-size: 1.25rem; font-family: var(--serif); font-variant-numeric: tabular-nums; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.quick button { font: inherit; font-size: .9rem; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-variant-numeric: tabular-nums; }
.quick button:hover, .quick button.on { border-color: var(--brass); background: var(--brass-soft); }
.desc { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); white-space: pre-line; max-width: 65ch; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table.data { border-collapse: collapse; width: 100%; font-size: .95rem; }
table.data th { text-align: left; font-weight: 600; color: var(--slate); font-size: .85rem; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #FAFBFC; }
table.data td { padding: 12px 14px; border-bottom: 1px solid #EEF1F5; vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.top td { background: var(--brass-soft); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 4px 14px; min-width: 120px; }
.item-col { min-width: 180px; }
.tag { display: inline-block; font-size: .8rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: #EAEDF2; color: var(--slate); }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }

/* Admin */
.subnav { display: flex; gap: 20px; margin-bottom: 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.subnav a { padding: 8px 0; text-decoration: none; color: var(--slate); font-weight: 600; }
.subnav a.on { color: var(--ink); box-shadow: inset 0 -3px 0 var(--brass); }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.head-row h1 { margin: 0; }
.thumb-row { display: flex; gap: 16px; align-items: center; }
.thumb { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

@media (max-width: 800px) {
  .item { grid-template-columns: 1fr; gap: 24px; }
  .two { grid-template-columns: 1fr; }
  h1 { font-size: 1.7rem; }
  .bid-row { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .board.flash-update .board-price { animation: none; }
}
.bid-form > label { display: block; font-weight: 600; }
.bid-row .btn { white-space: nowrap; }
.bid-form[hidden] { display: none; }

/* Dark header: logo sits on the brand background */
.masthead.dark { background: var(--navy); border-top: 0; border-bottom: 0; }
.masthead.dark .brand, .masthead.dark .brand:hover { color: var(--on-primary); }
.masthead.dark .brand-logo { height: 60px; max-width: 240px; }
.masthead.dark .brand-logo + .brand-name { border-left-color: rgba(255,255,255,.3); }
.masthead.dark .nav a, .masthead.dark .nav .linkish { color: var(--on-primary); opacity: .8; }
.masthead.dark .nav a:hover, .masthead.dark .nav .linkish:hover { opacity: 1; background: rgba(255,255,255,.1); color: var(--on-primary); }
.masthead.dark .nav a.on { opacity: 1; color: var(--on-primary); }
.brand-stripe { display: flex; height: 6px; }
.brand-stripe span { flex: 1; }
.auth-logo img { border-radius: 8px; }
@media (max-width: 560px) { .brand-logo + .brand-name { display: none; } }
hr.rule { border: 0; border-top: 1px solid var(--line); margin: 8px 0; width: 100%; }
details.help { color: var(--slate); font-size: .9rem; }
details.help summary { cursor: pointer; font-weight: 600; color: var(--ink); }
details.help p { margin: 8px 0 0; }
.bid-row input[type=email] { font-family: var(--sans); font-size: 1rem; }
.site-warn { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.site-warn .btn { white-space: nowrap; }
/* Bid number above the item name */
.lot-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.lot-meta .bid-no { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.lot-meta .cat { color: var(--slate); }
.lot-meta .cat::before { content: ""; display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--brass); margin: 0 8px 3px 0; vertical-align: middle; }
p.lot-meta { margin: 0 0 4px; }
ol.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.import-errors { margin-bottom: 24px; }
.mini-thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); display: block; }
.images-box { display: grid; gap: 4px; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.images-box code { font-size: .9rem; word-break: break-all; }
