/* chatctc shell — small, dependency-free stylesheet in the ctc-tools look. */
:root {
    /* The legacy chatctc palette (App.css #2c3e50 header, Material blue #2196f3),
       so the rebuilt shell reads as the same product (Stephanie, 2026-10-02). */
    --ctc-navy: #2c3e50;
    --ctc-blue: #2196f3;
    --ctc-blue-dark: #1976d2;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;
    --chat-bg: #f7f7f7;
    --chat-border: #e0e0e0;
    --user-bubble: #e3f2fd;
    --assistant-bubble: #f5f5f5;
    --bg: #f4f6f9;
    --card: #ffffff;
    --text: #1d2733;
    --muted: #6b7785;
    --border: #d9dee5;
    --danger: #b3261e;
    --ok: #1e7a3c;
    --warn: #9a6700;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--ctc-blue); }
code { font-family: Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.center { text-align: center; }
.inline { display: inline; }
.pre-wrap { white-space: pre-wrap; max-width: 36em; }

.env-banner { text-align: center; font-size: 0.8em; font-weight: 600; padding: 2px; letter-spacing: 0.05em; }
.env-dev { background: #fff3c4; color: var(--warn); }
.env-soak { background: #dff3e4; color: var(--ok); }
.env-local { background: #e6e9ef; color: var(--muted); }

/* The header strip as legacy chatctc's: 72 px navy, logo / icon tabs / user block. */
:root { --header-height: 72px; }
.App-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; height: var(--header-height); padding: 0 1rem; background: var(--ctc-navy); color: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.header-left { display: flex; align-items: center; gap: 12px; }
.app-logo { height: 40px; display: block; border-radius: 4px; }
.mode-selector { display: flex; align-items: center; gap: 4px; padding-left: 16px; }
/* Icon-only tabs; the active one expands to icon + label (ModeSelector.css). */
.mode-button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 6px; color: rgba(255,255,255,0.7); text-decoration: none; font-size: 13px; font-weight: 500; transition: padding 0.2s ease, background-color 0.2s ease, color 0.2s ease; }
.mode-button:hover:not(.active) { background: rgba(255,255,255,0.06); color: #fff; }
.mode-button.active { background: rgba(255,255,255,0.15); color: #fff; padding: 6px 12px; }
.mode-icon { display: inline-flex; align-items: center; justify-content: center; }
.mode-icon img { width: 40px; height: 40px; display: block; }
.mode-label { display: none; white-space: nowrap; }
.mode-button.active .mode-label { display: inline; }
.header-right { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.user-info { display: flex; align-items: center; padding: 8px 16px; background: rgba(255,255,255,0.1); border-radius: 8px; font-size: 14px; }
.feedback-button { padding: 6px 12px; font-size: 13px; background: rgba(52,152,219,0.3); color: #fff; border: 1px solid rgba(52,152,219,0.5); border-radius: 6px; text-decoration: none; }
.feedback-button:hover, .feedback-button.active { background: rgba(52,152,219,0.5); }
.logout-button { padding: 6px 12px; font: inherit; font-size: 14px; background: rgba(255,255,255,0.2); color: #fff; border: 1px solid rgba(255,255,255,0.3); border-radius: 6px; cursor: pointer; }
.logout-button:hover { background: rgba(255,255,255,0.3); }
@media (max-width: 760px) {
    .App-header { height: auto; min-height: var(--header-height); padding: 6px 0.75rem; gap: 0.5rem; }
    .user-info { display: none; }
}

.page { max-width: 1200px; margin: 1.5rem auto; padding: 0 1.25rem; }
h1 { font-size: 1.5rem; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.1rem; margin-top: 0; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1.25rem; margin-bottom: 1rem; }
.card.narrow { max-width: 440px; margin: 2rem auto; }
details.card > summary { cursor: pointer; font-weight: 600; }

.alert { padding: 0.7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid var(--border); background: #fff; }
.alert-error { border-color: #f1b6b2; background: #fdecea; color: var(--danger); }
.alert-success { border-color: #b7e0c3; background: #eaf6ee; color: var(--ok); }
.alert-info, .alert-warning { border-color: #c9d9ef; background: #eef4fb; }

label { display: block; margin-bottom: 0.75rem; font-size: 0.9rem; }
label.check { display: flex; align-items: center; gap: 0.5rem; }
input, select, textarea { font: inherit; padding: 0.45rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; width: 100%; background: #fff; }
label.check input { width: auto; }
.form-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin: 0.75rem 0; }
.form-row input, .form-row select { width: auto; flex: 1 1 12rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-grid .span2 { grid-column: span 2; }

.btn { display: inline-block; font: inherit; padding: 0.45rem 1rem; border-radius: 6px; border: 1px solid var(--border); background: #fff; color: var(--text); cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--ctc-blue); border-color: var(--ctc-blue); color: #fff; }
.btn-primary:hover { background: var(--ctc-blue-dark); }
.btn-secondary { background: #eef1f5; }
.btn-danger { color: var(--danger); border-color: #f1b6b2; }
.btn-small { padding: 0.2rem 0.6rem; font-size: 0.85em; }
.btn-block { display: block; width: 100%; text-align: center; margin: 0.5rem 0; }
.danger-zone { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: 1rem; }

.toggle { border: 1px solid var(--border); background: #f3f4f6; border-radius: 999px; padding: 0.15rem 0.7rem; cursor: pointer; font-size: 0.85em; }
.toggle.on { background: #e2effb; border-color: #9cc3ea; color: var(--ctc-blue-dark); }
.toggle.on.danger { background: #fdecea; border-color: #f1b6b2; color: var(--danger); }

.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { background: #f7f8fa; font-size: 0.8rem; text-transform: uppercase; color: var(--muted); letter-spacing: 0.03em; }
.table td.actions { display: flex; gap: 0.35rem; }
.row-muted td { opacity: 0.6; }
pre { white-space: pre-wrap; font-size: 0.8em; max-width: 40em; }

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tab { padding: 0.5rem 1rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.active { color: var(--ctc-navy); border-bottom-color: var(--ctc-blue); font-weight: 600; }

.badge { display: inline-block; font-size: 0.7rem; padding: 0.1rem 0.45rem; border-radius: 999px; background: #eef1f5; color: var(--muted); text-transform: uppercase; vertical-align: middle; }
.badge-alpha { background: #fdf0d5; color: var(--warn); }
.badge-beta { background: #e2effb; color: var(--ctc-blue-dark); }
.badge-stable { background: #eaf6ee; color: var(--ok); }
.badge-deprecated { background: #fdecea; color: var(--danger); }

.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.tile { display: flex; flex-direction: column; gap: 0.6rem; background: var(--card); border: 1px solid var(--border); border-top: 4px solid var(--tile-color, var(--ctc-blue)); border-radius: 10px; padding: 1rem; }
.tile-disabled { opacity: 0.55; }
.tile-icon { font-size: 2rem; line-height: 1; }
.tile-icon img { width: 40px; height: 40px; object-fit: contain; }
.tile-icon-sm { font-size: 1.4rem; }
.tile-title { font-weight: 600; }
.tile-desc { color: var(--muted); font-size: 0.9rem; }
.tile form { margin-top: auto; }
.pager { display: flex; gap: 1rem; justify-content: center; }
/* Toolshed tab as legacy chatctc's (frontend/src/components/tools/ToolsPage.css). The
   .tile rules above stay for the admin pages. */
.toolshed-page { padding: 0.5rem 0 2rem; }
.toolshed-header { margin-bottom: 1.75rem; }
.toolshed-header h1 { margin: 0 0 0.25rem; font-size: 1.5rem; color: #222; }
.toolshed-header p { margin: 0; color: #666; font-size: 0.9rem; }
.toolshed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.tool-tile-form { display: contents; }
.tool-tile { display: flex; flex-direction: column; gap: 0.75rem; width: 100%; background: #fff; border: 1px solid var(--chat-border); border-radius: 12px; padding: 1.25rem; text-align: left; font: inherit; color: var(--text); cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease; }
button.tool-tile:hover, button.tool-tile:focus-visible { border-color: #4a90e2; box-shadow: 0 4px 14px rgba(74,144,226,0.15); transform: translateY(-1px); outline: none; }
button.tool-tile:focus-visible { outline: 2px solid #4a90e2; outline-offset: 2px; }
.tool-tile-header { display: flex; align-items: center; gap: 0.75rem; }
.tool-tile-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; background: var(--ctc-navy); color: #fff; flex-shrink: 0; overflow: hidden; }
.tool-tile-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tool-tile-title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tool-tile-name { font-size: 1rem; font-weight: 600; color: #222; }
.tool-tile-owner { font-size: 0.75rem; color: #888; }
.tool-tile-description { margin: 0; font-size: 0.875rem; color: #555; line-height: 1.4; flex: 1; }
.tool-tile-footer { display: flex; justify-content: space-between; align-items: center; }
.tool-status-badge { display: inline-block; padding: 0.25rem 0.6rem; border-radius: 9999px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.tool-status-alpha { background: #fef3c7; color: #92400e; }
.tool-status-beta { background: #dbeafe; color: #1e40af; }
.tool-status-deprecated { background: #fee2e2; color: #991b1b; }
.tool-launch-hint { font-size: 0.8rem; color: #4a90e2; }
.tool-tile-locked { font-size: 0.8rem; color: #888; }
.toolshed-empty { padding: 3rem 1.5rem; text-align: center; color: #666; background: #fff; border: 1px dashed #d0d0d0; border-radius: 12px; }
/* Inaccessible tools: shown but greyed, so people see what exists and can ask for access. */
.tool-tile.tool-tile-disabled { cursor: not-allowed; opacity: 0.55; background: #f7f7f7; filter: grayscale(85%); }
.mock-login { margin-top: 1rem; border-top: 1px dashed var(--border); padding-top: 1rem; }

/* Admin dashboard / environment / monitoring */
.dashboard-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.dashboard-header .form-row { margin: 0; }
.realtime { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.rt-item { background: #eef4fb; border-radius: 999px; padding: 0.15rem 0.7rem; }
.kpi-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.kpi-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem 1rem; }
.kpi-card h3 { margin: 0; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.kpi-value { font-size: 1.8rem; font-weight: 600; margin: 0.2rem 0; }
.charts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(480px, 100%), 1fr)); gap: 1rem; }
.charts-grid .card { overflow-x: auto; }
.charts-grid .card h3 { margin-top: 0; }
.bars td { white-space: nowrap; }
.bar { display: inline-block; height: 0.7em; min-width: 2px; background: var(--ctc-blue); border-radius: 2px; vertical-align: middle; }
.bar-alt { background: #00a383; }
.health-dot { display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; background: #9ca3af; margin-right: 0.35em; vertical-align: middle; }
.health-Green { background: #16a34a; } .health-Yellow { background: #d97706; } .health-Red { background: #dc2626; }
.check-ok { color: var(--ok); } .check-warn { color: var(--warn); } .check-fail { color: var(--danger); }
.log-ERROR td, .log-CRITICAL td { background: #fdf3f2; }
.log-WARNING td { background: #fffaf0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-all; }
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }

/* Chat (app/templates/chat) */
/* The chat page fills the viewport: banner and header take their natural height,
   the chat area gets the rest, the thread scrolls inside it and the composer stays
   put. No header-height constant: a 21 px environment banner on the soak host used
   to push Send below the fold (Stephanie, 2026-10-02). */
body.body-chat { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.body-chat > .env-banner, body.body-chat > .App-header { flex: none; }
.page-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 0; padding: 0; }
.chat-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px 1fr; }
.chat-layout.sidebar-closed { grid-template-columns: 1fr; }
.chat-layout.sidebar-closed .chat-sidebar { display: none; }
.chat-sidebar { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.75rem 0.5rem; background: var(--chat-bg); border-right: 1px solid var(--chat-border); overflow: hidden; }
.chat-sidebar .btn-block { margin: 0; }
.new-chat-btn { display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.75rem; background: #fff; border: 1px solid var(--chat-border); border-radius: 0.5rem; font-weight: 500; color: var(--text); }
.new-chat-btn:hover { background: #f0f0f0; }
.chat-search { padding: 0.6rem 0.75rem; border: 1px solid var(--chat-border); border-radius: 0.5rem; }
/* Legacy's edge tab: sits on the sidebar's edge at mid-height and hides or shows it. */
.sidebar-toggle { position: absolute; left: 0; top: 50%; transform: translateY(-50%); z-index: 15; width: 18px; height: 56px; padding: 0; font: inherit; font-size: 1.2rem; line-height: 1; color: #333; background: var(--chat-bg); border: 1px solid var(--chat-border); border-left: 0; border-radius: 0 6px 6px 0; cursor: pointer; }
.sidebar-toggle:hover { background: #e8e8e8; }
.sidebar-tabs { display: flex; gap: 0.2rem; border-bottom: 1px solid var(--border); }
.sidebar-tab { flex: 1; font: inherit; font-size: 0.8rem; background: none; border: 0; border-bottom: 2px solid transparent; padding: 0.35rem 0.2rem; color: var(--muted); cursor: pointer; }
.sidebar-tab.active { color: var(--ctc-navy); border-bottom-color: var(--ctc-blue); font-weight: 600; }
.conv-list { overflow-y: auto; flex: 1; }
.conv-list-note { padding: 0.4rem 0.2rem; margin: 0; }
.conv-items { list-style: none; margin: 0; padding: 0; }
.conv-items { display: flex; flex-direction: column; gap: 0.35rem; }
.conv-item { position: relative; display: flex; align-items: flex-start; background: #fff; border: 1px solid transparent; border-radius: 0.5rem; }
.conv-item:hover { background: #f0f0f0; border-color: var(--chat-border); }
.conv-item.current { background: var(--user-bubble); border-color: var(--ctc-blue); }
.conv-link { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; padding: 0.7rem 0.75rem; color: var(--text); text-decoration: none; }
.conv-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-date { font-size: 0.75rem; }
.conv-snippet { display: block; white-space: normal; }
.pin { font-size: 0.8em; }
.conv-menu > summary { list-style: none; cursor: pointer; padding: 0.4rem 0.5rem; color: var(--muted); }
.conv-menu > summary::-webkit-details-marker { display: none; }
.conv-menu-items { position: absolute; right: 0.25rem; top: 2rem; z-index: 5; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,0.08); min-width: 8rem; }
.conv-menu-items button { font: inherit; text-align: left; background: none; border: 0; padding: 0.45rem 0.8rem; cursor: pointer; }
.conv-menu-items button:hover { background: #f3f4f6; }
.conv-menu-items button.danger { color: var(--danger); }

.chat-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 0; background: #fff; box-shadow: 0 0 10px rgba(0,0,0,0.06); }
/* Legacy's selector bar: title, assistant and prompt pickers, actions. */
.chat-toolbar { padding: 0.7rem 1.25rem 0.7rem 1.75rem; border-bottom: 1px solid var(--chat-border); background: #f8f9fa; }
.prompt-picker { padding-left: 1.75rem; padding-right: 1.25rem; }
.drop-overlay { position: absolute; inset: 0.5rem; z-index: 20; display: flex; align-items: center; justify-content: center; border: 2px dashed var(--ctc-blue); border-radius: 12px; background: rgba(238,244,251,0.92); color: var(--ctc-blue-dark); font-size: 1.1rem; font-weight: 600; pointer-events: none; }
.drop-overlay[hidden] { display: none; }
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.chat-title-wrap { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.chat-title { font-size: 1.05rem; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-actions { display: flex; gap: 0.35rem; }
.chat-thread { flex: 1; overflow-y: auto; padding: 1rem 1.25rem 1rem 1.75rem; display: flex; flex-direction: column; gap: 1rem; }
.chat-empty { margin: auto; text-align: center; max-width: 32rem; }
/* Bubbles as in legacy MessageList.css: user right-aligned in light blue, assistant
   in light grey, a role line above each. */
.msg { max-width: 70%; width: 100%; align-self: flex-start; background: var(--assistant-bubble); border: 0; border-radius: 0.5rem; padding: 1rem; line-height: 1.5; }
.msg-user { align-self: flex-end; background: var(--user-bubble); width: fit-content; min-width: 200px; }
.msg-kind-note { background: #fffaf0; border: 1px dashed var(--border); }
.msg-kind-status { background: transparent; border: 1px dashed var(--border); color: var(--muted); }
.msg-meta { margin-bottom: 0.5rem; font-size: 0.875rem; font-weight: 600; color: #666; }
.msg-text-plain { white-space: pre-wrap; word-wrap: break-word; }
.msg.streaming .msg-text-plain:empty::after { content: "Thinking…"; color: var(--muted); }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md pre { background: #f5f7fa; border: 1px solid var(--border); border-radius: 6px; padding: 0.6rem; overflow-x: auto; max-width: none; font-size: 0.85em; }
.md code { background: #f1f3f6; padding: 0 0.2em; border-radius: 3px; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; margin: 0.5rem 0; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 0.3rem 0.55rem; }
.md blockquote { margin: 0.5rem 0; padding-left: 0.8rem; border-left: 3px solid var(--border); color: var(--muted); }
.md img { max-width: 100%; }
.msg-files, .msg-tools { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.msg-tools:empty { display: none; }
/* The AI notice under produced files: amber like the disclaimer strip. */
.ai-note { margin-top: 0.5rem; padding: 0.45rem 0.7rem; border-radius: 6px; font-size: 0.8rem; line-height: 1.4; background: var(--warning-bg); color: var(--warning-text); border: 1px solid #f3dc9a; }
.ai-note-gis { border-width: 2px; }
.file-chip { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.82rem; padding: 0.15rem 0.6rem; border: 1px solid var(--border); border-radius: 999px; background: #f7f8fa; color: var(--text); text-decoration: none; }
a.file-chip:hover { border-color: var(--ctc-blue); color: var(--ctc-blue); }
.chip-remove { border: 0; background: none; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0; color: var(--muted); }
/* An upload in flight: its files as dashed, dimmed chips and a status line with a spinner. */
.file-chip-uploading { border-style: dashed; color: var(--muted); background: transparent; }
.upload-status { display: block; color: var(--ctc-blue-dark); margin-bottom: 0.15rem; }
.upload-status::before { content: ''; display: inline-block; width: 0.7em; height: 0.7em; margin-right: 0.4rem; vertical-align: -0.05em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: upload-spin 0.8s linear infinite; }
@keyframes upload-spin { to { transform: rotate(360deg); } }
.attach-button-disabled { opacity: 0.5; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .upload-status::before { animation: none; } }
.tool-chip { display: inline-block; font-size: 0.78rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: #eef1f5; color: var(--muted); }
.tool-chip.running { background: #e2effb; color: var(--ctc-blue-dark); }
.tool-chip.ok { background: #eaf6ee; color: var(--ok); }
.tool-chip.failed { background: #fdecea; color: var(--danger); }
.tool-chip.skipped { background: #f3f4f6; }
/* Registry focus (chat header) and the "Used" line under a reply: what the chatbot used */
.chat-focus { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; margin: 0.35rem 0 0; padding-left: 1.75rem; padding-right: 1.25rem; }
.chat-focus[hidden] { display: none; }
.chat-focus-value { color: var(--ctc-blue-dark); font-weight: 600; }
.chat-focus-info { position: relative; display: inline-block; }
.chat-focus-info > summary { list-style: none; cursor: pointer; color: var(--muted); padding: 0 0.15rem; }
.chat-focus-info > summary::-webkit-details-marker { display: none; }
.chat-focus-pop { position: absolute; left: 0; top: 1.5rem; z-index: 20; width: 18rem; max-width: 80vw; padding: 0.55rem 0.7rem; background: var(--card); border: 1px solid var(--border); border-radius: 0.5rem; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); color: inherit; }
.msg-used { margin-top: 0.4rem; line-height: 1.5; }
.msg-used .used-failed { color: var(--danger); }
.jobs { display: flex; flex-direction: column; gap: 0.35rem; }
.job-row { display: flex; gap: 0.5rem; align-items: center; }

/* The composer as legacy's input box: white strip, rounded field, bold blue Send. */
.composer { border-top: 1px solid var(--chat-border); padding: 0.75rem 1.25rem 0.6rem 1.75rem; background: #fff; }
.composer-row { display: flex; gap: 0.5rem; align-items: flex-end; }
.composer-row textarea { resize: vertical; min-height: 2.8rem; max-height: 8rem; padding: 0.75rem; border: 1px solid var(--chat-border); border-radius: 0.5rem; }
.composer-row textarea:focus { outline: none; border-color: var(--ctc-blue); }
.send-button { padding: 0.75rem 1.5rem; border-radius: 0.5rem; font-weight: 600; }
.attach-button { margin: 0; white-space: nowrap; display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.75rem 1rem; border-radius: 0.5rem; border-color: var(--chat-border); }
.attach-icon { font-size: 1.05em; line-height: 1; }
.pending-files { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.4rem; }
.pending-files:empty { display: none; }
.profile-picker { display: flex; align-items: center; gap: 0.5rem; max-width: 22rem; margin-bottom: 0.5rem; }
.manage-prompts { text-align: right; padding: 0.2rem 0 0; }
.manage-prompts .inline-form { display: inline; }
.manage-prompts .link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--ctc-blue); cursor: pointer; text-decoration: underline; }
.manage-prompts a { color: var(--ctc-blue); }
/* AI disclaimer strip, as the toolshed's (style.css .ai-disclaimer): amber, small, always visible. */
.ai-disclaimer { flex: none; background: var(--warning-bg); color: var(--warning-text); text-align: center; padding: 0.4rem 1rem; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.03em; border-top: 1px solid #f3dc9a; }
.chat-readonly { margin: 0 1.25rem 0.75rem 1.75rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
#chat-error { margin: 0 1.25rem 0.5rem 1.75rem; }
.chat-readonly p { margin: 0; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(11,37,69,0.35); display: flex; align-items: flex-start; justify-content: center; padding-top: 10vh; z-index: 50; }
.modal { width: min(520px, 92vw); max-height: 80vh; overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.whats-new { width: min(640px, 92vw); }
.whats-new-list { padding-left: 1.2rem; margin: 0.5rem 0 1rem; }
.whats-new-list li { margin: 0.45rem 0; line-height: 1.45; }
.whats-new-actions { display: flex; justify-content: flex-end; }
/* Admin editor for the note (admin/whats_new.html). */
.whats-new-form { max-width: 48rem; }
.whats-new-items { border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 1rem; margin: 0 0 0.75rem; }
.whats-new-item { display: grid; gap: 0.3rem; padding: 0.6rem 0; border-bottom: 1px dashed var(--border); }
.whats-new-item:last-of-type { border-bottom: 0; }
.whats-new-item input { font-weight: 600; }
.whats-new-preview h2 { margin-top: 0; }
.modal-head h2 { margin: 0; }
.share-suggestions { display: flex; flex-direction: column; margin: -0.4rem 0 0.6rem; }
.share-suggestion { font: inherit; text-align: left; background: #fff; border: 1px solid var(--border); border-top: 0; padding: 0.35rem 0.6rem; cursor: pointer; }
.share-suggestion:first-child { border-top: 1px solid var(--border); }
.share-suggestion:hover { background: #eef4fb; }
.share-list { list-style: none; padding: 0; margin: 0; }
.share-list li { display: flex; justify-content: space-between; align-items: center; padding: 0.35rem 0; border-bottom: 1px solid var(--border); }

@media (max-width: 760px) {
    .chat-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .chat-layout.sidebar-closed { grid-template-rows: 1fr; }
    .chat-sidebar { max-height: 32vh; border-right: 0; border-bottom: 1px solid var(--border); }
    .msg { max-width: 100%; }
}

/* saved-prompt picker and "My prompts" dialog */
.prompt-picker { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin: 0.35rem 0; }
.prompt-picker select { max-width: 18rem; }
.alert-inline { color: var(--danger); font-size: 0.85rem; }
.prompt-form { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
.prompt-form label { display: flex; flex-direction: column; gap: 0.2rem; }
.prompt-form textarea { width: 100%; }
.prompt-form [aria-invalid="true"] { border-color: var(--danger); }
.prompt-form-actions, .prompt-list-actions { display: flex; gap: 0.35rem; }
.field-error { color: var(--danger); font-size: 0.85rem; }

/* "Earlier messages summarized" (the chat service's compaction note) */
.msg-compacted { max-width: 52rem; width: 100%; border-top: 1px dashed var(--border); padding-top: 0.4rem; color: var(--muted); font-size: 0.85rem; }
.msg-compacted summary { cursor: pointer; }
.msg-compacted .msg-text-plain { white-space: pre-wrap; margin-top: 0.4rem; }

/* The user guide (templates/guide/index.html), legacy UserGuidePage.css restyled
   on the shell palette: a sticky table of contents beside the sections. */
.userguide-container { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 2rem; align-items: start; }
.userguide-sidebar { position: sticky; top: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; }
.userguide-sidebar h3 { margin: 0 0 0.75rem; font-size: 1rem; }
.toc-nav { display: flex; flex-direction: column; gap: 2px; }
.toc-link { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: 0.9rem; }
.toc-link:hover { background: var(--bg); color: var(--ctc-blue-dark); }
.userguide-content { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 2rem 2.5rem; }
.userguide-content h1 { color: var(--ctc-blue-dark); font-size: 2rem; margin: 0 0 0.5rem; }
.userguide-content .intro { font-size: 1.1rem; color: var(--muted); margin-bottom: 2rem; line-height: 1.6; }
.guide-section { margin-bottom: 3rem; scroll-margin-top: 1rem; }
.guide-section h2 { font-size: 1.5rem; margin: 0 0 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--ctc-blue); }
.guide-section h3 { font-size: 1.15rem; margin: 1.5rem 0 0.6rem; }
.guide-section h4 { font-size: 1rem; margin: 1.1rem 0 0.4rem; }
.guide-section p, .guide-section li { line-height: 1.65; }
.guide-section ul, .guide-section ol { margin: 0 0 1rem; padding-left: 1.6rem; }
.guide-section ul ul, .guide-section ol ul { margin: 0.3rem 0; }
.highlight-box { background: var(--warning-bg); color: var(--warning-text); border-radius: 6px; padding: 1rem 1.25rem; margin: 1rem 0; }
.highlight-box p { margin: 0 0 0.5rem; }
.shortcuts-table { border-collapse: collapse; max-width: 480px; margin: 1rem 0; }
.shortcuts-table th, .shortcuts-table td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
.shortcuts-table th { background: var(--bg); }
.shortcuts-table kbd { background: var(--bg); border: 1px solid var(--border); border-radius: 3px; padding: 1px 6px; font-family: Consolas, monospace; font-size: 0.9em; }
.troubleshooting-item, .advantage-item { background: var(--bg); border-left: 4px solid var(--ctc-blue); border-radius: 4px; padding: 0.75rem 1.25rem; margin-bottom: 1rem; }
.troubleshooting-item h4, .advantage-item h4 { margin-top: 0; }
.troubleshooting-item h4 { color: var(--ctc-blue-dark); }
.troubleshooting-item ul { margin-bottom: 0; }
.highlight-text { background: var(--user-bubble); border-radius: 6px; padding: 1rem; }
.tagline { color: var(--ctc-blue-dark); font-weight: 500; font-size: 1.05rem; }
.admin-note { background: var(--bg); border-radius: 6px; padding: 0.75rem 1rem; margin-bottom: 1rem; }
.admin-note p { margin: 0; color: var(--muted); }
.contact-section { background: var(--user-bubble); border-radius: 8px; padding: 1.5rem; margin-top: 2rem; }
.contact-section h2 { font-size: 1.5rem; margin: 0 0 0.75rem; }
.final-note { background: var(--card); color: var(--ctc-blue-dark); border-radius: 8px; padding: 1rem; margin-top: 1rem; text-align: center; font-style: italic; }
@media (max-width: 760px) {
    .userguide-container { grid-template-columns: 1fr; }
    .userguide-sidebar { position: static; }
    .userguide-content { padding: 1.25rem; }
}

/* Sign-in page as legacy chatctc's (LoginPage.css / SSOLogin.css): no app header,
   purple gradient, white card with a navy band. Inputs and buttons use the browser
   default face, since legacy set no font on them. */
body.body-login { min-height: 100vh; display: flex; flex-direction: column; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-page { flex: 1; display: flex; align-items: center; justify-content: center; }
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-box { background: #fff; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.1); overflow: hidden; }
.login-header { background: var(--ctc-navy); color: #fff; padding: 30px; text-align: center; }
.login-header h1 { margin: 0 0 8px 0; font-size: 28px; font-weight: 600; }
.login-header p { margin: 0; font-size: 16px; opacity: 0.9; }
.login-form { padding: 30px; }
.login-form .error-message { background-color: #fee; color: #c33; padding: 12px; border-radius: 6px; margin-bottom: 20px; font-size: 14px; text-align: center; }
.login-form .form-group { margin-bottom: 20px; }
.login-form .form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: #333; font-size: 14px; }
.login-form .form-group input { font-family: Arial, sans-serif; width: 100%; padding: 12px 16px; font-size: 16px; border: 2px solid #e0e0e0; border-radius: 8px; outline: none; transition: border-color 0.2s; }
.login-form .form-group input:focus { border-color: #667eea; }
.login-button { width: 100%; padding: 14px; font-family: Arial, sans-serif; font-size: 16px; font-weight: 500; background-color: #667eea; color: #fff; border: none; border-radius: 8px; cursor: pointer; transition: background-color 0.2s; margin-top: 10px; }
.login-button:hover { background-color: #5a67d8; }
.sso-login-container { margin-top: 2rem; }
.login-divider { position: relative; text-align: center; margin: 2rem 0; }
.login-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background-color: #e5e7eb; }
.login-divider span { position: relative; display: inline-block; padding: 0 1rem; background-color: #fff; color: #6b7280; font-size: 0.875rem; font-weight: 500; }
.sso-login-button { width: 100%; display: flex; align-items: center; justify-content: center; gap: 0.75rem; padding: 0.75rem 1rem; border: 1px solid #e5e7eb; border-radius: 6px; background-color: #fff; color: #374151; font-family: Arial, sans-serif; font-size: 1rem; font-weight: 500; cursor: pointer; text-decoration: none; transition: all 0.2s; }
.sso-login-button:hover { background-color: #f9fafb; border-color: #d1d5db; }
.sso-icon { width: 1.25rem; height: 1.25rem; }
.login-footer { background-color: #f8f9fa; padding: 20px 30px; text-align: center; border-top: 1px solid #e0e0e0; }
.login-footer p { margin: 0; font-size: 14px; color: #666; }
@media (max-width: 480px) {
    .login-container { padding: 10px; }
    .login-header, .login-form { padding: 24px; }
}
