:root { --bg:#f6f7f4; --card:#fff; --ink:#1d2a2f; --muted:#5b6b70; --primary:#0f4c5c; --accent:#e36414; --line:#dde3e3; --ok:#2d6a4f; --warn:#b7791f; --bad:#9b2226; }
* { box-sizing: border-box; }
body { margin:0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color:var(--ink); background:var(--bg); }
a { color: var(--primary); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.top { background: var(--primary); color:#fff; }
.top .wrap { display:flex; align-items:center; justify-content:space-between; gap:16px; padding-top:12px; padding-bottom:12px; flex-wrap:wrap; }
.top a { color:#fff; text-decoration:none; }
.brand { font-weight:700; font-size:1.15rem; }
.logo { color: var(--accent); }
nav a { margin-left: 16px; opacity:.9; }
nav a:hover { opacity:1; text-decoration:underline; }
.hero h1 { font-size: 2rem; line-height:1.2; margin: 28px 0 8px; }
.hero p { max-width: 75ch; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.grid { display:grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 20px 0; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } nav a { margin-left: 10px; } }
.card { background: var(--card); border:1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
h2 { font-size: 1.25rem; margin-top: 0; }
form label { display:block; margin: 8px 0; font-weight: 600; font-size:.92rem; }
form input[type=text], form input[type=number], form select { display:block; width:100%; margin-top:4px; padding: 8px 10px; border:1px solid #b9c4c6; border-radius: 8px; font: inherit; font-weight:400; background:#fff; }
fieldset { border:1px solid var(--line); border-radius:8px; margin: 8px 0; }
fieldset.inline label { display:inline-block; margin-right: 14px; font-weight:400; }
.two { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks { display:grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; max-height: 220px; overflow:auto; padding: 6px 2px; }
.checks label, .checks fieldset label { font-weight: 400; margin: 2px 0; font-size:.88rem; }
.checks fieldset { grid-column: span 1; }
details summary { cursor: pointer; font-weight: 600; margin: 6px 0; }
button { background: var(--primary); color: #fff; border: 0; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; }
button:hover { background: #0b3a46; }
button.secondary, button[disabled] { background: #d8e2e3; color: var(--ink); cursor: default; }
button.link-btn { background: none; color: var(--bad); padding: 0 6px; font-weight: 500; }
#result-status.error { color: var(--bad); font-weight: 600; }
.results { display:grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.tender { background:#fff; border:1px solid var(--line); border-radius:12px; padding: 14px 16px; display:flex; flex-direction:column; }
.tender header { display:flex; justify-content:space-between; gap: 10px; align-items:flex-start; }
.tender h3 { font-size: 1rem; margin: 0; }
.tender h3 a { text-decoration: none; color: var(--ink); }
.tender h3 a:hover { text-decoration: underline; }
.buyer { color: var(--muted); font-size: .88rem; margin: 6px 0; }
.facts { display:grid; grid-template-columns: max-content 1fr; gap: 2px 10px; font-size: .86rem; margin: 6px 0 10px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.facts dd.urgent { color: var(--bad); font-weight: 600; }
.tender .actions { margin-top:auto; display:flex; gap: 12px; align-items:center; flex-wrap: wrap; font-size:.88rem; }
.fit { white-space:nowrap; font-weight:700; font-size:.8rem; border-radius: 999px; padding: 3px 10px; color:#fff; cursor: help; }
.fit-strong { background: var(--ok); } .fit-possible { background: var(--warn); } .fit-weak { background: #8a9a9e; }
#shortlist { margin: 24px 0; }
#shortlist-list li { margin: 6px 0; }
.export { display:flex; gap: 14px; align-items:center; flex-wrap:wrap; }
.export input { width: 70px; display:inline-block; padding:6px; border:1px solid #b9c4c6; border-radius:6px; }
.devs { margin: 24px 0; }
footer { padding: 20px; }
dialog.gate dl, dialog.assistant-review dl { display:grid; grid-template-columns:max-content 1fr; gap: 4px 12px; }
dialog.gate label { display:block; margin: 10px 0; font-size: .9rem; }
/* Assistant layout. Append to the site's stylesheet and set the colors to the site's palette. */
.assistant { margin-top: 48px; }

/* The runtime reads these variables for its chat, settings and agent panels.
   The chat background below also uses --ns-bg. White text sits on --ns-primary (the
   visitor's messages, Send, and the chat form and settings buttons) and on --ns-accent
   (Send while a turn is steered), so give both at least 4.5:1 contrast with white.
   --ns-accent also underlines the chat header. */
#agent-app {
  --ns-font: system-ui, sans-serif;
  --ns-bg: #ffffff;
  --ns-fg: #1f2328;
  --ns-primary: #0f4c5c;
  --ns-accent: #b34d0e;
  --ns-border: #d0d7de;
  --ns-panelbg: #ffffff;
  --ns-msgbg: #f6f8fa;
  --ns-muted: #59636e;
}

.assistant-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 16px;
  margin-top: 16px;
}

/* Set the height once the runtime has mounted the chat, so a failed load leaves no
   empty box. */
#agent-app.ns-composed-app [data-ns-slot="chat"] { height: 720px; }
/* The runtime gives the chat no background of its own. Keep --ns-msgbg different from
   --ns-bg, or bot replies lose their bubble. */
#agent-app .ns-chat { background: var(--ns-bg); }

/* Site-wide form rules often stretch the runtime's own controls. Undo them here. */
#agent-app input[type="checkbox"],
#agent-app input[type="radio"] { width: auto; }
#agent-app .ns-header { flex-wrap: wrap; }
/* Site label rules add margins and bold text, and the inputs inside the labels inherit
   the weight. */
#agent-app .ns-settings-body label { margin: 4px 0; font-weight: 400; }
/* Chat forms label radio groups with a legend, so site legend fonts would reach them. */
#agent-app .ns-w-label { font-family: inherit; }
/* Site label rules add margins to chat form fields and make their options bold. */
#agent-app .ns-widget label { margin: 0; }
#agent-app .ns-w-radio label,
#agent-app .ns-w-multi label,
#agent-app .ns-w-toggle { font-weight: 400; }
/* The runtime sizes radio and multi-choice options but not the checkbox label. */
#agent-app .ns-w-toggle { font-size: 13px; }
/* The runtime spaces its buttons with gap. A site's button margin pushes Send below the input. */
#agent-app button { margin: 0; }
/* Chat choices are buttons with a light background. A site's button color can hide their
   titles. */
#agent-app .ns-w-choice { color: var(--ns-fg); }
/* A site's button:hover background also reaches the runtime's plain buttons, behind
   their dark text. Keep the runtime's own backgrounds. */
#agent-app .ns-devtoggle:not(.on):hover,
#agent-app .ns-modal-close:hover { background: transparent; }
#agent-app .ns-w-choice:disabled:hover { background: #fafbfc; }
/* The runtime's message rule hides the partner consent card's own background, and its
   Decline label then has too little contrast. */
#agent-app .ns-consent { background: #fffbeb; }
/* While a consent card waits, the status line above it already says "Contacting", though
   nothing has been sent. Hide it until the visitor answers. */
#agent-app .ns-msgs:has(.ns-consent-actions) > .ns-turn-status { display: none; }
/* Long links in a reply would run out of the bubble on a phone. "anywhere" would also
   let the consent card's buttons shrink and split their labels. */
#agent-app .ns-msg { overflow-wrap: break-word; }
/* On a phone the consent card is too narrow for its three buttons in one row, and
   "Always allow" breaks onto two lines. Keep each label whole and wrap the row. */
#agent-app .ns-consent-actions { flex-wrap: wrap; }
#agent-app .ns-consent-actions button { white-space: nowrap; }

/* site.js and the runtime add their confirmation dialogs to <body>, outside #agent-app.
   Site h2 rules reach the heading, and the two buttons touch. A right margin keeps
   wrapped buttons lined up on the left. */
body > dialog h2 { margin: 0 0 12px; font: 700 1.25em system-ui, sans-serif; }
body > dialog button { margin-right: 8px; }
/* site.js's dialog: the details in two columns, and a plain decline button, so the two
   choices do not look the same. */
.assistant-review { max-width: 640px; width: 85%; max-height: 85vh; overflow: auto; border: 1px solid #888; border-radius: 12px; padding: 24px; font: 16px system-ui, sans-serif; }
.assistant-review dl { display: grid; grid-template-columns: fit-content(40%) 1fr; gap: 4px 16px; margin: 12px 0; }
.assistant-review dt { font-weight: 600; }
.assistant-review dd { margin: 0; overflow-wrap: anywhere; }
.assistant-review details { margin: 12px 0; }
.assistant-review pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-review .assistant-decline { background: transparent; color: inherit; border: 1px solid currentColor; }

@media (max-width: 760px) {
  .assistant-panels { grid-template-columns: 1fr; }
  /* On a phone, each detail goes under its label, so an email is not split. */
  .assistant-review dl { grid-template-columns: 1fr; gap: 0; }
  .assistant-review dd { margin-bottom: 8px; }
}
