/* SPDX-FileCopyrightText: 2026 Dieter Bolz <dieter.bolz@t-online.de> */
/* SPDX-License-Identifier: AGPL-3.0-or-later */

:root {
    color-scheme: light;
    font-family:
        system-ui,
        -apple-system,
        "Segoe UI",
        sans-serif;
    color: var(--text);
    background: var(--surface-page);
    --muted: var(--text-muted);
}
* {
    box-sizing: border-box;
}
:root[data-theme="dark"] {
    color-scheme: dark;
}
body {
    margin: 0;
    background: var(--surface-page);
    color: var(--text);
    line-height: 1.5;
}
button,
input {
    font: inherit;
}
button,
a,
input {
    -webkit-tap-highlight-color: transparent;
}
button {
    cursor: pointer;
    color: inherit;
}
button {
    border: 0;
    background: none;
}
a {
    color: inherit;
    text-decoration: none;
}
button,
a {
    touch-action: manipulation;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 4px;
}
button {
    transition:
        background 160ms,
        box-shadow 160ms,
        transform 160ms;
}
.icon {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: middle;
}
.icon-library {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.skip-link {
    position: fixed;
    left: 20px;
    top: -100px;
    padding: 14px;
    z-index: 20;
    background: var(--surface-page);
    color: var(--brand);
    border: 2px solid var(--brand);
    border-radius: 6px;
    font-weight: 600;
}
.skip-link:focus {
    top: 10px;
}
.topbar {
    min-height: 82px;
    padding: 0 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: var(--surface-page);
    border-bottom: 1px solid var(--border-subtle);
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 23px;
    font-weight: 650;
    letter-spacing: -1px;
}
.app-logo {
    display: block;
    width: 32px;
    height: 32px;
}
.app-logo-main {
    fill: var(--color-primary-700);
}
.app-logo-accent {
    fill: var(--color-primary-900);
}
.brand-divider {
    height: 22px;
    width: 1px;
    background: var(--border);
    margin: 0 5px 0 8px;
}
.brand-product {
    font-size: 17px;
    font-weight: 450;
    letter-spacing: -0.3px;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 25px;
}
.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
}
.legacy-link {
    font-size: 11px;
    color: var(--muted);
}
.legacy-link:hover {
    text-decoration: underline;
}
.avatar {
    width: 31px;
    height: 31px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    font-size: 10px;
    font-weight: 600;
    border: 2px solid var(--surface-page);
    color: var(--brand);
}
.profile {
    background: var(--brand-surface);
    width: 35px;
    height: 35px;
}
.context-bar {
    padding: 17px 42px;
    display: flex;
    align-items: center;
    gap: 27px;
    background: var(--surface-page);
    border-bottom: 1px solid var(--border-subtle);
}
.nav-caption {
    font-size: 9px;
    letter-spacing: 1.6px;
    color: var(--muted);
    white-space: nowrap;
}
.context-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
}
.context-tab,
.new-context {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 15px;
    border-radius: 9px;
    font-size: 12px;
    white-space: nowrap;
}
.context-tab .icon,
.new-context .icon {
    width: 17px;
    height: 17px;
}
.context-tab {
    color: var(--text-muted);
}
.context-tab:hover,
.new-context:hover {
    background: var(--surface-subtle);
}
.context-tab.active {
    background: var(--brand-surface);
    color: var(--brand);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px var(--color-primary-200);
}
.tab-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--brand);
    margin-left: 5px;
}
.context-tab:not(.active) .tab-dot {
    display: none;
}
.new-context {
    color: var(--muted);
    font-size: 11px;
}
.nav-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
    white-space: nowrap;
}
main {
    padding: 37px 42px 18px;
    max-width: 1680px;
    margin: auto;
    background-image: radial-gradient(
        color-mix(in srgb, var(--border) 60%, transparent) 0.7px,
        transparent 0.7px
    );
    background-size: 20px 20px;
}
.context-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.eyebrow {
    font-size: 9px;
    letter-spacing: 1.65px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}
