/* Auction workspace: layout and components. The values come from tokens.css (colours, type, sizes, shape, motion,
   light and dark); theme.css, loaded after this file, gives every component its FCRF look from those tokens. */
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--body); }
a { color: var(--accent); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.topbar { position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar .in { max-width: 1160px; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between; }
.brand { font: 600 22px var(--display); color: var(--fg); text-decoration: none; }
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 6px; font-weight: 600; font-size: 14px; }
.nav a.on { background: var(--fg); color: var(--bg); }
.who { color: var(--muted); font-size: 13px; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 22px 16px 60px; display: grid; gap: 18px; }
h1 { font: 600 34px/1.1 var(--display); margin: 0; }
h2 { font: 600 24px var(--display); margin: 8px 0 -4px; }
.sub { color: var(--muted); margin: 4px 0 0; }

.filters { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg button { font: inherit; border: 0; background: none; cursor: pointer; font-size: 14px; color: var(--muted); padding: 7px 14px; display: inline-flex; gap: 6px; align-items: center; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.chipbtn { cursor: pointer; font: inherit; color: inherit; }
.lot.leaving { opacity: 0; transform: translateX(12px); transition: opacity .3s, transform .3s; }
.lot.failed { box-shadow: inset 4px 0 0 var(--bad); }
[hidden] { display: none !important; }
main.wrap { transition: opacity .15s; }
main.wrap.loading { opacity: .45; pointer-events: none; }
/* ---------- the lot page: media on the left, the article's fields on the right, a live preview last */
.lothead { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; align-items: center; }
.back { text-decoration: none; font-weight: 600; }
.lotnav { display: flex; flex-wrap: wrap; gap: 4px; }
.lotnav a { font: 500 12px var(--mono); text-decoration: none; padding: 3px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--panel); }
.lotnav a.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.lottop { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.lottop h1 { margin-top: 10px; }
.lead { margin: 4px 0 0; font-weight: 600; }
.lead a { color: inherit; }
.saved { font-size: 13px; font-weight: 600; color: var(--ok); opacity: 0; transition: opacity .3s; white-space: nowrap; }
.saved.show { opacity: 1; }
.saved.bad { color: var(--bad); }
.work { display: grid; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); gap: 18px; align-items: start; }
.cols { display: grid; gap: 18px; min-width: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; display: grid; gap: 12px; min-width: 0; }
.card h2 { margin: 0; font-size: 21px; }
.media { position: sticky; top: 70px; }
.mainpic { position: relative; background: var(--photo-bg); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.mainpic img { width: 100%; height: 100%; object-fit: contain; }
.mainpic .tag { position: absolute; left: 8px; bottom: 8px; font-size: 11px; background: rgba(0,0,0,.55); color: var(--on-solid); padding: 2px 7px; border-radius: 4px; }
.thumbs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.thumb { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--soft); }
.thumb img, .thumb video { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--media-bg); }
.thumb .cap { display: flex; gap: 6px; align-items: center; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 4px 6px; }
.thumb .cap span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.thumb .x { border: 0; background: none; color: var(--bad); cursor: pointer; font: 600 12px var(--body); white-space: nowrap; }
.drop { display: grid; gap: 2px; justify-items: center; text-align: center; border: 2px dashed var(--line); border-radius: 8px; padding: 18px 12px; cursor: pointer; color: var(--muted); font-size: 13px; position: relative; }
.drop b { color: var(--fg); font-size: 14px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .bar { width: 100%; height: 6px; background: var(--soft); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.drop .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.card label { display: grid; gap: 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.card label small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.card input, .card select, .card textarea { font: 15px var(--body); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; width: 100%; text-transform: none; letter-spacing: 0; font-weight: 400; }
.card textarea { line-height: 1.55; resize: vertical; min-height: 180px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.withlink { display: flex; gap: 6px; align-items: center; }
.withlink a { font-weight: 700; text-decoration: none; }
.ghost { font: 600 13px var(--body); border: 1px solid var(--line); background: var(--panel); color: var(--fg); border-radius: 7px; padding: 7px 10px; cursor: pointer; white-space: nowrap; }
.primary { font: 600 14px var(--body); border: 0; background: var(--fg); color: var(--bg); border-radius: 7px; padding: 10px 14px; cursor: pointer; }
.primary:disabled { opacity: .5; cursor: default; }
.fetchrow { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; }
.inline { display: flex !important; gap: 8px; align-items: center; }
.inline input { width: 160px; }
.warnline { color: var(--warn); margin: 0; }
.fcrf p { margin: 4px 0; }
.docs { display: flex; flex-wrap: wrap; gap: 8px; }
.doc { font-weight: 700; text-decoration: none; border: 1px solid var(--line); border-radius: 6px; padding: 5px 12px; background: var(--soft); }
.doc.off, b.off { color: var(--muted); font-weight: 500; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.score { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.score.total { border-bottom: 0; font-weight: 600; }
.pick { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.pick button { font: 600 14px var(--mono); width: 40px; height: 34px; border: 0; background: var(--panel); color: var(--muted); cursor: pointer; }
.pick button + button { border-left: 1px solid var(--line); }
.pick button[aria-pressed="true"] { background: var(--accent); color: var(--on-solid); }
.preview #preview { font: 15px/1.6 var(--body); }
.preview #preview p { margin: 6px 0; }
.preview #preview img, .preview #preview video { max-width: 100%; max-height: 320px; display: block; margin: 8px 0; border-radius: 6px; }
.cutmark { display: block; margin: 6px 0; padding: 3px 8px; font-size: 12px; color: var(--accent); border-top: 2px dashed var(--accent); }
table.va { border-collapse: collapse; margin-top: 8px; }
table.va td { padding: 3px 18px 3px 0; }
@media (max-width: 900px) { .work { grid-template-columns: 1fr; } .media { position: static; } .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.est .open { display: block; margin-top: 6px; font: 600 13px var(--body); text-decoration: none; }
.lot:not(.relevant) .open { display: none; }
.seg .n { font: 500 12px var(--mono); opacity: .8; }
.houses { display: flex; flex-wrap: wrap; gap: 6px; }
.houses a { text-decoration: none; }

.logo { display: inline-flex; align-items: center; gap: 9px; color: var(--fg); }
.plate { background: var(--photo-bg); border: 1px solid var(--line); border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 8px; flex: none; }
.plate img { display: block; max-height: 17px; max-width: 96px; }
.plate.christies { background: #c8102e; border-color: #c8102e; padding: 0; width: 32px; }
.plate.christies img, .plate.sothebys img { max-height: 32px; max-width: 32px; border-radius: 5px; }
.plate.sothebys { padding: 0; width: 32px; overflow: hidden; }
.logo .nm { font: 600 15px var(--display); }
.chipbtn { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px 3px 3px; background: var(--panel); }
.chipbtn.on { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }

.sale { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.sale > header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.sale h3 { font: 600 22px/1.15 var(--display); margin: 6px 0 2px; }
.sale h3 a { color: inherit; text-decoration: none; }
.meta { color: var(--muted); font-size: 13px; }
.when { text-align: right; display: grid; gap: 4px; justify-items: end; align-content: start; }
.date { font-weight: 600; white-space: nowrap; }
.days { font-size: 13px; color: var(--muted); }
.pill { font-size: 12px; border-radius: 99px; padding: 2px 10px; font-weight: 600; white-space: nowrap; }
.pill.live { background: var(--ok-soft); color: var(--ok); }
.pill.preview { background: var(--warn-soft); color: var(--warn); }

.lot { display: grid; grid-template-columns: 88px 52px minmax(0, 1fr) auto auto; gap: 4px 16px; padding: 12px 18px; border-bottom: 1px solid var(--line); align-items: center; transition: background .2s; }
.lot:last-child { border-bottom: 0; }
.lot.relevant { background: color-mix(in srgb, var(--ok-soft) 55%, transparent); }
.lot.rejected { opacity: .55; }
.pic { width: 88px; height: 88px; border-radius: 6px; background: var(--photo-bg); border: 1px solid var(--line); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.pic img { width: 100%; height: 100%; object-fit: contain; }
.pic.none { background: var(--soft); font-size: 11px; color: var(--muted); text-align: center; padding: 6px; text-decoration: none; }
.no { font: 500 12px var(--mono); color: var(--muted); }
.no b { display: block; font: 600 20px var(--display); color: var(--fg); }
.t { font-weight: 600; line-height: 1.35; }
.t a { color: inherit; text-decoration: none; }
.t a:hover { text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: 13px; background: var(--soft); border-radius: 5px; padding: 2px 8px; white-space: nowrap; }
.chip.mono { font-family: var(--mono); font-size: 12px; }
.v { font-size: 12px; border-radius: 5px; padding: 2px 8px; font-weight: 600; white-space: nowrap; }
.v.natural { background: var(--ok-soft); color: var(--ok); }
.v.likely { background: var(--accent-soft); color: var(--accent); }
.v.untested { background: var(--warn-soft); color: var(--warn); }
.v.mention { background: var(--info-soft); color: var(--info); }
.est { font: 500 14px var(--mono); white-space: nowrap; text-align: right; }

.vx { display: flex; gap: 6px; }
.vx button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font: 700 18px var(--body); cursor: pointer; color: var(--muted); }
.vx button.yes:hover, .vx button.yes.on { background: var(--ok); border-color: var(--ok); color: var(--on-solid); }
.vx button.no:hover, .vx button.no.on { background: var(--bad); border-color: var(--bad); color: var(--on-solid); }

.none-here, .empty { padding: 12px 18px; color: var(--muted); }
.quiet { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.qrow { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 4px 16px; padding: 10px 18px; border-bottom: 1px solid var(--line); align-items: center; }
.qrow:last-child { border-bottom: 0; }
.qrow a { color: inherit; text-decoration: none; font-weight: 600; }

.login { max-width: 360px; margin: 12vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; display: grid; gap: 12px; }
.login input { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--fg); }
.login button { font: inherit; font-weight: 600; padding: 10px; border: 0; border-radius: 7px; background: var(--fg); color: var(--bg); cursor: pointer; }
.err { color: var(--bad); }

@media (max-width: 760px) {
  .sale > header { grid-template-columns: 1fr; }
  .when { justify-items: start; text-align: left; }
  .lot { grid-template-columns: 72px minmax(0, 1fr) auto; }
  .pic { width: 72px; height: 72px; grid-row: span 2; }
  .lot .no { display: none; }
  .est { grid-column: 2; text-align: left; }
  .vx { grid-column: 3; grid-row: 1 / span 2; flex-direction: column; }
  .qrow { grid-template-columns: 1fr; }
}

/* ---------- top bar user, toast, page heads */
.me { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--fg); font-weight: 600; font-size: 14px; padding: 3px 10px 3px 3px; border-radius: 99px; border: 1px solid transparent; }
.me.on, .me:hover { border-color: var(--line); background: var(--soft); }
.me img, .ini { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.ini { display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; text-transform: uppercase; }
.ini.big { width: 64px; height: 64px; font-size: 26px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--fg); color: var(--bg); padding: 9px 16px; border-radius: 8px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: var(--on-solid); }
.pagehead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 20px; }
.ghost.sm { padding: 4px 9px; font-size: 12px; }
a.ghost { text-decoration: none; display: inline-block; }
button:disabled { opacity: .5; cursor: default; }
.nowrap { white-space: nowrap; }
.card.flat { padding: 0; overflow: hidden; }
.scroll { overflow-x: auto; }
.pill.none { background: var(--soft); color: var(--muted); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

/* ---------- scans */
.housegrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.hcard { gap: 8px; }
.hrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.jobhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.console, .loglist { font: 12.5px/1.55 var(--mono); max-height: 420px; overflow: auto; background: var(--soft); border-radius: 6px; padding: 8px 10px; }
.loglist { max-height: none; background: none; padding: 0; }
.line { padding: 2px 0; white-space: pre-wrap; word-break: break-word; }
.loglist .line { display: grid; grid-template-columns: 170px 150px minmax(0, 1fr); gap: 10px; padding: 6px 14px; border-bottom: 1px solid var(--line); }
.line .t { color: var(--muted); margin-right: 10px; white-space: nowrap; }
.line .tag { color: var(--muted); font-family: var(--body); font-size: 12px; }
.line.warn { color: var(--warn); }
.line.error { color: var(--bad); background: color-mix(in srgb, var(--bad-soft) 60%, transparent); }
table.grid { border-collapse: collapse; width: 100%; font-size: 14px; }
table.grid th, table.grid td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: var(--panel); }
table.grid td.num, table.grid th.num { text-align: right; font-family: var(--mono); }
table.grid tr:last-child td { border-bottom: 0; }
table.grid .logo .nm { display: none; }
.fl { display: flex; flex-wrap: wrap; gap: 8px; }
.fl select, .fl input { font: inherit; font-size: 14px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--fg); }

/* ---------- settings, me, login */
fieldset.settings { border: 0; padding: 0; margin: 0; display: grid; gap: 18px; min-width: 0; }
.switch { display: flex !important; align-items: center; gap: 12px; text-transform: none !important; letter-spacing: 0 !important; font-size: 15px !important; color: var(--fg) !important; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; }
.switch > span:first-of-type { width: 40px; height: 22px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.switch > span:first-of-type::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--photo-bg); transition: transform .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.card .inline input { width: auto; }
dl.sys { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; margin: 0; }
dl.sys dt { color: var(--muted); }
dl.sys dd { margin: 0; }
code { font-family: var(--mono); font-size: 13px; background: var(--soft); padding: 1px 5px; border-radius: 4px; }
.profile { display: flex; align-items: center; gap: 16px; }
.profile img { width: 64px; height: 64px; border-radius: 50%; }
.statrow { display: flex; flex-wrap: wrap; gap: 10px 32px; }
.statrow div { display: grid; }
.statrow b { font: 500 26px var(--mono); }
.statrow span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.login .sub { margin: 0; }
.gbtn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600; text-decoration: none; color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 11px 14px; background: var(--panel); }
.gbtn:hover { background: var(--soft); }
@media (max-width: 760px) { .loglist .line { grid-template-columns: 1fr; gap: 2px; } dl.sys { grid-template-columns: 1fr; } }

/* ---------- the ⓘ window */
.info { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--accent); background: none; color: var(--accent); font: italic 700 12px Georgia, serif; cursor: pointer; margin-right: 6px; vertical-align: 2px; padding: 0; }
.info:hover { background: var(--accent); color: var(--on-solid); }
.tlink { color: inherit; text-decoration: none; }
.tlink:hover { text-decoration: underline; }
dialog.infobox { width: min(980px, 94vw); max-height: 88vh; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--fg); overflow: hidden; display: none; }
dialog.infobox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
dialog.infobox::backdrop { background: rgba(20, 16, 12, .55); }
.infohead { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.infohead h2 { margin: 4px 0 0; font-size: 22px; }
.infobody { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 18px; padding: 16px 18px; overflow: auto; }
.infopic img { width: 100%; border-radius: 8px; background: var(--photo-bg); border: 1px solid var(--line); }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 12px; }
dl.facts dt { color: var(--muted); font-size: 13px; }
dl.facts dd { margin: 0; font-weight: 600; }
.cattext { white-space: pre-line; line-height: 1.6; font-size: 14.5px; }
.infobody h3 { font: 600 17px var(--display); margin: 14px 0 4px; }
.infofoot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
@media (max-width: 720px) { .infobody { grid-template-columns: 1fr; } }

/* ---------- stones on the lot page */
.stones { display: grid; gap: 12px; }
.stone { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 10px; background: var(--bg); }
.stonehead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.stonehead b { font: 600 18px var(--display); }
.stone .grid3 input, .stone .grid3 select { background: var(--panel); }
.ghost.danger { color: var(--bad); }
.toolbar h2 { margin: 0; }
.toolbar > span { display: flex; gap: 8px; flex-wrap: wrap; }
.scoregroup + .scoregroup { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.scoregroup .sgt { display: block; margin-bottom: 6px; font: 600 15px var(--display); }
.preview .va + .va { margin-top: 10px; }

/* ---------- several lots at once on the review board */
.lot .no .sel { display: flex; justify-content: center; margin-bottom: 4px; cursor: pointer; }
.pick-lot, .pick-sale { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.lot.picked { box-shadow: inset 4px 0 0 var(--accent); }
.selall { grid-column: 1 / -1; display: inline-flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); cursor: pointer; width: max-content; }
.bulkbar { position: sticky; bottom: 16px; z-index: 20; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 8px 28px rgba(0,0,0,.18); }
.bulkbar[hidden] { display: none; }
.bulkbar > span { margin-right: 6px; }
.bulkbar button { font: 600 14px var(--body); padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); cursor: pointer; }
.bulkbar .yes { background: var(--ok); border-color: var(--ok); color: var(--on-solid); }
.bulkbar .no { background: var(--bad); border-color: var(--bad); color: var(--on-solid); }
.bulkbar button:disabled { opacity: .5; cursor: wait; }

/* ---------- something is happening: the top bar and the spinner on what was clicked (busy.js) */
#busybar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1000; pointer-events: none; opacity: 0; overflow: hidden; transition: opacity .2s; }
#busybar.on { opacity: 1; }
#busybar::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 40%; background: var(--accent); border-radius: 0 3px 3px 0;
  animation: busyslide 1.1s ease-in-out infinite; }
#busybar.done::before { animation: none; width: 100%; transition: width .2s; }
@keyframes busyslide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
@keyframes busyspin { to { transform: rotate(360deg); } }
button.is-busy { position: relative; color: transparent !important; cursor: progress; }
button.is-busy > * { visibility: hidden; }
button.is-busy::after { content: ''; position: absolute; top: 50%; left: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  border: 2px solid var(--muted); border-right-color: transparent; animation: busyspin .7s linear infinite; }
.vx button.is-busy::after, .bulkbar .yes.is-busy::after, .bulkbar .no.is-busy::after, button.primary.is-busy::after { border-color: var(--on-solid); border-right-color: transparent; }
a.is-busy, [data-info].is-busy, select.is-busy { cursor: progress; opacity: .6; }
html:has(#busybar.on) { cursor: progress; }
@media (prefers-reduced-motion: reduce) { #busybar::before { animation-duration: 3s; } button.is-busy::after { animation-duration: 2s; } }
/* labelled buttons keep their words; the spinner sits before them */
button.ghost.is-busy, button.primary.is-busy, .bulkbar button.is-busy { color: inherit !important; padding-left: 34px; }
.bulkbar .yes.is-busy, .bulkbar .no.is-busy, button.primary.is-busy { color: var(--on-solid) !important; }
button.ghost.is-busy > *, button.primary.is-busy > *, .bulkbar button.is-busy > * { visibility: visible; }
button.ghost.is-busy::after, button.primary.is-busy::after, .bulkbar button.is-busy::after { left: 12px; margin-left: 0; }
button.primary.is-busy { color: var(--bg) !important; }
button.primary.is-busy::after { border-color: var(--bg); border-right-color: transparent; }

/* ---------- review of an analysis: the bar, the 💬 buttons, the comments panel, the "For review" page */
.pill.st-draft { background: var(--soft); color: var(--muted); }
.pill.st-in_review { background: var(--info-soft); color: var(--info); }
.pill.st-changes { background: var(--warn-soft); color: var(--warn); }
.pill.st-approved { background: var(--ok-soft); color: var(--ok); }
.nav .badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 99px; background: var(--accent); color: var(--on-solid); font: 600 11px/18px var(--body); text-align: center; }
.nav .badge[hidden] { display: none; }

.revbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 16px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.revbar.st-in_review { border-color: var(--info); }
.revbar.st-changes { border-color: var(--warn); background: color-mix(in srgb, var(--warn-soft) 50%, var(--panel)); }
.revbar.st-approved { border-color: var(--ok); }
.revbar .grow { flex: 1; }
.revbar select, .revbar input { font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--fg); }
.revbar input { min-width: 180px; }
.primary.ok { background: var(--ok); color: var(--on-solid); }
.rvhist { flex-basis: 100%; font-size: 13px; }
.rvhist summary { cursor: pointer; color: var(--muted); }
.rvhist ol { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 3px; }

.commentable { position: relative; }
.cbtn { position: absolute; top: -2px; right: 0; z-index: 2; display: inline-flex; gap: 3px; align-items: center; font: 600 11px var(--body); padding: 2px 6px;
  border: 1px solid var(--line); border-radius: 99px; background: var(--panel); color: var(--muted); cursor: pointer; opacity: .35; transition: opacity .15s; }
section.commentable > .cbtn, .fcrf.commentable > .cbtn { top: 10px; right: 10px; }
/* on a field the button sits right after the field's name, not over it */
.ltitle { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ltitle > .cbtn { position: static; padding: 0 5px; text-transform: none; letter-spacing: 0; flex: none; }
.commentable:hover > .ltitle > .cbtn { opacity: 1; }
.commentable:hover > .cbtn, .cbtn:focus-visible, .cbtn.has, .cbtn.done { opacity: 1; }
.cbtn.has { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.cbtn.done { color: var(--ok); }
.commentable.flagged > input, .commentable.flagged > select, .commentable.flagged .withlink input { box-shadow: 0 0 0 2px var(--warn-soft); }
section.commentable.flagged { box-shadow: inset 3px 0 0 var(--warn); }
.commentable.pulse { animation: cpulse 1.6s ease-out; }
@keyframes cpulse { 0%, 40% { box-shadow: 0 0 0 4px var(--warn); } 100% { box-shadow: 0 0 0 0 transparent; } }
.card .toolbar:has(+ #scores) { padding-right: 60px; }

.cpanel { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100vw); z-index: 50; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgba(0,0,0,.12); }
.cpanel[hidden] { display: none; }
/* the page moves left of the open panel and keeps its full width; on narrow screens the panel covers it instead */
body.cp-open main.wrap { margin-right: 400px; margin-left: max(0px, calc((100vw - 400px - 1160px) / 2)); }
@media (max-width: 1100px) { body.cp-open main.wrap { margin: 0 auto; } }
.cphead { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cphead b { font: 600 18px var(--display); }
.cphead span { display: flex; gap: 4px; }
.cphead [aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.cplist { flex: 1; overflow: auto; padding: 12px 14px; display: grid; gap: 10px; align-content: start; }
.cth { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; display: grid; gap: 6px; background: var(--bg); }
.cth.resolved { opacity: .6; }
.cton { font-size: 12px; font-weight: 600; color: var(--accent); }
.cmsg p { margin: 2px 0 0; white-space: pre-wrap; }
.cmsg.reply { margin-left: 12px; padding-left: 10px; border-left: 2px solid var(--line); }
.cact { display: flex; gap: 6px; align-items: center; }
.cact .creply { flex: 1; min-width: 0; font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--fg); }
.cpnew { display: grid; gap: 6px; padding: 12px 14px; border-top: 1px solid var(--line); }
.cpnew textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--fg); resize: vertical; }
.cpnew .primary { justify-self: end; }

.revrow { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.revrow:last-child { border-bottom: 0; }
.revrow:hover { background: var(--soft); }
.revside { display: flex; gap: 8px; align-items: center; }
.revside .cnt { font-size: 13px; color: var(--warn); font-weight: 600; }
@media (max-width: 700px) { .revrow { grid-template-columns: 1fr; } }

/* ---------- review board: sales fold like an accordion; live / online filter */
.sale > header { grid-template-columns: auto minmax(0, 1fr) auto; cursor: pointer; }
.sale > header .fold { align-self: start; width: 28px; height: 28px; margin-top: 2px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--muted); cursor: pointer; }
.sale > header .fold::before { content: '▾'; display: block; font-size: 14px; line-height: 1; transition: transform .2s; }
.sale.folded > header .fold::before { transform: rotate(-90deg); }
.sale.folded > header { border-bottom: 0; }
.sale.folded > .lot, .sale.folded > .none-here { display: none; }
.sale > header .selall { grid-column: 2 / -1; }
.sale.folded > header .selall { display: none; }
.folds { display: inline-flex; gap: 4px; margin-left: auto; }
@media (max-width: 700px) { .sale > header { grid-template-columns: auto minmax(0, 1fr); } .sale > header .when { grid-column: 2; } }
.sale > header:not(:has(.fold)) { grid-template-columns: minmax(0, 1fr) auto; cursor: default; }

/* ---------- comments on a passage of the analysis: the text sits over a copy of itself with the passages marked */
.hlwrap { position: relative; }
.hlwrap .hlback, .hlwrap textarea { font: 15px/1.55 var(--body); padding: 8px 10px; border: 1px solid transparent; border-radius: 7px;
  white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; letter-spacing: 0; box-sizing: border-box; tab-size: 4; }
.hlwrap .hlback { position: absolute; inset: 0; overflow: hidden; color: transparent; background: var(--bg); border-color: var(--line); pointer-events: none; }
.hlwrap textarea { position: relative; z-index: 1; background: transparent; overflow: hidden; resize: none; min-height: 180px; display: block; }
.hlback mark { color: transparent; background: var(--mark); border-bottom: 2px solid var(--mark-line); border-radius: 2px; }
.hlback mark.on { background: var(--mark-strong); }
#here-comment.hint { border-color: var(--mark-line); color: var(--warn); }
.cquote { margin: 0; padding: 4px 8px; border-left: 3px solid var(--mark-line); background: var(--mark-soft); font-size: 13px; font-style: italic;
  max-height: 5.5em; overflow: hidden; cursor: pointer; white-space: pre-wrap; }
.cquote.lost { border-left-color: var(--line); text-decoration: line-through; opacity: .7; cursor: default; }
.cpnew .cquote { cursor: default; }
.cth.focus { border-color: var(--mark-line); box-shadow: 0 0 0 2px var(--mark); }
.mention { color: var(--accent); font-weight: 600; background: var(--accent-soft); border-radius: 4px; padding: 0 3px; }
.tagmenu { position: fixed; z-index: 1001; display: grid; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 10px 30px rgba(0,0,0,.18); overflow: hidden; }
.tagmenu button { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border: 0; background: none; color: var(--fg); text-align: left; cursor: pointer; font: 14px var(--body); }
.tagmenu button.on, .tagmenu button:hover { background: var(--soft); }
.tagmenu img, .tagmenu .ini { width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; }
.tagmenu small { display: block; color: var(--muted); font-size: 11px; }

/* ---------- Workflow table */
.tablewrap { overflow-x: auto; }
table.flow { width: 100%; border-collapse: collapse; font-size: 14px; }
table.flow th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.flow td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.flow tr:hover td { background: var(--soft); }
table.flow td a { color: inherit; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.pill.st-not_started { background: var(--soft); color: var(--muted); }
.pill.st-writing { background: var(--accent-soft); color: var(--accent); }

/* ---------- lot page: wider, pictures in a strip on top, the cards in two columns on wide screens */
main.wrap:has(> .work) { max-width: 1480px; }
body.cp-open main.wrap:has(> .work) { margin-left: max(0px, calc((100vw - 400px - 1480px) / 2)); }
.work { grid-template-columns: minmax(0, 1fr); }
.media { position: static; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; align-items: start; }
.media .mainpic { grid-row: span 2; }
.media .thumbs { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.media .thumbs:empty { display: none; }
.media .drop { padding: 14px 12px; }
.stone .grid3 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (min-width: 1200px) {
  .cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "stones stones" "article scores" "analysis analysis" "preview preview"; align-items: start; }
  .cols > section:nth-child(1) { grid-area: stones; }
  .cols > section:nth-child(2) { grid-area: article; }
  .cols > section:nth-child(3) { grid-area: analysis; }
  .cols > section:nth-child(4) { grid-area: scores; }
  .cols > section:nth-child(5) { grid-area: preview; }
}
@media (max-width: 700px) { .media { grid-template-columns: 1fr; } .media .mainpic { grid-row: auto; max-width: 320px; } }

/* ---------- lot page top: pictures beside the catalogue description */
@media (min-width: 1200px) {
  .work { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "media catalogue" "cols cols"; }
  .work > .media { grid-area: media; }
  .work > .catalogue { grid-area: catalogue; }
  .work > .cols { grid-area: cols; }
}
.catalogue .toolbar > span { display: flex; gap: 8px; flex-wrap: wrap; }
.catalogue .cattext { max-height: 340px; overflow: auto; padding-right: 6px; }
.catalogue h3 { margin: 4px 0 0; font-size: 16px; }
.btnlink { display: inline-flex; align-items: center; text-decoration: none; color: inherit; }

/* ---------- lot page: previous / next lot of the sale */
.lotnav { align-items: center; }
.lotnav .step { font: 600 13px var(--body); padding: 5px 12px; color: var(--fg); }
.lotnav .step:hover { border-color: var(--fg); }
.lotnav .step.off { border: 1px solid var(--line); border-radius: 5px; color: var(--line); padding: 5px 12px; }
.lotnav .meta { margin-left: 6px; }

/* ---------- "Analysis →" on a relevant lot: a clear button, not a small link */
.est .open { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 9px 16px; border-radius: 8px;
  background: var(--accent); color: var(--on-solid); font: 700 15px var(--body); letter-spacing: .01em; box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 30%, transparent); }
.est .open:hover { filter: brightness(1.1); }

/* ---------- e-mail card */
.mailbox { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; }
.mailbox .btns { display: flex; gap: 8px; flex-wrap: wrap; }
.okline { color: var(--ok); margin: 0; font-weight: 600; }
#email h3 { margin: 6px 0 0; font-size: 16px; }
#email fieldset.settings { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
#notify .switch { display: flex; }

/* Phillips and Bonhams logos are SVGs with no size of their own: give them one (their shapes are 131:18 and 522:120) */
.plate.phillips img { width: 84px; height: 12px; max-width: none; max-height: none; }
.plate.bonhams img { width: 70px; height: 16px; max-width: none; max-height: none; }
/* a link drawn as the main button keeps the button's text colour (.btnlink would make it inherit the light page text) */
a.primary, a.primary.btnlink { color: var(--bg); text-decoration: none; }

/* ======================================================================================================
   Phones and small tablets. Everything above is laid out for a desk screen; this block fixes what breaks
   below 760px (and touch-only details for any width).
   ====================================================================================================== */

/* toolbars with a title and buttons may wrap instead of pushing out of the card */
.toolbar { flex-wrap: wrap; }
.inline { flex-wrap: wrap; }
/* a section with its 💬 in the corner keeps its own buttons clear of it */
section.commentable > .toolbar, section.commentable > h2 { padding-right: 64px; }
.card .toolbar:has(+ #scores) { padding-right: 64px; }

/* touch screens have no hover: the 💬 buttons are always fully visible */
@media (hover: none) {
  .cbtn, .ltitle > .cbtn { opacity: 1; }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .wrap { padding: 14px 12px 90px; gap: 14px; }
  h1 { font-size: 28px; }
  h2 { font-size: 21px; }

  /* top bar: brand and me on one line, the menu below as one row that scrolls sideways */
  .topbar .in { padding: 8px 12px 0; gap: 6px 12px; }
  .brand { font-size: 19px; }
  .me span:not(.ini) { display: none; }
  .me { padding: 2px; }
  .nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; flex: none; padding: 7px 11px; }

  /* every segmented control fits the screen and scrolls sideways when its words do not */
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg button { white-space: nowrap; flex: none; padding: 8px 12px; }
  .filters { gap: 10px; }
  .folds { margin-left: 0; }

  /* inputs at 16px: below that, iPhones zoom into the page on every tap */
  input, select, textarea, .card input, .card select, .card textarea, .revbar input, .revbar select,
  .cact .creply, .cpnew textarea, .fl select, .fl input, .hlwrap .hlback, .hlwrap textarea { font-size: 16px; }

  /* review board: picture | text | ✓ ✕, with the select box and lot number under the picture */
  .lot { grid-template-columns: 64px minmax(0, 1fr) auto; gap: 6px 12px; padding: 12px; }
  .pic { width: 64px; height: 64px; grid-column: 1; grid-row: 1 / span 2; }
  .lot .no { display: flex; gap: 6px; align-items: center; grid-column: 1; grid-row: 3; font-size: 11px; }
  .lot .no b { display: inline; font-size: 15px; }
  .lot .no .sel { margin: 0; }
  .lot > div:not(.no):not(.est):not(.vx) { grid-column: 2; grid-row: 1; min-width: 0; }
  .est { grid-column: 2; grid-row: 2 / span 2; text-align: left; white-space: normal; }
  .est .open { padding: 8px 14px; font-size: 14px; }
  .vx { grid-column: 3; grid-row: 1 / span 3; flex-direction: column; }
  .vx button { width: 42px; height: 42px; }
  .chip { white-space: normal; }
  .sale > header { padding: 12px; gap: 6px 10px; }
  .sale h3 { font-size: 19px; }
  .none-here, .empty { padding: 12px; }
  .bulkbar { bottom: 10px; gap: 6px; padding: 8px 10px; }
  .bulkbar > span { flex-basis: 100%; text-align: center; margin: 0; }
  .bulkbar button { padding: 9px 12px; font-size: 13px; }

  /* lot page */
  .lotnav a:not(.step) { display: none; }      /* the long list of numbers; ← → stay */
  .lottop { flex-direction: column; gap: 4px; }
  .lottop h1 { margin-top: 6px; }
  .revbar { padding: 10px; gap: 8px; }
  .revbar .grow { display: none; }
  .revbar select, .revbar input { flex: 1 1 100%; min-width: 0; }
  .revbar .primary, .revbar .ghost { flex: 1 1 auto; }
  .card { padding: 14px 12px; }
  .stone { padding: 10px; }
  .stone .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score { flex-wrap: wrap; }
  .pick button { width: 44px; height: 40px; }
  .catalogue .cattext { max-height: 260px; }
  .media .mainpic { max-width: none; }
  table.va td { padding-right: 12px; }
  .cpanel { width: 100vw; border-left: 0; }
  .cphead { padding: 10px 12px; }
  .cact { flex-wrap: wrap; }
  .cact .creply { flex-basis: 100%; }

  /* the ⓘ window takes the whole screen */
  dialog.infobox { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; margin: 0; }
  .infohead, .infobody, .infofoot { padding-left: 12px; padding-right: 12px; }
  .infofoot { flex-wrap: wrap; }

  /* tables scroll sideways inside their card instead of widening the page */
  table.grid, table.flow { display: block; overflow-x: auto; white-space: nowrap; }
  table.grid td, table.flow td { white-space: normal; min-width: 90px; }
  .revrow { padding: 10px 0; }
  .pagehead { align-items: flex-start; }
  .profile img, .ini.big { width: 52px; height: 52px; }
  .statrow { gap: 10px 22px; }
  .housegrid { grid-template-columns: 1fr; }
  .mailbox { align-items: flex-start; }
  #email fieldset.settings { align-items: stretch; }
  .inline input, .card .inline input { width: 100%; }
  .toast { left: 12px; right: 12px; transform: translateY(20px); text-align: center; }
  .toast.show { transform: translateY(0); }
}

@media (max-width: 380px) {
  .stone .grid3 { grid-template-columns: 1fr; }
  .lot { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .pic { width: 56px; height: 56px; }
}

/* ---------- Logs page: day headings, a calm row per line, tracebacks folded away */
.loglist { font: 14px/1.5 var(--body); }
.lday { position: sticky; top: 0; z-index: 1; padding: 8px 16px; background: var(--soft); border-bottom: 1px solid var(--line);
  font: 600 12px var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.lrow { display: grid; grid-template-columns: 72px 74px 150px minmax(0, 1fr); gap: 12px; align-items: baseline;
  padding: 9px 16px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
.lrow:last-child { border-bottom: 0; }
.lt { font: 500 12.5px var(--mono); color: var(--muted); }
.llv { justify-self: start; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.lsrc { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lm { overflow-wrap: anywhere; }
.lm details { margin-top: 4px; }
.lm summary { cursor: pointer; font-size: 12.5px; color: var(--muted); width: max-content; }
.lm pre { margin: 6px 0 0; padding: 8px 10px; max-height: 260px; overflow: auto; background: var(--soft); border-radius: 6px;
  font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
#log-filters .fl input[type=search] { min-width: 220px; }
@media (max-width: 760px) {
  .lrow { grid-template-columns: auto auto minmax(0, 1fr); gap: 4px 10px; padding: 10px 12px; }
  .lrow .lm { grid-column: 1 / -1; }
  .lday { padding: 8px 12px; }
  #log-filters .fl { width: 100%; }
  #log-filters .fl select, #log-filters .fl input { flex: 1 1 140px; min-width: 0; }
}
/* log levels carry an lv- prefix: a bare .info is the ⓘ button and squeezed every info row into a 20px circle */
.lrow.lv-warn { border-left-color: var(--warn); }
.lrow.lv-warn .llv { background: var(--warn-soft); color: var(--warn); }
.lrow.lv-error { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad-soft) 35%, transparent); }
.lrow.lv-error .llv { background: var(--bad-soft); color: var(--bad); }
.line.lv-warn { color: var(--warn); }
.line.lv-error { color: var(--bad); background: color-mix(in srgb, var(--bad-soft) 60%, transparent); }

/* ---------- main page: one summary card per house (a click shows only that house) */
.hsum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.hcardbtn { display: grid; gap: 12px; align-content: start; text-align: left; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); color: var(--fg); font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.hcardbtn:hover { border-color: var(--muted); }
.hcardbtn.on { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
.hcardbtn .logo .nm { font-size: 18px; }
.hnums { display: flex; gap: 22px; }
.hnums span { display: grid; gap: 2px; }
.hnums b { font: 600 22px var(--mono); line-height: 1; }
.hnums small { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
@media (max-width: 1000px) { .hsum { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .hsum { gap: 8px; }
  .hcardbtn { padding: 12px; gap: 10px; }
  .hnums { gap: 14px; }
  .hnums b { font-size: 19px; }
  .hcardbtn .logo .nm { font-size: 16px; }
}
@media (max-width: 380px) { .hsum { grid-template-columns: 1fr; } }

/* ---------- GIA reports read from the pictures */
.ocrbox { border: 1px solid var(--line); border-left: 3px solid var(--info); border-radius: 8px; padding: 10px 12px; background: var(--info-soft); display: grid; gap: 6px; }
.ocrbox p { margin: 0; }
.ocrbox [data-ocrclose] { justify-self: end; }
.ocrrow { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
/* the certificate picture a GIA report was read from, beside its stone (a link to the house's copy, not stored) */
.giapic { display: flex; gap: 12px; align-items: center; padding: 8px; border: 1px dashed var(--info); border-radius: 8px; background: var(--info-soft); font-size: 14px; }
.giapic img { width: 120px; height: 90px; object-fit: contain; background: var(--photo-bg); border-radius: 5px; border: 1px solid var(--line); display: block; }
.ocrrow img { width: 64px; height: 48px; object-fit: contain; background: var(--photo-bg); border-radius: 4px; border: 1px solid var(--line); display: block; }
.ocrrow > span { flex: 1; min-width: 160px; }

/* ---------- the house's pictures we keep, under the big frame */
.housepics { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.housepics:empty { display: none; }
.housepics .hp { flex: none; width: 58px; height: 58px; padding: 0; border: 2px solid var(--line); border-radius: 6px; background: var(--photo-bg); cursor: pointer; overflow: hidden; }
.housepics .hp.on { border-color: var(--accent); }
.housepics .hp img { width: 100%; height: 100%; object-fit: contain; display: block; }
#pics-status { margin: 0; }
.media .housepics, .media #pics-status { grid-column: 2; }
@media (max-width: 700px) { .media .housepics, .media #pics-status { grid-column: auto; } }
/* the big frame on the left, everything else stacked in the right column */
.media .mainpic { grid-row: 1 / span 5; align-self: start; }
.media > *:not(.mainpic):not(.cbtn) { grid-column: 2; }
@media (max-width: 700px) { .media .mainpic { grid-row: auto; } .media > *:not(.mainpic):not(.cbtn) { grid-column: auto; } }

/* ---------- article preview: the red Quality Remark, and what the draft still needs */
.preview .qremark { color: var(--remark); margin-top: 10px; }
.preview .miss { color: var(--warn); background: var(--warn-soft); border-radius: 4px; padding: 0 5px; font-weight: 600; font-size: 13px; }
.preview .pstone { padding: 2px 0 2px 10px; margin: 8px 0; border-left: 2px solid var(--line); }

/* ---------- the sale as one article (sale.js) */
.salehead h1 { margin: 8px 0 4px; }
.saletoc { position: sticky; top: 56px; z-index: 4; display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 0; background: var(--bg); }
.saletoc a { font: 500 12px var(--mono); text-decoration: none; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); background: var(--panel); }
.saletoc a.st-approved { border-color: var(--ok); color: var(--ok); }
.saletoc a.st-in_review { border-color: var(--info); color: var(--info); }
.saletoc a.st-changes { border-color: var(--warn); color: var(--warn); }
.article { display: grid; gap: 22px; max-width: 860px; }
.alotbox { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; scroll-margin-top: 110px; }
.abar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--soft); }
.abar .alot { font: 600 18px var(--display); color: var(--fg); text-decoration: none; }
.abar .grow { flex: 1; }
.averdict { display: flex; gap: 6px; flex-wrap: wrap; flex-basis: 100%; justify-content: flex-end; }
.averdict input { font: inherit; font-size: 14px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--fg); flex: 1 1 200px; max-width: 360px; }
.primary.sm { padding: 6px 12px; font-size: 13px; }
.apreview { padding: 14px 18px; font: 15px/1.6 var(--body); }
.apreview p { margin: 6px 0; }
.apreview img, .apreview video { max-width: 100%; max-height: 340px; display: block; margin: 8px 0; border-radius: 6px; }
.apreview mark { background: var(--mark); border-bottom: 2px solid var(--mark-line); color: inherit; cursor: pointer; border-radius: 2px; }
.apreview mark.on { background: var(--mark-strong); }
.atext { white-space: pre-wrap; }
.acomments { display: grid; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--bg); }
.acomments .cpnew { padding: 0; border: 0; }
.selcomment { position: fixed; z-index: 60; font: 600 13px var(--body); padding: 7px 12px; border-radius: 99px; border: 1px solid var(--mark-line);
  background: var(--panel); color: var(--fg); box-shadow: 0 6px 18px rgba(0,0,0,.18); cursor: pointer; }
@media (max-width: 760px) {
  .saletoc { top: 92px; }
  .apreview { padding: 12px; }
  .averdict input { max-width: none; }
}

/* ---------- sale article: editing a lot in place, and folding lots */
.saletools { position: sticky; top: 56px; z-index: 4; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between; background: var(--bg); padding: 8px 0; }
.saletools .saletoc { position: static; padding: 0; }
.abar .fold { width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--muted); cursor: pointer; }
.abar .fold::before { content: '▾'; display: block; font-size: 13px; line-height: 1; transition: transform .2s; }
.alotbox.folded .abar .fold::before { transform: rotate(-90deg); }
.alotbox.folded .abar { border-bottom: 0; }
.abar .ghost.on { border-color: var(--accent); color: var(--accent); }
.aedit { display: grid; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--accent-soft) 40%, var(--panel)); }
.aedit label { display: grid; gap: 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.aedit input, .aedit select, .aedit textarea { font: 15px var(--body); color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; width: 100%; text-transform: none; letter-spacing: 0; font-weight: 400; }
.aedit textarea { line-height: 1.55; resize: vertical; }
.aedit .unsaved { border-color: var(--warn); }
.estone { display: grid; gap: 6px; }
.estone > b, .escores > b { font: 600 15px var(--display); }
.egrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px 10px; }
.escores { display: grid; gap: 4px; }
.escores .esub { font-size: 13px; color: var(--muted); margin-top: 6px; }
@media (max-width: 760px) {
  .saletools { top: 92px; }
  .aedit input, .aedit select, .aedit textarea { font-size: 16px; }
  .egrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- our own dropdowns (combobox.js) instead of the browser's */
select.cbox-hidden { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; margin: 0 !important; padding: 0 !important; border: 0 !important; }
.cselect { display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; max-width: 100%; text-align: left;
  font: inherit; font-size: 15px; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s; }
.cselect > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cselect::after { content: ''; flex: none; width: 7px; height: 7px; margin: -3px 2px 0; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); }
.cselect:hover { border-color: var(--muted); }
.cselect:focus-visible, .cselect[aria-expanded="true"] { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cselect.placeholder > span { color: var(--muted); }
.cselect:disabled { opacity: .5; cursor: default; }
.card .cselect, .aedit .cselect, .fl .cselect, .revbar .cselect { width: 100%; }
.fl .cselect, .revbar .cselect { width: auto; min-width: 150px; }
.cinput:focus { outline: none; border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-soft); }
.cmenu { position: fixed; z-index: 1002; max-height: 280px; overflow-y: auto; padding: 4px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.22); font: 14px var(--body); color: var(--fg); scrollbar-width: thin; }
.cmenu[hidden] { display: none; }
.cmenu [role=option] { padding: 8px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.cmenu [role=option].on { background: var(--soft); }
.cmenu [role=option].sel { color: var(--accent); font-weight: 600; }
.cmenu [role=option].sel::after { content: ' ✓'; }
.cmenu .empty { padding: 8px 12px; color: var(--muted); }
@media (max-width: 760px) { .cselect { font-size: 16px; } .cmenu { font-size: 15px; } .cmenu [role=option] { padding: 10px 12px; } }

/* ---------- sale article: the comments panel and the lot it belongs to */
.alotbox.incomments { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
#scp .cphead { align-items: flex-start; }
#scp .cphead b { font: 600 19px var(--display); }
@media (max-width: 760px) {
  /* on a phone the panel is the whole screen, with a clear title bar and the box to write at the bottom */
  #scp { top: 0; height: 100dvh; width: 100vw; border-left: 0; box-shadow: none; }
  #scp .cphead { position: sticky; top: 0; background: var(--panel); padding: 12px; }
  #scp .cphead button { font-size: 16px; padding: 6px 12px; }
  #scp .cplist { padding: 12px; }
  #scp .cpnew { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--panel); }
  #scp .cpnew textarea { font-size: 16px; }
  #scp .cpnew .primary { width: 100%; justify-self: stretch; padding: 12px; }
  .selcomment { font-size: 15px; padding: 10px 16px; }
}
/* the locked part of the in-place editor: visible, greyed, not editable */
.aedit .elocked { display: grid; gap: 8px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.aedit .ro input:disabled { background: var(--soft); color: var(--muted); border-style: dashed; cursor: not-allowed; opacity: 1; }
.aedit .elocked .meta { margin: 0; }

/* editing mode on the sale page: the article itself, with three parts turned into fields in place */
.apreview.aedit { display: block; background: none; border-bottom: 0; padding: 14px 18px; }
.apreview.aedit .eblock { margin: 10px 0; padding: 10px 12px; border: 1px dashed var(--accent); border-radius: 8px; background: color-mix(in srgb, var(--accent-soft) 35%, transparent); display: grid; gap: 6px; }
.apreview.aedit textarea, .apreview.aedit .eremark input { font: 15px/1.6 var(--body); color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; width: 100%; resize: vertical; }
.apreview.aedit .eremark { color: var(--remark); font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 15px; }
.apreview.aedit .escores .score { border-bottom: 1px solid var(--line); }
@media (max-width: 760px) { .apreview.aedit { padding: 12px; } .apreview.aedit textarea, .apreview.aedit .eremark input { font-size: 16px; } }

/* sale page: each lot's bar (with ✏ Edit / ✓ Save) stays in view while its lot is scrolled; the heights of the top
   bar and the lot strip above it are measured by sale.js into --top and --stick */
.alotbox { overflow: clip; scroll-margin-top: calc(var(--stick, 110px) + 8px); }
.saletools { top: var(--top, 56px); }
.abar { position: sticky; top: var(--stick, 104px); z-index: 3; }
.alotbox.folded .abar { position: static; }
/* the lot strip stays above a lot's sticky bar if they ever touch */
.saletools { z-index: 6; box-shadow: 0 6px 8px -6px rgba(0,0,0,.25); }
.abar { z-index: 2; }
