/* ============================================
   M37 Dashboard — styles
   Base: web-brand tokens (app-build/web-brand/templates/tokens.css).
   Per-client values below come from clients/m37-auction/brand-kit.md —
   never Stein defaults, never invented.
   ============================================ */

:root {
  /* Spacing scale */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;

  /* Radius scale — --radius from brand-kit corner style */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.12);

  /* Readable-width caps (MANDATORY — do not remove) */
  --readable-text: 720px;
  --readable-ui: 900px;

  /* Gutters */
  --gutter-mobile: 12px; --gutter-tablet: 24px; --gutter-desktop: 32px;

  /* Brand — from brand-kit.md. Admin Settings > Branding overrides at runtime. */
  /* 2026-09-21 (Phillip): match the live site's theme, not the kit's promo-block red. The site
     is white ground, slate greys, near-black headings and Bootstrap-blue buttons/links. */
  --primary: #007BFF;
  --primary-dark: #0062CC;
  --accent: #E7F3FF;
  --border: #E2E8F0;
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --text: #0F172A;
  --text-muted: #475569;
  --success: #27AE60;
  --error: #C0392B;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; /* the site sets no heading face */

  --sidebar-w: 240px;
  --topbar-h: 60px;
  /* Shell content cap. Wider than --readable-ui because a dashboard holds data
     tables, not prose — the sidebar already eats 240px. Prose inside stays
     capped at --readable-text via .page-intro and .card-text (see below), so
     the readable-width rule is honored where it actually matters: line length. */
  --shell-max: 1280px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { font-family: var(--font-display); color: var(--text); font-weight: 700; }

.readable { max-width: var(--readable-text); margin: 0 auto; padding: 0 var(--gutter-desktop); width: 100%; }
.readable-wide { max-width: var(--readable-ui); margin: 0 auto; padding: 0 var(--gutter-desktop); width: 100%; }
@media (max-width: 900px) { .readable, .readable-wide { padding: 0 var(--gutter-tablet); } }
@media (max-width: 600px) { .readable, .readable-wide { padding: 0 var(--gutter-mobile); } }

button, a.btn, [role="button"] { min-height: 44px; min-width: 44px; }

/* ---------- Header ---------- */
.topbar {
  height: var(--topbar-h);
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-4);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-md);
}
.topbar-logo { height: 34px; width: auto; border-radius: var(--radius-sm); }
/* brand-kit.md: the wordmark exists only as black-on-transparent and must never be inverted,
   so on the red bar it sits on a white chip instead. */
.topbar-logo { height: 36px; background: #fff; padding: 3px 8px; } /* black wordmark on a white chip; the kit forbids inverting the PNG */
.topbar-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-who { font-size: 13px; opacity: 0.85; white-space: nowrap; }
@media (max-width: 600px) { .topbar-who { display: none; } }
.hamburger { display: none; background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; }
.btn-ghost { background: none; border: 1px solid rgba(255,255,255,0.5); color: #fff; border-radius: var(--radius-sm); padding: 6px 14px; font-family: var(--font); font-size: 13px; cursor: pointer; }
.btn-ghost:hover { background: rgba(255,255,255,0.15); }

/* ---------- Layout ---------- */
.layout { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: var(--sidebar-w);
  background: #F8FAFC;
  border-right: 1px solid var(--border);
  padding: var(--sp-5) 0;
  display: flex; flex-direction: column;
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  flex-shrink: 0;
}
.nav-list { list-style: none; flex: 1; }
.nav-list a {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  color: var(--text); text-decoration: none; font-size: 14.5px;
  border-left: 3px solid transparent;
}
.nav-list a:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.nav-list a.active {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--primary) 9%, transparent);
  font-weight: 600; color: var(--primary);
}

.sidebar-contact {
  border-top: 1px solid rgba(0,0,0,0.07);
  padding: var(--sp-4) var(--sp-5) 0;
}
.contact-head { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: var(--sp-2); }
.contact-link {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 13.5px; color: var(--primary); text-decoration: none;
  padding: var(--sp-2) 0; background: none; border: 0; cursor: pointer;
  font-family: var(--font); text-align: left; width: 100%;
}
.contact-link:hover { color: var(--accent); }

.sidebar-scrim { display: none; }

/* ---------- Content ---------- */
.content { padding: var(--sp-6) var(--gutter-desktop); flex: 1; max-width: var(--shell-max); margin: 0 auto; width: 100%; }
/* Text-only cards keep prose at a readable line length. Data cards (tables,
   scoreboards, forms) use the full width. */