h1 {
    font-size: clamp(32px, 2.6vw, 42px);
    font-weight: 650;
    letter-spacing: -1px;
    margin: 13px 0 10px;
    line-height: 1.1;
}
h1 span {
    color: var(--accent);
}
.context-heading p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}
.context-about {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    max-width: 70ch;
}
.context-about p {
    white-space: pre-line;
    overflow-wrap: anywhere;
}
.context-about p.empty {
    font-style: italic;
}
.context-about .icon-button {
    flex: none;
    margin-top: -4px;
}
.context-members {
    display: flex;
    align-items: center;
    gap: 13px;
    font-size: 10px;
    line-height: 1.8;
    color: var(--muted);
}
.context-members strong {
    font-weight: 450;
    color: var(--text);
}
.canvas-toolbar {
    margin-top: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}
.view-filters {
    display: flex;
    gap: 4px;
    align-items: center;
}
.view-filters button {
    font-size: 11px;
    padding: 8px 12px;
    border-radius: 7px;
    color: var(--muted);
    white-space: nowrap;
}
.view-filters button.selected {
    background: var(--surface-page);
    color: var(--brand);
    box-shadow:
        0 1px 4px rgba(10, 18, 30, 0.08),
        0 0 0 1px var(--border);
}
.view-filters .icon {
    width: 14px;
    height: 14px;
    margin-right: 5px;
}
.view-filters button:hover {
    background: var(--surface-subtle);
}
.canvas-hint {
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    gap: 7px;
    align-items: center;
}
.canvas-hint .icon {
    width: 14px;
    height: 14px;
}
.landscape {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 30px;
    min-height: 505px;
    padding: 35px 13px 35px;
    isolation: isolate;
}
.connections {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: -2;
    fill: var(--surface-page);
    stroke: var(--border);
    stroke-width: 1;
    stroke-dasharray: 4 6;
}
.connections circle {
    stroke-dasharray: none;
}
.cloud {
    position: relative;
    align-self: start;
    padding: 28px 21px 22px;
    min-width: 0;
    --field: var(--color-primary-700);
    --tint: var(--color-primary-100);
}
.cloud-shape {
    position: absolute;
    z-index: -1;
    inset: 0 -10px -8px;
    background: linear-gradient(135deg, var(--color-primary-50), var(--color-primary-100));
    border-radius: 38% 45% 35% 31% / 22% 21% 24% 30%;
    border: 1px solid var(--color-primary-200);
}
.cloud-shape::before,
.cloud-shape::after {
    content: "";
    position: absolute;
    background: inherit;
    z-index: -1;
}
.cloud-shape::before {
    width: 51%;
    height: 39%;
    top: -12px;
    left: 17%;
    border-radius: 50%;
}
.cloud-shape::after {
    width: 30%;
    height: 48%;
    right: -12px;
    top: 30%;
    border-radius: 50%;
}
.communication {
    margin-top: 54px;
    --field: var(--color-accent-700);
    --tint: var(--color-accent-100);
}
.communication .cloud-shape {
    background: linear-gradient(130deg, var(--color-accent-50), var(--color-accent-100));
    border-color: var(--color-accent-100);
    border-radius: 39% 40% 28% 38% / 20% 26% 28% 25%;
}
.communication .cloud-shape::before {
    left: 35%;
    top: -17px;
}
.action {
    margin-top: 5px;
    --field: var(--color-warm-700);
    --tint: var(--color-warm-100);
}
.action .cloud-shape {
    background: linear-gradient(120deg, var(--color-warm-50), var(--color-warm-100));
    border-color: var(--color-warm-200);
    border-radius: 42% 32% 38% 33% / 20% 27% 30% 29%;
}
.action .cloud-shape::before {
    left: 20%;
    top: -10px;
}
.field-heading {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 18px;
}
.field-icon {
    background: color-mix(in srgb, var(--surface-page) 60%, transparent);
    border-radius: 12px;
    width: 39px;
    height: 39px;
    display: grid;
    place-items: center;
    color: var(--field);
    border: 1px solid color-mix(in srgb, var(--surface-page) 50%, transparent);
}
h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 550;
    letter-spacing: -0.4px;
}
.field-heading p {
    font-size: 10px;
    margin: 5px 0 0;
    color: var(--field);
}
.field-number {
    margin-left: auto;
    font-size: 11px;
    color: var(--field);
    opacity: 0.65;
}
.field-content {
    display: grid;
    gap: 13px;
}
.cloud-caption {
    display: block;
    margin-top: 19px;
    text-align: center;
    font-size: 8px;
    letter-spacing: 1.65px;
    color: var(--field);
    opacity: 0.85;
}
.agent-dock {
    max-width: 760px;
    margin: auto;
}
#agent-form {
    display: flex;
    align-items: center;
    gap: 13px;
    background: var(--surface-page);
    border: 1px solid var(--border);
    padding: 11px 13px;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(10, 18, 30, 0.05);
}
.agent-orb {
    width: 35px;
    height: 35px;
    display: grid;
    place-items: center;
    background: linear-gradient(140deg, var(--brand-surface), var(--color-primary-200));
    color: var(--brand);
    border-radius: 12px;
    flex: 0 0 auto;
}
#agent-input {
    border: 0;
    background: transparent;
    min-width: 0;
    flex: 1;
    color: var(--text);
    font-size: 12px;
    padding: 8px 0;
}
#agent-input::placeholder {
    color: var(--text-muted);
}
.scope-pill {
    font-size: 9px;
    border: 1px solid var(--border);
    padding: 5px 8px;
    border-radius: 5px;
    white-space: nowrap;
    color: var(--text-muted);
}
button.scope-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    cursor: pointer;
    max-width: 30%;
}
button.scope-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
}
button.scope-pill:hover:not(:disabled) {
    color: var(--brand);
    border-color: var(--brand);
}
.chat-pins {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.chat-pins[hidden] {
    display: none;
}
.pin-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 260px;
    font-size: 11px;
    padding: 3px 4px 3px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-page);
    color: var(--text);
}
.pin-chip strong {
    color: var(--brand);
    font-weight: 600;
}
.pin-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pin-remove {
    background: transparent;
    color: var(--text-muted);
    border-radius: 999px;
    width: 20px;
    height: 20px;
    line-height: 1;
}
.pin-remove:hover {
    color: var(--text);
}
.row-handle {
    flex: none;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--field);
    border: 1px solid currentColor;
    border-radius: 4px;
    padding: 1px 4px;
    opacity: 0.85;
}
.brief-dialog {
    width: min(760px, calc(100vw - 32px));
}
.brief-note {
    font-size: 12px;
    color: var(--text-muted);
}
.brief-text {
    max-height: 60vh;
    overflow: auto;
    overflow-wrap: anywhere;
    font-size: 12px;
    line-height: 1.55;
    color: var(--text);
    background: var(--surface-page);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}
