/* Lone Star AC & Heating. Light theme by default; [data-theme="dark"] on <html> switches. */
:root {
  --bg: #fbfaf7; --fg: #1d232b; --muted: #55606c; --card: #ffffff; --border: #dfe3e8;
  --primary: #b4441c; --primary-text: #b4441c; --primary-ink: #ffffff; --accent: #1f5f8b; --soft: #fff4ec;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #12161b; --fg: #e8ecf1; --muted: #a8b3bf; --card: #1b2128; --border: #2e3741;
  --primary: #b4441c; --primary-text: #f2a583; --primary-ink: #ffffff; --accent: #7fb7e0; --soft: #2a1d17;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--fg); line-height: 1.5; }
a { color: var(--accent); }
main { max-width: 1100px; margin: 0 auto; padding: 0 20px 48px; }
.topbar { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--card); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--fg); text-decoration: none; }
.brand span { color: var(--primary-text); }
.topbar nav { display: flex; gap: 14px; flex-wrap: wrap; }
.topbar nav a { color: var(--fg); text-decoration: none; font-weight: 500; }
.theme-toggle { border: 1px solid var(--border); background: var(--bg); color: var(--fg); border-radius: 999px; padding: 6px 14px; cursor: pointer; font: inherit; }
.hero { padding: 56px 0 24px; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); line-height: 1.1; margin: 8px 0 12px; }
.eyebrow { color: var(--primary-text); font-weight: 700; letter-spacing: .02em; margin: 0; }
.button { display: inline-block; background: var(--primary); color: var(--primary-ink); padding: 10px 18px; border-radius: 10px; text-decoration: none; font-weight: 600; }
.button.ghost { background: transparent; color: var(--fg); border: 1px solid var(--border); }
.demo-note { background: var(--soft); border: 1px dashed var(--primary); padding: 8px 12px; border-radius: 8px; display: inline-block; font-size: .92rem; }
.services { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.service, .card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.service strong { display: block; margin-bottom: 6px; }
.badge { display: inline-block; font-size: .8rem; background: var(--soft); color: var(--fg); border-radius: 999px; padding: 2px 10px; }
.muted { color: var(--muted); }
.fact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.fact-grid h3 { margin: 0 0 6px; font-size: 1rem; }
.fact-grid p { margin: 0; }
.forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-top: 32px; }
form label { display: block; margin: 10px 0; font-weight: 500; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--fg); font: inherit; }
form button, .assistant-review button { background: var(--primary); color: var(--primary-ink); border: 0; border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; }
.status { min-height: 1.5em; font-weight: 500; }
.activity li { margin: 6px 0; }
footer { border-top: 1px solid var(--border); padding: 20px; text-align: center; color: var(--muted); font-size: .9rem; }
.assistant-review { background: var(--card); color: var(--fg); border: 1px solid var(--border); border-radius: 14px; max-width: 520px; }
.assistant-review .assistant-decline { background: transparent; color: var(--fg); border: 1px solid var(--border); margin-left: 8px; }
.assistant-review dt { font-weight: 600; margin-top: 6px; }
.assistant-review dd { margin: 0 0 4px; }

