:root {
  color-scheme: light;
  --red: #ea0000;
  --red-dark: #b80000;
  --magenta: #d80084;
  --ink: #111111;
  --muted: #5f6368;
  --line: #dcdcdc;
  --soft: #f6f6f6;
  --white: #ffffff;
  --success: #187e30;
  --warning: #a45d00;
  --danger: #b00020;
  --radius: 8px;
  --sidebar: 250px;
  font-family: "Fujitsu Infinity Pro", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--white); color: var(--ink); }
body { font-size: 15px; line-height: 1.5; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(234, 0, 0, .3); outline-offset: 2px; }

.app-shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); padding: 28px 20px 20px; display: flex; flex-direction: column; background: var(--white); }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; font-weight: 700; letter-spacing: .08em; }
.brand img { width: 104px; height: 50px; object-fit: contain; }
.main-nav { display: grid; gap: 5px; margin-top: 44px; }
.main-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 6px; color: #303030; text-decoration: none; }
.main-nav a:hover { background: var(--soft); }
.main-nav a.active { color: var(--red); background: #fff4f4; font-weight: 650; }
.nav-icon { width: 20px; height: 20px; flex: 0 0 auto; }
.sidebar-user { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.user-tile { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; margin: -6px 0 -6px -8px; padding: 6px 8px; border-radius: 6px; color: inherit; text-decoration: none; }
.user-tile:hover { background: var(--soft); }
.user-tile.active { background: #fff4f4; }
.user-tile.active strong { color: var(--red); }
.user-tile-icon { color: var(--muted); font-size: 1rem; opacity: 0; transition: opacity .15s; }
.user-tile:hover .user-tile-icon, .user-tile.active .user-tile-icon { opacity: 1; }
.user-tile.active .user-tile-icon { color: var(--red); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--white); font-weight: 700; }
.user-copy { display: grid; min-width: 0; flex: 1; }
.user-copy strong, .user-copy small { overflow: hidden; text-overflow: ellipsis; }
.user-copy small { color: var(--muted); }
.icon-button, .text-button { border: 0; background: transparent; cursor: pointer; padding: 7px; }
.content { min-width: 0; padding: 48px clamp(24px, 5vw, 72px); }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin: 0 0 34px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(2rem, 4vw, 3.5rem); letter-spacing: -.04em; line-height: 1.05; }
h2 { margin-bottom: 10px; font-size: 1.25rem; }
.eyebrow { margin-bottom: 8px; color: var(--red); text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 800; }
.eyebrow.light { color: #ffe4e4; }
.lede, .muted { color: var(--muted); }
.lede { max-width: 720px; margin-bottom: 0; font-size: 1.05rem; }

.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.agent-grid { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.settings-grid { max-width: 1040px; }
.tile { min-height: 210px; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; background: var(--white); text-decoration: none; transition: border-color .15s, transform .15s; }
a.tile:hover { border-color: var(--red); transform: translateY(-2px); }
.tile p { color: var(--muted); }
.tile-topline { display: flex; align-items: center; gap: 7px; margin-bottom: 30px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #9b9b9b; }
.status-dot.ready { background: var(--success); }
.status-dot.offline { background: var(--danger); }
.status-label { color: var(--muted); font-size: .78rem; }
.tile-footer { margin-top: auto; padding-top: 22px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--muted); font-size: .85rem; }
.collections-list { grid-template-columns: 1fr; }
.collection-row { min-height: 0; display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: center; gap: 24px; }
.collection-row-main h2, .collection-row-main p { margin: 0; }
.collection-row-main p { margin-top: 6px; }
.collection-row-meta { display: flex; align-items: center; gap: 24px; color: var(--muted); font-size: .82rem; }
.collection-row-meta span { display: flex; flex-direction: column; gap: 3px; white-space: nowrap; }
.collection-row-meta strong { color: var(--ink); font-weight: 600; }
@media (max-width: 900px) {
  .collection-row { grid-template-columns: 1fr; gap: 14px; }
  .collection-row-meta { flex-wrap: wrap; }
}
.agent-tile-footer { justify-content: flex-end; }
.tile-link { margin-top: auto; color: var(--red); font-weight: 650; }
.unsupported { background: #fafafa; }
.badge { display: inline-flex; width: fit-content; padding: 2px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); font-size: .72rem; font-weight: 700; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; background: var(--white); }
.panel.narrow { max-width: 720px; }
.split-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.workspace-grid { display: grid; grid-template-columns: minmax(230px, .7fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.workspace-history { position: sticky; top: 24px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.section-heading > span { color: var(--muted); font-size: .8rem; }
.definition-list { display: grid; gap: 12px; margin: 18px 0 0; }
.definition-list div { display: flex; justify-content: space-between; gap: 20px; padding-top: 12px; border-top: 1px solid var(--line); }
.definition-list dt { color: var(--muted); }
.definition-list dd { margin: 0; font-weight: 650; }
.definition-list.compact { grid-template-columns: repeat(2, 1fr); }
.detail-tabs { display: flex; gap: 28px; margin: -12px 0 30px; border-bottom: 1px solid var(--line); }
.detail-tabs a { margin-bottom: -1px; padding: 12px 2px; border-bottom: 3px solid transparent; color: var(--muted); text-decoration: none; font-weight: 700; }
.detail-tabs a.active { border-color: var(--red); color: var(--ink); }
.agent-tabs { display: flex; gap: 28px; margin: -12px 0 28px; border-bottom: 1px solid var(--line); }
.agent-tabs a { margin-bottom: -1px; padding: 11px 2px; border-bottom: 3px solid transparent; color: var(--muted); text-decoration: none; font-weight: 700; }
.agent-tabs a.active { border-color: var(--red); color: var(--ink); }
.agent-run-form { max-width: 820px; }
.recent-runs-pane { max-width: 1060px; display: grid; gap: 14px; overflow-y: auto; }
.recent-run-card { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.recent-run-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.recent-run-heading > div { display: flex; align-items: center; gap: 10px; }
.recent-run-heading time { color: var(--muted); font-size: .78rem; }
.recent-run-heading > a { color: var(--red); font-weight: 700; text-decoration: none; }
.recent-run-input, .recent-run-output { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 14px; padding: 9px 0; border-top: 1px solid var(--line); }
.recent-run-input strong, .recent-run-output strong { font-size: .78rem; }
.recent-run-input p, .recent-run-output p { margin: 0; }
.recent-conversation-title { display: grid; gap: 2px; margin-bottom: 12px; }
.recent-conversation-title strong { font-size: 1.05rem; }
.recent-conversation-title small { color: var(--muted); }
.recent-run-output pre { max-height: 180px; margin: 0; padding: 10px; }
.recent-run-artifacts { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.recent-artifact { padding: 5px 9px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 5px; }
.recent-artifact-name { font-size: .78rem; font-weight: 650; }
.recent-artifact small { color: var(--muted); font-size: .7rem; }
.collection-section { max-width: 1180px; }
.collection-section .section-heading p { margin: 3px 0 0; }
.collection-files-heading { align-items: center; margin-bottom: 14px; }
.collection-files-heading > div { display: flex; align-items: baseline; gap: 9px; }
.collection-files-heading h2 { margin: 0; }
.collection-upload-modal { width: min(620px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 22px 70px rgba(0, 0, 0, .25); }
.collection-upload-modal::backdrop { background: rgba(0, 0, 0, .48); backdrop-filter: blur(2px); }
.modal-heading { padding: 20px 22px 16px; display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-heading h2 { margin: 0; }
.modal-close-button { font-size: 1.4rem; line-height: 1; }
.collection-upload-fields { padding: 20px 22px; display: grid; gap: 16px; }
.collection-upload-fields > div { display: grid; gap: 5px; }
.collection-upload-fields label { font-size: .78rem; font-weight: 700; }
.collection-upload-fields input, .collection-upload-fields textarea { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #bdbdbd; border-radius: 5px; background: var(--white); }
.collection-upload-fields textarea { min-height: 86px; resize: vertical; }
.modal-actions { padding: 14px 22px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.collection-file-list { border-top: 1px solid var(--line); }
.collection-file-row { padding: 0 4px; border-bottom: 1px solid var(--line); }
.collection-file-main { min-height: 68px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.collection-file-copy { display: grid; min-width: 0; padding: 14px 0; }
.collection-file-copy small { color: var(--muted); }
.collection-file-name { display: flex; align-items: center; gap: 8px; }
.collection-file-details { flex: 1; min-width: 0; }
.collection-file-details summary { min-height: 68px; display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.collection-file-details summary::-webkit-details-marker { display: none; }
.file-chevron { width: 8px; height: 8px; flex: 0 0 auto; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
.collection-file-details[open] .file-chevron { transform: rotate(45deg); }
.file-processing-icon { display: none; width: 13px; height: 13px; border: 2px solid #e3c99e; border-top-color: var(--warning); border-radius: 50%; animation: spin .85s linear infinite; }
.file-failed-icon { display: none; width: 15px; height: 15px; place-items: center; border-radius: 50%; background: var(--danger); color: var(--white); font-size: .65rem; font-weight: 800; }
.file-processing .file-processing-icon { display: inline-block; }
.file-failed .file-failed-icon { display: inline-grid; }
.collection-file-actions { flex: 0 0 auto; display: flex !important; flex-direction: row !important; flex-wrap: nowrap; align-items: center; gap: 5px; padding-top: 17px; }
.collection-file-actions form { display: inline-flex; margin: 0; }
/* Icon-only actions: download is neutral black, delete has the red accent */
.icon-action { width: 34px; height: 34px; padding: 0; flex: 0 0 auto; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; background: var(--white); color: var(--ink); cursor: pointer; text-decoration: none; }
.icon-action:hover { border-color: var(--ink); background: var(--soft); }
.icon-action.danger { color: var(--red); }
.icon-action.danger:hover { border-color: var(--red); background: #fff4f4; }
.icon-action .action-icon { width: 18px; height: 18px; }
.icon-action.small { width: 26px; height: 26px; }
.icon-action.small .action-icon { width: 15px; height: 15px; }
.icon-actions { display: inline-flex; align-items: center; gap: 6px; }
.citations { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 12px; }
.citation { max-width: 100%; display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--white); font-size: .78rem; }
.citation > .action-icon { width: 15px; height: 15px; flex: 0 0 auto; color: var(--muted); }
.citation-name { min-width: 0; overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.citation-page { flex: 0 0 auto; color: var(--muted); }
.icon-actions form { display: inline-flex; margin: 0; }
.collection-agent-statuses { display: grid; gap: 4px; padding: 0 0 14px 18px; }
.collection-agent-status { display: flex; align-items: center; gap: 8px; min-height: 27px; color: var(--muted); font-size: .76rem; }
.collection-agent-status strong { min-width: 150px; color: var(--ink); font-weight: 600; }
.agent-detail-icon { width: 12px; height: 12px; display: grid; place-items: center; flex: 0 0 auto; border: 1.5px solid #9b9b9b; border-radius: 50%; color: var(--white); font-size: .6rem; font-weight: 800; }
.agent-detail-icon .status-check,
.agent-detail-icon .status-x { display: none; }
.status-ready .agent-detail-icon { width: 16px; height: 16px; border: 0; color: var(--success); }
.status-ready .agent-detail-icon .status-check { display: block; width: 16px; height: 16px; stroke-width: 2.5; }
.status-failed .agent-detail-icon { width: 16px; height: 16px; border: 0; color: var(--danger); }
.status-failed .agent-detail-icon .status-x { display: block; width: 16px; height: 16px; stroke-width: 2.5; }
.status-pending .agent-detail-icon,
.status-running .agent-detail-icon,
.status-processing .agent-detail-icon { border: 2px solid #e3c99e; border-top-color: var(--warning); animation: spin .85s linear infinite; }
.agent-status-badge { padding: 2px 7px; border-radius: 99px; background: var(--soft); font-size: .7rem; }
.status-ready .agent-status-badge { background: #edf8ef; color: var(--success); }
.status-failed .agent-status-badge { background: #fff0f0; color: var(--danger); }
.status-pending .agent-status-badge,
.status-running .agent-status-badge,
.status-processing .agent-status-badge { background: #fff6e8; color: var(--warning); }
@keyframes spin { to { transform: rotate(360deg); } }
.sharing-section { max-width: 820px; }
.sharing-list { border-top: 1px solid var(--line); }
.sharing-row { min-height: 62px; padding: 12px 4px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.sharing-row > div { display: grid; }
.sharing-row small { color: var(--muted); }
.sharing-form { margin-top: 24px; padding: 20px; display: grid; grid-template-columns: 1fr 180px auto; align-items: end; gap: 14px; background: var(--soft); border-radius: var(--radius); }
.sharing-form > div { display: grid; gap: 5px; }
.sharing-form label { font-size: .78rem; font-weight: 700; }
.sharing-form select { width: 100%; min-height: 40px; padding: 8px; border: 1px solid #bdbdbd; border-radius: 5px; background: var(--white); }

.stack-form { display: grid; gap: 18px; }
.stack-form > div { display: grid; gap: 6px; }
.stack-form label { font-weight: 650; font-size: .85rem; }
.stack-form input:not([type="checkbox"]):not([type="radio"]), .stack-form select, .stack-form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #bdbdbd; border-radius: 5px; background: var(--white);
}
.dropdown-checkboxes { position: relative; }
.dropdown-checkboxes summary { min-height: 42px; padding: 10px 36px 10px 12px; overflow: hidden; border: 1px solid #bdbdbd; border-radius: 5px; background: var(--white); text-overflow: ellipsis; white-space: nowrap; cursor: pointer; list-style: none; }
.dropdown-checkboxes summary::-webkit-details-marker { display: none; }
.dropdown-checkboxes summary::after { content: ""; position: absolute; top: 16px; right: 14px; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); }
.dropdown-checkboxes[open] summary { border-color: var(--red); }
.dropdown-checkboxes-options { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0; max-height: 240px; overflow-y: auto; padding: 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--white); box-shadow: 0 10px 30px rgba(0, 0, 0, .12); }
.dropdown-checkboxes-options > div > div { margin: 0; }
.dropdown-checkboxes-options label { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 4px; font-weight: 500; cursor: pointer; }
.dropdown-checkboxes-options label:hover { background: var(--soft); }
.dropdown-checkboxes-options input { accent-color: var(--red); }
.dropdown-checkboxes-options p { margin: 6px 8px; }
.stack-form input:focus, .stack-form select:focus, .stack-form textarea:focus { border-color: var(--red); outline: 3px solid rgba(234, 0, 0, .12); }
.stack-form ul { margin: 0; padding-left: 20px; }
.stack-form .errorlist, .form-errors { color: var(--danger); }
.subform { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 40px; padding: 9px 16px; border-radius: 5px; border: 1px solid transparent; text-decoration: none; cursor: pointer; font-weight: 700; }
.button.primary { background: var(--red); color: var(--white); }
.button.primary:hover { background: var(--red-dark); }
.button.secondary { background: var(--white); border-color: #a8a8a8; }
.button.danger { color: var(--danger); background: #fff5f5; border-color: #efb1b1; }
.button.full { width: 100%; }
.danger-zone { margin-top: 28px; padding-top: 20px; border-top: 1px solid #efb1b1; }
.danger-text { color: var(--danger); }

.list { display: grid; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.list-row:last-child { border-bottom: 0; }
.list-row div { display: grid; }
.list-row small { color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.toasts { position: fixed; top: 20px; right: 20px; z-index: 1000; width: min(400px, calc(100vw - 40px)); display: grid; gap: 8px; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 10px 12px 14px; border: 1px solid var(--line); border-left: 4px solid #767676; border-radius: var(--radius); background: var(--white); box-shadow: 0 10px 30px rgba(0, 0, 0, .14); font-size: .88rem; animation: toast-in .18s ease-out; }
.toast > span { flex: 1; overflow-wrap: anywhere; }
.toast.success { border-left-color: var(--success); }
.toast.warning { border-left-color: var(--warning); }
.toast.error { border-left-color: var(--danger); background: #fff8f8; }
.toast-close { flex: 0 0 auto; padding: 0 4px; border: 0; background: transparent; color: var(--muted); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.toast-close:hover { color: var(--ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.message { padding: 11px 14px; border-left: 4px solid #767676; background: var(--soft); }
.message.success { border-color: var(--success); }
.message.error { border-color: var(--danger); background: #fff4f4; }
.message.warning { border-color: var(--warning); }

.content.chat-content { height: 100vh; padding: 0; overflow: hidden; }
.chat-page { width: 100%; height: 100%; min-height: 580px; display: flex; flex-direction: column; }
.chat-page-header { flex: 0 0 auto; align-items: center; margin: 0; padding: 24px 32px 18px; }
.chat-page-header h1 { margin: 0; font-size: clamp(1.5rem, 3vw, 2.25rem); }
.chat-surface { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--white); }
.chat-transcript { flex: 1; min-height: 0; overflow-y: auto; padding: 0; display: flex; flex-direction: column; scroll-behavior: smooth; }
.chat-row { width: 100%; display: flex; align-items: flex-start; gap: 12px; padding: 20px 32px; }
.user-row { align-self: stretch; flex-direction: row-reverse; background: #fff7f7; }
.agent-row { align-self: flex-start; }
.chat-avatar { flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-size: .72rem; font-weight: 800; }
.user-avatar { background: var(--ink); color: var(--white); border-color: var(--ink); }
.agent-avatar { background: #fff3f3; color: var(--red); border-color: #f3c2c2; }
.message-bubble { flex: 1; min-width: 0; padding: 3px 0; border: 0; border-radius: 0; background: transparent; }
.user-message { text-align: right; }
.agent-message { background: transparent; }
.pending-response .agent-message { min-height: 48px; display: flex; align-items: center; }
.typing-point { width: 8px; height: 8px; display: block; border-radius: 50%; background: var(--red); animation: typing-pulse 1s ease-in-out infinite; }
@keyframes typing-pulse {
  0%, 100% { opacity: .2; transform: scale(.75); }
  50% { opacity: 1; transform: scale(1); }
}
.message-author { display: block; margin-bottom: 6px; color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.message-text, .prose { overflow-wrap: anywhere; line-height: 1.65; }
.message-text p:last-child, .prose p:last-child { margin-bottom: 0; }
.chat-empty { flex: 1; display: grid; place-content: center; justify-items: center; padding: 40px; text-align: center; }
.chat-empty p { max-width: 520px; }
.chat-welcome-avatar { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 16px; border-radius: 14px; background: #fff3f3; color: var(--red); font-size: 1.2rem; font-weight: 800; }
.chat-composer { flex: 0 0 auto; margin: 0; padding: 0; border-top: 1px solid var(--line); background: #fafafa; }
.chat-composer[aria-busy="true"] { opacity: .72; }
.chat-input-bar { position: relative; display: flex; align-items: flex-end; gap: 14px; padding: 12px 32px; border: 0; border-radius: 0; background: var(--white); }
.chat-input-bar:focus-within { box-shadow: inset 0 2px 0 rgba(234, 0, 0, .15); }
.chat-input-bar textarea { flex: 1; width: 100%; max-height: 180px; padding: 8px 0; overflow-y: auto; resize: none; border: 0; outline: 0; background: transparent; line-height: 1.5; }
.chat-attachment-field { flex: 0 0 auto; display: flex; align-items: center; }
.chat-attachment-field .errorlist { position: absolute; bottom: 58px; left: 32px; margin: 0; padding: 7px 10px; border-radius: 5px; background: #fff0f0; color: var(--danger); font-size: .75rem; list-style: none; }
.chat-send-button { min-height: 38px; padding: 8px 18px; border: 0; border-radius: 5px; background: var(--red); color: var(--white); cursor: pointer; font-weight: 750; }
.chat-send-button:hover { background: var(--red-dark); }
.chat-send-button:disabled { cursor: wait; background: #8c8c8c; }
.chat-hint { display: block; padding: 0 32px 8px; color: #777; text-align: right; font-size: .68rem; }
.chat-options { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--white); }
.chat-options summary { padding: 8px 11px; cursor: pointer; color: var(--muted); font-size: .78rem; font-weight: 700; }
.chat-options-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.chat-options-fields .field, .new-chat-surface .field { display: grid; gap: 5px; }
.chat-options-fields label, .new-chat-surface .field label { font-size: .78rem; font-weight: 700; }
.chat-options-fields select, .new-chat-surface .field select { width: 100%; padding: 8px; border: 1px solid #bdbdbd; border-radius: 5px; background: var(--white); }
.file-picker { display: inline-flex; }
.file-picker-button { position: relative; width: 38px; height: 38px; padding: 8px; display: inline-grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.file-picker-button:hover { background: var(--soft); color: var(--ink); }
.file-picker-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.file-picker-count { position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px; border: 2px solid var(--white); border-radius: 10px; background: var(--red); color: var(--white); font-size: .62rem; font-weight: 800; line-height: 13px; }
.file-picker-dialog { width: min(860px, calc(100vw - 32px)); max-height: min(82vh, 720px); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 22px 70px rgba(0, 0, 0, .25); }
.file-picker-dialog::backdrop { background: rgba(0, 0, 0, .45); backdrop-filter: blur(2px); }
.file-picker-tabs { display: flex; padding: 0 22px; border-bottom: 1px solid var(--line); }
.file-picker-tabs [role="tab"] { margin-bottom: -1px; padding: 13px 16px 11px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-weight: 700; }
.file-picker-tabs [role="tab"][aria-selected="true"] { border-color: var(--red); color: var(--ink); }
.file-picker-panel { min-height: 230px; max-height: 350px; overflow-y: auto; padding: 22px; }
.file-picker-collections { display: grid; gap: 8px; }
.file-picker-collection { border: 1px solid var(--line); border-radius: 6px; background: var(--white); }
.file-picker-collection > summary { min-height: 48px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.file-picker-collection > summary::-webkit-details-marker { display: none; }
.file-picker-collection > summary label { flex: 1; display: flex; align-items: center; gap: 9px; cursor: pointer; }
.file-picker-collection > summary > strong { flex: 1; }
.file-picker-collection > summary small { color: var(--muted); }
.file-picker-collection[open] > summary .file-chevron { transform: rotate(45deg); }
.file-picker-collection-files { padding: 0 10px 8px 30px; border-top: 1px solid var(--line); }
.file-picker-collection-files .file-picker-row:last-child { border-bottom: 0; }
.file-picker-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 10px; border-bottom: 1px solid #ededed; cursor: pointer; }
.file-picker-row:hover { background: var(--soft); }
.file-picker-row > span, .file-picker-selected > span { flex: 1; min-width: 0; display: grid; }
.file-picker-row strong, .file-picker-selected strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-picker-row small, .file-picker-selected small { color: var(--muted); }
.file-picker-row .file-ready { color: var(--success); }
[data-file-dropdown-choices] { margin-top: 14px; }
.file-picker-selected { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); }
.file-picker-selected + .file-picker-selected { margin-top: 7px; }
.file-picker-selected > input { position: absolute; opacity: 0; pointer-events: none; }
.file-picker-selected button { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.2rem; }
.file-picker-selected button:hover { background: #e8e8e8; color: var(--ink); }
.file-picker-upload { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
/* shared upload button: the native file input is hidden behind the red button */
div.upload-button { display: flex; align-items: center; gap: 12px; }
.upload-button .button { width: auto; font-size: inherit; cursor: pointer; }
.upload-button:focus-within .button { outline: 3px solid rgba(234, 0, 0, .3); outline-offset: 2px; }
.upload-count { color: var(--muted); font-size: .8rem; }
.upload-files { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: .8rem; }
.upload-files li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-picker-section-label { margin: 0 0 8px; font-size: .85rem; font-weight: 650; }
.file-picker-ingestion { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 22px; border-top: 1px solid #efce87; background: #fffaf0; }
.file-picker-ingestion label { font-weight: 700; white-space: nowrap; }
.file-picker-ingestion select { flex: 1 1 200px; }
.file-picker-panel[hidden], .file-picker-selected[hidden], .file-picker-ingestion[hidden] { display: none !important; }
.file-picker-ingestion > small { flex-basis: 100%; }
.file-picker-ingestion > small:empty { display: none; }
.file-picker-ingestion select { min-height: 40px; padding: 7px 9px; border: 1px solid #a8a8a8; border-radius: 5px; background: var(--white); }
.rag-source-picker { display: grid; grid-template-columns: minmax(220px, 320px) minmax(180px, 260px) 1fr; align-items: end; gap: 10px 14px; padding: 12px 32px; border-bottom: 1px solid var(--line); background: #fafafa; }
.rag-source-field { display: grid; gap: 4px; }
.rag-source-field label { color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.rag-source-field select { width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid #bdbdbd; border-radius: 5px; background: var(--white); }
.rag-file-picker { position: relative; }
.rag-file-picker summary { min-height: 38px; padding: 8px 12px; border: 1px solid #bdbdbd; border-radius: 5px; background: var(--white); cursor: pointer; font-weight: 650; list-style-position: inside; }
.rag-file-count { margin-left: 6px; color: var(--red); font-size: .75rem; }
.rag-file-options { position: absolute; z-index: 4; bottom: calc(100% + 6px); left: 0; width: min(420px, 80vw); max-height: 280px; overflow-y: auto; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); box-shadow: 0 10px 28px rgba(0, 0, 0, .14); }
.rag-file-options > div { display: grid; gap: 2px; }
.rag-file-options > div > div { padding: 7px 8px; border-radius: 4px; }
.rag-file-options > div > div:hover { background: var(--soft); }
.rag-file-options label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.rag-file-options input { accent-color: var(--red); }
.rag-source-hint { align-self: center; color: var(--muted); font-size: .75rem; }
.rag-file-empty { margin: 4px 8px; }
.chat-launch-layout { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-agent-tabs { flex: 0 0 auto; margin: 0; padding: 0 32px; }
.chat-page > .recent-runs-pane { flex: 1; min-height: 0; max-width: none; padding: 22px 32px; }
.conversation-history-menu { position: absolute; z-index: 2; top: 14px; left: 32px; width: min(340px, calc(100% - 64px)); border: 1px solid var(--line); border-radius: 7px; background: var(--white); box-shadow: 0 4px 18px rgba(0, 0, 0, .08); }
.conversation-history-menu:not([open]) { width: auto; box-shadow: none; }
.conversation-history-menu summary { padding: 8px 12px; cursor: pointer; color: var(--muted); font-size: .78rem; font-weight: 700; }
.conversation-history-menu summary span { margin-left: 6px; }
.conversation-history-menu .list { max-height: 45vh; overflow-y: auto; padding: 0 12px 10px; }
.new-chat-surface { min-height: 0; }
.new-chat-surface .chat-composer > .field { margin-bottom: 10px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.prose { overflow-wrap: anywhere; }
pre { max-width: 100%; overflow: auto; padding: 16px; background: #f3f3f3; border-radius: 5px; white-space: pre-wrap; }
.artifact-link, .artifact-card { margin-top: 14px; }
.artifact-card { display: flex; justify-content: space-between; gap: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 5px; }
.artifact-card div { display: grid; }
.artifact-card small { color: var(--muted); }
.artifact-live-status { display: inline-flex; align-items: center; gap: 6px; }
.artifact-processing-point { display: none; width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--red); }
.status-pending .artifact-processing-point { display: inline-block; animation: typing-pulse 1s ease-in-out infinite; }
.status-failed .artifact-processing-point { display: inline-block; background: var(--danger); }
.empty-state { padding: 64px 24px; border: 1px dashed #bdbdbd; text-align: center; }
.empty-state.compact { padding: 24px; }
.error-state { border-color: #efb1b1; background: #fffafa; }
.error-text { color: var(--danger); }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(380px, .65fr); }
.login-brand { position: relative; overflow: hidden; padding: 60px; display: flex; flex-direction: column; justify-content: space-between; color: white; background: linear-gradient(135deg, #c3005f 0%, #ea0000 75%); }
.login-brand h1 { max-width: 780px; font-size: clamp(3rem, 7vw, 6.6rem); }
.login-mark { width: 130px; height: 64px; object-fit: contain; z-index: 1; }
.infinity-graphic { position: absolute; right: -6%; bottom: -10%; width: 48%; opacity: .35; }
.login-panel { display: grid; place-items: center; padding: 40px; }
.login-form { width: min(100%, 380px); display: grid; gap: 20px; }
.login-form h2 { margin: 0; font-size: 2rem; }
.login-form .field { display: grid; gap: 7px; }
.login-form input { width: 100%; padding: 12px; border: 1px solid #bdbdbd; border-radius: 5px; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; height: auto; padding: 16px 20px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand img { width: 80px; height: 36px; }
  .main-nav { margin-top: 14px; grid-template-columns: repeat(4, 1fr); }
  .main-nav a { justify-content: center; }
  .main-nav .nav-icon { display: none; }
  .sidebar-user { margin-top: 14px; }
  .content { padding: 30px 20px; }
  .split-layout, .workspace-grid { grid-template-columns: 1fr; }
  .sharing-form { align-items: stretch; grid-template-columns: 1fr; }
  .workspace-history { position: static; }
  .content.chat-content { height: calc(100vh - 152px); }
  .chat-page { min-height: 540px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 42vh; padding: 32px; }
  .login-brand h1 { font-size: clamp(2.5rem, 12vw, 4rem); }
}

@media (max-width: 600px) {
  .main-nav { grid-template-columns: repeat(2, 1fr); }
  .page-header { align-items: flex-start; flex-direction: column; }
  .content { padding: 24px 16px; }
  .content.chat-content { height: auto; min-height: calc(100vh - 190px); overflow: visible; }
  .chat-page { min-height: calc(100vh - 190px); }
  .chat-surface { min-height: 0; }
  .chat-row, .user-row { width: 100%; padding: 16px 12px; }
  .chat-avatar { display: none; }
  .chat-page-header { padding: 20px 16px 16px; }
  .chat-transcript { padding: 0; }
  .chat-composer { padding: 0; }
  .chat-input-bar { padding: 10px 12px; }
  .rag-source-picker { grid-template-columns: 1fr; align-items: stretch; padding: 10px 12px; }
  .rag-source-hint { display: none; }
  .rag-file-options { width: calc(100vw - 48px); }
  .conversation-history-menu { left: 12px; width: min(340px, calc(100% - 24px)); }
  .chat-hint { display: none; }
  .file-picker-tabs { padding: 0 10px; overflow-x: auto; }
  .file-picker-tabs [role="tab"] { padding-inline: 11px; white-space: nowrap; }
  .file-picker-panel { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Personal data tables (My files / My artifacts) */
.page-count { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.page-count strong { color: var(--ink); font-size: 1.4rem; margin-right: 4px; }
.data-panel { max-width: 1180px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.table-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); background: var(--soft); border-radius: var(--radius) var(--radius) 0 0; }
.filter-field { display: grid; gap: 4px; min-width: 140px; }
.filter-field > span { color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.filter-field input, .filter-field select { min-height: 38px; padding: 7px 10px; border: 1px solid #bdbdbd; border-radius: 5px; background: var(--white); }
.filter-field input:focus, .filter-field select:focus { border-color: var(--red); outline: 3px solid rgba(234, 0, 0, .12); }
.filter-search { flex: 1 1 260px; }
.filter-actions { margin-left: auto; }
.filter-actions .button { min-height: 38px; }
.data-table { transition: opacity .15s; }
.data-table.htmx-request { opacity: .55; }
.data-table th { padding: 0; }
.data-table th > span, .sort-link { display: flex; align-items: center; gap: 6px; padding: 12px; }
.data-table th.align-end .sort-link { justify-content: flex-end; }
.sort-link { color: inherit; text-decoration: none; }
.sort-link:hover, .sort-link.active { color: var(--ink); }
.sort-indicator { font-size: .65rem; opacity: .45; }
.sort-link.active .sort-indicator { color: var(--red); opacity: 1; }
.data-table tbody tr:hover { background: #fafafa; }
.data-table td { vertical-align: middle; }
.cell-primary { display: grid; gap: 1px; max-width: 420px; }
.cell-primary small { overflow: hidden; color: var(--muted); font-size: .74rem; text-overflow: ellipsis; }
.file-name { overflow: hidden; font-weight: 600; text-overflow: ellipsis; }
.align-end { text-align: right; }
.data-table time { color: var(--muted); font-variant-numeric: tabular-nums; }
.table-empty { padding: 48px 12px; color: var(--muted); text-align: center; }
.upload-inline { margin: 0; }
.upload-inline .button { cursor: pointer; }
.status-pill { display: inline-flex; padding: 2px 9px; border-radius: 99px; background: var(--soft); color: var(--muted); font-size: .74rem; font-weight: 700; }
.status-pill.ready { background: #edf8ef; color: var(--success); }
.status-pill.failed { background: #fff0f0; color: var(--danger); }
.status-pill.pending { background: #fff6e8; color: var(--warning); }
.data-table-footer { padding: 14px 20px; color: var(--muted); font-size: .85rem; }
/* Compact variant inside the agent file picker */
.data-table-root.compact { border: 1px solid var(--line); border-radius: var(--radius); }
.data-table-root.compact .table-filters { padding: 10px 12px; gap: 8px; }
.data-table-root.compact .filter-field { min-width: 110px; }
.data-table-root.compact .filter-field input, .data-table-root.compact .filter-field select, .data-table-root.compact .filter-actions .button { min-height: 32px; padding: 4px 8px; }
.data-table-root.compact .table-wrap { max-height: 300px; overflow-y: auto; }
.data-table-root.compact thead th { position: sticky; top: 0; background: var(--white); z-index: 1; }
.data-table-root.compact td, .data-table-root.compact .sort-link { padding: 7px 10px; }
.data-table-root.compact .cell-primary { max-width: 360px; }
.data-table-root.compact .data-table-footer { padding: 8px 12px; font-size: .78rem; }
.pick-cell { width: 34px; }
.pick-cell input { pointer-events: none; accent-color: var(--red); }
.pick-row { cursor: pointer; }
.pick-row.is-selected { background: #fff4f4; }
.pick-row.is-selected:hover { background: #ffeaea; }
.pick-row.is-unavailable { cursor: not-allowed; opacity: .5; }
.row-note { color: var(--warning); font-weight: 600; }
.file-picker-selected-heading { margin: 16px 0 6px; color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 900px) {
  .filter-field { flex: 1 1 140px; }
  .filter-actions { margin-left: 0; }
}