.brief-text > :first-child {
    margin-top: 0;
}
.brief-text > :last-child {
    margin-bottom: 0;
}
.brief-text h3,
.brief-text h4 {
    font-size: 13px;
    margin: 14px 0 6px;
}
.brief-text ul {
    padding-left: 18px;
    margin: 4px 0;
}
.brief-text p {
    margin: 4px 0;
}
.send-button {
    color: var(--text-inverse);
    background: var(--brand);
    border-radius: 10px;
    width: 35px;
    height: 35px;
    flex: 0 0 auto;
}
.mic-button {
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 10px;
    width: 35px;
    height: 35px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
}
.mic-button:hover:not(:disabled) {
    color: var(--brand);
    border-color: var(--brand);
}
.mic-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.mic-button.is-listening {
    color: var(--text-inverse);
    background: var(--danger);
    border-color: var(--danger);
    animation: mic-listening 1.2s ease-in-out infinite;
}
@keyframes mic-listening {
    50% {
        box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 18%, transparent);
    }
}
@media (prefers-reduced-motion: reduce) {
    .mic-button.is-listening {
        animation: none;
    }
}
.send-button:hover {
    background: var(--color-primary-800);
    transform: translateX(2px);
}
.demo-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 9px;
    margin: 12px 0 0;
}
.noscript-note {
    text-align: center;
    padding: 20px;
}
/* A single focused cloud takes the whole width and the remaining screen height. */
.landscape:not([data-focus="all"]) {
    grid-template-columns: minmax(0, 1fr);
    min-height: max(505px, calc(100dvh - 400px));
    padding-inline: 10px;
}
.landscape:not([data-focus="all"]) .cloud {
    margin-top: 0;
    width: 100%;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    padding: 36px 40px 28px;
}
.landscape:not([data-focus="all"]) .field-content {
    flex: 1;
}
.landscape:not([data-focus="all"]) .cloud-empty {
    height: 100%;
}
.landscape:not([data-focus="all"]) .cloud-shape {
    border-radius: 6% 7% 5% 6% / 12% 14% 11% 13%;
}
.landscape:not([data-focus="all"]) .connections {
    display: none;
}
.landscape[data-focus="knowledge"] .cloud:not(.knowledge),
.landscape[data-focus="communication"] .cloud:not(.communication),
.landscape[data-focus="action"] .cloud:not(.action) {
    display: none;
}
dialog {
    width: min(580px, calc(100% - 32px));
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 27px;
    color: var(--text);
    background: var(--surface-page);
    box-shadow: 0 25px 100px rgba(10, 18, 30, 0.25);
    max-height: calc(100dvh - 40px);
}
dialog::backdrop {
    background: rgba(10, 18, 30, 0.45);
    backdrop-filter: blur(5px);
}
.preview-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 19px;
}
.icon-button {
    border: 1px solid var(--border);
    border-radius: 50%;
    padding: 6px;
}
.icon-button:hover {
    background: var(--surface-subtle);
}
dialog h2 {
    font-size: 24px;
    font-weight: 650;
    line-height: 1.25;
    margin-bottom: 20px;
}
.preview-footer {
    border-top: 1px solid var(--border-subtle);
    margin-top: 25px;
    padding-top: 18px;
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: space-between;
}
.preview-footer span {
    font-size: 9px;
    line-height: 1.5;
    color: var(--text-muted);
}
.preview-footer button {
    color: var(--brand);
    font-size: 11px;
    white-space: nowrap;
}
.preview-footer .icon {
    width: 14px;
    height: 14px;
}
@media (min-width: 1500px) {
    .landscape {
        gap: 55px;
        padding-inline: 28px;
    }
    .cloud {
        padding-inline: 27px;
    }
}
@media (max-width: 1190px) {
    .nav-note {
        display: none;
    }
    .topbar,
    .context-bar {
        padding-inline: 26px;
    }
    main {
        padding-inline: 26px;
    }
    .landscape {
        gap: 18px;
        padding-inline: 0;
    }
    .cloud {
        padding-inline: 16px;
    }
    .field-heading {
        gap: 7px;
    }
    .field-heading h2 {
        font-size: 15px;
    }
    .field-heading p {
        font-size: 9px;
    }
    .field-icon {
        width: 33px;
        height: 33px;
    }
    .field-number {
        display: none;
    }
    .context-bar {
        gap: 18px;
    }
    .legacy-link {
        display: none;
    }
}
@media (max-width: 920px) {
    .nav-caption {
        display: none;
    }
    .context-bar {
        overflow-x: auto;
    }
    .context-members {
        display: none;
    }
    .canvas-hint {
        display: none;
    }
    .landscape {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
        padding-top: 35px;
    }
    .action {
        grid-column: 1 / -1;
        width: min(420px, 80%);
        justify-self: center;
        margin-top: 0;
    }
    .communication {
        margin-top: 45px;
    }
    .connections {
        display: none;
    }
    .landscape:not([data-focus="all"]) .action {
        width: 100%;
    }
}
@media (max-width: 600px) {
    .topbar {
        padding: 16px 20px;
        min-height: 70px;
        gap: 10px;
    }
    .brand {
        font-size: 20px;
        gap: 8px;
    }
    .brand-divider {
        margin: 0 3px;
    }
    .brand-product {
        font-size: 15px;
    }
    .topbar-right {
        gap: 0;
    }
    .profile {
        display: none;
    }
    .context-bar {
        padding: 12px 16px;
    }
    .context-tab,
    .new-context {
        padding: 9px 11px;
        font-size: 11px;
    }
    main {
        padding: 27px 20px 18px;
    }
    h1 {
        font-size: 38px;
    }
    .eyebrow {
        font-size: 8px;
        gap: 5px;
        letter-spacing: 1px;
    }
    .context-heading p {
        font-size: 12px;
        line-height: 1.6;
    }
    .canvas-toolbar {
        margin-top: 23px;
        overflow-x: auto;
        padding: 3px;
        margin-inline: -3px;
    }
    .view-filters {
        gap: 0;
    }
    .view-filters button {
        font-size: 10px;
        padding: 8px 9px;
    }
    .view-filters .icon {
        width: 12px;
        height: 12px;
    }
    .landscape {
        grid-template-columns: minmax(0, 1fr);
        gap: 45px;
        padding: 32px 5px 25px;
    }
    .cloud,
    .action {
        width: 100%;
        margin-top: 0;
        padding: 26px 19px 22px;
    }
    .field-heading h2 {
        font-size: 18px;
    }
    .field-heading p {
        font-size: 10px;
    }
    .field-icon {
        width: 39px;
        height: 39px;
    }
    .field-number {
        display: block;
    }
    .field-heading {
        gap: 10px;
    }
    /* Narrow screens: the brief button keeps its icon, the name goes. */
    .scope-pill span {
        display: none;
    }
    #agent-form {
        gap: 9px;
        padding: 9px;
    }
    #agent-input {
        font-size: 11px;
    }
    .agent-orb {
        width: 30px;
        height: 30px;
    }
    .demo-note {
        font-size: 8px;
    }
    .preview-footer {
        flex-direction: column;
        align-items: flex-start;
    }
    dialog {
        padding: 22px;
    }
}
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* Contextagent: tab management, empty clouds, dialogs */
.context-tab-wrap {
    display: flex;
    align-items: center;
    border-radius: 9px;
}
.context-tab-wrap.active {
    background: var(--brand-surface);
    box-shadow: inset 0 0 0 1px var(--color-primary-200);
}
.context-tab-wrap .context-tab.active {
    background: none;
    box-shadow: none;
}
/* Menu of one tab (long press / right click): rename, delete. */
.tab-actions {
    display: grid;
    gap: 8px;
}
#tab-dialog h2 {
    margin-bottom: 14px;
    overflow-wrap: anywhere;
}
.new-context:disabled,
#agent-input:disabled,
.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.cloud-empty {
    min-height: 150px;
    display: grid;
    place-items: center;
    border: 1.5px dashed color-mix(in srgb, var(--field) 40%, transparent);
    border-radius: 13px;
    font-size: 13px;
    color: var(--field);
    opacity: 0.8;
}
body[data-empty="true"] .canvas-toolbar,
body[data-empty="true"] .landscape,
body[data-empty="true"] .agent-dock,
body[data-empty="true"] .context-members {
    display: none;
}
.field-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 7px;
}
.text-field {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-page);
    font: inherit;
    font-size: 14px;
    color: var(--text);
}
.form-error {
    min-height: 1.4em;
    margin-top: 8px;
    font-size: 12px;
    color: var(--danger);
}
.delete-text {
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-muted);
}
.preview-footer button.danger {
    color: var(--danger);
    font-weight: 600;
}
.load-error {
    margin-bottom: 14px;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--danger-surface);
    border: 1px solid var(--danger-border);
    color: var(--danger);
    font-size: 13px;
}
.load-error[hidden] {
    display: none;
}

