/* robot: cùng họ với techpark (giấy ấm, mực gần đen, một màu nhấn dùng rất ít).
   Một hệ bo góc: tag 5, control 8, panel nổi 12. Mono chỉ cho chuỗi kỹ thuật. Không nhãn viết hoa. */
:root {
  --bg: #FAF9F7;
  --surface: #FFFFFF;
  --ink: #1A1917;
  --ink-2: #3D3A36;
  --mute: #75716B;
  --faint: #A8A39C;
  --line: rgba(26, 25, 23, 0.08);
  --line-2: rgba(26, 25, 23, 0.15);
  --wash: #F3F1EE;
  --accent: #FF6341;
  --accent-wash: #FFF0EC;
  --shadow: 0 1px 2px rgba(26, 25, 23, 0.05), 0 4px 16px rgba(26, 25, 23, 0.05);
  --shadow-lg: 0 12px 48px rgba(26, 25, 23, 0.16), 0 2px 6px rgba(26, 25, 23, 0.06);

  --t-green-bg: #E4F2E6; --t-green: #1F6B34;
  --t-yellow-bg: #FAF0CF; --t-yellow: #765800;
  --t-blue-bg: #E5ECFA; --t-blue: #2A4C96;
  --t-red-bg: #FBE6E0; --t-red: #983820;
  --t-violet-bg: #EEE8FA; --t-violet: #573E96;
  --t-teal-bg: #E0F1F0; --t-teal: #1D6460;
  --t-grey-bg: #EFEDEA; --t-grey: #55524D;

  --display: 'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --hdr: 60px;
  --r-sm: 5px; --r: 8px; --r-lg: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--sans); font-size: 14px; line-height: 1.5; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01';
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; }
.ic { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hint { color: var(--mute); font-size: 12.5px; }
.link { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.link:hover { text-decoration-color: var(--ink); }

/* ───────── header ───────── */
.bar {
  position: sticky; top: 0; z-index: 30; height: var(--hdr);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px;
  padding: 0 24px; background: rgba(250, 249, 247, 0.88); backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.wordmark { font-family: var(--display); font-size: 17px; font-weight: 600; letter-spacing: -0.02em; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.wordmark .mk { width: 22px; height: 22px; display: block; }
.wordmark span { color: var(--faint); font-weight: 500; margin-left: -8px; }
.lenses { display: flex; gap: 2px; justify-content: center; overflow-x: auto; scrollbar-width: none; }
.lenses::-webkit-scrollbar { display: none; }
.lenses button { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: var(--r); color: var(--mute); font-weight: 500; white-space: nowrap; }
.lenses button:hover { color: var(--ink); background: var(--wash); }
.lenses button[aria-selected="true"] { color: var(--ink); background: var(--surface); box-shadow: 0 0 0 1px var(--line-2); }
.bar-right { display: flex; align-items: center; gap: 10px; position: relative; }
.search { display: flex; align-items: center; gap: 8px; height: 36px; width: 280px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--mute); }
.search:focus-within { border-color: var(--ink); color: var(--ink); }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font: inherit; color: var(--ink); }
.search input::placeholder { color: var(--faint); }
.search kbd { font-family: var(--mono); font-size: 11px; color: var(--faint); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; }
.results { position: absolute; top: 44px; right: 0; width: 420px; max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 6px; z-index: 40; }
.results button { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--r); }
.results button:hover, .results button[aria-selected="true"] { background: var(--wash); }
.results .r-name { font-weight: 500; }
.results .r-sub { grid-column: 2; color: var(--mute); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .r-ask { color: var(--accent); }
.lang { display: flex; gap: 2px; font-size: 12px; font-weight: 500; color: var(--faint); }
.lang button { padding: 4px 6px; border-radius: 4px; }
.lang button[aria-pressed="true"] { color: var(--ink); background: var(--wash); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r); font-weight: 500; white-space: nowrap; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); text-decoration: none; }
.btn:hover { border-color: var(--ink); }
.btn.ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.ink:hover { background: #000; }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }

/* ───────── layout ───────── */
main { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 28px 24px 40px; }
.loading { padding: 120px 0; text-align: center; color: var(--mute); }
.lens-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 0 0 20px; flex-wrap: wrap; }
.lens-head h1 { font-family: var(--display); font-weight: 500; font-size: clamp(26px, 3.2vw, 36px); letter-spacing: -0.03em; line-height: 1.1; margin: 0 0 6px; text-wrap: balance; }
.lens-head p { margin: 0; color: var(--ink-2); max-width: 640px; text-wrap: pretty; }
.insight { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; margin: 0 0 20px; color: var(--ink-2); max-width: 900px; }
.insight .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex: none; }
.insight b { color: var(--ink); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .cc { font-size: 11px; color: var(--faint); font-weight: 500; }
.chip[aria-pressed="true"] .cc { color: rgba(255,255,255,.6); }
.chip.unsrc::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); margin-left: 2px; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--r-sm); font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.tag.class { background: var(--t-blue-bg); color: var(--t-blue); }
.tag.product { background: var(--t-violet-bg); color: var(--t-violet); }
.tag.part { background: var(--t-yellow-bg); color: var(--t-yellow); }
.tag.company { background: var(--t-green-bg); color: var(--t-green); }
.tag.role { background: var(--t-red-bg); color: var(--t-red); }
.tag.sector { background: var(--t-teal-bg); color: var(--t-teal); }
.tag.grey { background: var(--t-grey-bg); color: var(--t-grey); }

