/* Agent Showcase: shared tokens, demo bar, "How it's built" sheet, chat components.
   Brand: Azure Innovation Station (Segoe UI, Azure Blue, Onyx). Demo pages re-theme the chat with --chat-* variables. */
:root {
  --ink: #0B1A24;
  --ink-2: #26313B;
  --muted: #56626E;
  --line: #DFE4EA;
  --line-2: #EBEFF3;
  --bg: #FFFFFF;
  --bg-2: #F4F6F9;
  --bg-3: #EBEFF4;
  --blue: #0078D4;
  --blue-ink: #005A9E;
  --blue-50: #EAF3FC;
  --green: #0E7A0D;
  --green-50: #E7F4E6;
  --amber: #8A5300;
  --amber-50: #FFF4DE;
  --red: #B42318;
  --red-50: #FDECEA;
  --bar: #0B1620;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(11, 26, 36, .06), 0 10px 28px -14px rgba(11, 26, 36, .22);
  --shadow-lg: 0 2px 4px rgba(11, 26, 36, .06), 0 28px 56px -24px rgba(11, 26, 36, .34);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --bar-h: 48px;
  /* chat theme (overridden per demo) */
  --chat-accent: var(--blue);
  --chat-accent-ink: var(--blue-ink);
  --chat-user-bg: var(--blue);
  --chat-user-ink: #fff;
  --chat-bot-bg: #fff;
  --chat-bot-ink: var(--ink);
  --chat-surface: var(--bg-2);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue-ink); text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); text-wrap: balance; }