/* Chat of the context */
.chat-log {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: min(46vh, 460px);
    overflow-y: auto;
    margin-bottom: 12px;
    padding: 4px 2px;
}
.chat-log[hidden] {
    display: none;
}
.chat-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 85%;
}
.chat-row.user {
    align-self: flex-end;
    align-items: flex-end;
}
.chat-row.assistant {
    align-self: flex-start;
    align-items: flex-start;
}
/* Charts and forms use the width of the chat instead of shrinking to their
   content, as in the agent app. */
.chat-row.assistant:has(.chart, .mcp-form) {
    align-self: stretch;
    align-items: stretch;
}
/* Actions below a message (as in the agent app): dimmed, never hidden, since
   touch has no hover to reveal them. */
.chat-row .message-actions {
    display: flex;
    align-items: center;
}
.chat-row .message-actions > button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0.6;
}
.chat-row .message-actions:focus-within > button,
.chat-row .message-actions > .copy-button.copied {
    opacity: 1;
}
.chat-row .message-actions > button:hover,
.chat-row .message-actions > button:focus-visible {
    opacity: 1;
    background: var(--surface-subtle);
}
@media (hover: hover) {
    .chat-row:hover .message-actions > button {
        opacity: 1;
    }
}
.chat-message {
    max-width: 100%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.chat-message.user {
    background: var(--brand-surface);
    color: var(--text);
}
.chat-message.assistant {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    color: var(--text);
}
.chat-message.assistant:not(.pending):not(.error) {
    white-space: normal;
}
.chat-message.assistant > :first-child {
    margin-top: 0;
}
.chat-message.assistant > :last-child {
    margin-bottom: 0;
}
.chat-message.pending:empty::after {
    content: "denkt nach …";
    color: var(--text-muted);
}
.chat-message.error {
    background: var(--danger-surface);
    border-color: var(--danger-border);
    color: var(--danger);
}
/* mcp-ui forms and the agent's questions in an answer (mcpui.css holds the
   layout). The page resets buttons and fields, so the controls get their
   look here, as in the agent app. */
.chat-message :is(.mcp-form, .mcp-box) :is(input, select, textarea) {
    width: 100%;
    font: inherit;
    font-size: 0.9rem;
    color: inherit;
    background: var(--surface-page);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5em 0.75em;
}
.chat-message :is(.mcp-form, .mcp-box) input:is([type="checkbox"], [type="radio"]) {
    width: auto;
    padding: 0;
}
.chat-message :is(.mcp-form, .mcp-box) select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}
.chat-message :is(.mcp-form, .mcp-box) :is(input, select, textarea):focus-visible {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-surface);
}
.chat-message :is(.mcp-form-submit, .mcp-button),
.chat-question-choices > button {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-card);
    color: var(--text);
    min-height: 36px;
    padding: 0.2em 1em;
    font-size: 0.85rem;
    font-weight: 500;
}
.chat-message .mcp-form-submit.primary,
.chat-question-choices > button:first-child {
    background: var(--action);
    border-color: var(--action);
    color: var(--text-inverse);
}
@media (hover: hover) {
    .chat-message :is(.mcp-form-submit, .mcp-button):hover,
    .chat-question-choices > button:hover {
        background: var(--surface-subtle);
    }
    .chat-message .mcp-form-submit.primary:hover,
    .chat-question-choices > button:first-child:hover {
        background: var(--brand);
        color: var(--text-inverse);
    }
}
.chat-message .mcp-form {
    margin-top: 1em;
}
.chat-question {
    margin-top: 0.75em;
    padding-top: 0.75em;
    border-top: 1px solid var(--border-subtle);
}
.chat-message > .chat-question:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}
.chat-question-text {
    margin: 0 0 0.6em;
    font-weight: 600;
}
.chat-question-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.send-button.stop {
    background: var(--danger);
}
#agent-input:focus-visible {
    outline: none;
}
#agent-form:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-surface);
}

