@font-face {
  font-family: "Raleway";
  src: local("Raleway");
  font-display: swap;
}

:root {
  --jcm-blue: rgb(0, 96, 157);
  --jcm-orange: #e17534;
  --ink: #25333e;
  --muted: #66737d;
  --line: #e1e6e9;
  --light: #f8f9fa;
  --white: #fff;
}

* { box-sizing: border-box; }
body { margin: 0; background: #f5f7f8; color: var(--ink); font-family: Raleway, Helvetica, Arial, sans-serif; font-weight: 300; line-height: 1.55; }
a { color: var(--jcm-blue); }
a:hover, a:focus { color: var(--jcm-orange); }
.page-shell { width: min(1440px, calc(100% - 1.5rem)); height: 100dvh; margin: 0 auto; padding: .75rem 0; }
.chat-card { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; height: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: .5rem; background: var(--white); box-shadow: 0 .8rem 2rem rgba(0, 0, 0, .06); }
.chat-toolbar { display: flex; align-items: center; gap: 1rem; min-height: 64px; padding: .55rem 1rem; border-bottom: 1px solid var(--line); background: var(--light); }
.brand { display: flex; align-items: center; min-width: 152px; }
.brand img { display: block; width: 150px; height: auto; }
.interface-selector { display: flex; align-items: center; gap: .5rem; margin-left: auto; color: var(--muted); font-size: .82rem; font-weight: 700; white-space: nowrap; }
select, textarea { width: 100%; border: 1px solid #cdd5da; border-radius: .375rem; background: var(--white); color: var(--ink); font: inherit; }
select { padding: .35rem .5rem; }
.toolbar-actions { display: flex; align-items: center; gap: 1rem; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--jcm-blue); font: inherit; font-size: .9rem; cursor: pointer; text-decoration: underline; text-underline-offset: .15em; }
.text-button.danger { color: #a3342c; }
.messages { display: grid; align-content: start; gap: 1rem; min-height: 0; padding: clamp(1rem, 2vw, 1.75rem); overflow-y: auto; background: linear-gradient(135deg, rgba(0, 96, 157, .025), rgba(225, 117, 52, .025)); }
.message { max-width: min(84%, 900px); padding: .9rem 1rem; border: 1px solid var(--line); border-radius: .5rem; overflow-wrap: anywhere; }
.message.user { justify-self: end; border-color: rgba(0, 96, 157, .24); background: rgba(0, 96, 157, .08); white-space: pre-wrap; }
.message.assistant { justify-self: start; background: var(--white); }
.message.assistant > :first-child { margin-top: 0; }
.message.assistant > :last-child { margin-bottom: 0; }
.message.assistant pre { padding: .75rem; overflow-x: auto; border-radius: .3rem; background: #f3f6f7; }
.message.assistant code { color: #004e7e; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.message.assistant :not(pre) > code { padding: .1rem .3rem; border-radius: .2rem; background: rgba(0, 96, 157, .08); }
.fa-icon { display: inline-block; width: 1em; height: 1em; flex: 0 0 auto; background: currentColor; mask: var(--fa-icon) center / contain no-repeat; -webkit-mask: var(--fa-icon) center / contain no-repeat; }
.fa-copy { --fa-icon: url("/static/vendor/fontawesome/copy.svg"); }
.fa-envelope { --fa-icon: url("/static/vendor/fontawesome/envelope.svg"); }
.fa-paper-plane { --fa-icon: url("/static/vendor/fontawesome/paper-plane.svg"); }
.fa-paperclip { --fa-icon: url("/static/vendor/fontawesome/paperclip.svg"); }
.fa-trash-can { --fa-icon: url("/static/vendor/fontawesome/trash-can.svg"); }
.icon-button { display: inline-flex; align-items: center; gap: .4em; }
.source-citation { display: inline-flex; margin-left: .18em; color: var(--jcm-blue); font-size: .9em; line-height: 1; text-decoration: none; vertical-align: -.08em; }
.source-citation:hover, .source-citation:focus { color: var(--jcm-orange); }
.message.assistant table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.message.assistant th, .message.assistant td { padding: .45rem .6rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.message.assistant th { background: var(--light); font-weight: 700; }
.message.assistant mjx-container[jax="SVG"] { max-width: 100%; }
.message.assistant mjx-container[jax="SVG"]:not([display="true"]) { margin: 0 .08em; vertical-align: middle; }
.message.assistant mjx-container[jax="SVG"][display="true"] { margin: 1rem 0; overflow-x: auto; overflow-y: hidden; }
.code-block { position: relative; margin: 1rem 0; }
.code-block pre { margin: 0; padding-top: 2.5rem; }
.copy-code { position: absolute; z-index: 1; top: .4rem; right: .4rem; padding: .18rem .5rem; border: 1px solid rgba(0, 96, 157, .25); border-radius: .25rem; background: var(--white); color: var(--jcm-blue); font: inherit; font-size: .78rem; cursor: pointer; }
.copy-code:hover, .copy-code:focus { border-color: var(--jcm-orange); color: var(--jcm-orange); }
.message.assistant .k, .message.assistant .kd, .message.assistant .kn, .message.assistant .kr { color: #d73a49; }
.message.assistant .nf, .message.assistant .fm { color: #6f42c1; }
.message.assistant .nb, .message.assistant .bp { color: #005cc5; }
.message.assistant .s, .message.assistant .s1, .message.assistant .s2, .message.assistant .sa { color: #032f62; }
.message.assistant .c, .message.assistant .c1, .message.assistant .cm { color: #6a737d; font-style: italic; }
.message.status { justify-self: center; border: 0; background: transparent; color: var(--muted); font-size: .9rem; }
.welcome-message { color: var(--muted); }
.eyebrow { margin: 0 0 .5rem; color: var(--jcm-blue); font-size: .82rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: .75rem; padding: .85rem 1rem; border-top: 1px solid var(--line); }
textarea { min-height: 3.5rem; padding: .65rem .75rem; resize: vertical; }
.primary-button { align-self: end; padding: .55rem .9rem; border: 1px solid var(--jcm-blue); border-radius: .375rem; background: var(--jcm-blue); color: var(--white); font: inherit; font-weight: 700; cursor: pointer; }
.primary-button:hover, .primary-button:focus { border-color: var(--jcm-orange); background: var(--jcm-orange); }
.primary-button:disabled { cursor: wait; opacity: .65; }
.secondary-button { padding: .55rem .9rem; border: 1px solid #aeb9c0; border-radius: .375rem; background: var(--white); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.secondary-button:hover, .secondary-button:focus { border-color: var(--jcm-blue); color: var(--jcm-blue); }
.secondary-button:disabled { cursor: wait; opacity: .65; }
.danger-button { border-color: #a3342c; background: #a3342c; }
.modal { width: min(30rem, calc(100% - 2rem)); padding: 0; border: 0; border-radius: .5rem; color: var(--ink); box-shadow: 0 1rem 3rem rgba(0, 0, 0, .24); }
.modal::backdrop { background: rgba(21, 38, 50, .52); }
.modal__content { padding: clamp(1.25rem, 4vw, 1.75rem); }
.modal__content h2 { margin: 0 0 .65rem; color: var(--jcm-blue); font-size: 1.25rem; }
.modal__content p { margin: 0 0 1rem; }
.modal__status { display: flex; align-items: center; gap: .55rem; padding: .65rem .75rem; border-radius: .3rem; background: #f5f9fb; color: var(--muted); font-size: .9rem; }
.modal__status:not([hidden])::before { content: ""; width: .85rem; height: .85rem; flex: 0 0 auto; border: 2px solid rgba(0, 96, 157, .2); border-top-color: var(--jcm-blue); border-radius: 50%; animation: work-spin .8s linear infinite; }
.modal__status.error { background: #fff5f4; color: #8c2d26; }
.modal__status.error::before { border-color: #a3342c; border-top-color: #a3342c; animation: none; }
.modal__actions { display: flex; justify-content: end; gap: .65rem; margin-top: 1.25rem; }
.privacy-notice { margin: 0; padding: 0 1rem .75rem; color: var(--muted); font-size: .78rem; }
.sources { margin-top: 1rem; padding-top: .7rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.sources ul { margin: .35rem 0 0; padding-left: 1.1rem; }
.answer-output { display: grid; gap: 1rem; }
.llm-debug-panel { display: grid; gap: .75rem; padding: .75rem; border: 1px solid rgba(225, 117, 52, .45); border-radius: .35rem; background: #fffaf6; color: var(--muted); font-size: .8rem; }
.llm-debug-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.llm-debug-header strong { color: #9a4b1d; font-size: .9rem; }
.llm-debug-header span { padding: .1rem .4rem; border-radius: 999px; background: rgba(225, 117, 52, .14); color: #8a431a; font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.debug-budgets { padding: .45rem .55rem; border-radius: .25rem; background: rgba(225, 117, 52, .08); color: var(--ink); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.debug-interactions { display: grid; gap: .75rem; }
.debug-interaction { display: grid; gap: .45rem; padding-top: .7rem; border-top: 1px solid rgba(225, 117, 52, .25); }
.debug-interaction h4 { margin: 0; color: var(--ink); font-size: .85rem; }
.debug-usage { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; line-height: 1.45; overflow-wrap: anywhere; }
.debug-frame { overflow: hidden; border: 1px solid #d8dee2; border-radius: .3rem; background: var(--white); }
.debug-frame-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .35rem .5rem; border-bottom: 1px solid var(--line); background: #f5f7f8; }
.debug-frame-header strong { color: var(--jcm-blue); }
.debug-frame-header button { padding: 0; border: 0; background: transparent; color: var(--jcm-blue); font: inherit; font-weight: 700; cursor: pointer; }
.debug-frame pre { max-height: 9rem; margin: 0; padding: .6rem; overflow: auto; border-radius: 0; background: var(--white); color: #34434e; font-size: .75rem; line-height: 1.4; white-space: pre-wrap; }
.debug-frame.expanded pre { max-height: 60vh; }
.work-in-progress { display: grid; grid-template-columns: 1fr auto; align-items: center; max-height: 3rem; padding: .6rem .75rem; overflow: hidden; border: 1px solid rgba(0, 96, 157, .2); border-radius: .35rem; background: #f5f9fb; color: var(--muted); font-size: .82rem; transition: max-height .2s ease; }
.work-in-progress.expanded { max-height: min(22rem, 45vh); overflow-y: auto; }
.work-status { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.work-status strong { color: var(--jcm-blue); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-animation { width: .85rem; height: .85rem; flex: 0 0 auto; border: 2px solid rgba(0, 96, 157, .2); border-top-color: var(--jcm-blue); border-radius: 50%; animation: work-spin .8s linear infinite; }
.work-animation.tool { width: 1.45rem; height: 1.1rem; border: 0; border-radius: .2rem; background: rgba(0, 96, 157, .1); color: var(--jcm-blue); font-size: .65rem; font-weight: 700; line-height: 1.1rem; text-align: center; animation: work-pulse 1s ease-in-out infinite; }
.work-animation.tool::before { content: "MCP"; }
.work-animation.completed { border: 0; animation: none; }
.work-animation.completed::after { content: ""; display: block; width: .3rem; height: .55rem; margin: -.15rem auto 0; border-right: 2px solid #3b7f5b; border-bottom: 2px solid #3b7f5b; transform: rotate(45deg); }
.work-steps { display: none; gap: .45rem; grid-column: 1 / -1; margin: .7rem 0 0; padding: .7rem 0 0; border-top: 1px solid var(--line); list-style: none; }
.work-in-progress.expanded .work-steps { display: grid; }
.work-steps li { display: grid; grid-template-columns: auto 1fr; column-gap: .45rem; }
.work-steps li > strong { color: var(--ink); }
.work-steps li > span:last-child { grid-column: 2; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .78rem; line-height: 1.4; overflow-wrap: anywhere; }
.work-step-icon { grid-row: span 2; width: 1.45rem; height: 1.1rem; border-radius: .2rem; background: rgba(0, 96, 157, .1); color: var(--jcm-blue); font-size: .65rem; font-weight: 700; line-height: 1.1rem; text-align: center; }
.work-step-icon.tool::before { content: "MCP"; }
.work-step-icon.thinking::before { content: "..."; }
.work-step-icon.generation::before { content: "AI"; }
.work-steps-toggle { width: 1.75rem; height: 1.75rem; padding: 0; border: 0; background: transparent; cursor: pointer; }
.work-steps-arrow { display: inline-block; width: .5rem; height: .5rem; border-right: 2px solid var(--jcm-blue); border-bottom: 2px solid var(--jcm-blue); transform: rotate(45deg) translate(-.1rem, -.1rem); transition: transform .2s ease; }
.work-in-progress.expanded .work-steps-arrow { transform: rotate(225deg) translate(-.1rem, -.1rem); }
@keyframes work-spin { to { transform: rotate(360deg); } }
@keyframes work-pulse { 50% { opacity: .35; transform: scale(.75); } }
.admin-body { min-width: 20rem; }
.admin-header { border-bottom: 1px solid var(--line); background: var(--white); box-shadow: 0 .2rem 1rem rgba(0, 0, 0, .04); }
.admin-header__inner, .admin-nav, .admin-shell { width: min(88rem, calc(100% - 2rem)); margin-inline: auto; }
.admin-header__inner { display: flex; align-items: baseline; gap: 1rem; padding: 1rem 0 .7rem; }
.admin-brand { color: var(--ink); font-size: 1.35rem; text-decoration: none; }
.admin-brand strong { color: var(--jcm-blue); }
.admin-product { color: var(--muted); }
.admin-subject { margin-left: auto; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.admin-nav { display: flex; gap: 1.5rem; }
.admin-nav a { padding: .55rem 0; border-bottom: 3px solid transparent; color: var(--ink); font-weight: 600; text-decoration: none; }
.admin-nav a[aria-current="page"] { border-color: var(--jcm-orange); color: var(--jcm-blue); }
.admin-shell { padding-block: clamp(1.25rem, 3vw, 2.5rem); }
.admin-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1.25rem; }
.admin-heading h1 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 300; overflow-wrap: anywhere; }
.admin-heading > p { max-width: 32rem; margin: 0; color: var(--muted); text-align: right; }
.admin-panel { overflow: hidden; border: 1px solid var(--line); border-radius: .5rem; background: var(--white); box-shadow: 0 .6rem 1.5rem rgba(0, 0, 0, .04); }
.admin-filter { display: flex; align-items: end; gap: .7rem; padding: 1rem; border-bottom: 1px solid var(--line); }
.admin-filter label { font-size: .82rem; font-weight: 600; }
.admin-filter input, .admin-grant-form input { padding: .5rem .65rem; border: 1px solid #cdd5da; border-radius: .375rem; color: var(--ink); font: inherit; }
.admin-filter input { width: min(18rem, 100%); }
.admin-filter select { width: auto; }
.admin-table-wrap { width: 100%; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.admin-table th, .admin-table td { padding: .8rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin-table th { background: var(--light); color: var(--muted); font-size: .76rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.admin-table td:last-child { white-space: nowrap; }
.admin-counts { display: grid; gap: .1rem; white-space: nowrap; }
.admin-badge { display: inline-block; padding: .12rem .45rem; border-radius: 999px; background: rgba(0, 96, 157, .09); color: var(--jcm-blue); font-size: .75rem; font-weight: 700; }
.admin-redacted { color: #9b1c1c; font-size: .75rem; font-weight: 600; }
.admin-empty { padding: 2rem !important; color: var(--muted); text-align: center !important; }
.admin-pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1rem; color: var(--muted); font-size: .88rem; }
.admin-pagination div { display: flex; gap: 1rem; }
.admin-pagination [aria-disabled="true"] { opacity: .45; }
.admin-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1px; margin-bottom: 2rem; overflow: hidden; border: 1px solid var(--line); border-radius: .5rem; background: var(--line); }
.admin-summary-grid div { display: grid; align-content: start; gap: .25rem; padding: 1rem; background: var(--white); }
.admin-summary-grid span, .admin-summary-grid small { color: var(--muted); }
.admin-summary-grid strong { font-size: 1rem; overflow-wrap: anywhere; }
.admin-message-list { display: grid; gap: 1rem; }
.admin-message-list h2 { margin-bottom: 0; }
.admin-message { overflow: hidden; border: 1px solid var(--line); border-left: .3rem solid #8c9aa3; border-radius: .4rem; background: var(--white); }
.admin-message--user { border-left-color: var(--jcm-blue); }
.admin-message--assistant { border-left-color: var(--jcm-orange); }
.admin-message header { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .65rem .8rem; border-bottom: 1px solid var(--line); background: var(--light); color: var(--muted); font-size: .78rem; }
.admin-message header code { margin-left: auto; overflow-wrap: anywhere; }
.admin-message pre { margin: 0; padding: 1rem; overflow-x: auto; color: var(--ink); font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-warning { margin: .8rem 1rem 0; padding: .5rem .65rem; border: 1px solid #edc59f; border-radius: .3rem; background: #fff8f0; color: #8a431a; font-size: .85rem; font-weight: 600; }
.admin-redacted-content { margin: 0; padding: 1rem; color: var(--muted); font-style: italic; }
.admin-users { padding-top: 1rem; }
.admin-users > p, .admin-users > form { margin-inline: 1rem; }
.admin-grant-form { display: flex; align-items: end; gap: .75rem; margin-block: 1rem; }
.admin-grant-form label { display: grid; gap: .3rem; font-weight: 600; }
.admin-grant-form input { min-width: 20rem; }
.admin-users form { margin-top: 0; margin-bottom: 0; }
.admin-current { color: var(--muted); font-size: .875rem; }
.admin-notice { color: #176b3a; }
.admin-error { color: #9b1c1c; }
.admin-users .danger { color: #9b1c1c; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 650px) {
  .page-shell { width: 100%; padding: 0; }
  .chat-card { border-width: 0; border-radius: 0; }
  .chat-toolbar { flex-wrap: wrap; gap: .45rem .75rem; }
  .brand { min-width: 120px; }
  .brand img { width: 120px; }
  .interface-selector { margin-left: 0; }
  .toolbar-actions { width: 100%; justify-content: space-between; }
  .chat-form { grid-template-columns: 1fr; }
  .message { max-width: 95%; }
  .primary-button { width: 100%; }
  .modal__actions { flex-direction: column-reverse; }
  .modal__actions button { width: 100%; }
  .admin-header__inner, .admin-nav, .admin-shell { width: min(100% - 1rem, 88rem); }
  .admin-header__inner { align-items: start; flex-wrap: wrap; }
  .admin-subject { width: 100%; margin-left: 0; }
  .admin-heading { align-items: start; flex-direction: column; gap: .5rem; }
  .admin-heading > p { text-align: left; }
  .admin-filter { align-items: stretch; flex-direction: column; }
  .admin-filter input, .admin-filter select { width: 100%; }
  .admin-pagination { align-items: start; flex-direction: column; }
  .admin-message header code { width: 100%; margin-left: 0; }
  .admin-grant-form { align-items: stretch; flex-direction: column; }
  .admin-grant-form input { min-width: 0; }
}
