/* Haqdaar shared styles: the front site and every desk. Each page sets --theme and --accent. */
:root {
  --theme: #3b2f63;
  --accent: #b45309;
  --ink: #1c1917;
  --muted: #57534e;
  --paper: #fbf8f3;
  --card: #ffffff;
  --line: #e7e0d6;
  --ok: #166534;
  --ok-bg: #dcfce7;
  --no: #78716c;
  --no-bg: #f5f5f4;
  --ask: #92400e;
  --ask-bg: #fef3c7;
  --chk: #1e40af;
  --chk-bg: #dbeafe;
  font-size: 17px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.55 "Segoe UI", system-ui, -apple-system, "Noto Sans", sans-serif; }
a { color: var(--theme); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; }
pre { background: #f5f1ea; border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; max-height: 420px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
h1, h2, h3 { line-height: 1.2; }
h2 { margin: 48px 0 12px; font-size: 1.5rem; }
section > p { max-width: 70ch; }

.masthead { background: var(--theme); color: #fff; padding: 36px 0 30px; }
.masthead h1 { margin: 4px 0 8px; font-size: 2.2rem; letter-spacing: -0.01em; }
.masthead .dept { margin: 0; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.78rem; opacity: 0.85; }
.masthead .tagline { margin: 0; font-size: 1.1rem; opacity: 0.95; max-width: 60ch; }
.demo-banner { margin: 0; background: #fff7ed; border-bottom: 1px solid #fed7aa; padding: 10px 20px; text-align: center; font-size: 0.9rem; color: #7c2d12; }
.demo-banner a { color: inherit; }

button { font: inherit; background: var(--theme); color: #fff; border: 0; border-radius: 8px; padding: 10px 18px; cursor: pointer; }
button:hover { filter: brightness(1.12); }
button.secondary { background: transparent; color: var(--theme); border: 1px solid var(--theme); }
button.link { background: none; color: var(--theme); padding: 4px 0; text-decoration: underline; }
input, select { font: inherit; padding: 8px 10px; border: 1px solid #cfc6b8; border-radius: 6px; background: #fff; width: 100%; }

.check-form { display: grid; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.check-form fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; }
.check-form legend { font-weight: 600; padding: 0 6px; }
.check-form .field span { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.check-form > button[type=submit] { justify-self: start; }

.badge { display: inline-block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; border-radius: 999px; padding: 2px 10px; margin-right: 8px; vertical-align: 1px; }
.results { list-style: none; padding: 0; display: grid; gap: 8px; }
.result { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--no); border-radius: 8px; padding: 10px 14px; }
.result .why { color: var(--muted); font-size: 0.92rem; }
.result.eligible { border-left-color: var(--ok); } .result.eligible .badge { background: var(--ok-bg); color: var(--ok); }
.result.not_eligible .badge { background: var(--no-bg); color: var(--no); }
.result.need_info { border-left-color: #d97706; } .result.need_info .badge { background: var(--ask-bg); color: var(--ask); }
.result.check { border-left-color: var(--chk); } .result.check .badge { background: var(--chk-bg); color: var(--chk); }
.fine { color: var(--muted); font-size: 0.88rem; }

.scheme-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.scheme { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 10px; padding: 14px 16px; }
.scheme h3 { margin: 0 0 2px; }
.scheme .scheme-name { margin: 0 0 8px; color: var(--muted); font-size: 0.85rem; }
.scheme .benefit { margin: 0 0 8px; font-weight: 600; }
.scheme li.exclusion { color: #9f1239; }
.scheme .links { font-size: 0.9rem; margin: 8px 0 0; }

.reads { columns: 2; padding-left: 20px; }
.agent-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.agent-facts dt { font-weight: 600; }
.agent-facts dd { margin: 0; overflow-wrap: anywhere; }
.footer { margin-top: 56px; padding-bottom: 40px; color: var(--muted); font-size: 0.88rem; border-top: 1px solid var(--line); padding-top: 16px; }

@media (max-width: 700px) {
  .reads { columns: 1; }
  .masthead h1 { font-size: 1.7rem; }
}

/* 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: #7c2d12;
  --ns-accent: #c2410c;
  --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; }
}