/* "Wissen" cloud content */
.knowledge-query {
    margin: 0;
    font-size: 11px;
    color: var(--field);
}
.app-card {
    background: color-mix(in srgb, var(--surface-page) 88%, transparent);
    border: 1px solid var(--border-subtle);
    border-radius: 13px;
    overflow: hidden;
}
.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--field);
}
.card-header .icon {
    width: 16px;
    height: 16px;
}
.card-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.card-source {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-muted);
}
.card-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    max-height: 320px;
    overflow-y: auto;
}
.card-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
}
.card-row.low {
    opacity: 0.55;
}
.row-icon {
    color: var(--field);
    display: grid;
}
.row-icon .icon {
    width: 16px;
    height: 16px;
}
.row-text {
    display: grid;
    min-width: 0;
    flex: 1;
}
.row-title {
    font-size: 12px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
a.row-title:hover {
    text-decoration: underline;
}
.row-meta {
    font-size: 10px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.row-score {
    font-size: 10px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.card-note {
    margin: 0;
    padding: 12px 14px;
    font-size: 12px;
    color: var(--text-muted);
}
.card-note.error,
.cloud-empty.error {
    color: var(--danger);
}
.card-note a {
    color: var(--brand);
}
.card-filter-note {
    margin: 0;
    padding: 6px 14px 10px;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
}

/* Filler button and dialog: what fills a cloud */
.filler-button {
    margin-left: auto;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: var(--field);
    background: color-mix(in srgb, var(--surface-page) 60%, transparent);
    border: 1px solid color-mix(in srgb, var(--field) 25%, transparent);
}
.filler-button .icon {
    width: 15px;
    height: 15px;
}
.filler-button:hover {
    background: var(--surface-page);
}
.filler-button + .field-number {
    margin-left: 4px;
}
.filler-kind {
    margin: 0 0 4px;
    font-weight: 600;
    color: var(--text);
}
.filler-text {
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
}
.filler-text.muted {
    color: var(--text-muted);
}
.filler-text.error {
    color: var(--danger);
}
.filler-steps {
    margin: 14px 0 0;
    padding-left: 20px;
    display: grid;
    gap: 12px;
}
.filler-step-head {
    font-size: 13px;
    color: var(--text);
}
.filler-step-head span {
    color: var(--text-muted);
}
.filler-step-text {
    margin: 4px 0 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-muted);
}
.preview-footer button:disabled {
    opacity: 0.5;
    cursor: progress;
}

/* Per-section filler button and loading state */
.section-filler-button {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin-left: 4px;
    border-radius: 50%;
    color: var(--field);
}
.section-filler-button .icon {
    width: 13px;
    height: 13px;
}
.section-filler-button:hover {
    background: var(--surface-subtle);
}
.app-card.loading {
    opacity: 0.5;
}
.filler-step-kind {
    margin: 2px 0 0;
    font-size: 11px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--field, var(--text-muted));
}
.preview-footer button span {
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

/* Section editor in the filler dialog */
.card-query {
    margin: 0;
    padding: 6px 14px 0;
    font-size: 10px;
    color: var(--text-muted);
}
.card-query strong {
    font-weight: 600;
    color: var(--field);
}
.section-edit-list {
    display: grid;
    gap: 14px;
}
.section-edit {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: var(--surface-card);
}
.section-add {
    margin-top: 14px;
    border-style: dashed;
    border-color: var(--border);
}
.section-edit .filler-step-text {
    margin: 0;
}
.section-edit-field .field-label {
    margin-bottom: 4px;
    font-size: 11px;
}
.section-edit .text-field {
    padding: 8px 11px;
    font-size: 13px;
}
.section-edit .form-error {
    min-height: 0;
    margin: 0;
}
.section-edit .form-error:empty {
    display: none;
}
.section-edit-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.section-add .section-edit-actions {
    justify-content: flex-end;
}
.section-save {
    padding: 7px 14px;
    border-radius: 8px;
    background: var(--brand);
    color: var(--text-inverse);
    font-size: 12px;
    font-weight: 600;
}
.section-save:disabled,
.section-delete:disabled {
    opacity: 0.5;
}
.section-delete {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    color: var(--text-muted);
}
.section-delete .icon {
    width: 13px;
    height: 13px;
}
.section-delete:hover,
.section-delete.confirm {
    color: var(--danger);
}
#filler-dialog {
    width: min(640px, calc(100% - 32px));
}
#filler-body {
    max-height: 60vh;
    overflow-y: auto;
}

