:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    background: #08111f;
    color: #e8eef7;
}

* { box-sizing: border-box; }

body { margin: 0; }

.login-page,
.home-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at top, #16325c 0, #08111f 48%);
}

.login-card,
.home-card,
.settings-card {
    width: min(100%, 420px);
    padding: 36px;
    border: 1px solid #294466;
    border-radius: 18px;
    background: rgba(12, 27, 47, 0.94);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.gateway-settings-card {
    width: min(100%, 1080px);
}

.home-card { width: min(100%, 1480px); }

.user-management-card { width: min(100%, 1080px); }

.user-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr .7fr 1fr auto;
    gap: .85rem;
    align-items: end;
}

.user-form-grid label { margin-top: 0; }
.user-create-button { white-space: nowrap; }

.user-list { margin-top: 2rem; }
.user-list h2 { margin-bottom: .75rem; }

.user-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 0;
    border-bottom: 1px solid #253c53;
}

.user-list-row > span:first-child { display: grid; gap: .2rem; }
.user-list-row small { color: #8fa6bd; }
.user-list-row.is-inactive {
    margin: 0 -.75rem;
    padding-right: .75rem;
    padding-left: .75rem;
    border-left: 3px solid #d9687a;
    border-radius: 7px;
    background: rgba(102, 31, 45, .2);
    opacity: .72;
}

.role-badge {
    padding: .3rem .65rem;
    border: 1px solid #365d80;
    border-radius: 999px;
    color: #7cd2ff;
    background: #10263a;
    font-size: .85rem;
}

.role-badge.is-inactive { color: #f0a7b2; border-color: #7b3d4a; background: #311a22; }
.user-list-actions { display: flex; align-items: center; gap: .55rem; }
.compact-button { width: auto; margin: 0; padding: .5rem .75rem; white-space: nowrap; }

.chat-card { width: min(100%, 980px); }

.chat-context-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 1rem;
    align-items: end;
}

.chat-context-row label { margin-top: 0; }

.chat-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.chat-title-row h1 { margin: 0; }

.developer-mode-toggle {
    display: flex;
    width: fit-content;
    min-height: 36px;
    align-items: center;
    gap: .6rem;
    padding: 0 .85rem;
    border: 1px solid #365574;
    border-radius: 9px;
    background: #091727;
    color: #d6e3f1;
    cursor: pointer;
}

.developer-mode-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #27a9f8;
}

.chat-fixed-company {
    display: grid;
    gap: .45rem;
    padding: 12px 14px;
    border: 1px solid #365574;
    border-radius: 9px;
    background: #091727;
}

