:root {
  --bg: #f4f1ea;
  --paper: #ffffff;
  --paper-soft: #fbf9f4;
  --ink: #13212e;
  --ink-2: #33465a;
  --muted: #72808d;
  --line: #e1dbcf;
  --line-strong: #cfc6b5;
  --navy: #0d2a40;
  --navy-2: #16465f;
  --copper: #b5651d;
  --copper-soft: #f8ead8;
  --green: #1f7a55;
  --green-soft: #e5f3ec;
  --amber: #9a6415;
  --amber-soft: #fbf0dc;
  --red: #a33a2b;
  --red-soft: #f9e7e3;
  --blue: #2a78d6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(19, 33, 46, .04), 0 10px 28px rgba(19, 33, 46, .05);
  --sans: "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--copper); }

.app-header {
  background: linear-gradient(135deg, #081725, #0d2a40 60%, #143f54);
  color: #f7f3ea;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 16px rgba(8, 23, 37, .22);
}
.header-inner {
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 26px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: #f1b968; color: #1d160d;
  font-weight: 800; font-size: 17px;
}
.brand-text { font-weight: 700; letter-spacing: .02em; line-height: 1.2; }
.brand-en { display: block; font-size: 9px; letter-spacing: .16em; color: rgba(255,255,255,.52); font-weight: 500; margin-top: 2px; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  border: 0; background: transparent; color: rgba(247, 243, 234, .62);
  padding: 8px 13px; border-radius: 999px; font-size: 13px;
  transition: background .15s, color .15s;
}
.tab:hover { color: #fff; background: rgba(255,255,255,.08); }
.tab.active { color: #1d160d; background: #f1b968; font-weight: 700; }
.header-status { font-size: 10px; letter-spacing: .08em; color: rgba(247,243,234,.48); display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #45c08a; box-shadow: 0 0 0 3px rgba(69,192,138,.15); }

.app-main { max-width: 1480px; margin: 0 auto; padding: 26px 24px 60px; }
.view { display: none; }
.view.active { display: block; }

.page-head {
  display: flex; justify-content: space-between; gap: 30px; align-items: flex-end;
  margin: 6px 0 22px;
}
.eyebrow { font-size: 10px; letter-spacing: .18em; color: var(--copper); font-weight: 700; }
.page-head h1 { margin: 6px 0 5px; font-size: 27px; line-height: 1.3; color: var(--ink); letter-spacing: -.01em; }
.page-head p { margin: 0; color: var(--muted); max-width: 760px; font-size: 13px; }
.page-head-badges { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.panel + .panel { margin-top: 16px; }
.panel-title {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13px; font-weight: 700; color: var(--ink);
  margin-bottom: 13px;
}
.panel-title.spaced { margin-top: 22px; }
.micro { font-size: 10px; color: #9a8e7a; font-weight: 400; letter-spacing: .02em; }
.muted { color: var(--muted); font-size: 12px; }
.section-label { font-size: 10px; font-weight: 700; letter-spacing: .1em; color: #9a8e7a; text-transform: uppercase; margin: 17px 0 8px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 9px; font-size: 10.5px; color: var(--ink-2);
  background: #fff; white-space: nowrap;
}
.badge-navy { background: var(--navy); color: #f7f3ea; border-color: transparent; }
.badge-green { background: var(--green-soft); color: var(--green); border-color: #c7e4d6; }
.badge-amber { background: var(--amber-soft); color: var(--amber); border-color: #ead4ac; }
.badge-red { background: var(--red-soft); color: var(--red); border-color: #eccac3; }
.badge-blue { background: #eaf2fc; color: #1b5a9f; border-color: #cbdcf2; }

.btn {
  border: 1px solid transparent; border-radius: 9px;
  padding: 9px 14px; font-size: 12.5px; font-weight: 650;
  background: #f1ece2; color: var(--ink);
  transition: transform .12s, background .15s, border-color .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--navy); color: #f8f4ea; }
.btn.primary:hover { background: #174763; }
.btn.ghost { background: transparent; border-color: var(--line-strong); color: var(--ink-2); }
.btn.danger { color: var(--red); border-color: #e0bdb5; }
.btn.full { width: 100%; margin-top: 9px; }
.btn.small { padding: 5px 9px; font-size: 11px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.mini { border: 0; background: #f2ede3; color: var(--ink-2); font-size: 10px; border-radius: 6px; padding: 3px 7px; }

.field { display: block; margin-bottom: 11px; }
.field span { display: block; font-size: 10.5px; color: #7d6d56; margin-bottom: 4px; font-weight: 600; }
.field input, .field select {
  width: 100%; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; padding: 8px 10px; color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus { border-color: #b9a98e; box-shadow: 0 0 0 3px rgba(181,101,29,.08); }
.field.compact { margin-bottom: 12px; }
.inline-select { display: flex; align-items: center; gap: 7px; font-size: 10.5px; color: var(--muted); font-weight: 400; }
.inline-select select { border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; background: #fff; color: var(--ink); font-size: 10.5px; max-width: 260px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 10.5px; color: #8c7f6b; line-height: 1.55; margin: 4px 0 12px; }
.setup-panel .micro { margin: 10px 0 0; line-height: 1.55; }

.buyer-grid {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}
.chat-panel {
  display: flex; flex-direction: column;
  min-height: 680px; height: calc(100vh - 220px);
  max-height: 900px;
  padding: 0;
  overflow: hidden;
}
.chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line); background: #fbf9f4;
}
.chat-head b { display: block; font-size: 13px; color: var(--ink); }
.chat-head span { display: block; font-size: 10.5px; color: var(--muted); }
.messages { flex: 1; overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; background: #fff; }
.empty-state { margin: auto; text-align: center; color: #9a8e7a; max-width: 320px; }
.empty-icon { font-size: 34px; opacity: .35; margin-bottom: 8px; }
.empty-state p { font-size: 12px; line-height: 1.7; margin: 0; }

.msg { max-width: 84%; padding: 10px 13px; border-radius: 12px; font-size: 12.8px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.msg-ai { align-self: flex-start; background: var(--navy); color: #f7f3ea; border-bottom-left-radius: 4px; }
.msg-buyer { align-self: flex-end; background: #edf2f6; color: #263646; border-bottom-right-radius: 4px; }
.msg-system { align-self: center; background: var(--amber-soft); color: #78541c; border: 1px dashed #dfc493; font-size: 10.8px; max-width: 92%; text-align: center; }
.msg-rep { align-self: flex-start; background: #e8f4ee; color: #1f5b42; border-bottom-left-radius: 4px; }
.msg-time { display: block; font-size: 9px; opacity: .5; margin-top: 4px; }
.msg-products { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.msg-product { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.16); border-radius: 6px; padding: 4px 7px; font-size: 9.5px; }
.product-strip { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.product-chip { border: 1px solid #e6dfd2; background: #fbf8f2; border-radius: 8px; padding: 7px 9px; font-size: 10.5px; color: var(--ink-2); }
.product-chip b { display: block; color: var(--ink); font-size: 11px; }

.quick-row { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 14px 0; border-top: 1px solid var(--line); background: #fbf9f4; }
.chip { border: 1px solid #ddd4c4; background: #fff; color: #6e604b; border-radius: 999px; padding: 5px 9px; font-size: 10.5px; }
.chip:hover { border-color: var(--copper); color: var(--copper); }
.composer { display: flex; gap: 8px; padding: 10px 14px 14px; background: #fbf9f4; }
.composer input { flex: 1; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; outline: none; background: #fff; }
.composer input:focus { border-color: #b9a98e; }
.composer .btn { padding: 9px 18px; }

.deal-room { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; }
.action-stack { display: flex; flex-direction: column; gap: 7px; }
.kv-list { display: flex; flex-direction: column; gap: 5px; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; padding: 5px 0; border-bottom: 1px dashed #eee8dc; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { color: var(--ink); font-weight: 600; text-align: right; }

.quote-card { border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; margin-bottom: 7px; background: #fdfcf9; }
.quote-card:last-child { margin-bottom: 0; }
.quote-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.quote-top b { font-size: 11.5px; color: var(--ink); }
.quote-price { color: var(--copper); font-weight: 800; font-size: 13px; white-space: nowrap; }
.quote-meta { font-size: 10px; color: var(--muted); margin-top: 2px; }
.quote-cert { display: inline-block; background: #eef4ee; color: #3f6b51; border-radius: 4px; padding: 1px 5px; font-size: 9px; margin-right: 4px; }

.supplier-pill { display: inline-flex; align-items: center; gap: 5px; border: 1px solid #e4dccd; border-radius: 999px; padding: 3px 8px; font-size: 10px; margin: 2px 4px 2px 0; background: #fff; }
.supplier-pill b { color: var(--ink); }
.consent-banner { background: var(--amber-soft); border: 1px solid #ead4ac; border-radius: 10px; padding: 10px; margin-bottom: 7px; }
.consent-banner p { margin: 0 0 8px; font-size: 10.8px; line-height: 1.55; color: #6f4d18; }
.consent-actions { display: flex; gap: 6px; }
.handoff-card { background: #eef4ff; border: 1px solid #d3e0f4; border-radius: 10px; padding: 10px; font-size: 11px; }
.handoff-card b { color: #1c4f82; }
.handoff-card .muted { margin-top: 3px; }
.contact-hidden { background: #f6f2e9; border: 1px dashed #d8cdb9; border-radius: 9px; padding: 9px; font-size: 10.5px; color: #7d6d56; }
.contact-revealed { background: var(--green-soft); border: 1px solid #c7e4d6; border-radius: 9px; padding: 9px; font-size: 11px; color: #1f5b42; word-break: break-all; }
.contact-revealed b { display: block; margin-bottom: 3px; }

.rep-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.rep-list-panel { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; }
.handoff-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 7px; cursor: pointer; background: #fdfcf9; transition: border-color .15s, background .15s; }
.handoff-item:hover { border-color: #c8b89e; background: #fff; }
.handoff-item.active { border-color: var(--copper); background: #fdf6eb; }
.handoff-item b { display: block; font-size: 11.5px; color: var(--ink); }
.handoff-item .meta { font-size: 9.5px; color: var(--muted); margin-top: 3px; }
.rep-chat-panel { min-height: 650px; display: flex; flex-direction: column; }
#rep-conversation { flex: 1; }
.rep-messages { display: flex; flex-direction: column; gap: 9px; max-height: 520px; overflow: auto; padding: 4px 2px; }
.rep-header { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 12px; }
.rep-header h2 { margin: 0; font-size: 17px; color: var(--ink); }
.rep-header p { margin: 2px 0 0; font-size: 10.5px; color: var(--muted); }
.rep-action-panel { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; }
.deal-form { border-top: 1px dashed var(--line); padding-top: 11px; margin-top: 11px; }
.deal-form .field { margin-bottom: 8px; }
.commission-box { background: #f7f5ef; border: 1px solid #e5ded0; border-radius: 9px; padding: 10px; margin-top: 9px; font-size: 11px; }
.commission-box .kv { font-size: 10.5px; }

.security-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.security-grid .panel:nth-child(4) { grid-column: 2 / -1; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.summary-card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 15px 17px; box-shadow: var(--shadow); }
.summary-card b { display: block; font-size: 24px; line-height: 1.2; color: var(--ink); }
.summary-card span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.summary-card em { display: block; font-style: normal; font-size: 9.5px; color: #9a8e7a; margin-top: 2px; }

.admin-supplier { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; background: #fdfcf9; }
.supplier-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.supplier-head h3 { margin: 0; font-size: 14px; color: var(--ink); }
.supplier-head p { margin: 2px 0 0; font-size: 10.5px; color: var(--muted); }
.supplier-stats { display: flex; gap: 8px; flex-wrap: wrap; margin: 9px 0; }
.stat-chip { background: #f4f0e8; border: 1px solid #e4dccd; border-radius: 7px; padding: 4px 8px; font-size: 10px; color: #6e604b; }
.stat-chip b { color: var(--ink); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px dashed #e9e2d6; }
.switch-row label { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-2); }
.switch-row input[type="checkbox"] { accent-color: var(--copper); width: 15px; height: 15px; }
.deposit-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.deposit-form input, .deposit-form select { border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; font-size: 10.5px; background: #fff; }
.deposit-form input[type="number"] { width: 100px; }
.inventory-box { margin-top: 10px; }
.inventory-box textarea { width: 100%; min-height: 110px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font-family: var(--mono); font-size: 10.5px; line-height: 1.55; background: #fff; outline: none; resize: vertical; }
.inventory-box textarea:focus { border-color: #b9a98e; }
.inventory-result { margin-top: 7px; font-size: 10.5px; color: var(--muted); }
.connector-card { border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; margin-bottom: 7px; background: #fdfcf9; }
.connector-card b { font-size: 11px; color: var(--ink); }
.connector-card .meta { font-size: 9.5px; color: var(--muted); margin: 2px 0 5px; }
.connector-card code { display: block; font-family: var(--mono); font-size: 9.5px; background: #f3efe6; border: 1px solid #e6dfd2; border-radius: 6px; padding: 5px 7px; word-break: break-all; color: #5c4a32; }
.connector-card .connector-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.connector-form { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.connector-form select, .connector-form input { border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; font-size: 10.5px; background: #fff; }
.connector-form input { flex: 1; min-width: 140px; }
.products-list { margin-top: 10px; border-top: 1px dashed #e9e2d6; padding-top: 8px; }
.product-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 10.5px; border-bottom: 1px dashed #efe9dd; }
.product-row:last-child { border-bottom: 0; }
.product-row .product-name { color: var(--ink); font-weight: 600; }
.product-row .product-meta { color: var(--muted); font-size: 9.5px; }
.product-row label { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.product-row .select-box { flex: 0 0 auto; }
.product-row .product-main { flex: 1; min-width: 0; }
.product-row .product-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.product-row .product-actions label { font-size: 9.5px; }
.product-editor { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; margin-top: 10px; background: #fdfcf9; }
.product-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.product-editor-head b { font-size: 11.5px; color: var(--ink); }
.product-editor .field { margin-bottom: 8px; }
.product-editor .field input, .product-editor .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; font-size: 10.5px; background: #fff; outline: none; font-family: inherit; }
.product-editor .field textarea { resize: vertical; line-height: 1.5; }
.product-editor .field input:focus, .product-editor .field textarea:focus { border-color: #b9a98e; box-shadow: 0 0 0 3px rgba(181, 101, 29, .08); }
.product-editor .field input:disabled { background: #f3efe6; color: var(--muted); }
.product-editor .field-row { gap: 8px; }
.product-editor-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.product-editor-foot .btn { margin-left: auto; }
.checkbox-line { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--ink-2); white-space: nowrap; }
.checkbox-line input[type="checkbox"] { accent-color: var(--copper); width: 14px; height: 14px; }
.batch-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding: 8px 10px; border: 1px dashed #ddd3c2; border-radius: 9px; background: #faf7f1; }
.batch-bar select { border: 1px solid var(--line); border-radius: 7px; padding: 5px 7px; font-size: 10.5px; background: #fff; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.data-table th { background: #f3efe6; color: var(--ink); text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; font-weight: 650; }
.data-table td { padding: 7px 9px; border-bottom: 1px solid #eee8dc; vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rfq-block { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 9px; overflow: hidden; }
.rfq-head { display: flex; justify-content: space-between; gap: 10px; background: #f8f5ee; padding: 8px 11px; font-size: 10.5px; color: var(--muted); }
.rfq-head b { color: var(--ink); }
.audit-list { display: flex; flex-direction: column; gap: 5px; max-height: 420px; overflow: auto; }
.audit-row { display: grid; grid-template-columns: 130px 1fr 130px; gap: 8px; font-size: 10px; color: var(--muted); border-bottom: 1px dashed #eee8dc; padding: 5px 0; }
.audit-row b { color: var(--ink-2); font-weight: 600; }

.toast {
  position: fixed; right: 24px; top: 78px; transform: translateY(-10px);
  background: var(--navy); color: #f7f3ea; border-radius: 9px;
  padding: 10px 16px; font-size: 12px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 100; max-width: min(420px, 90vw);
  box-shadow: 0 10px 30px rgba(8,23,37,.24);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }

@media (max-width: 1180px) {
  .buyer-grid, .rep-grid { grid-template-columns: 250px minmax(0, 1fr); }
  .deal-room, .rep-action-panel { grid-column: 1 / -1; position: static; max-height: none; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .header-inner { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .header-status { margin-left: auto; }
  .app-main { padding: 18px 14px 50px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .buyer-grid, .rep-grid { grid-template-columns: 1fr; }
  .chat-panel { height: 70vh; min-height: 520px; }
  .deal-room, .rep-list-panel, .rep-action-panel { position: static; max-height: none; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .security-grid { grid-template-columns: 1fr; }
  .security-grid .panel:nth-child(4) { grid-column: auto; }
  .page-head h1 { font-size: 22px; }
  .toast { left: 12px; right: 12px; top: 70px; max-width: none; }
  .audit-row { grid-template-columns: 1fr; gap: 2px; }
}
@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .summary-grid { grid-template-columns: 1fr; }
  .msg { max-width: 92%; }
  .page-head-badges { display: none; }
}

.mfa-secret {
  background: #f3efe6;
  border: 1px solid #e4dccd;
  border-radius: 9px;
  padding: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: #5c4a32;
  word-break: break-all;
  margin: 8px 0;
}
.recovery-codes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  background: #fdf6e9;
  border: 1px solid #ead4ac;
  border-radius: 9px;
  padding: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: #6f4d18;
}
.session-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border-bottom: 1px dashed var(--line);
  padding: 7px 0;
  font-size: 10.5px;
}
.session-row:last-child { border-bottom: 0; }
.session-row .meta { color: var(--muted); font-size: 9.5px; }

/* ============================================================
   Public buyer shell / role entries
   ============================================================ */
[hidden] { display: none !important; }
body { overflow-x: hidden; }

.public-shell { min-height: 100vh; display: flex; flex-direction: column; }
.public-header {
  background: linear-gradient(135deg, #081725, #0d2a40 60%, #143f54);
  color: #f7f3ea;
  position: sticky; top: 0; z-index: 40;
  box-shadow: 0 2px 16px rgba(8, 23, 37, .22);
}
.public-header-inner {
  max-width: 1480px; margin: 0 auto; padding: 0 24px; min-height: 64px;
  display: flex; align-items: center; gap: 22px;
}
.public-nav { margin-left: auto; display: flex; align-items: center; gap: 3px; }
.public-nav a {
  color: rgba(247, 243, 234, .68); text-decoration: none; font-size: 12.5px;
  padding: 7px 11px; border-radius: 999px; white-space: nowrap;
}
.public-nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.public-role-btn { color: #f1b968; border-color: rgba(241, 185, 104, .38); }
.public-main { width: 100%; max-width: 1480px; margin: 0 auto; padding: 26px 24px 60px; flex: 1; }
.public-footer {
  width: 100%; max-width: 1480px; margin: 0 auto; padding: 18px 24px 30px;
  display: flex; justify-content: space-between; gap: 12px;
  color: #8c7f6b; font-size: 10.5px;
}
.public-footer-links { display: flex; gap: 14px; }
.public-footer a { color: var(--copper); text-decoration: none; }

/* ============================================================
   Role gate
   ============================================================ */
.role-gate {
  min-height: 100vh; padding: 40px 20px;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(900px 500px at 12% 0%, #fdf6e9, transparent 60%), var(--bg);
}
.role-gate-inner { width: min(1020px, 100%); }
.role-gate .brand { color: var(--ink); margin-bottom: 38px; }
.dark-brand .brand-en { color: #9a8e7a; }
.role-gate h1 { font-size: 34px; line-height: 1.25; color: var(--ink); margin: 8px 0 8px; letter-spacing: -.02em; }
.role-gate p { margin: 0; color: var(--muted); font-size: 13px; }
.role-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 26px 0 24px; }
.role-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding: 22px; border: 1px solid var(--line); border-radius: 16px;
  background: #fff; color: var(--ink-2); text-decoration: none;
  box-shadow: var(--shadow); transition: transform .15s, border-color .15s;
}
.role-card:hover { transform: translateY(-3px); border-color: #c9b28e; }
.role-icon {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: var(--copper-soft); color: var(--copper); font-size: 19px;
}
.role-card b { color: var(--ink); font-size: 16px; }
.role-card > span:not(.role-icon) { color: var(--muted); font-size: 12px; line-height: 1.6; }
.role-card em { font-style: normal; color: var(--copper); font-size: 11px; font-weight: 700; margin-top: auto; padding-top: 6px; }
.back-link { color: var(--copper); text-decoration: none; font-size: 12px; }

/* ============================================================
   Login
   ============================================================ */
.login-screen {
  min-height: 100vh; display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr);
  background: var(--bg);
}
.login-art {
  min-height: 100vh; padding: 34px 42px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: #f7f3ea;
  background: radial-gradient(700px 440px at 15% 10%, rgba(241, 185, 104, .16), transparent 65%), linear-gradient(150deg, #081725, #0d2a40 60%, #16465f);
}
.login-art .brand { color: #fff; align-self: flex-start; }
.login-art-copy { max-width: 640px; padding: 36px 0; }
.login-art h1 { font-size: 40px; line-height: 1.25; color: #fff; margin: 10px 0 16px; letter-spacing: -.025em; }
.login-art p { margin: 0; color: rgba(247, 243, 234, .7); font-size: 14px; line-height: 1.75; }
.login-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.login-points li { position: relative; padding-left: 20px; color: rgba(247, 243, 234, .78); font-size: 12px; }
.login-points li::before { content: "✓"; position: absolute; left: 0; color: #f1b968; font-weight: 700; }
.login-art-foot { color: rgba(247, 243, 234, .52); font-size: 11px; }
.login-art-foot a { color: #f1b968; text-decoration: none; }
.login-panel-wrap { display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.login-panel {
  width: min(430px, 100%); background: #fff; border: 1px solid var(--line);
  border-radius: 18px; padding: 28px; box-shadow: 0 20px 60px rgba(19, 33, 46, .08);
}
.login-panel h2 { margin: 9px 0 4px; font-size: 22px; color: var(--ink); letter-spacing: -.01em; }
.login-subtitle { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.login-role-badge {
  display: inline-block; border: 1px solid #eed9bf; background: var(--copper-soft);
  color: var(--copper); border-radius: 999px; padding: 4px 9px;
  font-size: 9px; font-weight: 700; letter-spacing: .14em;
}
.login-error {
  margin-bottom: 12px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid #eccac3; background: var(--red-soft); color: var(--red);
  font-size: 11.5px; line-height: 1.5;
}
.login-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: 11px; flex-wrap: wrap; }
.login-links a { text-decoration: none; }
#login-switch-roles { display: flex; gap: 10px; flex-wrap: wrap; }
.login-note { margin: 16px 0 0; line-height: 1.6; }

/* ============================================================
   Portal shell
   ============================================================ */
.portal-shell { min-height: 100vh; display: flex; background: var(--bg); }
.sidebar {
  width: 248px; flex: 0 0 248px; height: 100vh; position: sticky; top: 0; z-index: 50;
  display: flex; flex-direction: column; gap: 15px; padding: 20px 14px;
  background: linear-gradient(180deg, #081725, #0c283c 65%, #0d2a40);
  color: #f7f3ea;
}
.sidebar-brand { padding: 0 8px 3px; }
.role-chip {
  margin: 0 8px; padding: 5px 9px; text-align: center;
  border: 1px solid rgba(241, 185, 104, .24); border-radius: 999px;
  background: rgba(241, 185, 104, .1);
  color: #f1b968; font-size: 9.5px; font-weight: 700; letter-spacing: .12em;
}
.side-menu { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 3px; padding: 2px 0; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border-radius: 8px; color: rgba(247, 243, 234, .64);
  font-size: 12.5px; text-decoration: none; transition: background .15s, color .15s;
}
.side-link:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.side-link.active { background: #f1b968; color: #1d160d; font-weight: 700; }
.side-icon { width: 18px; text-align: center; font-size: 14px; }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 12px; }
.sidebar-user { display: flex; flex-direction: column; gap: 1px; margin: 0 8px 8px; font-size: 11px; }
.sidebar-user b { color: #fff; }
.sidebar-user span { color: rgba(247, 243, 234, .44); font-size: 9.5px; word-break: break-all; }
.sidebar-logout { width: 100%; color: rgba(247, 243, 234, .72); border-color: rgba(255, 255, 255, .16); }
.portal-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.portal-topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 13px 24px; border-bottom: 1px solid var(--line);
  background: rgba(244, 241, 234, .93); backdrop-filter: blur(10px);
}
.portal-heading .eyebrow { font-size: 9px; }
.portal-heading h1 { margin: 2px 0 0; font-size: 20px; line-height: 1.3; color: var(--ink); letter-spacing: -.01em; }
.portal-top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.menu-toggle { display: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 17px; }
.portal-content { width: 100%; max-width: 1480px; margin: 0 auto; padding: 20px 24px 60px; }
.sidebar-scrim { display: none; }
.console-note {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px;
  padding: 12px 16px; background: #fff; border: 1px solid var(--line);
  border-left: 4px solid var(--copper); border-radius: 12px;
  scroll-margin-top: 86px;
}
.console-note b { color: var(--ink); font-size: 13px; white-space: nowrap; }
.console-note span { color: var(--muted); font-size: 11.5px; }
.console-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-label, .inventory-box, .deposit-form, .panel { scroll-margin-top: 86px; }

/* ============================================================
   Rep multi-session
   ============================================================ */
.rep-identity { display: flex; flex-direction: column; gap: 1px; margin-bottom: 9px; padding-bottom: 8px; border-bottom: 1px dashed #e9e2d6; }
.rep-identity b { color: var(--ink); font-size: 12px; }
.rep-identity span { color: var(--muted); font-size: 9.5px; }
.rep-tabs {
  display: flex; align-items: flex-end; gap: 6px; overflow-x: auto;
  padding: 10px 12px 0; background: #fbf9f4; border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
.rep-tabs-empty { padding: 5px 3px 9px; color: var(--muted); font-size: 10px; }
.rep-tab {
  flex: 0 0 auto; display: flex; align-items: center; gap: 6px;
  padding: 6px 9px; border: 1px solid var(--line); border-bottom: 0;
  border-radius: 8px 8px 0 0; background: #f2ede3; color: var(--ink-2);
  font-size: 10.5px; cursor: pointer;
}
.rep-tab.active { background: #fff; color: var(--ink); font-weight: 700; border-color: #d8cdb9; }
.rep-tab-title { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-tab-close { border: 0; background: transparent; color: #9a8e7a; font-size: 14px; line-height: 1; padding: 0 1px; }
.rep-tab-close:hover { color: var(--red); }
.unread-dot {
  display: inline-grid; place-items: center; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 999px; background: var(--copper); color: #fff;
  font-size: 9px; font-weight: 700;
}
.handoff-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.open-mark { color: var(--green); }

/* ============================================================
   Responsive: tablet / mobile
   ============================================================ */
@media (max-width: 1180px) {
  .portal-content { padding: 18px 18px 50px; }
  .rep-grid { grid-template-columns: 250px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 276px; height: 100dvh;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 24px 0 60px rgba(8, 23, 37, .3);
  }
  .portal-shell.nav-open .sidebar { transform: none; }
  .portal-shell.nav-open .sidebar-scrim {
    display: block; position: fixed; inset: 0; z-index: 45;
    background: rgba(8, 23, 37, .46);
  }
  .menu-toggle { display: grid; place-items: center; }
  .portal-topbar { padding: 10px 14px; gap: 10px; }
  .portal-heading h1 { font-size: 17px; }
  .portal-heading .eyebrow { display: none; }
  .portal-content { padding: 14px 12px 48px; }
  .console-note { flex-direction: column; gap: 2px; scroll-margin-top: 72px; }
  .console-toolbar { flex-direction: column; align-items: flex-start; }
  .section-label, .inventory-box, .deposit-form, .panel { scroll-margin-top: 72px; }
  .rep-grid { grid-template-columns: 1fr; }
  .rep-list-panel { position: static; max-height: 270px; }
  .rep-chat-panel { min-height: 72dvh; }
  .rep-action-panel { position: static; max-height: none; }
  .rep-messages { max-height: 42dvh; }
  .security-grid { grid-template-columns: 1fr; }
  .security-grid .panel:nth-child(4) { grid-column: auto; }
  .chat-panel { height: calc(100dvh - 170px); min-height: 480px; }
  .login-screen { grid-template-columns: 1fr; }
  .login-art { min-height: auto; padding: 22px 20px 26px; }
  .login-art-copy { padding: 22px 0 0; }
  .login-art h1 { font-size: 26px; }
  .login-art p { font-size: 12px; }
  .login-points { display: none; }
  .login-art-foot { display: none; }
  .login-panel-wrap { padding: 18px 14px 40px; }
  .public-header-inner { flex-wrap: wrap; padding: 10px 14px; gap: 6px; }
  .public-nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; padding-bottom: 2px; }
  .public-role-btn { margin-left: auto; }
  .public-main { padding: 18px 12px 40px; }
  .public-footer { padding: 14px 14px 26px; }
  .role-cards { grid-template-columns: 1fr; }
  .role-gate { padding: 24px 16px; align-items: flex-start; }
  .role-gate h1 { font-size: 26px; }
  .role-gate .brand { margin-bottom: 26px; }
}
@media (max-width: 520px) {
  .portal-top-actions .badge { display: none; }
  .portal-top-actions .btn { padding: 5px 8px; }
  .rep-tab-title { max-width: 112px; }
  .summary-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .data-table { font-size: 10px; }
  .data-table th, .data-table td { padding: 6px; }
  .public-footer { flex-direction: column; gap: 5px; }
  .login-panel { padding: 22px 18px; }
  .login-art h1 { font-size: 23px; }
}

@supports (padding: max(0px)) {
  .composer { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}

/* Anchor/heading fixes for narrow screens */
.summary-grid { scroll-margin-top: 86px; }
@media (max-width: 900px) {
  .panel-title { flex-wrap: wrap; }
  .panel-title .inline-select { width: 100%; justify-content: space-between; }
  .panel-title .inline-select select { max-width: calc(100% - 76px); }
  .summary-grid { scroll-margin-top: 72px; }
}
@media (max-width: 900px) {
  .portal-topbar { background: var(--bg); backdrop-filter: none; }
}

/* ============================================================
   Buyer: who is speaking now (AI / transferring / human)
   ============================================================ */
.chat-agent-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; border-bottom: 1px solid var(--line);
  background: #fbf9f4; transition: background .2s, border-color .2s;
}
.agent-avatar {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800; letter-spacing: .02em;
}
.agent-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.agent-copy b { font-size: 11.5px; color: var(--ink); }
.agent-copy span { font-size: 9.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-state-dot { flex: 0 0 auto; margin-left: auto; width: 8px; height: 8px; border-radius: 50%; }
.chat-agent-bar.agent-ai { background: #f4f8fd; border-bottom-color: #dbe7f5; }
.chat-agent-bar.agent-ai .agent-avatar { background: #eaf2fc; color: #1b5a9f; }
.chat-agent-bar.agent-ai .agent-state-dot { background: var(--blue); box-shadow: 0 0 0 3px rgba(42, 120, 214, .12); }
.chat-agent-bar.agent-transfer { background: var(--amber-soft); border-bottom-color: #ead4ac; }
.chat-agent-bar.agent-transfer .agent-avatar { background: #fff1d6; color: var(--amber); }
.chat-agent-bar.agent-transfer .agent-state-dot { background: var(--amber); animation: agentPulse 1.4s ease-in-out infinite; }
.chat-agent-bar.agent-human { background: var(--green-soft); border-bottom-color: #c7e4d6; }
.chat-agent-bar.agent-human .agent-avatar { background: #d9ede3; color: var(--green); }
.chat-agent-bar.agent-human .agent-state-dot { background: var(--green); box-shadow: 0 0 0 3px rgba(31, 122, 85, .12); }
@keyframes agentPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.msg-speaker { display: block; margin-bottom: 3px; font-size: 9px; font-weight: 700; letter-spacing: .08em; opacity: .62; }

.handoff-card.handoff-ai { background: #f6f2e9; border-color: #e1d8c9; }
.handoff-card.handoff-ai b { color: var(--ink); }
.handoff-card.handoff-transferring { background: var(--amber-soft); border-color: #ead4ac; }
.handoff-card.handoff-transferring b { color: var(--amber); }
.handoff-card.handoff-accepted { background: var(--green-soft); border-color: #c7e4d6; }
.handoff-card.handoff-accepted b { color: var(--green); }
.handoff-status-line { display: flex; align-items: center; gap: 6px; margin: 4px 0 5px; font-size: 10.5px; font-weight: 700; color: var(--ink-2); }
.handoff-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.handoff-transferring .handoff-dot { color: var(--amber); animation: agentPulse 1.4s ease-in-out infinite; }
.handoff-accepted .handoff-dot { color: var(--green); }
.handoff-ai .handoff-dot { color: var(--muted); }
@media (max-width: 520px) {
  .chat-agent-bar { padding: 8px 12px; }
  .agent-copy span { white-space: normal; }
}

/* ============================================================
   List pages + record sheet standard
   ============================================================ */
.list-toolbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; margin-bottom: 14px; flex-wrap: wrap;
}
.list-heading h2 { margin: 2px 0 0; font-size: 20px; color: var(--ink); letter-spacing: -.01em; }
.list-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.search-input, .filter-select {
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  color: var(--ink); padding: 7px 10px; font-size: 11.5px; outline: none;
}
.search-input { min-width: 230px; }
.search-input:focus, .filter-select:focus { border-color: #b9a98e; box-shadow: 0 0 0 3px rgba(181, 101, 29, .08); }
.list-panel { padding: 0; overflow: hidden; }
.list-panel .table-wrap { overflow: auto; }
.list-panel .data-table { min-width: 760px; }
.list-panel .data-table th { position: sticky; top: 0; z-index: 1; }
.row-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.row-main b { display: block; color: var(--ink); font-size: 11.5px; }
.row-main span { display: block; color: var(--muted); font-size: 9.5px; margin-top: 1px; }
.list-empty { padding: 30px 18px; text-align: center; color: var(--muted); font-size: 12px; }

body.record-open { overflow: hidden; }
.record-overlay {
  position: fixed; inset: 0; z-index: 90; padding: 24px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 23, 37, .5); backdrop-filter: blur(2px);
}
.record-sheet {
  width: min(860px, 100%); max-height: 90vh; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid #d8cdb9; border-radius: 16px;
  box-shadow: 0 30px 90px rgba(8, 23, 37, .32);
}
.record-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--line); background: #fbf9f4; flex: 0 0 auto;
}
.record-close {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 17px;
}
.record-close:hover { border-color: var(--copper); color: var(--copper); }
.record-heading { min-width: 0; }
.record-heading .eyebrow { font-size: 9px; }
.record-heading h2 { margin: 2px 0 0; font-size: 18px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.record-head-actions { margin-left: auto; display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.record-body { padding: 20px; overflow: auto; }
.record-form .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.record-form .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; color: var(--ink); outline: none; resize: vertical;
  font-family: inherit; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.record-form .field textarea:focus { border-color: #b9a98e; box-shadow: 0 0 0 3px rgba(181, 101, 29, .08); }
.record-form .field input:disabled { background: #f3efe6; color: var(--muted); }
.form-section { margin: 17px 0 9px; padding-top: 13px; border-top: 1px dashed var(--line); }
.form-section-title { font-size: 11px; font-weight: 700; color: var(--ink); letter-spacing: .03em; margin-bottom: 8px; }
.checkbox-grid { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 2px 0 13px; }
.form-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line);
}
.record-view .record-hero { margin-bottom: 13px; }
.record-view .record-hero h3 { margin: 0 0 3px; font-size: 20px; color: var(--ink); letter-spacing: -.01em; }
.record-view .record-hero p { margin: 0; color: var(--muted); font-size: 11.5px; }
.record-badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.record-kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.record-kv-grid .kv { font-size: 11.5px; }
.record-description { margin-top: 12px; padding: 10px 12px; background: var(--paper-soft); border: 1px dashed var(--line); border-radius: 9px; font-size: 11.5px; color: var(--ink-2); white-space: pre-wrap; line-height: 1.65; }
.record-subhead { margin: 18px 0 8px; font-size: 11px; font-weight: 700; color: var(--ink); letter-spacing: .04em; text-transform: uppercase; }
.deposit-box { margin-top: 16px; padding: 12px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--paper-soft); }
.deposit-box .form-row { display: flex; gap: 7px; flex-wrap: wrap; align-items: flex-end; }
.deposit-box .field { min-width: 140px; flex: 1; margin-bottom: 0; }
.deposit-box .btn { margin-bottom: 0; }
.record-note { margin-top: 14px; font-size: 10.5px; color: var(--muted); line-height: 1.6; }

@media (max-width: 900px) {
  .list-toolbar { align-items: flex-start; }
  .list-actions { width: 100%; }
  .list-actions .search-input { flex: 1; min-width: 0; }
  .list-actions .filter-select { flex: 1; min-width: 0; }
  .record-overlay { padding: 0; align-items: stretch; }
  .record-sheet {
    width: 100%; height: 100dvh; max-height: none; border-radius: 0; border: 0;
  }
  .record-head { padding: 10px 12px; }
  .record-heading h2 { font-size: 16px; }
  .record-head-actions { gap: 5px; }
  .record-body { padding: 16px 14px calc(36px + env(safe-area-inset-bottom)); }
  .record-form .form-grid, .record-kv-grid { grid-template-columns: 1fr; gap: 0; }
  .list-panel .data-table { min-width: 720px; }
}
.section-label-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
a.mini { display: inline-flex; align-items: center; text-decoration: none; line-height: 1.4; }

/* Notification center */
.notification-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-size: 15px;
}
.notification-btn:hover { border-color: var(--copper); }
.notification-count {
  position: absolute; top: -5px; right: -5px;
  min-width: 17px; height: 17px; padding: 0 4px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--copper); color: #fff; font-size: 9px; font-weight: 700;
}
.notification-panel {
  position: fixed; top: 68px; right: 22px; z-index: 85;
  width: min(380px, calc(100vw - 24px)); max-height: min(560px, 75vh);
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line); border-radius: 13px;
  box-shadow: 0 24px 70px rgba(8, 23, 37, .22); overflow: hidden;
}
.notification-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fbf9f4;
}
.notification-head b { font-size: 12.5px; color: var(--ink); }
.notification-list { overflow: auto; }
.notification-item {
  display: block; width: 100%; text-align: left; border: 0;
  border-bottom: 1px dashed #eee8dc; background: #fff;
  padding: 10px 14px; cursor: pointer;
}
.notification-item:hover { background: #fdfaf4; }
.notification-item.unread { background: #fdf6eb; }
.notification-item b { display: block; font-size: 11.5px; color: var(--ink); }
.notification-item span { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.notification-item em { display: block; font-style: normal; font-size: 9px; color: #9a8e7a; margin-top: 4px; }
.notification-empty { padding: 24px 14px; text-align: center; color: var(--muted); font-size: 11px; }
@media (max-width: 900px) {
  .notification-panel { top: 60px; right: 10px; left: 10px; width: auto; }
}
.rep-settings { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 7px; }
.rep-settings .rep-max { display: flex; align-items: center; gap: 4px; font-size: 9.5px; color: var(--muted); white-space: nowrap; }
.rep-settings .rep-max input { width: 52px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 5px; font-size: 10px; background: #fff; }

/* Public onboarding application */
.apply-screen {
  min-height: 100vh; padding: 32px 20px 50px;
  background: radial-gradient(900px 500px at 12% 0%, #fdf6e9, transparent 60%), var(--bg);
}
.apply-wrap { width: min(680px, 100%); margin: 0 auto; }
.apply-wrap > .brand { margin-bottom: 22px; }
.apply-card {
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  padding: 28px; box-shadow: 0 20px 60px rgba(19, 33, 46, .08);
}
.apply-card h1 { margin: 8px 0 4px; font-size: 26px; color: var(--ink); letter-spacing: -.02em; }
.apply-card > p { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.apply-card textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font: inherit; color: var(--ink); outline: none; resize: vertical;
}
.apply-card textarea:focus { border-color: #b9a98e; box-shadow: 0 0 0 3px rgba(181, 101, 29, .08); }
.apply-result {
  margin-top: 14px; padding: 10px 12px; border-radius: 9px;
  background: var(--green-soft); border: 1px solid #c7e4d6; color: var(--green);
  font-size: 11.5px; line-height: 1.6;
}
@media (max-width: 520px) {
  .apply-screen { padding: 18px 12px 36px; }
  .apply-card { padding: 20px 16px; }
}
.product-image-edit { margin: 4px 0 12px; }
.product-image-edit > span { display: block; font-size: 10.5px; color: #7d6d56; margin-bottom: 5px; font-weight: 600; }
.product-image-preview { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.product-image-preview img { width: 74px; height: 74px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); background: #f6f2e9; }
.product-thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); background: #f6f2e9; flex: 0 0 auto; }
.row-with-thumb { display: flex; align-items: center; gap: 8px; min-width: 0; }
.record-product-image { width: 150px; max-height: 150px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 12px; }
.msg-product img { width: 100%; max-height: 70px; object-fit: cover; border-radius: 5px; margin-bottom: 3px; display: block; }

/* Merchant onboarding checklist */
.onboarding-card {
  margin: 10px 0 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 11px; background: #fbf9f4;
}
.onboarding-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.onboarding-head b { font-size: 11.5px; color: var(--ink); }
.onboarding-head span { font-size: 10px; color: var(--muted); }
.onboarding-progress { height: 5px; border-radius: 999px; background: #e9e1d4; margin: 8px 0 10px; overflow: hidden; }
.onboarding-progress span { display: block; height: 100%; background: var(--green); border-radius: inherit; }
.onboarding-steps { display: flex; gap: 6px 12px; flex-wrap: wrap; }
.onboarding-step {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; color: var(--muted); text-decoration: none;
}
.onboarding-step i { font-style: normal; font-size: 11px; color: #b9a98e; }
.onboarding-step.done { color: var(--green); }
.onboarding-step.done i { color: var(--green); }
a.onboarding-step:hover { color: var(--copper); }
.rfq-response-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 11px; border-bottom: 1px solid var(--line); background: #fdfcf9; }
.workqueue-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.workqueue-card { display: flex; flex-direction: column; gap: 1px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; text-decoration: none; color: var(--ink-2); }
.workqueue-card b { font-size: 18px; color: var(--ink); line-height: 1.2; }
.workqueue-card span { font-size: 9.5px; color: var(--muted); }
.workqueue-card.has-work { border-color: #e3c18d; background: var(--amber-soft); }
.workqueue-card.has-work b { color: var(--amber); }
@media (max-width: 1180px) { .workqueue-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .workqueue-grid { grid-template-columns: repeat(2, 1fr); } }
.sla-ok { color: var(--green); }
.sla-overdue { color: var(--red); font-weight: 700; }
.rep-header-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.attach-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; flex: 0 0 auto; font-size: 15px; }
.attach-btn:hover { border-color: var(--copper); }
.msg-image { max-width: 100%; max-height: 220px; border-radius: 8px; display: block; margin-bottom: 6px; }
.msg-file { display: inline-block; margin-top: 5px; color: inherit; font-size: 10.5px; text-decoration: underline; }
.quick-replies { display: flex; gap: 5px; flex-wrap: wrap; padding: 8px 14px 0; border-top: 1px solid var(--line); background: #fbf9f4; }
.quick-replies button { border: 1px solid #ddd4c4; background: #fff; color: #6e604b; border-radius: 999px; padding: 4px 8px; font-size: 9.5px; }
.quick-replies button:hover { border-color: var(--copper); color: var(--copper); }
.help-list details { border-bottom: 1px dashed var(--line); padding: 9px 0; }
.help-list summary { cursor: pointer; font-size: 12px; font-weight: 650; color: var(--ink); }
.help-list p { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.buyer-lang-btn { margin-left: 2px; letter-spacing: .06em; }
.geo-banner {
  margin: 0 0 11px; padding: 7px 9px; border-radius: 8px;
  background: #eef4ff; border: 1px solid #d3e0f4;
  color: #1c4f82; font-size: 10px; line-height: 1.55;
}
.geo-banner strong { font-weight: 700; }
.rep-lang-select { border: 1px solid var(--line); border-radius: 7px; padding: 4px 7px; font-size: 10px; background: #fff; }
.rep-language-row { margin-top: 7px; }
.rep-settings + .rep-language-row { margin-top: 5px; }
.msg-translated { display: block; font-size: 8.5px; letter-spacing: .03em; opacity: .55; margin-bottom: 3px; }

.qr-wrap {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  padding: 18px; border: 1px dashed var(--line-strong); border-radius: 12px;
  background: var(--paper-soft);
}
.qr-wrap img { width: 220px; height: 220px; image-rendering: pixelated; background: #fff; border-radius: 10px; }
.qr-wrap p { max-width: 280px; line-height: 1.7; }
@media (max-width: 700px) {
  .qr-wrap { justify-content: center; }
  .qr-wrap img { width: 200px; height: 200px; }
}

/* ---------- settlement statement / print ---------- */
.statement-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 4px 0 14px;
}
.statement-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.statement-head h3 { margin: 2px 0 0; color: var(--ink); }
.statement-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 12px; }
.statement-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.statement-chip {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: var(--paper-soft);
}
.statement-chip b { display: block; font-size: 17px; color: var(--ink); }
.statement-chip span { display: block; font-size: 10.5px; color: var(--muted); }
.statement-foot { margin-top: 14px; font-size: 11px; color: var(--muted); }

.print-area { display: none; }

@media (max-width: 760px) {
  .statement-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .statement-actions .search-input { width: 100%; }
}

@media print {
  @page { margin: 12mm; }
  body.printing-statement { background: #fff; }
  body.printing-statement > *:not(.print-area) { display: none !important; }
  body.printing-statement .print-area {
    display: block !important;
    color: #111;
    font-family: var(--sans);
    font-size: 11px;
  }
  body.printing-statement .print-area h1 { font-size: 18px; margin: 0 0 4px; }
  body.printing-statement .print-area .statement-head { border-color: #bbb; }
  body.printing-statement .print-area .statement-summary { grid-template-columns: repeat(6, 1fr); }
  body.printing-statement .print-area .statement-chip { background: #fff; border-color: #ccc; }
  body.printing-statement .print-area .data-table { width: 100%; border-collapse: collapse; font-size: 10px; }
  body.printing-statement .print-area .data-table th,
  body.printing-statement .print-area .data-table td { border: 1px solid #ccc; padding: 5px 6px; }
  body.printing-statement .print-area .badge { border: 1px solid #bbb; background: #fff; color: #111; }
  body.printing-statement .print-area .statement-foot { margin-top: 18px; color: #555; }
}

/* ---------- dispute detail ---------- */
.record-view .record-hero-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.record-view .record-hero-line h3 { flex: 1; }
.record-view #dispute-evidence-list .record-note { margin-bottom: 8px; }

/* ---------- settlement batch statement ---------- */
.batch-signatures {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 40px;
  margin: 18px 0 6px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
  color: var(--ink-2);
  font-size: 12px;
}
.batch-signatures span { margin-left: 12px; color: var(--muted); }