/* Prompt sections: answer of the agent */
.prompt-answer {
    padding: 8px 14px 12px;
    font-size: 12px;
    line-height: 1.55;
    color: var(--text);
    max-height: 320px;
    overflow-y: auto;
}
.prompt-answer.running {
    color: var(--text-muted);
}
.prompt-answer > :first-child {
    margin-top: 0;
}
.prompt-answer > :last-child {
    margin-bottom: 0;
}
.prompt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 14px 10px;
    border-top: 1px solid var(--border-subtle);
    font-size: 11px;
    color: var(--text-muted);
}
.prompt-rerun {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-page);
    color: var(--brand);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.prompt-rerun:hover {
    border-color: var(--brand);
}
.prompt-rerun.stop {
    color: var(--danger);
}
.prompt-rerun .icon {
    width: 12px;
    height: 12px;
}
.prompt-text.muted {
    color: var(--text-muted);
}
.prompt-text {
    margin: 0;
    white-space: pre-wrap;
}
.prompt-field {
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

/* Status of the activity-based refresh in the top bar */
.refresh-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.refresh-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
}
.refresh-status[data-state="running"] .refresh-dot {
    background: var(--brand);
    animation: refresh-pulse 1s ease-in-out infinite;
}
.refresh-status[data-state="idle"] .refresh-dot,
.refresh-status[data-state="hidden"] .refresh-dot,
.refresh-status[data-state="paused"] .refresh-dot {
    background: var(--border);
}
@keyframes refresh-pulse {
    50% {
        opacity: 0.3;
    }
}
@media (max-width: 920px) {
    .refresh-status {
        display: none;
    }
}
@media (prefers-reduced-motion: reduce) {
    .refresh-status[data-state="running"] .refresh-dot {
        animation: none;
    }
}