/* ───────── lens: họ robot ───────── */
.families { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.fam { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 16px 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.fam-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.fam-ic { width: 34px; height: 34px; border-radius: var(--r); background: var(--wash); display: grid; place-items: center; color: var(--ink); flex: none; }
.fam-ic .ic { width: 19px; height: 19px; }
.fam h2 { font-family: var(--display); font-size: 17px; font-weight: 600; letter-spacing: -0.015em; margin: 0; line-height: 1.2; }
.fam h2 button:hover { text-decoration: underline; text-underline-offset: 3px; }
.fam .meta { color: var(--mute); font-size: 12.5px; margin: 0 0 10px 44px; }
.sub { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border-radius: var(--r); text-align: left; }
.sub:hover { background: var(--wash); }
.sub .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub .bars { display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 12px; }
.sub .bar-in { height: 6px; border-radius: 3px; background: var(--ink); opacity: .14; min-width: 3px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--mute); font-size: 12.5px; margin: 18px 0 0; }

/* ───────── lens: giải phẫu ───────── */
.picker { margin: 0 0 18px; }
.anat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px; overflow-x: auto; }
.anat-root { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.anat-root h2 { font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.sys { display: grid; grid-template-columns: 220px 1fr; gap: 0 24px; padding: 14px 0; border-top: 1px solid var(--line); }
.sys-name { font-weight: 600; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.sys-name .hint { font-weight: 400; }
.comps { display: flex; flex-direction: column; gap: 6px; }
.comp { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 16px; align-items: start; padding: 6px 0; position: relative; }
.comp + .comp { border-top: 1px dashed var(--line); }
.comp-name { display: flex; align-items: center; gap: 8px; font-weight: 500; text-align: left; }
.comp-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.comp-name .generic { font-weight: 400; color: var(--faint); font-size: 12px; }
.makers { display: flex; flex-wrap: wrap; gap: 6px; }
.makers .none { color: var(--faint); font-size: 12.5px; padding-top: 4px; }
.cc-badge { font-family: var(--mono); font-size: 10.5px; color: var(--mute); background: var(--wash); border-radius: 4px; padding: 0 4px; }
.conc { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin: 8px 0 6px; max-width: 520px; }
.conc span { display: block; height: 100%; }
.conc-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--mute); }
.conc-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ───────── ma trận (con người, ứng dụng) ───────── */
.matrix-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: auto; max-height: calc(100vh - 260px); }
table.matrix { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; }
.matrix th, .matrix td { padding: 0; border-bottom: 1px solid var(--line); }
.matrix thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; font-weight: 500; color: var(--ink-2); vertical-align: bottom; padding: 12px 6px 10px; min-width: 92px; text-align: center; }
.matrix thead th button { font-weight: 500; line-height: 1.25; }
.matrix thead th button:hover { text-decoration: underline; }
.matrix th.rowh { position: sticky; left: 0; background: var(--surface); z-index: 1; text-align: left; padding: 8px 14px; font-weight: 500; min-width: 220px; border-right: 1px solid var(--line); }
.matrix thead th.rowh { z-index: 3; }
.matrix th.rowh button:hover { text-decoration: underline; }
.matrix th.rowh .hint { display: block; font-weight: 400; }
.cell { display: flex; align-items: center; justify-content: center; gap: 3px; width: 100%; min-height: 40px; padding: 6px; }
.cell:hover { background: var(--wash); }
.cell .heat { display: block; width: 26px; height: 26px; border-radius: 6px; background: var(--ink); }
.stage { width: 9px; height: 18px; border-radius: 2px; background: var(--line); }
.stage.on { background: var(--ink); }
.stage-legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--mute); font-size: 12.5px; margin: 0 0 12px; align-items: center; }
.stage-legend .seq { display: inline-flex; gap: 3px; align-items: center; margin-right: 6px; }