p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.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; }
.skip { position: absolute; left: 16px; top: -80px; z-index: 200; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.skip:focus { top: 8px; color: #fff; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

/* ---------- Demo bar (top of every demo) ---------- */
.demo-bar { position: sticky; top: 0; z-index: 90; height: var(--bar-h); background: var(--bar); color: #E8EEF3; display: flex; align-items: center; gap: 14px; padding: 0 clamp(12px, 2.4vw, 24px); font: 500 14px/1 var(--font); border-bottom: 1px solid rgba(255, 255, 255, .08); }
.demo-bar a, .demo-bar button { color: inherit; }
.demo-bar .back { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px 0 6px; margin-left: -6px; border-radius: 8px; text-decoration: none; color: #C9D4DD; white-space: nowrap; }
.demo-bar .back:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.demo-bar .back .mark { width: 24px; height: 24px; border-radius: 6px; background: var(--blue); color: #fff; display: grid; place-items: center; font: 700 11px/1 var(--font-display); }
.demo-bar .divider { width: 1px; height: 20px; background: rgba(255, 255, 255, .16); flex: none; }
.demo-bar .title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.demo-bar .title strong { font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-bar .live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #9FE3A6; background: rgba(46, 220, 104, .10); border: 1px solid rgba(46, 220, 104, .25); padding: 4px 8px; border-radius: 999px; white-space: nowrap; }
.demo-bar .live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #2EDC68; box-shadow: 0 0 0 0 rgba(46, 220, 104, .6); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(46, 220, 104, .55); } 70% { box-shadow: 0 0 0 7px rgba(46, 220, 104, 0); } 100% { box-shadow: 0 0 0 0 rgba(46, 220, 104, 0); } }
.demo-bar .spacer { flex: 1; }
.demo-bar .quota { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #C9D4DD; white-space: nowrap; }
.demo-bar .quota b { color: #fff; font-weight: 600; }
.demo-bar .quota.low b { color: #FFC66D; }
.demo-bar .quota.presenter { color: #FFD98A; }
.demo-bar .how-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .06); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.demo-bar .how-btn:hover { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .4); }
@media (max-width: 720px) {
  .demo-bar { gap: 10px; }
  .demo-bar .back span.txt, .demo-bar .live, .demo-bar .divider { display: none; }
  .demo-bar .title strong { font-size: 13.5px; }
  .demo-bar .quota .txt { display: none; }
  .demo-bar .quota .txt-mob { display: inline; }
  .demo-bar .how-btn .txt-long { display: none; }
}
@media (min-width: 721px) { .demo-bar .how-btn .txt-short, .demo-bar .quota .txt-mob { display: none; } }

/* ---------- "How it's built" sheet ---------- */
dialog.sheet { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(600px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; padding: 0; border: 0; background: #fff; color: var(--ink); box-shadow: var(--shadow-lg); overflow: hidden; }
dialog.sheet[open] { display: flex; flex-direction: column; animation: sheet-in .38s var(--ease); }
dialog.sheet::backdrop { background: rgba(11, 22, 32, .48); backdrop-filter: blur(2px); }
@keyframes sheet-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: flex-start; gap: 16px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line-2); }
.sheet-head .eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--blue-ink); }
.sheet-head h2 { font-size: 22px; line-height: 1.2; margin-top: 4px; letter-spacing: -.01em; }
.sheet-close { margin-left: auto; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; flex: none; }
.sheet-close:hover { border-color: var(--ink); }
.sheet-body { overflow-y: auto; padding: 8px 24px 32px; overscroll-behavior: contain; }
.how-sec { padding: 20px 0; border-bottom: 1px solid var(--line-2); }
.how-sec:last-child { border-bottom: 0; }
.how-sec h3 { font-size: 15px; letter-spacing: .01em; margin-bottom: 12px; }
.how-summary { font-size: 15.5px; color: var(--ink-2); }
.how-steps { list-style: none; counter-reset: s; display: grid; gap: 10px; }
.how-steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.how-steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--blue-50); color: var(--blue-ink); font: 700 13px/28px var(--font-display); text-align: center; }
.how-steps b { display: block; font-size: 14.5px; }
.how-steps span { font-size: 14px; color: var(--muted); }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 10px; }
.svc { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.svc b { display: block; font-size: 14px; }
.svc span { font-size: 13px; color: var(--muted); }
.conn { list-style: none; display: grid; gap: 10px; }
.conn li { border-left: 3px solid var(--blue); padding: 2px 0 2px 12px; }
.conn b { font-size: 14px; }
.conn .how { display: block; font-size: 13.5px; color: var(--ink-2); }
.conn .needs { display: block; font-size: 13px; color: var(--muted); }
.cost-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.cost-table th, .cost-table td { text-align: left; padding: 9px 8px 9px 0; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.cost-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.cost-table td:last-child, .cost-table th:last-child { text-align: right; white-space: nowrap; padding-right: 0; font-variant-numeric: tabular-nums; }
.cost-table td .math { display: block; color: var(--muted); font-size: 12.5px; }
.cost-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--blue-50); }
.cost-total b { font: 700 18px/1.2 var(--font-display); color: var(--blue-ink); }
.fine { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.how-note { margin-top: 8px; font-size: 13.5px; color: var(--ink-2); background: var(--bg-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.guard { list-style: none; display: grid; gap: 8px; font-size: 14px; }
.guard li { display: flex; gap: 10px; }
.guard li::before { content: ""; width: 8px; height: 8px; margin-top: 8px; border-radius: 2px; background: var(--green); flex: none; }
.how-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent; font: 600 15px/1 var(--font); text-decoration: none; white-space: nowrap; transition: background-color .2s, color .2s, border-color .2s, transform .2s var(--ease); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-ink); color: #fff; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--ink); color: var(--ink); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; min-height: 0; height: 100%; background: var(--chat-surface); }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 20px clamp(14px, 3vw, 28px) 12px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; overscroll-behavior: contain; }
.msg { display: flex; gap: 10px; max-width: 100%; }
.msg.user { justify-content: flex-end; }
.msg .avatar { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center; font: 700 11.5px/1 var(--font-display); background: var(--chat-accent); color: #fff; margin-top: 2px; }
.msg .body { min-width: 0; max-width: min(720px, 100%); display: flex; flex-direction: column; gap: 8px; }
.msg.user .body { align-items: flex-end; max-width: min(560px, 88%); }
.bubble { padding: 11px 15px; border-radius: 16px; font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--chat-user-bg); color: var(--chat-user-ink); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.msg.bot .bubble { background: var(--chat-bot-bg); color: var(--chat-bot-ink); border: 1px solid var(--line-2); border-top-left-radius: 6px; box-shadow: 0 1px 2px rgba(11, 26, 36, .04); }
.msg.bot .bubble:empty { display: none; }
.bubble.error { background: var(--red-50); border-color: #F5C2BD; color: var(--red); }
.typing { display: inline-flex; gap: 4px; padding: 14px 16px; background: var(--chat-bot-bg); border: 1px solid var(--line-2); border-radius: 16px; border-top-left-radius: 6px; width: fit-content; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .35; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: .9; transform: translateY(-2px); } }

/* agent steps (tool calls) */
.steps { list-style: none; display: grid; gap: 6px; }
.step { display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: start; font-size: 13px; color: var(--ink-2); background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; }
.step .st { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--green-50); color: var(--green); }
.step .st .icon { width: 13px; height: 13px; stroke-width: 3; }
.step.running .st { background: var(--blue-50); }
.step.running .st::after { content: ""; width: 10px; height: 10px; border: 2px solid var(--blue); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.step .lbl { font-weight: 600; color: var(--ink); }
.step .sum { color: var(--muted); }
.step .detail { display: block; margin-top: 3px; color: var(--muted); overflow-wrap: anywhere; }
.step details.code summary { cursor: pointer; color: var(--chat-accent-ink); font-weight: 600; margin-top: 4px; width: fit-content; }
.step pre { margin: 6px 0 0; padding: 8px 10px; border-radius: 8px; background: #0F1B26; color: #D7E3EE; font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow-y: auto; }

/* markdown inside bubbles */
.md > * + * { margin-top: .6em; }
.md ul, .md ol { padding-left: 1.25em; }
.md li + li { margin-top: .2em; }
.md strong { font-weight: 650; }
.md code { font: 13px/1.4 var(--mono); background: var(--bg-3); padding: 1px 5px; border-radius: 5px; }
.md .tbl { overflow-x: auto; max-width: 100%; }
.md table { border-collapse: collapse; font-size: 13.5px; min-width: 100%; }
.md th, .md td { border-bottom: 1px solid var(--line); padding: 6px 10px 6px 0; text-align: left; vertical-align: top; }
.md th { font-weight: 650; white-space: nowrap; }
.md a { color: var(--chat-accent-ink); }
.cite { display: inline-flex; align-items: center; vertical-align: 1px; margin: 0 1px; padding: 0 6px; height: 19px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink-2); font: 600 11px/17px var(--font); letter-spacing: .02em; cursor: pointer; white-space: nowrap; }
.cite:hover, .cite.on { border-color: var(--chat-accent); color: var(--chat-accent-ink); background: #fff; }

/* composer */
.composer { padding: 10px clamp(14px, 3vw, 28px) 14px; background: var(--chat-surface); }
.starters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.starter { border: 1px solid var(--line); background: #fff; color: var(--ink-2); border-radius: 999px; padding: 7px 13px; font-size: 13.5px; line-height: 1.3; text-align: left; transition: border-color .2s, color .2s; }
.starter:hover { border-color: var(--chat-accent); color: var(--chat-accent-ink); }
.input-row { display: flex; align-items: flex-end; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 6px 6px 6px 14px; box-shadow: 0 1px 2px rgba(11, 26, 36, .04); transition: border-color .2s, box-shadow .2s; }
.input-row:focus-within { border-color: var(--chat-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--chat-accent) 18%, transparent); }
.input-row textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; padding: 8px 0; min-height: 24px; max-height: 140px; font-size: 15px; line-height: 1.5; }
.send { width: 40px; height: 40px; flex: none; border-radius: 12px; border: 0; background: var(--chat-accent); color: #fff; display: grid; place-items: center; transition: background-color .2s, opacity .2s; }
.send:hover { background: var(--chat-accent-ink); }
.send:disabled { opacity: .4; cursor: not-allowed; }
.composer-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.composer-meta .left { min-width: 0; }
.limit-card { border: 1px solid #F1D29A; background: var(--amber-50); color: #5C3A00; border-radius: 14px; padding: 14px 16px; font-size: 14px; }
.limit-card b { display: block; font-size: 15px; margin-bottom: 2px; }
.limit-card .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
