:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --ink: #18202a;
  --muted: #687385;
  --line: #dfe4ea;
  --brand: #29245c;
  --brand-2: #5148a8;
  --danger: #9d2424;
  --success: #14764d;
  --warning: #8b650f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 5vw; background: #181638; color: white; }
.brand { color: white; font-size: 1.25rem; font-weight: 800; letter-spacing: .02em; }
.topbar nav { display: flex; align-items: center; gap: 20px; }
.topbar nav a, .link-button { color: white; }
.topbar form { margin: 0; }
.link-button { border: 0; background: transparent; font: inherit; cursor: pointer; padding: 0; }
.container { width: min(1180px, 92vw); margin: 32px auto 90px; }
.container.narrow { width: min(460px, 92vw); margin-top: 10vh; }
.public-container { width: min(720px, 94vw); }
.page-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
h1, h2 { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(1.7rem, 4vw, 2.4rem); }
h2 { font-size: 1.15rem; }
p { line-height: 1.55; }
.muted { color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: 0 5px 20px rgba(23, 31, 45, .04); margin-bottom: 20px; }
.login-panel { padding: 34px; }
.stack { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.search-grid { display: grid; grid-template-columns: 2fr 1fr auto; align-items: end; gap: 14px; }
label { display: grid; gap: 7px; font-size: .88rem; font-weight: 650; color: #374151; }
label.full { grid-column: 1 / -1; }
label.checkbox { display: flex; flex-direction: row; align-items: center; font-weight: 500; }
input, select, textarea, button, .button { font: inherit; }
input, select, textarea { width: 100%; border: 1px solid #cbd3dd; border-radius: 8px; padding: 10px 11px; background: white; color: var(--ink); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(81,72,168,.15); border-color: var(--brand-2); }
button, .button { border: 1px solid #c9d0da; border-radius: 8px; padding: 10px 16px; background: white; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
button:hover, .button:hover { text-decoration: none; filter: brightness(.98); }
.primary { background: var(--brand); color: white; border-color: var(--brand); }
.large { padding: 14px 20px; font-size: 1rem; }
.button-row, .inline-form { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.alert { padding: 13px 15px; border: 1px solid #ddc888; border-radius: 9px; background: #fff9df; margin: 14px 0; }
.alert.error { color: var(--danger); border-color: #e6b5b5; background: #fff0f0; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { padding: 20px; background: white; border: 1px solid var(--line); border-radius: 13px; display: grid; gap: 8px; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat strong { font-size: 1.7rem; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 13px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
td small { display: block; color: var(--muted); margin-top: 4px; }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: .75rem; font-weight: 800; text-transform: capitalize; background: #e8ebef; white-space: nowrap; }
.badge.large { font-size: .9rem; padding: 7px 12px; }
.badge.in_stock { color: #0c5f3c; background: #dff5e9; }
.badge.reserved, .badge.intake { color: #72530a; background: #fff2c7; }
.badge.sold, .badge.archived, .badge.removed { color: #5f6570; background: #e8eaed; }
.badge.damaged, .badge.returned { color: #8b1f1f; background: #f8dddd; }
.detail-grid { display: grid; grid-template-columns: minmax(220px, .65fr) 1.35fr; gap: 20px; }
.qr-panel { display: grid; place-items: center; gap: 10px; }
.qr-panel img { width: min(260px, 100%); }
.summary-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 22px; }
.summary-list div { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.summary-list span { color: var(--muted); }
.image-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; margin: 15px 0; }
.image-grid figure { margin: 0; }
.image-grid img { width: 100%; max-height: 420px; object-fit: contain; border-radius: 10px; background: #eef1f4; }
.image-grid figcaption { color: var(--muted); padding-top: 5px; text-transform: capitalize; }
.two-column, .scan-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.history > div { display: grid; gap: 3px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.history span { color: var(--muted); font-size: .85rem; }
.public-card { background: white; border: 1px solid var(--line); border-radius: 20px; padding: clamp(22px, 5vw, 44px); box-shadow: 0 12px 50px rgba(23,31,45,.08); text-align: center; }
.public-card header p { color: var(--muted); }
.eyebrow { font-weight: 900; color: var(--brand); text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; }
.public-images { grid-template-columns: repeat(2, 1fr); }
.image-placeholder { grid-column: 1 / -1; min-height: 220px; display: grid; place-items: center; border-radius: 12px; color: var(--muted); background: #edf0f4; }
.public-price { font-size: 2.5rem; font-weight: 900; margin: 16px 0 8px; }
.card-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 22px 0; text-align: left; }
.card-facts div { background: white; padding: 13px; }
.card-facts dt { color: var(--muted); font-size: .75rem; }
.card-facts dd { margin: 3px 0 0; font-weight: 700; text-transform: capitalize; }
.public-notes { text-align: left; padding: 14px; background: #f5f6f8; border-radius: 9px; }
.public-card footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 18px; color: var(--muted); font-size: .75rem; margin-top: 24px; }
.center { text-align: center; }
#reader { width: 100%; min-height: 280px; }
.mobile-nav { display: none; }

@media (max-width: 760px) {
  .topbar nav { display: none; }
  .container { width: min(94vw, 700px); margin-top: 20px; }
  .form-grid, .stat-grid, .detail-grid, .two-column, .scan-layout, .search-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .summary-list { grid-template-columns: 1fr; }
  .mobile-nav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; z-index: 20; bottom: 0; left: 0; right: 0; background: #181638; padding: 10px 6px max(10px, env(safe-area-inset-bottom)); }
  .mobile-nav a { color: white; text-align: center; font-size: .78rem; font-weight: 750; }
  .public-images { grid-template-columns: 1fr; }
  .card-facts { grid-template-columns: 1fr 1fr; }
}