/* Top bar: theme, help and settings (menus.js) */
.top-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.top-icon {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}
.top-icon:hover,
.top-icon[aria-expanded="true"] {
    background: var(--surface-subtle);
    color: var(--text);
}
/* Material Symbols from the agent's icons.js are filled, not stroked. */
svg.icon[fill="currentColor"] {
    fill: currentColor;
    stroke: none;
    width: 20px;
    height: 20px;
}
/* The theme button carries both icons and shows the one for the other theme. */
:root[data-theme="dark"] .theme-icon-dark,
:root:not([data-theme="dark"]) .theme-icon-light {
    display: none;
}
.settings-anchor {
    position: relative;
}
.settings-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 40;
    min-width: 240px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--surface-page);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(10, 18, 30, 0.18);
}
.settings-menu .menu-head {
    padding: 8px 10px 6px;
    font-size: 11px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 4px;
}
.settings-menu .menu-item {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.settings-menu .menu-item:hover,
.settings-menu .menu-item:focus-visible {
    background: var(--surface-subtle);
}
.settings-menu .menu-note {
    padding: 6px 10px;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    margin-top: 4px;
}
.settings-menu .menu-item.logout {
    color: var(--danger);
}
.help-dialog {
    width: min(860px, calc(100% - 32px));
    overflow-y: auto;
}
.help-dialog .help-card {
    padding: 16px 18px;
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    background: var(--surface-card);
    margin-bottom: 12px;
}
.help-dialog .help-nav-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.help-dialog .help-nav-row button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-page);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.help-dialog .help-nav-row .help-nav-next {
    margin-left: auto;
    color: var(--brand);
}
.help-dialog .status {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.help-dialog .help-search-row input {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-page);
    color: var(--text);
    font: inherit;
    font-size: 14px;
}
.help-dialog .help-clear-btn[hidden] {
    display: none;
}

