/* OmniMatch — supply-agent SPA styles. No framework. */
:root {
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1e242c;
  --line: #2a323d;
  --text: #e6eaf0;
  --muted: #93a0b1;
  --brand: #4f8cff;
  --brand-2: #36d6a0;
  --danger: #ff6b6b;
  --warn: #f0b24a;
  --radius: 10px;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 14px; line-height: 1.55;
}
#app { height: 100%; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--brand); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2c343f; border-radius: 6px; }

/* ---------- buttons & inputs ---------- */
.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 8px 14px; border-radius: 8px; font-size: 13px; transition: .15s;
}
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #4a2a2a; }
.btn.danger:hover { background: #2a1c1c; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, textarea, select {
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-family: inherit; font-size: 13px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); }
textarea { resize: vertical; }
label.field { display: block; margin-bottom: 10px; }
label.field > span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px;
  border: 1px solid var(--line); color: var(--muted);
}
.tag.member { color: var(--brand-2); border-color: #1e4a3c; background: #102420; }
.tag.supplier { color: var(--brand); border-color: #243a5e; background: #0f1a2b; }
.tag.exp { color: var(--warn); border-color: #4a3a1e; background: #241f10; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- header shell ---------- */
.shell { display: flex; flex-direction: column; height: 100%; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 0 18px; height: 54px;
  background: var(--panel); border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.brand { font-weight: 700; font-size: 15px; letter-spacing: .3px; }
.brand .dot { color: var(--brand); }
.nav-pill { padding: 5px 12px; border-radius: 999px; border: 1px solid transparent; color: var(--muted); text-decoration: none; font-size: 13px; }
.nav-pill.active, .nav-pill:hover { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.engine { font-size: 12px; color: var(--muted); }
.engine .on { color: var(--brand-2); }
.engine .off { color: var(--warn); }
.who { font-size: 13px; }
.who b { color: var(--text); }

/* ---------- login ---------- */
.login-wrap { display: grid; place-items: center; height: 100%; padding: 20px; }
.login-card {
  width: 380px; max-width: 92vw; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px; box-shadow: var(--shadow);
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-card .hint { margin-top: 14px; font-size: 12px; color: var(--muted); }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ---------- generic content area ---------- */
.content { flex: 1; min-height: 0; overflow: auto; padding: 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card h2 { font-size: 15px; margin: 0 0 12px; }
.card h3 { font-size: 13px; margin: 0 0 8px; color: var(--muted); text-transform: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: none; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }

/* tabs */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tab { padding: 7px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); }
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* credential reveal box */
.cred { background: #10261f; border: 1px solid #1e4a3c; border-radius: 8px; padding: 12px; margin-top: 12px; }
.cred .mono { font-size: 14px; color: var(--brand-2); }

/* ---------- workspace 3-column ---------- */
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px 1fr 320px; }
.col { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.col.left { border-right: 1px solid var(--line); background: var(--panel); }
.col.right { border-left: 1px solid var(--line); background: var(--panel); }
.col-head { padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.col-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 14px; }
.section-title { font-size: 12px; color: var(--muted); margin: 6px 0 8px; text-transform: none; letter-spacing: .3px; }

/* uploads */
.dropzone { border: 1.5px dashed var(--line); border-radius: 10px; padding: 16px; text-align: center; color: var(--muted); font-size: 12px; transition: .15s; cursor: pointer; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); color: var(--text); background: var(--panel-2); }
.doc { padding: 8px 0; border-top: 1px solid var(--line); font-size: 12px; }
.doc:first-child { border-top: none; }
.doc .name { color: var(--text); word-break: break-all; }
.doc .meta { color: var(--muted); font-size: 11px; margin-top: 2px; }
.collapse-head { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.collapse-head .caret { transition: .15s; }
.collapse-head.open .caret { transform: rotate(90deg); }

/* chat */
.chat-head { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }
.chat-head select { width: auto; max-width: 320px; flex: 1; }
.messages { flex: 1; min-height: 0; overflow: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.msg { max-width: 84%; }
.msg.user { align-self: flex-end; }
.msg.assistant { align-self: flex-start; width: 100%; max-width: 100%; }
.bubble { padding: 11px 14px; border-radius: 12px; font-size: 14px; }
.msg.user .bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 3px; }
.msg.assistant .bubble { background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.msg .by { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.msg.user .by { text-align: right; }
.msg-actions { margin-top: 6px; display: flex; gap: 8px; }
.composer { border-top: 1px solid var(--line); padding: 12px 16px; flex: 0 0 auto; background: var(--panel); }
.composer textarea { height: 60px; }
.composer .bar { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.provider-note { font-size: 11px; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 40px 16px; font-size: 13px; }
.thinking { display: inline-flex; gap: 4px; align-items: center; color: var(--muted); font-size: 13px; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.thinking i:nth-child(2){ animation-delay:.2s } .thinking i:nth-child(3){ animation-delay:.4s }
@keyframes blink { 0%,80%,100%{opacity:.2} 40%{opacity:1} }

/* markdown */
.md h1,.md h2,.md h3 { margin: 12px 0 6px; line-height: 1.3; }
.md h1 { font-size: 17px; } .md h2 { font-size: 15px; } .md h3 { font-size: 14px; color: var(--brand-2); }
.md p { margin: 6px 0; }
.md ul,.md ol { margin: 6px 0; padding-left: 22px; }
.md li { margin: 3px 0; }
.md code { background: #0c0f13; padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, monospace; font-size: 12px; }
.md strong { color: #fff; }
.md hr { border: none; border-top: 1px solid var(--line); margin: 10px 0; }

/* skills (right) */
.skill { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; margin-bottom: 10px; }
.skill .t { font-weight: 600; font-size: 13px; display:flex; align-items:center; gap:6px; }
.skill .s { color: var(--muted); font-size: 12px; margin: 3px 0 6px; }
.skill .c { font-size: 12px; max-height: 0; overflow: hidden; transition: max-height .2s; }
.skill .c.open { max-height: 600px; overflow: auto; }
.skill .acts { margin-top: 8px; display: flex; gap: 8px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: 520px; max-width: 94vw; max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 16px; font-size: 16px; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #222a33; border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); z-index: 100; font-size: 13px;
}
.toast.err { border-color: #4a2a2a; color: #ffb4b4; }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .col.left, .col.right { max-height: 240px; border: none; border-bottom: 1px solid var(--line); }
}