.card-text { max-width: var(--readable-text); }
.page { display: none; }
.page.active { display: block; }
.page h1 { font-size: 26px; margin-bottom: var(--sp-2); }
.page-intro { color: var(--text-muted); margin-bottom: var(--sp-5); max-width: var(--readable-text); }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: var(--sp-5);
  margin-bottom: var(--sp-5);
}
.card h2 { font-size: 18px; margin-bottom: var(--sp-3); }

.btn-primary {
  background: var(--primary); color: #fff; border: 0;
  border-radius: var(--radius-sm); padding: 12px 22px;
  font-family: var(--font); font-size: 15px; font-weight: 600; cursor: pointer;
  width: 100%;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }

/* ---------- Team page (staff + permissions) ---------- */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.card-head h2 { margin: 0; }

.invite-form { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.invite-form input, .invite-form select {
  flex: 1 1 160px; min-width: 0; padding: 10px 12px; font-family: var(--font); font-size: 14px;
  border: 1px solid rgba(0,0,0,0.15); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
.btn-inline { width: auto; flex: 0 0 auto; padding: 10px 18px; font-size: 14px; }
.invite-result:not(:empty) { margin-top: var(--sp-3); }
.invite-ok { background: color-mix(in srgb, var(--success) 8%, transparent); border-radius: var(--radius-sm); padding: var(--sp-3); }
.invite-ok p { margin: 0 0 var(--sp-2); font-size: 14px; }
.invite-link { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.invite-link code {
  flex: 1 1 240px; background: var(--surface); border: 1px solid rgba(0,0,0,0.12);
  border-radius: var(--radius-sm); padding: 9px 11px; font-size: 12.5px; word-break: break-all;
}
.invite-err { color: var(--error); font-size: 13.5px; margin-top: var(--sp-2); }
.fine { font-size: 12.5px; color: var(--text-muted); margin-top: var(--sp-3); line-height: 1.5; }
.login-help { text-align: center; }

.team-row { border-top: 1px solid rgba(0,0,0,0.08); padding: var(--sp-4) 0; }
.team-row:first-child { border-top: 0; padding-top: 0; }
.team-row.is-off { opacity: 0.55; }
.team-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.team-name { font-weight: 700; font-size: 15px; }
.team-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.team-actions { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.role-select, .perm-select {
  padding: 8px 10px; font-family: var(--font); font-size: 13px; color: var(--text);
  border: 1px solid rgba(0,0,0,0.15); border-radius: var(--radius-sm); background: var(--surface);
}
.perm-select.is-override { border-color: var(--accent); border-width: 2px; font-weight: 600; }
.tag-off {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700;
  background: rgba(0,0,0,0.08); color: var(--text-muted); padding: 2px 7px; border-radius: 999px; vertical-align: middle;
}
.btn-danger {
  background: none; border: 1px solid var(--error); color: var(--error);
  border-radius: var(--radius-sm); padding: 8px 14px; font-family: var(--font); font-size: 13px; cursor: pointer;
}
.btn-danger:hover { background: color-mix(in srgb, var(--error) 10%, transparent); }
.btn-link {
  background: none; border: 0; color: var(--primary); text-decoration: underline;
  font-family: var(--font); font-size: 13px; cursor: pointer; padding: 0; min-height: 0; min-width: 0;
}
.invite-pending {
  margin-top: var(--sp-2); font-size: 13px; color: var(--text-muted);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-radius: var(--radius-sm); padding: 8px 11px;
  display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap;
}
.team-perms { margin-top: var(--sp-3); }
.team-perms summary { cursor: pointer; font-size: 13px; color: var(--primary); font-weight: 600; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--sp-3); margin-top: var(--sp-3); }
.perm { display: flex; flex-direction: column; gap: 4px; }
.perm-name { font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); }
.view-only-note {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-radius: var(--radius-sm); padding: 10px 13px; font-size: 13.5px; margin-bottom: var(--sp-4);
}
@media (max-width: 600px) {
  .invite-form input, .invite-form select, .btn-inline { flex: 1 1 100%; }
  .team-head { flex-direction: column; }
}

/* ---------- Footer ---------- */
.footer { padding: var(--sp-5); text-align: center; font-size: 12.5px; color: var(--text-muted); }
.stealth-link { color: inherit; text-decoration: none; }

/* ---------- Login page ---------- */
.login-body { justify-content: center; align-items: center; padding: var(--sp-4); }
.login-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border-top: 5px solid var(--primary);
  box-shadow: var(--shadow-lg);
  max-width: 420px; width: 100%; padding: var(--sp-7) var(--sp-6);
  text-align: center;
}
.login-logo { max-height: 60px; max-width: 220px; margin-bottom: var(--sp-4); }
.login-card h1 { font-size: 22px; margin-bottom: var(--sp-2); }
.login-sub { color: var(--text-muted); font-size: 14px; margin-bottom: var(--sp-5); }
.login-card input {
  width: 100%; padding: 12px 14px; font-size: 15px; font-family: var(--font);
  border: 1px solid rgba(0,0,0,0.15); border-radius: var(--radius-sm);
  margin-bottom: var(--sp-3);
}
.login-err { color: var(--error); font-size: 13px; min-height: 18px; margin-bottom: var(--sp-2); }
.login-foot { position: fixed; bottom: var(--sp-4); left: 0; right: 0; text-align: center; font-size: 12px; color: var(--text-muted); }

/* ---------- Secure key-drop widget ---------- */
.sdw-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 9000;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--primary); color: #fff; border: 2px solid #fff;
  font-size: 22px; cursor: pointer; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s, box-shadow 0.12s;
}
.sdw-fab:hover { transform: translateY(-2px); }
.sdw-fab-tip {
  position: fixed; right: 84px; bottom: 33px; z-index: 9000;
  background: var(--primary); color: #fff; font-size: 12.5px;
  padding: 6px 12px; border-radius: var(--radius-sm); white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
  font-family: var(--font);
}
.sdw-fab:hover + .sdw-fab-tip { opacity: 1; }
.sdw-overlay {
  position: fixed; inset: 0; z-index: 9100;
  background: color-mix(in srgb, var(--primary) 45%, transparent);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.sdw-overlay.open { display: flex; }
.sdw-modal {
  background: var(--surface); border-top: 5px solid var(--primary);
  border-radius: var(--radius); max-width: 480px; width: 100%;
  padding: 24px 26px; font-family: var(--font); color: var(--text);
  box-shadow: var(--shadow-lg); position: relative;
}
.sdw-modal h3 { font-size: 19px; margin: 0 0 8px; }
.sdw-modal p { font-size: 13.5px; line-height: 1.5; color: var(--text-muted); margin: 0 0 14px; }
.sdw-close { position: absolute; top: 12px; right: 14px; border: 0; background: none; font-size: 20px; color: var(--text-muted); cursor: pointer; line-height: 1; min-height: 0; min-width: 0; }
.sdw-modal input, .sdw-modal textarea {
  width: 100%; box-sizing: border-box; border: 1px solid rgba(0,0,0,0.15);
  border-radius: var(--radius-sm); padding: 11px 13px; font-family: inherit;
  font-size: 14px; margin-bottom: 10px;
}
.sdw-modal textarea { min-height: 110px; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.sdw-send {
  width: 100%; padding: 12px; border: 0; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--primary); color: #fff; font-family: var(--font);
  font-size: 15px; font-weight: 600;
}
.sdw-send:hover { background: var(--primary-dark); }
.sdw-send:disabled { opacity: 0.6; cursor: wait; }
.sdw-done { display: none; text-align: center; padding: 10px 0 4px; }
.sdw-done.show { display: block; }
.sdw-done .big { font-size: 34px; }
.sdw-done p { color: var(--success); font-size: 14px; margin-top: 8px; }
.sdw-err { display: none; color: var(--error); font-size: 12.5px; margin: -2px 0 10px; line-height: 1.4; }
.sdw-err.show { display: block; }
.sdw-fine { font-size: 12px; color: var(--text-muted); margin: 0 0 12px; line-height: 1.45; }

/* ---------- Responsive: sidebar → hamburger drawer ---------- */
@media (max-width: 900px) {
  .hamburger { display: block; }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
    transform: translateX(-100%); transition: transform 0.2s ease;
    z-index: 200; box-shadow: var(--shadow-lg); height: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim {
    display: none; position: fixed; inset: var(--topbar-h) 0 0 0;
    background: rgba(0,0,0,0.35); z-index: 150;
  }
  .sidebar-scrim.show { display: block; }
  .content { padding: var(--sp-5) var(--gutter-tablet); }
}
@media (max-width: 600px) {
  .content { padding: var(--sp-4) var(--gutter-mobile); }
  #lc-review-card .card-head h2 { flex: 1 1 100%; }
  .topbar-title { display: none; }
  .sdw-fab { right: 14px; bottom: 14px; }
  .topbar-title { font-size: 15px; }
}

/* ---------- Listing Creator page (pulled in 2026-09-18 from the standalone
   listing-creator build; re-tokened onto the shell's variables per the scaffold's
   Phase 3.5). Everything is scoped under #page-listings / .lc-* so it cannot leak
   into the other pages. ---------- */
#page-listings .lc-status { font-size: 13px; color: var(--text-muted); margin: -12px 0 var(--sp-4); }
#page-listings .lc-status.ok { color: var(--success); }
#page-listings .lc-status.bad { color: var(--error); }
.lc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.lc-card { margin-bottom: var(--sp-5); }
.lc-form label, .lc-lot label { display: block; font-size: 13px; color: var(--text-muted); margin: var(--sp-2) 0; }
.lc-form input, .lc-form select, .lc-form textarea, .lc-lot input, .lc-lot select, .lc-lot textarea {
  display: block; width: 100%; margin-top: 3px; padding: 8px 10px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid rgba(0,0,0,0.15); border-radius: var(--radius-sm);
}
.lc-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--sp-3); }
.lc-mic-wrap { position: relative; }
.lc-mic-wrap textarea { padding-right: 48px; }
.lc-mic { position: absolute; right: 6px; bottom: 6px; width: 36px; height: 36px; min-width: 0; min-height: 0; border: 1px solid rgba(0,0,0,0.15); background: var(--surface); border-radius: var(--radius-sm); cursor: pointer; }
.lc-mic.recording { background: var(--primary); color: #fff; animation: lc-pulse 1s infinite; }
@keyframes lc-pulse { 50% { opacity: .55; } }
.lc-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-top: var(--sp-3); }
.lc-btn { background: var(--surface); border: 1px solid var(--primary-dark); color: var(--primary-dark); border-radius: var(--radius-sm); padding: 10px 16px; font: 600 14px var(--font); cursor: pointer; }
.lc-btn.ghost { border-color: rgba(0,0,0,0.15); color: var(--text-muted); }
.lc-btn:disabled, .btn-primary.btn-inline:disabled { opacity: .5; cursor: not-allowed; }
.lc-picker { padding: 9px 10px; border: 1px solid rgba(0,0,0,0.15); border-radius: var(--radius-sm); font: inherit; background: var(--surface); }
.lc-file-label input { display: none; }
.lc-file-btn { display: inline-block; cursor: pointer; }
.lc-current { margin-top: var(--sp-3); padding: var(--sp-2) var(--sp-3); background: var(--accent); border: 1px solid var(--primary); border-radius: var(--radius-sm); font-size: 13px; }
.lc-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--sp-2) 0; }
.lc-thumbs img, .lc-lot-photos img { width: 72px; height: 72px; object-fit: cover; border: 1px solid rgba(0,0,0,0.12); border-radius: var(--radius-sm); background: var(--surface); }
.lc-thumbs .n, .lc-lot-photos .n { position: relative; display: inline-block; line-height: 0; }
.lc-thumbs .n::after, .lc-lot-photos .n::after { content: attr(data-i); position: absolute; left: 3px; top: 3px; background: var(--text); color: #fff; font-size: 10px; padding: 1px 4px; border-radius: 3px; }
.lc-lots { display: flex; flex-direction: column; gap: var(--sp-3); }
.lc-lot { display: grid; grid-template-columns: 160px 1fr; gap: var(--sp-3); background: var(--surface); border: 1px solid rgba(0,0,0,0.12); border-radius: var(--radius); padding: var(--sp-3); }
.lc-lot.approved { border-color: var(--success); }
.lc-lot.failed { border-color: var(--error); }
.lc-lot-photos { display: flex; flex-wrap: wrap; gap: 4px; align-content: start; }
.lc-lot-photos img.hero { width: 152px; height: 152px; }
.lc-lot label.lc-check { display: inline-flex; align-items: center; gap: 6px; }
.lc-lot label.lc-check input { width: auto; display: inline; margin: 0; }
.lc-count { float: right; font-variant-numeric: tabular-nums; }
.lc-count.over { color: var(--error); font-weight: 700; }
.lc-gates, .lc-flags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.lc-chip { font-size: 12px; padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(0,0,0,0.12); background: var(--bg); color: var(--text-muted); }
.lc-chip.block { border-color: var(--error); color: var(--error); background: color-mix(in srgb, var(--error) 8%, transparent); }
.lc-chip.warn { border-color: #B7791F; color: #B7791F; background: #fffbeb; }
.lc-chip.ok { border-color: var(--success); color: var(--success); background: color-mix(in srgb, var(--success) 8%, transparent); }
.lc-chip.human { border-color: var(--primary-dark); color: var(--primary-dark); background: var(--accent); font-weight: 600; }
.lc-lot-status { font: 600 13px var(--font-display); text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
.lc-preview { grid-column: 1 / -1; width: 100%; height: 520px; border: 1px solid rgba(0,0,0,0.12); border-radius: var(--radius-sm); background: #fff; }
@media (max-width: 900px) {
  .lc-grid { grid-template-columns: 1fr; }
  .lc-lot { grid-template-columns: 1fr; }
  .lc-lot-photos .n:first-child { flex: 1 1 100%; }
  .lc-lot-photos img.hero { width: 100%; height: auto; max-height: 260px; object-fit: contain; }
}