/* Long press / right click on a cloud entry (same gesture as "Aktuell"). */
.has-long-press {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Menu of one entry: standard operations, then the skills for its type. */
#entry-body {
    display: grid;
    gap: 8px;
}
#entry-dialog h2 {
    margin-bottom: 14px;
    overflow-wrap: anywhere;
}
.entry-action {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-page);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    text-align: left;
}
.entry-action:hover {
    background: var(--surface-subtle);
}
.entry-action.primary {
    border-color: var(--brand);
    color: var(--brand);
}
.entry-action.danger {
    color: var(--danger);
}
.entry-action.entry-action-not_relevant,
.entry-action.entry-action-unavailable {
    opacity: 0.55;
}
.entry-action-hint {
    flex-basis: 100%;
    font-size: 10px;
    color: var(--text-muted);
}
.entry-heading {
    margin: 12px 0 0;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.entry-error {
    margin: 0 0 4px;
    font-size: 12px;
    color: var(--danger);
}

/* Menu button of one cloud entry (keyboard/touch alternative to the gesture). */
.row-menu {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin-left: 2px;
    border-radius: 50%;
    color: var(--text-muted);
}
.row-menu:hover {
    background: var(--surface-subtle);
}
.row-menu .icon {
    width: 16px;
    height: 16px;
    stroke-width: 3;
}

/* Marks a section that the agent answers (prompt), not a service search. */
.card-badge {
    padding: 1px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 9px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text-muted);
}