/* ───────── lens: Việt Nam ───────── */
.vn-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.vn-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--r-lg); overflow: hidden; box-shadow: 0 0 0 1px var(--line), var(--shadow); }
.vn-table th { text-align: left; font-weight: 500; color: var(--mute); font-size: 12.5px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); background: var(--surface); }
.vn-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.vn-table tr:hover td { background: #FCFBFA; }
.vn-table .co { font-weight: 500; text-align: left; }
.vn-table .co:hover { text-decoration: underline; }

/* ───────── drawer ───────── */
.scrim { position: fixed; inset: 0; background: rgba(26, 25, 23, 0.18); z-index: 49; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); z-index: 50; box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .22s cubic-bezier(.2, 0, 0, 1); overflow-y: auto; outline: none; }
.drawer.open { transform: none; }
.d-top { position: sticky; top: 0; background: rgba(255,255,255,.94); backdrop-filter: blur(8px); display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); z-index: 1; }
.d-top .sp { flex: 1; }
.x { width: 32px; height: 32px; border-radius: var(--r); display: grid; place-items: center; color: var(--mute); }
.x:hover { background: var(--wash); color: var(--ink); }
.d-body { padding: 18px 20px 28px; }
.d-body h2 { font-family: var(--display); font-size: 26px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.12; margin: 8px 0 4px; }
.d-aka { color: var(--mute); font-size: 13px; margin: 0 0 12px; }
.d-sum { font-size: 15px; color: var(--ink-2); margin: 0 0 14px; text-wrap: pretty; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; font-size: 13.5px; }
.facts dt { color: var(--mute); }
.facts dd { margin: 0; }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.d-sec { border-top: 1px solid var(--line); padding: 14px 0 6px; }
.d-sec h3 { font-size: 13px; font-weight: 600; margin: 0 0 10px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.d-sec h3 .n { color: var(--faint); font-weight: 500; }
.d-sec .more { margin-top: 8px; font-size: 13px; }
.src-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--mute); background: var(--wash); border-radius: var(--r); padding: 9px 11px; margin: 0 0 16px; }
.ev-list { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.ev-list a { color: var(--t-blue); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist { font-size: 12.5px; color: var(--mute); display: flex; flex-direction: column; gap: 3px; }

/* ───────── hỏi ───────── */
.ask { position: fixed; right: 20px; bottom: 20px; width: min(560px, calc(100vw - 24px)); max-height: min(78vh, 760px); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg), 0 0 0 1px var(--line); z-index: 60; display: flex; flex-direction: column; transform: translateY(16px); opacity: 0; pointer-events: none; transition: transform .2s cubic-bezier(.2,0,0,1), opacity .2s; }
.ask.open { transform: none; opacity: 1; pointer-events: auto; }
.ask-head { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.ask-head b { font-family: var(--display); font-size: 16px; font-weight: 600; }
.ask-head .hint { grid-column: 1; }
.ask-head .x { grid-row: 1 / span 2; grid-column: 2; }
.ask-thread { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.ask-empty .chips { margin-top: 8px; }
.ask-empty .chip { height: auto; min-height: 30px; padding: 5px 10px; white-space: normal; text-align: left; }
.msg-q { align-self: flex-end; background: var(--ink); color: #fff; border-radius: 12px 12px 4px 12px; padding: 8px 12px; max-width: 85%; }
.msg-a { color: var(--ink); font-size: 14.5px; line-height: 1.6; }
.msg-a p { margin: 0 0 8px; }
.msg-a ul { margin: 0 0 8px; padding-left: 20px; }
.msg-a li { margin: 2px 0; }
.msg-a .cites { margin-top: 10px; }
.gap-note { margin-top: 10px; font-size: 12.5px; color: var(--ink-2); background: var(--accent-wash); border-radius: var(--r); padding: 9px 11px; }
.gap-note b { font-weight: 600; }
.gap-note ul { margin: 4px 0 0; padding-left: 18px; }
.msg-foot { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.ask-form { display: flex; gap: 8px; padding: 12px 16px 14px; border-top: 1px solid var(--line); align-items: flex-end; }
.ask-form textarea { flex: 1; resize: none; border: 1px solid var(--line-2); border-radius: var(--r); padding: 9px 11px; font: inherit; color: var(--ink); outline: none; min-height: 40px; max-height: 140px; }
.ask-form textarea:focus { border-color: var(--ink); }

/* ───────── modal, toast, footer ───────── */
.modal { border: 0; border-radius: var(--r-lg); padding: 0; width: min(520px, calc(100vw - 24px)); box-shadow: var(--shadow-lg); color: var(--ink); }
.modal::backdrop { background: rgba(26, 25, 23, 0.3); }
.modal form { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.modal h3 { font-family: var(--display); font-size: 19px; font-weight: 600; margin: 0; letter-spacing: -0.015em; }
.modal label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.modal input, .modal textarea, .modal select { font: inherit; font-weight: 400; color: var(--ink); border: 1px solid var(--line-2); border-radius: var(--r); padding: 8px 10px; outline: none; background: var(--surface); }
.modal input:focus, .modal textarea:focus, .modal select:focus { border-color: var(--ink); }
.modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r); z-index: 80; font-size: 13.5px; box-shadow: var(--shadow-lg); }
.foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 16px 24px 24px; color: var(--mute); font-size: 12.5px; border-top: 1px solid var(--line); }
.foot .sep { color: var(--faint); }

@media (max-width: 1080px) {
  .bar { grid-template-columns: auto 1fr; height: auto; padding: 10px 16px; row-gap: 8px; }
  .lenses { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .bar-right { justify-self: end; }
  .search { width: 220px; }
}
@media (max-width: 640px) {
  main { padding: 20px 16px 32px; }
  .search { width: auto; flex: 1; }
  .search kbd { display: none; }
  .bar-right { grid-column: 1 / -1; justify-self: stretch; }
  .results { width: 100%; }
  .sys { grid-template-columns: 1fr; gap: 8px; }
  .comp { grid-template-columns: 1fr; gap: 6px; }
  .ask { right: 12px; left: 12px; bottom: 12px; width: auto; }
  .families { grid-template-columns: 1fr; }
}

/* ───────── trang RFQ (người mua, nhà cung cấp) ───────── */
.page { max-width: 980px; }
.page h1 { font-family: var(--display); font-weight: 500; font-size: clamp(28px, 3.6vw, 40px); letter-spacing: -0.03em; line-height: 1.08; margin: 0 0 8px; text-wrap: balance; }
.page .lede { color: var(--ink-2); max-width: 660px; margin: 0 0 22px; font-size: 15px; text-wrap: pretty; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px; margin: 0 0 16px; }
.panel h2 { font-family: var(--display); font-size: 18px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 12px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; color: var(--ink-2); min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field .hint { font-weight: 400; }
.field input, .field select, .field textarea { font: inherit; font-weight: 400; color: var(--ink); border: 1px solid var(--line-2); border-radius: var(--r); padding: 8px 10px; background: var(--surface); outline: none; min-width: 0; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); }
.field textarea { resize: vertical; min-height: 72px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); }
.check input { margin-top: 3px; }
.item-row { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 3fr) 90px 90px 32px; gap: 8px; align-items: end; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.item-row:last-of-type { border-bottom: 0; }
.picker-wrap { position: relative; }
.picker-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow-lg); max-height: 260px; overflow: auto; padding: 4px; }
.picker-list button { display: flex; gap: 8px; align-items: center; width: 100%; text-align: left; padding: 6px 8px; border-radius: 6px; font-size: 13px; }
.picker-list button:hover { background: var(--wash); }
.row-acts { display: flex; gap: 8px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.sup-list { display: flex; flex-direction: column; gap: 6px; }
.sup { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); }
.sup input { margin-top: 3px; }
.sup .why { color: var(--mute); font-size: 12.5px; }
.status-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 16px; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.steps span { font-size: 12.5px; padding: 3px 9px; border-radius: var(--r-sm); background: var(--wash); color: var(--mute); }
.steps span.on { background: var(--ink); color: #fff; }
.steps span.done { background: var(--t-green-bg); color: var(--t-green); }
table.cmp { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.cmp th, .cmp td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cmp th { color: var(--mute); font-weight: 500; font-size: 12.5px; }
.cmp td.num, .cmp th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cmp tr.best td { background: #FBFDF9; }
.cmp .tot { font-weight: 600; }
.board { display: flex; flex-direction: column; gap: 10px; }
.rfq-card { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.rfq-card h3 { margin: 0; font-size: 15.5px; font-weight: 600; }
.rfq-card .meta { color: var(--mute); font-size: 12.5px; }
.rfq-card ul { margin: 4px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--ink-2); }
.notice { background: var(--wash); border-radius: var(--r); padding: 10px 12px; font-size: 13px; color: var(--ink-2); margin: 0 0 14px; }
.notice.ok { background: var(--t-green-bg); color: var(--t-green); }
.notice.warn { background: var(--accent-wash); color: var(--t-red); }
.price-ref { display: flex; gap: 14px; flex-wrap: wrap; align-items: baseline; font-size: 13.5px; }
.price-ref b { font-family: var(--display); font-size: 17px; }
@media (max-width: 720px) {
  .fields { grid-template-columns: 1fr; }
  .item-row { grid-template-columns: 1fr 1fr; }
  .item-row .field:nth-child(1), .item-row .field:nth-child(2) { grid-column: 1 / -1; }
  .cmp-wrap { overflow-x: auto; }
}

/* điện thoại: thanh trên xuống dòng, nút và chip dài được xuống dòng thay vì tràn */
.d-actions .btn, .drawer .chip, .ask .chip { white-space: normal; height: auto; min-height: 30px; padding-top: 5px; padding-bottom: 5px; max-width: 100%; text-align: left; }
@media (max-width: 640px) {
  .bar-right { flex-wrap: wrap; gap: 8px; }
  .search { flex: 1 1 100%; order: -1; }
  .bar-right .btn { height: 32px; padding: 0 10px; }
  .chip { max-width: 100%; }
  .anat { padding: 14px; }
  .lens-head h1 { font-size: 26px; }
}
.lenses, .bar-right { min-width: 0; }
@media (max-width: 1080px) { .bar { grid-template-columns: minmax(0, auto) minmax(0, 1fr); } }
@media (max-width: 640px) { .bar { grid-template-columns: minmax(0, 1fr); } .bar-right { grid-column: 1; } .lenses { grid-row: 3; } }

@media (max-width: 640px) { .bar { position: static; } }
