/* Emissarii Buyer's Agent — the one stylesheet. Served at /static/app.css.
   System fonts, a single content column, honest controls. Owned by W10;
   other workstreams request additions rather than adding page-local CSS. */

:root {
  --bg: #ffffff; --fg: #1a1a1a; --muted: #6b6b6b; --line: #e6e6e6; --soft: #f6f6f4;
  --accent: #1f4e79; --accent-fg: #ffffff; --ok: #1f7a3a; --warn: #9a6700; --error: #b3261e;
  --radius: 8px; --col: 640px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111214; --fg: #ececec; --muted: #9a9a9a; --line: #2a2b2e; --soft: #1a1b1e; --accent: #7fb0e0; --accent-fg: #0b1620; }
}
* { box-sizing: border-box; }
/* Author `display` rules (.composer{display:flex}, .slots{display:grid}) otherwise beat the UA's
   [hidden]{display:none}, so `el.hidden = true` silently did nothing (W4's email field and composer). */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); }
body { font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; display: flex; flex-direction: column; min-height: 100vh; }
main { width: 100%; max-width: var(--col); margin: 0 auto; padding: 24px 16px 48px; flex: 1; }
body.wide { --col: 1200px; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 12px; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; margin-top: 28px; } h3 { font-size: 1.05rem; margin-top: 20px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
header.top { display: flex; align-items: baseline; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
header.top .brand { font-weight: 600; text-decoration: none; color: var(--fg); letter-spacing: .2px; }
header.top .sub { color: var(--muted); font-size: .95rem; }
footer.foot { color: var(--muted); font-size: .85rem; padding: 16px; border-top: 1px solid var(--line); text-align: center; }

.btn, button, input[type=submit] { font: inherit; padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg); cursor: pointer; }
.btn.secondary, button.secondary { background: transparent; color: var(--accent); }
.btn.danger, button.danger { background: var(--error); border-color: var(--error); color: #fff; }
.btn[disabled], button[disabled] { opacity: .5; cursor: default; }
label.field { display: block; margin: 0 0 14px; }
label.field span { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=url], textarea, select {
  font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--fg);
}
textarea { min-height: 120px; resize: vertical; }
form .row { display: flex; gap: 12px; flex-wrap: wrap; }
form .row > * { flex: 1 1 200px; }

.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; background: var(--soft); }
.card h3 { margin-top: 0; }
.notice { padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--soft); }
.notice.ok { border-color: var(--ok); } .notice.warn { border-color: var(--warn); } .notice.error { border-color: var(--error); }
.pill { display: inline-block; font-size: .8rem; padding: 2px 8px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); }

table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: .95rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: .85rem; }
body.wide table { font-size: .9rem; }

/* Chat (vendor agent page, vendor generalist) */
.chat { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.chat .msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; }
.chat .msg.agent { align-self: flex-start; background: var(--soft); border: 1px solid var(--line); }
.chat .msg.vendor { align-self: flex-end; background: var(--accent); color: var(--accent-fg); }
.chat .msg.system { align-self: center; color: var(--muted); font-size: .85rem; background: none; }
.composer { display: flex; gap: 8px; align-items: flex-end; position: sticky; bottom: 0; background: var(--bg); padding: 8px 0 16px; }
.composer textarea { min-height: 44px; }

/* Slot picker */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin: 12px 0; }
.slots button { background: var(--bg); color: var(--fg); border-color: var(--line); text-align: left; }
.slots button:hover { border-color: var(--accent); }

/* Match cards */
.cards { display: grid; gap: 12px; }
.cards .card .meta { color: var(--muted); font-size: .85rem; display: flex; gap: 8px; flex-wrap: wrap; }
.cards .card .actions form { display: inline; }

/* Admin */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 12px 0 24px; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.kpi .n { font-size: 1.6rem; font-weight: 600; } .kpi .l { color: var(--muted); font-size: .85rem; }
nav.tabs { display: flex; gap: 14px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 0 0 16px; padding-bottom: 8px; }
nav.tabs a.active { font-weight: 600; }
nav.tabs form { margin-left: auto; }
code, pre { font: .9em ui-monospace, SFMono-Regular, Menlo, monospace; }
pre { background: var(--soft); padding: 12px; border-radius: var(--radius); overflow: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }

/* Accessibility and small screens */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
img, video { max-width: 100%; height: auto; }
pre, code { overflow-wrap: anywhere; }
/* Wide admin tables scroll sideways inside the column instead of widening the page at 375 px. */
@media (max-width: 700px) {
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