.chat-fixed-company span { color: #8fa6bd; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }

.chat-workspace {
    min-height: 360px;
    margin-top: 1.5rem;
    display: grid;
    place-items: center;
    border: 1px solid #29445f;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(16, 38, 58, .8), rgba(9, 23, 39, .9));
}

.chat-empty-state { max-width: 480px; text-align: center; color: #a9bad0; }
.chat-empty-state > span { display: block; margin-bottom: .7rem; font-size: 2.4rem; }
.chat-empty-state h2 { margin: 0; color: #e8eef7; }
.chat-empty-state p { color: #7cd2ff; font-weight: 700; }

@media (max-width: 800px) {
    .chat-context-row { grid-template-columns: 1fr; }
    .chat-title-row { align-items: flex-start; }
}

.eyebrow {
    margin: 0 0 8px;
    color: #5bc0ff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1 { margin: 0; font-size: 34px; }
.subtitle { margin: 10px 0 28px; color: #a9bad0; }

label {
    display: block;
    margin: 18px 0 7px;
    color: #c6d3e4;
    font-size: 14px;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #365574;
    border-radius: 9px;
    outline: none;
    background: #091727;
    color: #fff;
    font-size: 16px;
}

input:focus,
select:focus,
textarea:focus { border-color: #5bc0ff; box-shadow: 0 0 0 3px rgba(91, 192, 255, 0.15); }

button {
    width: 100%;
    margin-top: 24px;
    padding: 12px 16px;
    border: 0;
    border-radius: 9px;
    background: #27a9f8;
    color: #04101d;
    font-size: 16px;
    font-weight: 750;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.danger-button {
    background: #d95468;
    color: #fff;
}

.danger-button:not(:disabled):hover { background: #e5687b; }

.secondary-button { background: #d6e3f1; }
.error-message { color: #ff9d9d; }
.success-message { color: #7ce3a1; }

.dashboard-tile {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    margin: 0;
    padding: 20px;
    border: 1px solid #365574;
    border-radius: 12px;
    background: #10243d;
    color: #e8eef7;
    text-decoration: none;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 28px;
}

@media (max-width: 1180px) {
    .dashboard-grid { grid-template-columns: repeat(2, minmax(240px, 1fr)); }
}

@media (max-width: 650px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.dashboard-tile:hover { border-color: #5bc0ff; }
.tile-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid #365574;
    border-radius: 12px;
    background: rgba(39, 169, 248, 0.12);
    font-size: 24px;
}
.tile-content { min-width: 0; }
.tile-title { display: block; font-size: 19px; font-weight: 750; }
.tile-text { display: block; margin-top: 5px; color: #a9bad0; }
.page-title-icon { color: #5bc0ff; font-size: 0.82em; }
.back-link { display: inline-block; margin-bottom: 24px; color: #5bc0ff; text-decoration: none; }

.dashboard-link {
    position: fixed;
    top: 22px;
    left: 22px;
    width: auto;
    margin: 0;
    padding: 11px 14px;
    border: 1px solid #365574;
    border-radius: 10px;
    background: #10243d;
    color: #dce9f7;
    font-weight: 700;
    text-decoration: none;
}

.dashboard-link:hover { border-color: #5bc0ff; color: #5bc0ff; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(2, 8, 16, 0.78);
}

.status-modal {
    width: min(100%, 420px);
    padding: 28px;
    border: 1px solid #365574;
    border-radius: 16px;
    background: #0c1b2f;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.status-modal h2 { margin: 0 0 12px; }
.status-modal p { margin: 0; color: #c6d3e4; }

.modal-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 22px;
}

.modal-actions button { margin: 0; }

.settings-section-title {
    margin: 32px 0 0;
    padding-top: 24px;
    border-top: 1px solid #294466;
    font-size: 20px;
}

.selection-message {
    margin: 28px 0 0;
    padding: 16px;
    border: 1px solid #365574;
    border-radius: 10px;
    background: #10243d;
    color: #dce9f7;
}

.companies-card { width: min(100%, 1100px); }

.catalog-mirror-panel {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(120, 166, 204, .28);
}

.catalog-mirror-panel h2 {
    margin: 0 0 1rem;
    font-size: 1.05rem;
}

.catalog-mirror-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .75rem;
    margin: 0 0 1rem;
}

.catalog-mirror-facts > div {
    padding: .75rem;
    border: 1px solid rgba(120, 166, 204, .24);
    border-radius: .55rem;
    background: rgba(8, 29, 47, .42);
}

.catalog-mirror-facts dt {
    color: #9db0c1;
    font-size: .78rem;
}

.catalog-mirror-facts dd {
    margin: .25rem 0 0;
    font-weight: 700;
}

.companies-page {
    align-content: start;
    padding-top: 76px;
}

.company-selection-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.7fr) auto auto;
    align-items: end;
    gap: 14px;
    margin-top: 18px;
}

.selection-field label { margin-top: 0; }

.selection-action {
    width: auto;
    min-width: 170px;
    margin: 0;
    white-space: nowrap;
}

.dataset-tree-card {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #294466;
}

.dataset-tree-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.dataset-tree-header h2 { margin: 0; }
.dataset-tree-header button { width: auto; margin: 0; }

.company-management-item {
    margin-top: 16px;
    padding: 18px;
    border: 1px solid #294466;
    border-radius: 10px;
    background: #0d2037;
}

.company-management-item.is-inactive { opacity: 0.68; }

.company-management-header,
.company-management-actions,
.tenant-status-list,
.company-edit-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.company-management-header { justify-content: space-between; }
.company-management-actions button { width: auto; min-width: 0; margin: 0; }
.company-name-status,
.heartbeat-result-line,
.heartbeat-result-tenants span {
    display: flex;
    align-items: center;
    gap: 8px;
}
.company-online-dot { display: inline-block; flex: 0 0 auto; }
.heartbeat-result-tenants { display: grid; gap: 8px; margin-top: 14px; }
.pending-connection-text { color: #ff9f43; font-weight: 700; }
.tenant-status-list { flex-wrap: wrap; margin-top: 14px; }
.tenant-status-list span { display: inline-flex; align-items: center; gap: 7px; }
.company-entra-tenant {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    color: #b8c7d9;
}
.company-entra-tenant span { font-weight: 700; }
.company-entra-tenant code {
    padding: 4px 7px;
    border: 1px solid #365578;
    border-radius: 5px;
    background: #09182a;
    color: #d8e8f8;
}
.company-entra-tenant em { color: #93a4b7; }

.mcp-access-section {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #294466;
}

.mcp-access-section h3 { margin: 0 0 8px; }

.mcp-access-create-row {
    display: grid;
    grid-template-columns: minmax(180px, 0.7fr) minmax(240px, 1fr) auto;
    align-items: end;
    gap: 12px;
    margin-top: 14px;
}

.mcp-generated-token {
    display: grid;
    gap: 8px;
    margin-top: 16px;
    padding: 14px;
    border: 1px solid #36a8eb;
    border-radius: 8px;
    background: #0a1b2f;
}

.mcp-generated-token code { overflow-wrap: anywhere; }

.mcp-access-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #294466;
    border-radius: 8px;
}

.mcp-access-row button { width: auto; min-width: 0; margin: 0; }

.online-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.online-dot.is-online { background: #31d07c; box-shadow: 0 0 8px rgba(49, 208, 124, .55); }
.online-dot.is-offline { background: #ef5b66; }

.company-edit-row { align-items: end; margin-top: 16px; }
.company-edit-row .selection-field { flex: 1; }
.company-edit-row button { width: auto; margin: 0; }

.dataset-tree,
.dataset-tree ul {
    margin: 12px 0 0;
    padding-left: 24px;
    list-style: none;
}

.dataset-tree { padding-left: 0; }

.dataset-search { margin: 0; }

.tree-column-legend {
    display: grid;
    grid-template-columns: 78px 78px 280px 42px;
    justify-content: end;
    gap: 8px;
    margin-top: 16px;
    padding: 0 0 4px;
    color: #8298b3;
    font-size: 12px;
    text-align: center;
}

.dataset-tree-node {
    margin: 8px 0;
    padding-left: 12px;
    border-left: 1px solid #294466;
}

.dataset-tree summary {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px;
    border-bottom: 1px solid rgba(54, 85, 116, 0.38);
    border-radius: 7px;
    color: #e8eef7;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.dataset-tree summary:hover,
.dataset-leaf label:hover {
    border-bottom-color: #4d7398;
    background: rgba(39, 169, 248, 0.08);
}

.dataset-tree summary::before {
    content: "›";
    width: 14px;
    color: #5bc0ff;
    font-size: 20px;
    line-height: 1;
    transform: rotate(0deg);
    transition: transform 0.15s ease;
}

.dataset-tree details[open] > summary::before { transform: rotate(90deg); }

.dataset-tree input[type="checkbox"] {
    width: 17px;
    height: 17px;
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
    accent-color: #27a9f8;
}

.node-options {
    display: grid;
    grid-template-columns: 78px 78px 280px 42px;
    justify-items: center;
    gap: 8px;
    margin-left: auto;
}

.node-information-button {
    display: grid;
    width: 36px;
    height: 34px;
    margin: 0;
    padding: 0;
    place-items: center;
    border: 1px solid #365574;
    background: #10243d;
    color: #9fb2c9;
    font-size: 17px;
}

.node-information-button.has-information {
    border-color: #5bc0ff;
    background: rgba(39, 169, 248, 0.18);
    color: #5bc0ff;
}

.information-modal { width: min(100%, 680px); }
.information-modal textarea { min-height: 260px; resize: vertical; }

.synonyms-input {
    min-width: 0;
    height: 34px;
    padding: 6px 9px;
    font-size: 13px;
    font-weight: 500;
}

.dataset-leaf label {
    display: grid;
    grid-template-columns: 17px minmax(0, 1fr) auto;
    column-gap: 9px;
    align-items: start;
    margin: 2px 0;
    padding: 8px;
    border-bottom: 1px solid rgba(54, 85, 116, 0.38);
    border-radius: 7px;
    font-weight: 500;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.dataset-leaf small {
    grid-column: 2;
    grid-row: 2;
    color: #8298b3;
    font-size: 12px;
}

.dataset-leaf label > input[type="checkbox"] {
    grid-row: 1;
    align-self: center;
}

.dataset-leaf .node-options {
    grid-column: 3;
    grid-row: 1;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(2, 8, 16, 0.76);
    backdrop-filter: blur(3px);
}

.search-loading-overlay { display: none; }
.search-loading-overlay.is-visible { display: grid; }

.dataset-search-controls {
    display: grid;
    grid-template-columns: minmax(220px, 480px) max-content max-content 46px;
    gap: 8px;
    align-items: center;
}

.dataset-search-controls button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 42px;
    margin: 0;
    white-space: nowrap;
}

.dataset-search-controls .dataset-search-button {
    width: auto;
    padding-inline: 14px;
}

.dataset-search-controls button[aria-label="Suche zurücksetzen"] {
    width: 46px;
    padding-inline: 0;
    font-size: 22px;
}

.dataset-tree-actions {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    gap: 8px;
    margin-top: 9px;
}

.dataset-selection-actions,
.dataset-expansion-actions {
    display: flex;
    gap: 8px;
}

.dataset-expansion-actions { margin-left: 8px; }

.dataset-tree-actions button {
    display: inline-grid;
    width: 42px;
    height: 38px;
    margin: 0;
    padding: 0;
    place-items: center;
    border: 1px solid #365574;
    background: #10243d;
    color: #dce9f7;
    font-size: 22px;
}

.dataset-tree-actions button:hover {
    border-color: #5bc0ff;
    color: #5bc0ff;
}

.dataset-tree-actions svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.node-bulk-actions {
    display: inline-flex;
    gap: 5px;
    margin-left: 8px;
}

.node-bulk-actions button {
    display: inline-grid;
    width: 26px;
    height: 24px;
    margin: 0;
    padding: 0;
    place-items: center;
    border: 1px solid #365574;
    border-radius: 6px;
    background: #10243d;
    color: #dce9f7;
    font-size: 15px;
}

.node-bulk-actions button:hover {
    border-color: #5bc0ff;
    color: #5bc0ff;
}

.loading-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 26px;
    border: 1px solid #365574;
    border-radius: 14px;
    background: #0c1b2f;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.loading-cancel-button {
    width: auto;
    margin: 0 0 0 8px;
    padding: 9px 13px;
    font-size: 14px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #294466;
    border-top-color: #5bc0ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 700px) {
    .companies-page { padding-top: 72px; }
    .company-selection-row { grid-template-columns: 1fr; }
    .selection-action { width: 100%; }
    .mcp-access-create-row { grid-template-columns: 1fr; }
    .mcp-access-row { align-items: stretch; flex-direction: column; }
    .mcp-access-row button { width: 100%; }
    .dataset-tree-header { align-items: stretch; flex-direction: column; }
    .dataset-tree-header button { width: 100%; }
    .company-management-header,
    .company-management-actions,
    .company-edit-row { align-items: stretch; flex-direction: column; }
    .company-management-actions button,
    .company-edit-row button { width: 100%; }
}

.top-actions {
    position: fixed;
    top: 22px;
    right: 22px;
    display: flex;
    gap: 10px;
}

.top-actions form { margin: 0; }

.icon-button {
    display: grid;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 10px;
    place-items: center;
    border: 1px solid #365574;
    border-radius: 10px;
    background: #10243d;
    color: #dce9f7;
}

.icon-button:hover { border-color: #5bc0ff; color: #5bc0ff; }
.icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.provider-settings-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #253c53;
}

.provider-settings-heading h2,
.provider-settings-heading p { margin: 0; }
.provider-settings-heading p { margin-top: .35rem; color: #8fa6bd; }
.provider-settings-heading .icon-button { width: 44px; min-width: 44px; }
.provider-heading-actions { display: flex; gap: .55rem; }
.provider-section-toggle { display: grid; place-items: center; }

.provider-settings-card {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid #29445f;
    border-radius: 12px;
    background: #101d2a;
}

.provider-collapse-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    color: #e8eef7;
    text-align: left;
}

.provider-collapse-button:hover { background: transparent; color: #7cd2ff; }
.provider-collapse-button span:first-child { display: grid; gap: .25rem; }
.provider-collapse-button small { color: #8fa6bd; font-weight: 400; }

.provider-collapse-icon {
    font-size: 1.7rem;
    line-height: 1;
    transition: transform .18s ease;
}

.provider-collapse-icon.is-expanded { transform: rotate(180deg); }
.provider-settings-content { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #253c53; }

.provider-settings-grid {
    display: grid;
    grid-template-columns: minmax(150px, .7fr) minmax(240px, 1.5fr) auto auto;
    gap: .85rem;
    align-items: end;
}

.provider-settings-grid .provider-load-button { white-space: nowrap; }
.provider-settings-grid .icon-button { width: 44px; min-width: 44px; }

.model-combobox { position: relative; }

.model-dropdown-backdrop {
    position: fixed;
    z-index: 29;
    inset: 0;
    background: transparent;
}

.model-dropdown {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    max-height: 360px;
    padding: 6px;
    overflow-y: auto;
    border: 1px solid #365d80;
    border-radius: 10px;
    background: #0b1827;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .48);
}

.model-dropdown-search {
    position: sticky;
    z-index: 1;
    top: 0;
    margin-bottom: 6px;
    background: #091727;
}

.model-dropdown-item {
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #dce8f5;
    text-align: left;
    overflow-wrap: anywhere;
}

.model-dropdown-item:hover,
.model-dropdown-item.is-selected,
.model-dropdown-item.is-highlighted {
    background: #173a55;
    color: #7cd2ff;
}

.model-dropdown-empty {
    margin: 0;
    padding: 14px 12px;
    color: #8fa6bd;
}

.chat-provider-settings {
    margin: 1.5rem 0;
    padding: 1.25rem;
    border: 1px solid #29445f;
    border-radius: 12px;
    background: #101d2a;
}

.chat-provider-settings h2,
.chat-provider-settings p { margin: 0; }
.chat-provider-settings p { margin-top: .35rem; color: #8fa6bd; }
.settings-page-top { align-items: flex-start; padding-top: 72px; }
.system-prompt-editor { min-height: 320px; resize: vertical; }
.system-prompt-tabs { display: flex; gap: .65rem; margin: 1rem 0; }
.system-prompt-tabs button { margin: 0; background: #17283a; color: #9fb2c9; }
.system-prompt-tabs button.is-active { background: #26a8f2; color: #04121f; }
.system-prompt-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  margin-bottom: 8px;
}
.system-prompt-heading label { margin: 0; }
.system-prompt-heading button { margin: 0; white-space: nowrap; }
.system-prompt-section {
    margin: 1rem 0;
    padding: .8rem 1rem;
    border: 1px solid #29445d;
    border-radius: 10px;
    background: #0d1d2c;
}
.system-prompt-section summary {
    cursor: pointer;
    font-weight: 700;
    color: #e8f2fb;
}
.system-prompt-section[open] summary { margin-bottom: .9rem; }
.prompt-reset-button {
  width: auto;
  padding: 6px 10px;
  border: 1px solid #365574;
  border-radius: 7px;
  background: rgba(91, 192, 255, 0.08);
  color: #a9bad0;
  font-size: 13px;
  font-weight: 650;
}
.prompt-reset-button:hover {
  border-color: #5bc0ff;
  background: rgba(91, 192, 255, 0.16);
  color: #e8eef7;
}
.field-hint { margin: .45rem 0 1rem; color: #8fa6bd; font-size: .9rem; }
.chat-provider-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 1rem; margin-top: 1rem; }

.chat-page { align-items: flex-start; height: 100vh; padding-top: 72px; overflow: hidden; }
.chat-card {
    display: flex;
    flex-direction: column;
    width: min(1180px, calc(100vw - 36px));
    height: calc(100vh - 104px);
    min-height: 0;
    overflow: hidden;
}
.chat-workspace {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    margin-top: 1.25rem;
    border: 0;
    background: transparent;
}
.chat-empty-state { justify-self: center; width: 100%; padding: 4rem 1rem; }
.chat-messages {
    display: grid;
    flex: 1;
    align-content: start;
    gap: .8rem;
    min-height: 0;
    max-height: none;
    padding: 1rem;
    overflow-y: auto;
    border: 1px solid #29445f;
    border-radius: 12px;
    background: #091522;
}
.chat-message { max-width: 82%; padding: .8rem 1rem; border-radius: 12px; background: #14283b; }
.chat-message.is-user { justify-self: end; background: #164563; }
.chat-message.is-assistant { justify-self: start; }
.chat-message strong { color: #7cd2ff; }
.chat-message p { margin: .35rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message.is-thinking { display: flex; align-items: center; gap: .7rem; }
.chat-sync-operations { display: grid; gap: .65rem; width: min(34rem, 82%); justify-self: start; }
.chat-sync-operation { display: grid; gap: .35rem; padding: .8rem 1rem; border: 1px solid #2a668c; border-radius: 12px; background: #102b41; }
.chat-sync-operation > div { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.chat-sync-operation span { color: #b5d9ef; font-size: .9rem; }
.chat-sync-operation p { margin: 0; white-space: pre-wrap; color: #e8eef7; }
.chat-sync-operation small { color: #8fa6bd; overflow-wrap: anywhere; }
.chat-sync-operation.is-running { box-shadow: inset 3px 0 #7cd2ff; }
.chat-sync-operation.is-finished { border-color: #3e8965; background: #123124; }
.chat-image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: .65rem;
    margin-top: .85rem;
}
.chat-image-gallery a {
    display: block;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #29445f;
    border-radius: 9px;
    background: #0c1e30;
}
.chat-image-gallery img {
    display: block;
    width: 100%;
    height: 132px;
    object-fit: contain;
    background: #fff;
}
.chat-downloads { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .85rem; }
.chat-download-link { width: auto; min-width: 0; overflow-wrap: anywhere; text-decoration: none; }
.field-deactivation-message { display: grid; gap: .75rem; width: min(34rem, 82%); }
.field-deactivation-message > p { margin: 0; }
.field-deactivation-dataset { display: grid; gap: .25rem; padding: .65rem .75rem; border-radius: 8px; background: #0c1e30; }
.field-deactivation-dataset > span { overflow-wrap: anywhere; }
.field-deactivation-message .secondary-button { justify-self: start; }
.field-deactivation-result { color: #65d693; font-weight: 700; }

.audit-card { width: min(100%, 1180px); }
.audit-filters {
    display: grid;
    grid-template-columns: 1.3fr 1fr .8fr auto auto;
    gap: 12px;
    align-items: end;
    margin: 1.2rem 0;
}
.audit-ai-filter {
    display: flex;
    min-height: 42px;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.audit-ai-filter input { width: 17px; height: 17px; margin: 0; }
.audit-reset-button { width: auto; margin: 0; white-space: nowrap; }
.audit-result-count { color: #9fb2c9; font-size: 13px; }
.audit-list { display: grid; gap: 10px; }
.audit-entry {
    border: 1px solid #29445d;
    border-radius: 10px;
    background: #0d1d2c;
}
.audit-entry summary {
    display: grid;
    grid-template-columns: 145px 1fr auto auto minmax(220px, 2fr);
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    cursor: pointer;
}
.audit-time { color: #9fb2c9; font-variant-numeric: tabular-nums; }
.audit-kind,
.audit-error {
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.audit-kind.is-ai { background: rgba(91, 192, 255, .16); color: #79cdff; }
.audit-kind.is-local { background: rgba(76, 209, 145, .14); color: #74dda9; }
.audit-error { background: rgba(255, 99, 132, .16); color: #ff8ca6; }
.audit-question { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-details {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 8px 14px;
    margin: 0;
    padding: 14px;
    border-top: 1px solid #29445d;
}
.audit-details dt { color: #9fb2c9; font-weight: 700; }
.audit-details dd { min-width: 0; margin: 0; }
.audit-details pre {
    max-height: 360px;
    margin: 0;
    padding: 10px;
    overflow: auto;
    border-radius: 7px;
    background: #08131f;
    color: #e8eef7;
    font: inherit;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.audit-empty { padding: 1.5rem; text-align: center; color: #9fb2c9; }

@media (max-width: 900px) {
    .audit-filters { grid-template-columns: 1fr; }
    .audit-entry summary { grid-template-columns: 1fr auto; }
    .audit-question { grid-column: 1 / -1; }
    .audit-details { grid-template-columns: 1fr; }
}
.chat-input-form { display: grid; grid-template-columns: 1fr auto; gap: .75rem; margin-top: .9rem; }
.chat-input-form textarea { min-height: 76px; resize: vertical; }
.chat-input-form button { width: auto; margin: 0; align-self: stretch; }
.chat-input-actions { display: flex; gap: .6rem; }
.chat-speech-button { min-width: 3.25rem; font-size: 1.15rem; }

@media (max-width: 800px) {
    .provider-settings-grid { grid-template-columns: 1fr; }
    .provider-settings-grid .icon-button { width: 100%; }
    .user-form-grid { grid-template-columns: 1fr; }
    .chat-provider-grid,
    .chat-input-form { grid-template-columns: 1fr; }
    .chat-input-actions { justify-content: flex-end; }
}
