:root {
  color-scheme: dark;
  --base: #090e18;
  --sidebar: #0d1421;
  --panel: #101b2b;
  --panel-raised: #152237;
  --line: #26374e;
  --text: #edf4ff;
  --muted: #a1b3ca;
  --accent: #92d8ff;
  --strong-accent: #b4e6ff;
  --warm: #f1c889;
  --error: #ffadaf;
  --radius: 16px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--base); color: var(--text); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--strong-accent); outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .7; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.15; }
h1 { font-size: clamp(2rem, 4.3vw, 3.35rem); letter-spacing: -.05em; font-weight: 650; }
h2 { font-size: 1.15rem; letter-spacing: -.025em; }
h3 { font-size: 1rem; }
p { line-height: 1.55; }
code { font-size: .9em; overflow-wrap: anywhere; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: .5rem; left: .5rem; z-index: 4; padding: .6rem 1rem; transform: translateY(-160%); background: var(--base); }
.skip-link:focus { transform: none; }
.startup { color: var(--muted); display: grid; min-height: 100vh; place-content: center; padding: 2rem; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; min-height: 100vh; height: 100vh; background: var(--sidebar); border-right: 1px solid #1d2a3d; padding: 30px 16px 16px; }
.brand { display: flex; gap: 12px; align-items: center; margin: 0 8px; }
.brand strong { display: block; font-size: 1rem; line-height: 1.25; letter-spacing: .035em; }
.brand small { display: block; color: var(--muted); font-size: .75rem; margin-top: 3px; }
.brand small { letter-spacing: .08em; }
.brand-mark { border: 1px solid #5796ba; height: 39px; width: 39px; flex: 0 0 auto; border-radius: 11px; background: #182d46; position: relative; display: grid; place-items: center; }
.brand-mark::before, .brand-mark::after, .brand-mark i { content: ""; position: absolute; display: block; width: 17px; height: 17px; border: 1px solid var(--accent); transform: rotate(45deg); }
.brand-mark::after { width: 9px; height: 9px; }
.brand-mark i { width: 3px; height: 3px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 10px var(--accent); }
.main-nav { display: grid; gap: 5px; margin-top: 43px; }
.main-nav a { min-height: 46px; padding: 0 10px; display: flex; align-items: center; gap: 11px; color: var(--muted); text-decoration: none; border: 1px solid transparent; border-radius: 9px; font-size: .9rem; font-weight: 550; white-space: nowrap; }
.main-nav a[aria-current] { color: var(--text); background: #16253b; border-color: #2b4662; }
.main-nav a:hover { color: var(--strong-accent); }
.nav-icon { width: 17px; height: 17px; border: 1px solid currentColor; display: inline-block; color: var(--accent); flex: 0 0 auto; }
.icon-overview { border-radius: 4px; background: linear-gradient(currentColor,currentColor) center/1px 100% no-repeat, linear-gradient(currentColor,currentColor) center/100% 1px no-repeat; }
.icon-conversation { border-radius: 5px 5px 5px 1px; height: 13px; background: radial-gradient(circle, currentColor 1.3px, transparent 1.5px) 3px center/4px 100% no-repeat, radial-gradient(circle, currentColor 1.3px, transparent 1.5px) 8px center/4px 100% no-repeat; }
.icon-knowledge { border-radius: 3px; border-left-width: 3px; background: repeating-linear-gradient(0deg, transparent 0 3px, #92d8ff70 3px 4px) center / 7px 9px no-repeat; }
.icon-agents { border-radius: 50%; background: radial-gradient(circle, currentColor 2px, transparent 2.5px); }
.sidebar-foot { margin-top: auto; padding: 18px 7px 0; border-top: 1px solid #26374e; display: grid; gap: 9px; }
.surface { min-width: 0; }
.topbar { min-height: 69px; padding: 12px clamp(16px, 3.5vw, 48px); display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid #1d2a3d; background: #0b121e; }
.topbar > p { color: var(--muted); font-size: .9rem; font-weight: 550; }
.topbar-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.mode-pill, .badge { display: inline-flex; align-items: center; gap: 7px; width: fit-content; border: 1px solid #42536b; color: #c4d6ed; background: #172437; border-radius: 7px; white-space: nowrap; padding: 5px 8px; font-size: .8rem; font-weight: 550; }
.mode-pill { padding: 7px 10px; }
.status-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px #92d8ff81; }
.badge[data-tone="blue"] { color: var(--strong-accent); border-color: #395a75; background: #172d44; }
.badge[data-tone="warn"] { color: var(--warm); border-color: #675432; background: #2a241c; }
.badge[data-tone="error"] { color: var(--error); border-color: #703a4a; background: #2d1c29; }
main { max-width: 1500px; margin: auto; padding: clamp(17px, 3.4vw, 44px); }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.content-panel { padding: clamp(16px, 2vw, 23px); }
.button { display: inline-flex; align-items: center; justify-content: center; padding: 9px 13px; min-height: 39px; border: 1px solid transparent; border-radius: 8px; font-size: .875rem; font-weight: 650; cursor: pointer; text-decoration: none; line-height: 1.35; }
.primary { color: #041424; background: #a4ddff; border-color: #b6e6ff; box-shadow: 0 4px 20px #61b7f31d; }
.primary:hover { background: #c0ecff; }
.outline { color: var(--strong-accent); background: #142237; border-color: #354c67; }
.outline:hover { border-color: #7faac7; background: #1c3049; }
.subtle { color: var(--muted); background: transparent; }
.subtle:hover { color: var(--text); background: var(--panel-raised); }
.text-link { color: var(--accent); text-underline-offset: 3px; font-weight: 600; font-size: .875rem; }
.hero { position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: center; min-height: 310px; background: radial-gradient(ellipse at 76% 46%, #16426a 0, #142b45 34%, transparent 67%), linear-gradient(112deg, #111c2e, #0e192a 63%, #121f36); border: 1px solid #385477; border-radius: var(--radius); padding: clamp(25px, 4vw, 55px); }
.hero-content { position: relative; z-index: 1; max-width: 510px; }
.hero-label { color: var(--accent); font-size: .78rem; font-weight: 700; letter-spacing: .17em; display: flex; gap: 9px; align-items: center; margin-bottom: 13px; }
.hero-label i { display: inline-block; width: 14px; height: 1px; background: var(--accent); }
.hero h1 { font-size: clamp(2.8rem, 6.15vw, 5.4rem); font-weight: 680; line-height: .96; letter-spacing: -.062em; }
.hero h1 span { color: var(--accent); }
.hero-content p:not(.hero-label) { color: #c6d7ea; margin-top: 16px; max-width: 360px; }
.hero .button { margin-top: 20px; }
.orbit { position: absolute; top: 50%; right: clamp(15px, 8%, 110px); transform: translateY(-50%); width: clamp(205px, 27vw, 350px); aspect-ratio: 1; display: grid; place-items: center; border: 1px solid #6cb4eb2e; border-radius: 50%; background: radial-gradient(circle, #75c6ff36, #2f7db327 25%, #1b45601c 52%, transparent 72%), linear-gradient(transparent calc(50% - .5px), #81c8f331 50%, transparent calc(50% + .5px)), linear-gradient(90deg, transparent calc(50% - .5px), #81c8f331 50%, transparent calc(50% + .5px)); box-shadow: inset 0 0 35px #56b8ff0b; }
.orbit::before, .orbit::after { content: ""; position: absolute; border: 1px solid #8bd9ff50; width: 81%; aspect-ratio: 1; border-radius: 50%; }
.orbit::after { width: 55%; border-style: dashed; border-color: #8bd9ff63; transform: rotate(21deg); }
.orbit i { position: absolute; width: 34%; aspect-ratio: 1; border: 1px solid #a8e1ffb0; transform: rotate(45deg); background: #86ddff12; box-shadow: 0 0 24px #5bb4ee24, inset 0 0 22px #5bb4ee31; }
.orbit i:nth-child(2) { width: 24%; border-color: #a8e1ff87; }
.orbit i:nth-child(3) { width: 12%; border-color: #a8e1ffbd; }
.orbit b { position: absolute; width: 4%; aspect-ratio: 1; border-radius: 50%; background: #bdedff; box-shadow: 0 0 30px #b1eaff, 0 0 9px #9edefc; }
.stat-grid { margin: 19px 0; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.stat { padding: 16px 19px; }
.stat dt { color: var(--muted); font-size: .9rem; }
.stat dd { margin: 7px 0 0; line-height: 1.15; color: var(--text); font-variant-numeric: tabular-nums; font-size: 1.75rem; letter-spacing: -.035em; font-weight: 650; }
.overview-grid, .agent-grid, .knowledge-grid { display: grid; gap: 17px; align-items: start; }
.overview-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.agent-grid { grid-template-columns: minmax(230px, .75fr) minmax(0,1.65fr); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.section-heading > h2 { margin: 0; }
.page-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 23px; }
.page-heading p { max-width: 600px; color: var(--muted); margin-top: 9px; }
.muted, .empty { color: var(--muted); }
.empty { padding: 12px 0; font-size: .9rem; }
.card-list, .event-list { margin: 0; padding: 0; list-style: none; }
.card-list li, .event-list li { padding: 11px 0; border-top: 1px solid #26374e; }
.card-list li:first-child, .event-list li:first-child { border-top: 0; }
.card-list a { color: var(--text); text-decoration: none; }
.card-list a:hover { color: var(--accent); }
.list-item, .roster-item { display: flex; gap: 10px; align-items: center; }
.item-copy { min-width: 0; flex: 1; }
.item-copy > strong { display: block; font-size: .93rem; overflow-wrap: anywhere; }
.item-copy > small, .item-meta { display: block; color: var(--muted); font-size: .82rem; line-height: 1.4; overflow-wrap: anywhere; }
.agent-monogram { display: grid; place-items: center; width: 36px; height: 36px; background: #19304a; border: 1px solid #344e6a; border-radius: 9px; color: var(--accent); font-size: .825rem; font-weight: 700; flex: 0 0 auto; }
.event-list .item-meta { margin-top: 4px; }
.event-list strong { font-size: .9rem; font-weight: 550; }
.roster { display: grid; gap: 5px; }
.roster-item { width: 100%; text-align: left; cursor: pointer; background: transparent; color: var(--text); border: 1px solid transparent; border-radius: 9px; padding: 7px 5px; }
.roster-item:hover { background: #182a40; }
.roster-item[aria-pressed="true"] { background: #1a3049; border-color: #395a75; }
.roster-item > .item-copy > small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-info { display: grid; gap: 15px; }
.agent-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.agent-heading { display: flex; align-items: center; gap: 12px; }
.agent-header .agent-monogram { width: 49px; height: 49px; font-size: 1rem; }
.agent-header h2 { font-size: 1.48rem; }
.agent-header .muted { display: block; margin-top: 4px; font-size: .875rem; }
.detail-block { display: grid; gap: 8px; padding: 14px 0; border-top: 1px solid var(--line); }
.detail-block:last-child { padding-bottom: 0; }
.detail-block p, .detail-block li { font-size: .92rem; }
.detail-block ul { margin: 0; padding-left: 20px; }
.meta-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px 16px; margin: 0; }
.meta-grid dt { color: var(--muted); font-size: .82rem; }
.meta-grid dd { color: var(--text); font-size: .92rem; margin: 3px 0 0; overflow-wrap: anywhere; }
label { display: block; font-size: .9rem; font-weight: 560; margin: 0 0 7px; }
input:not([type="checkbox"]), select, textarea { display: block; min-height: 41px; width: 100%; color: var(--text); background: #0b1422; border: 1px solid #3a4d66; border-radius: 8px; padding: 9px 10px; line-height: 1.45; }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #8c9eb6; }
.optional { color: var(--muted); font-weight: 400; font-size: .85em; }
.form-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 12px; }
.form-row > div { min-width: 0; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
#memory-form { margin-top: 12px; }
.checkbox { display: flex; align-items: flex-start; gap: 8px; margin-top: 13px; color: var(--muted); font-weight: 450; }
.checkbox input { accent-color: var(--accent); margin: 3px 0 0; }
.scenario { margin: 15px 0 0; border: 1px solid var(--line); border-radius: 9px; padding: 6px 12px 4px; }
.scenario legend { color: var(--muted); font-size: .875rem; }
.scenario button { margin-top: 6px; padding-left: 0; }
.task-list { display: grid; gap: 7px; }
.task { border: 1px solid var(--line); background: #101a29; border-radius: 9px; }
.task summary { cursor: pointer; display: flex; gap: 10px; align-items: center; justify-content: space-between; min-width: 0; min-height: 46px; list-style: none; padding: 8px 11px; }
.task summary::-webkit-details-marker { display: none; }
.task summary::before { content: ""; width: 7px; height: 7px; border: solid var(--accent); border-width: 0 1px 1px 0; transform: rotate(-45deg); margin-left: 3px; flex: 0 0 auto; }
.task[open] summary::before { transform: rotate(45deg); }
.task.child-task { margin-left: min(20px, 3vw); }
.task-body { display: grid; gap: 10px; padding: 11px; border-top: 1px solid var(--line); }
.task-body > p { font-size: .9rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.memory-list:not(:empty) { margin-top: 14px; }
.memory-row { padding: 11px 0; border-top: 1px solid var(--line); }
.memory-row p { font-size: .9rem; overflow-wrap: anywhere; }
.memory-actions { display: flex; gap: 5px; margin-top: 4px; }
.memory-actions button { min-height: 34px; padding: 5px 8px; }
.feedback { font-size: .9rem; color: var(--strong-accent); background: #152d44; border: 1px solid #466e8c; padding: 10px 12px; margin-bottom: 14px; border-radius: 8px; }
.feedback.is-error { background: #2d1c29; border-color: #703a4a; color: var(--error); }
@media (max-width: 1060px) {
  .shell { grid-template-columns: 196px minmax(0, 1fr); }
  .sidebar { padding-inline: 11px; }
  .hero-content { max-width: 365px; }
  .hero-content p:not(.hero-label) { max-width: 260px; }
}
@media (max-width: 800px) {
  .shell { display: block; }
  .sidebar { position: static; min-height: auto; height: auto; border-right: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; padding: 12px 16px 0; row-gap: 9px; }
  .brand { margin: 0; }
  .main-nav { display: flex; overflow-x: auto; grid-row: 2; grid-column: 1 / -1; margin: 0; padding: 0 0 8px; }
  .main-nav a { min-height: 39px; }
  .sidebar-foot { padding: 0; margin: 0; border: 0; justify-self: end; }
  .sidebar-foot button { min-height: 36px; padding: 5px 8px; }
  .topbar { min-height: 54px; }
  .hero { min-height: 273px; }
  .orbit { right: 4%; }
}
@media (max-width: 540px) {
  .overview-grid, .agent-grid { grid-template-columns: 1fr; }
  .hero { min-height: 245px; }
  .hero .orbit { right: -74px; opacity: .48; }
  .hero h1 { font-size: clamp(2.65rem, 10.3vw, 3.4rem); }
  .stat-grid { gap: 6px; margin: 12px 0; }
  .stat { padding: 11px 8px; }
  .stat dt { font-size: .82rem; }
  .stat dd { font-size: 1.42rem; }
  .topbar { padding-inline: 12px; }
  .topbar > p { display: none; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .main-nav a { gap: 6px; padding-inline: 6px; font-size: .82rem; }
  .main-nav a .nav-icon { height: 13px; width: 13px; }
  .section-heading { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
.instructions summary { cursor: pointer; font-size: .94rem; font-weight: 600; }
.instruction-version { margin-top: 12px; }
.instruction-version strong { display: block; color: var(--muted); margin-bottom: 5px; font-size: .82rem; }
.scenario-trigger { margin-top: 7px; padding-left: 0; }

.provider-overview { margin-bottom: 17px; }
.provider-overview p { margin-top: 10px; }
.quote-panel { border: 1px solid #425b74; background: #102338; padding: 13px; border-radius: 9px; margin-top: 14px; }
.quote-panel h3 { margin-bottom: 10px; }
.quote-panel p { margin-top: 9px; font-size: .855rem; }
.quote-panel label { margin-bottom: 0; }
#task-feedback { margin-top: 12px; }
.mode-pill[data-tone="warn"] .status-dot { background: var(--warm); box-shadow: 0 0 9px #f1c88967; }
.mode-pill[data-tone="error"] .status-dot { background: var(--error); box-shadow: 0 0 9px #ffadaf67; }
.trace-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.trace-list > li { border-radius: 8px; border: 1px solid var(--line); padding: 10px; }
.trace-list h3 { margin-bottom: 7px; font-size: .9rem; }

.conversation-heading, .conversation-workspace { max-width: 970px; margin-inline: auto; }
.conversation-heading { flex-wrap: wrap; }
.conversation-heading h1 { font-size: clamp(1.95rem, 3.7vw, 2.8rem); }
.chat-panel { overflow: hidden; background: #0d1726; }
.chat-controls { display: grid; grid-template-columns: minmax(105px,.85fr) minmax(145px,1.1fr) minmax(0,1.75fr) auto; gap: 12px; align-items: end; border-bottom: 1px solid var(--line); background: var(--panel); padding: 14px clamp(14px, 2.5vw, 23px); }
.chat-controls > div { min-width: 0; }
.chat-controls label { color: var(--muted); font-size: .78rem; }
.chat-controls select { text-overflow: ellipsis; }
.chat-controls #new-chat { grid-column: -2; min-height: 41px; }
.chat-scroll { height: clamp(17rem, 49svh, 38rem); overflow: auto; overscroll-behavior: contain; scrollbar-color: #3a5270 transparent; }
.chat-scroll:focus-visible { outline-offset: -3px; }
.chat-content { min-height: 100%; display: flex; flex-direction: column; max-width: 790px; margin-inline: auto; padding: clamp(14px, 3vw, 25px); }
#chat-messages { display: flex; flex: 1; flex-direction: column; justify-content: flex-end; gap: clamp(18px, 3vw, 28px); min-width: 0; }
.chat-history-controls { text-align: center; margin-bottom: 13px; }
.chat-history-controls .feedback { margin: 4px 0 0; }
.chat-empty { min-height: min(100%, 16rem); display: grid; align-content: center; justify-items: center; gap: 9px; align-self: stretch; margin-block: auto; text-align: center; padding: 1.5rem 0; }
.chat-empty h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); }
.chat-empty p { color: var(--muted); margin: 0; }
.chat-empty .agent-monogram { width: 50px; height: 50px; font-size: 1rem; margin-bottom: 5px; }
.chat-turn { display: grid; gap: 14px; min-width: 0; }
.chat-message { min-width: 0; }
.user-message { justify-self: end; max-width: min(85%, 36rem); padding: 12px 15px; border: 1px solid #355779; border-radius: 14px 14px 4px 14px; background: #19314b; white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-message { justify-self: start; max-width: min(100%, 42rem); width: fit-content; border-left: 2px solid #3c6489; padding: 3px 0 3px 13px; }
.chat-author { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--accent); font-size: .79rem; font-weight: 680; margin-bottom: 5px; }
.chat-author > span { color: var(--muted); font-size: .7rem; font-weight: 500; }
.chat-message-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.chat-message-actions .button { min-height: 34px; padding: 4px 7px; font-size: .78rem; }
.chat-message-actions [data-cancel] { color: var(--error); }
.chat-message-actions small { line-height: 1.4; }
.chat-turn-status, .chat-delegates { color: var(--muted); font-size: .86rem; }
.chat-delegates { margin-top: 8px; }
.chat-turn-status.is-processing { display: flex; align-items: center; gap: 8px; }
.is-processing > span { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: processing-pulse 1.5s ease-in-out infinite; }
@keyframes processing-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .is-processing > span { animation: none; } }
.chat-composer { padding: 14px clamp(14px, 2.5vw, 25px); border-top: 1px solid var(--line); background: var(--panel); }
.chat-composer .feedback { margin: 0 0 9px; }
.chat-composer .quote-panel { margin: 0 0 12px; }
.chat-context-note, .chat-hint { color: var(--muted); font-size: .77rem; }
.chat-context-note { margin-bottom: 6px; }
.chat-hint { margin-top: 7px; }
.composer-field { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; align-items: end; }
.composer-field textarea { resize: vertical; min-height: 63px; max-height: 15rem; }
.composer-field button { min-height: 44px; }
.chat-composer button:disabled { cursor: default; opacity: .6; }
.conversation-advanced { margin-top: 16px; }
.conversation-advanced > summary { cursor: pointer; font-weight: 640; }
.advanced-content { display: grid; gap: 16px; margin-top: 14px; }
.advanced-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.advanced-content .scenario { margin: 0; }
.advanced-content #task-time { max-width: 20rem; }
.advanced-audit { border-top: 1px solid var(--line); padding-top: 15px; min-width: 0; }
.advanced-audit h2 { margin-bottom: 10px; }
.agent-converse { margin-bottom: 15px; }

.markdown { min-width: 0; max-width: 100%; overflow-wrap: anywhere; line-height: 1.55; }
.markdown > * + * { margin-top: .6rem; }
.markdown h3, .markdown h4, .markdown h5, .markdown h6 { font-size: 1rem; line-height: 1.3; }
.markdown p, .markdown ul, .markdown ol { margin-bottom: 0; }
.markdown ul, .markdown ol { padding-left: 1.35rem; }
.markdown li + li, .markdown li > ul, .markdown li > ol { margin-top: .25rem; }
.markdown blockquote { margin-inline: 0; padding-left: 12px; border-left: 2px solid #6282a3; color: #c5d5e8; }
.markdown pre { overflow: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #0b1422; padding: 10px; }
.markdown code { background: #0b1422; color: #c2e4ff; padding: 1px 4px; border-radius: 4px; }
.markdown pre code { padding: 0; overflow-wrap: normal; }
.markdown hr { border: 0; border-top: 1px solid var(--line); }
.markdown-table { max-width: 100%; overflow-x: auto; border: 1px solid #3a4d66; border-radius: 8px; }
.markdown-table:focus-visible { outline-offset: -2px; }
.markdown table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.markdown th, .markdown td { padding: 7px 10px; text-align: left; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 6rem; }
.markdown [data-align="right"] { text-align: right; }
.markdown [data-align="center"] { text-align: center; }
.markdown th { background: #1a3049; color: #e1efff; }
.markdown th:last-child, .markdown td:last-child { border-right: 0; }
.markdown tbody tr:last-child td { border-bottom: 0; }

.knowledge-grid { grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); }
.knowledge-filters { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.knowledge-filters label { color: var(--muted); font-size: .79rem; }
.knowledge-filters select { text-overflow: ellipsis; }
.knowledge-paste { margin-top: 13px; }
#knowledge-input { font: .85rem/1.5 ui-monospace, Menlo, monospace; }
#knowledge-file { font-size: .85rem; }
.knowledge-record { min-width: 0; border-top: 1px solid var(--line); margin-top: 11px; padding-top: 11px; }
.knowledge-record-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.knowledge-record-heading h3 { overflow-wrap: anywhere; }
.knowledge-record-content { white-space: pre-wrap; overflow-wrap: anywhere; margin-block: 5px; }
.knowledge-classify { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.knowledge-classify select { width: auto; max-width: 100%; min-height: 36px; font-size: .84rem; }
.knowledge-classify .button { min-height: 36px; padding: 6px 8px; }
#knowledge-preview-records { max-height: 23rem; overflow-y: auto; overscroll-behavior: contain; }
#knowledge-commit, #knowledge-load { margin-top: 11px; }
#knowledge-import-feedback, #knowledge-library-feedback, #memory-feedback { margin: 12px 0 0; }
.knowledge-record .item-meta { margin-top: 3px; }

@media (max-width: 1070px) { .knowledge-grid { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .chat-controls { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 9px; }
  .chat-controls #new-chat { grid-column: auto; justify-self: end; }
  .chat-controls .chat-thread-control + #new-chat { grid-column: 2; }
}
@media (max-width: 540px) {
  .main-nav a .icon-conversation { height: 11px; }
  .chat-scroll { height: clamp(11rem, 42svh, 26rem); }
  .chat-controls select, .knowledge-filters select { font-size: .87rem; }
  .chat-controls #new-chat { min-height: 36px; }
  .chat-empty p { font-size: .85rem; }
  .chat-turn { gap: 11px; }
  .chat-content { padding-inline: 12px; }
  .chat-hint { font-size: .72rem; }
  .composer-field { gap: 6px; }
  .composer-field button { max-width: 106px; text-align: center; padding-inline: 8px; }
  .knowledge-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .knowledge-record-content, .composer-field textarea { font-size: 1rem; }
}

.shell {
  grid-template-columns: 218px minmax(0, 1fr);
}
.shell .sidebar { border-color: #1a3044; max-height: 100svh; overflow-y: auto; }
.shell .brand { color: var(--text); text-decoration: none; }
.shell .brand strong { font-size: 1.05rem; letter-spacing: .16em; }
.shell .brand-mark { border-radius: 50%; border-color: #3f6a85; background: #11273a; }
.shell .main-nav a { border-radius: 7px; font-size: .86rem; }
.shell .main-nav a[aria-current] {
  color: #e5f8ff;
  background: linear-gradient(95deg, #123246, #0e1e2f);
  border-color: #2b5065;
}
.shell .main-nav a[aria-current] .nav-icon { color: var(--accent); }
.icon-norte {
  border-radius: 50%;
  background: radial-gradient(circle, currentColor 0 1.5px, transparent 2px 3px, #83dbf673 3.5px 4px, transparent 4.7px);
}
.icon-life {
  border-radius: 50%;
  background: linear-gradient(0deg, transparent calc(50% - .5px), currentColor 50%, transparent calc(50% + .5px)),
    linear-gradient(90deg, transparent calc(50% - .5px), currentColor 50%, transparent calc(50% + .5px));
}
.icon-dreams { transform: rotate(45deg) scale(.75); background: radial-gradient(circle, currentColor 0 2px, transparent 2.5px); }
.icon-settings { border-radius: 4px; background: radial-gradient(circle, transparent 0 3px, currentColor 3.4px 4px, transparent 4.5px); }
.shell[data-page="norte"] .surface { background: #0c0f19; }
.shell[data-page="norte"][data-menus-hidden="true"] { grid-template-columns: minmax(0,1fr); }
.shell[data-page="norte"][data-menus-hidden="true"] .sidebar { display: none; }
.shell[data-page="norte"] .topbar { display: none; }
.shell[data-page="norte"] main { max-width: none; min-height: 100svh; margin: 0; padding: 0; }
.shell[data-page="norte"] .norte-immersive { min-height: 100svh; max-width: none; border: 0; border-radius: 0; }
.shell[data-page="norte"] #global-feedback { margin: 14px 18px 0; }
.shell[data-page="conversation"] .topbar { display: none; }
.shell[data-page="conversation"] main { max-width: 1180px; }
.shell[data-page="conversation"] .chat-controls { grid-template-columns: minmax(9rem, .7fr) minmax(0, 1.3fr) auto; }
.shell[data-page="conversation"] .chat-thread-control + #new-chat { grid-column: auto; }
.shell[data-page="conversation"] .chat-scroll { height: clamp(15rem, 51svh, 39rem); }
.product-heading { gap: 16px; }
.product-heading .button { flex: 0 0 auto; }
.council-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.council-card { display: flex; min-height: 185px; flex-direction: column; gap: 8px; }
.council-card header { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.council-card h2 { margin-top: 7px; font-size: clamp(1.1rem, 1.4vw, 1.35rem); }
.council-card p { font-size: .88rem; }
.council-actions { display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 7px; }
.council-actions a, .settings-links a, .local-shortcuts a, .admin-return {
  color: var(--accent); font-size: .89rem; font-weight: 600; text-underline-offset: .24em;
}
.settings-grid, .command-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.settings-control { margin-top: 14px; max-width: 29rem; }
.settings-control p { margin-top: 6px; font-size: .88rem; }
.settings-control .button { margin-top: 8px; }
.settings-motion { max-width: 29rem; min-height: 34px; align-items: center; margin-top: 20px; }
.settings-motion input { margin: 0; }
.settings-links { display: grid; gap: 0; margin-top: 16px; }
.settings-links a { display: flex; justify-content: space-between; gap: 11px; border-top: 1px solid var(--line); padding: 11px 0; }
.local-shortcuts { display: flex; flex-wrap: wrap; gap: 13px 22px; margin-top: 19px; }
.admin-return { display: inline-block; margin-bottom: 15px; }
.command-stats { margin-top: 0; }
.command-task { background: transparent; border: 0; padding: 0; cursor: pointer; color: var(--text); display: flex; gap: 12px; width: 100%; text-align: left; }
.command-task:hover { color: var(--accent); }
.command-task .badge { align-self: flex-start; }

@media (max-width: 1060px) {
  .shell { grid-template-columns: 194px minmax(0, 1fr); }
  .council-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .shell .sidebar { max-height: none; overflow: visible; }
  .shell .main-nav { flex-wrap: wrap; overflow: visible; }
  .shell .main-nav a { min-height: 42px; }
  .shell[data-page="norte"], .shell[data-page="norte"] .surface,
  .shell[data-page="norte"] main, .shell[data-page="norte"] .norte-page { display: flex; flex-direction: column; }
  .shell[data-page="norte"] { min-height: 100svh; }
  .shell[data-page="norte"] .surface, .shell[data-page="norte"] main, .shell[data-page="norte"] .norte-page { flex: 1; min-height: 0; }
  .shell[data-page="norte"] .norte-immersive { flex: 1; min-height: 460px; padding-bottom: env(safe-area-inset-bottom); }
}
@media (max-width: 570px) {
  .shell .sidebar { padding: 10px 12px 0; gap: 7px; }
  .shell .brand { margin: 0 3px; }
  .shell .brand-mark { width: 34px; height: 34px; }
  .shell .main-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
  .shell .main-nav a { min-width: 0; white-space: normal; line-height: 1.14; font-size: .70rem; min-height: 42px;
    padding: 4px 2px; flex-direction: column; justify-content: center; text-align: center; gap: 3px; }
  .shell .main-nav a span:last-child { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .shell .main-nav a:nth-child(6) { grid-column: span 2; }
  .shell .main-nav .nav-icon { flex-shrink: 0; }
  .shell .sidebar-foot button { min-height: 42px; }
  .product-heading { align-items: start; flex-direction: column; }
  .settings-grid, .command-grid { grid-template-columns: 1fr; }
  .council-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .council-card { min-height: 0; padding: 11px; }
  .council-card header { flex-wrap: wrap; }
  .council-card .badge { font-size: .7rem; }
  .council-actions { flex-wrap: wrap; gap: 6px 10px; }
  .council-actions .button { min-height: 42px; }
  .command-stats .stat { padding: 9px; }
  .command-stats dt { font-size: .73rem; }
  .command-stats dd { font-size: 1rem; }
  .shell[data-page="conversation"] .chat-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shell[data-page="conversation"] .chat-thread-control:not([hidden]) { grid-row: 2; grid-column: 1 / -1; }
  .shell[data-page="conversation"] .chat-controls #new-chat { grid-column: 2; grid-row: 1; }
}

#planner-dialog { width: min(36rem, calc(100vw - 2rem)); max-height: 85vh; overflow: auto; color: inherit; }
#planner-dialog::backdrop { background: rgb(4 10 22 / 70%); }
#planner-dialog ul { padding-inline-start: 1.4rem; }
#planner-dialog .strategic-choices { display: grid; gap: 6px; margin: 8px 0; }
#planner-dialog .strategic-choice { display: flex; align-items: start; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
#planner-dialog .strategic-choice input { margin-top: 4px; accent-color: #94d9f4; flex-shrink: 0; }
#planner-dialog .strategic-choice small { display: block; color: var(--muted); }
#planner-dialog [data-strategic-consent] { margin-block: 13px; }
#planner-dialog [data-strategic-confirm] { margin-inline-end: 7px; }
#speech-output-settings { display: grid; gap: 8px; }
#speech-output-settings label:not(.checkbox) { display: grid; gap: 4px; }

.private-import-page { width: min(58rem, calc(100% - 2rem)); margin: 2rem auto; }
.private-import-page header { margin-bottom: 1rem; }
.private-import-page [data-personal-discovery] details { margin-block: 0.65rem; }
.private-import-page [data-personal-summary-box] p { margin-block: 0.5rem; }

.icon-orion {
  border-radius: 4px;
  background: linear-gradient(currentColor,currentColor) 3px bottom / 2px 5px no-repeat,
    linear-gradient(currentColor,currentColor) center bottom / 2px 8px no-repeat,
    linear-gradient(currentColor,currentColor) 10px bottom / 2px 11px no-repeat;
}
.council-actions { flex-wrap: wrap; }
@media (max-width: 570px) {
  .shell[data-orion="local"] .main-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shell[data-orion="local"] .main-nav a:nth-child(6) { grid-column: auto; }
}