/* 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: var(--card);
  --ns-fg: var(--fg);
  --ns-primary: var(--primary);
  --ns-accent: var(--primary);
  --ns-border: var(--border);
  --ns-panelbg: var(--card);
  --ns-msgbg: var(--bg);
  --ns-muted: var(--muted);
}

.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; }
}

/* ---- Demo polish: AI team, try-asking list, partner card, focus, phone layout ---- */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.theme-toggle:focus-visible, .button:focus-visible, form button:focus-visible { outline-offset: 3px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; counter-reset: none; }
.steps .card h3 { margin: 6px 0; font-size: 1.05rem; }
.steps .card p { margin: 0; color: var(--muted); }
.step-n { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-weight: 700; }
.partner-card { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 32px; padding: 20px; border: 1px solid var(--border); border-left: 6px solid var(--primary); border-radius: 14px; background: var(--soft); }
.partner-card h2 { margin: 4px 0 6px; }
.partner-card p { margin: 0 0 6px; }
.try { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 4px 16px 8px; margin: 12px 0; }
.try h3 { margin: 10px 0 4px; font-size: 1rem; }
.try ul { margin: 0; padding-left: 20px; }
.try li { margin: 4px 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Dark mode for the runtime's own elements. The runtime hardcodes light backgrounds for
   its agent cards, dialogs, chat forms, trace rows and badges, and the runtime files are
   not edited, so each is overridden here. Text colors keep at least 4.5:1 contrast. */
[data-theme="dark"] #agent-app { --ns-msgbg: #262e37; --ns-panelbg: #1b2128; }
[data-theme="dark"] #agent-app .ns-anode,
[data-theme="dark"] #agent-app .ns-tbox,
[data-theme="dark"] #agent-app .ns-widget { background: #232b34; color: #e8ecf1; border-color: #3a4551; }
[data-theme="dark"] #agent-app .ns-anode .ns-arole,
[data-theme="dark"] #agent-app .ns-anode .ns-aaddr,
[data-theme="dark"] #agent-app .ns-w-desc,
[data-theme="dark"] #agent-app .ns-w-fdesc,
[data-theme="dark"] #agent-app .ns-w-csub,
[data-theme="dark"] #agent-app .ns-w-fk { color: #b3bec9; }
[data-theme="dark"] #agent-app .ns-anode:hover { background: #2b343e; }
[data-theme="dark"] #agent-app .ns-adot { background: #6b7886; }
[data-theme="dark"] #agent-app .ns-anode.done .ns-adot { background: #4ade80; }
[data-theme="dark"] #agent-app .ns-tbox.leaf { background: #1b2128; color: #b3bec9; }
[data-theme="dark"] #agent-app .ns-tbox.active { background: #3a2a22; }
[data-theme="dark"] #agent-app .ns-w-choice { background: #232b34; color: #e8ecf1; border-color: #3a4551; }
[data-theme="dark"] #agent-app .ns-w-choice:hover:not(:disabled) { background: #2b343e; }
[data-theme="dark"] #agent-app .ns-w-choice:disabled:hover { background: #232b34; }
[data-theme="dark"] #agent-app .ns-w-row input,
[data-theme="dark"] #agent-app .ns-w-row select,
[data-theme="dark"] #agent-app .ns-w-row textarea,
[data-theme="dark"] #agent-app .ns-inputbar input,
[data-theme="dark"] #agent-app .ns-settings-body input,
[data-theme="dark"] #agent-app .ns-settings-body select,
[data-theme="dark"] #agent-app .ns-toolbar input { background: #12161b; color: #e8ecf1; border-color: #3a4551; }
[data-theme="dark"] #agent-app .ns-w-btn.ghost,
[data-theme="dark"] #agent-app .ns-settings-body button.ghost { color: #c9d2db; border-color: #4a5663; }
[data-theme="dark"] #agent-app .ns-consent { background: #3a2f16; color: #fdf3d6; border-color: #b7791f; }
[data-theme="dark"] #agent-app .ns-consent-sub { color: #e6cf9a; }
[data-theme="dark"] #agent-app .ns-consent-req { color: #e6e0cf; }
[data-theme="dark"] #agent-app .ns-consent-actions button.ghost { color: #fcd34d; border-color: #b7791f; }
[data-theme="dark"] #agent-app .ns-consent-done { color: #86efac; }
[data-theme="dark"] #agent-app .ns-linker { background: #14303f; color: #e8f4fb; border-color: #38bdf8; }
[data-theme="dark"] #agent-app .ns-linker-sub { color: #bcd3e0; }
[data-theme="dark"] #agent-app .ns-row { background: #232b34; color: #e8ecf1; }
[data-theme="dark"] #agent-app .ns-row.k-remote_call { background: #3a2230; }
[data-theme="dark"] #agent-app .ns-row.k-mcp_call { background: #16332f; }
[data-theme="dark"] #agent-app .ns-row.k-error,
[data-theme="dark"] #agent-app .ns-row.status-error { background: #3b1f1f; }
[data-theme="dark"] #agent-app .ns-row pre { background: #12161b; color: #e8ecf1; border-color: #3a4551; }
[data-theme="dark"] #agent-app .ns-mact { background: #232b34; color: #e8ecf1; }
[data-theme="dark"] #agent-app .ns-node.origin { background: #3a2f16; color: #fdf3d6; border-color: #b7791f; }
[data-theme="dark"] #agent-app .ns-pill { background: #2c3550; color: #d5dcf2; }
[data-theme="dark"] #agent-app .ns-llmbadge.mock { background: #3a2f16; color: #fcd34d; }
[data-theme="dark"] #agent-app .ns-llmbadge.real { background: #123524; color: #86efac; }
[data-theme="dark"] #agent-app .ns-llmbadge.pending { background: #12303f; color: #7dd3fc; }
[data-theme="dark"] #agent-app .ns-llmbadge.error { background: #3b1f1f; color: #fca5a5; }
[data-theme="dark"] #agent-app .ns-devtoggle.on { background: #475569; border-color: #475569; }
/* The agent-details window and its code blocks are added inside #agent-app too. */
[data-theme="dark"] #agent-app .ns-modal-card { background: #1b2128; color: #e8ecf1; }
[data-theme="dark"] #agent-app .ns-modal-card pre { background: #12161b; color: #e8ecf1; }
[data-theme="dark"] #agent-app .ns-modal-close { color: #b3bec9; }
[data-theme="dark"] #agent-app .ns-rich pre,
[data-theme="dark"] #agent-app .ns-rich th { background: #12161b; }
[data-theme="dark"] .assistant-review { background: var(--card); color: var(--fg); border-color: var(--border); }
[data-theme="dark"] .assistant-review .assistant-decline { color: var(--fg); }

@media (max-width: 420px) {
  main { padding: 0 14px 40px; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .topbar nav { gap: 10px; font-size: .92rem; }
  .hero { padding-top: 32px; }
  .cta .button { display: block; text-align: center; margin: 0 0 8px; }
  .fact-grid, .forms { grid-template-columns: 1fr; }
  .partner-card { padding: 16px; }
  .partner-card .button { width: 100%; text-align: center; }
  #agent-app.ns-composed-app [data-ns-slot="chat"] { height: 640px; }
  .assistant-review { width: 94%; padding: 16px; }
}
