:root {
    --bg-a: #fff8f3;
    --bg-b: #ffe9da;
    --ink: #0f172a;
    --soft: #475569;
    --brand: #ff5e00;
    --brand-2: #ff8f4d;
    --brand-3: #cc4b00;
    --filter-border: rgba(255, 94, 0, 0.20);
    --filter-border-hover: rgba(255, 94, 0, 0.46);
    --filter-surface: rgba(255, 255, 255, 0.96);
    --filter-surface-hover: rgba(255, 241, 233, 0.98);
    --filter-text: #9a3412;
    --radius-panel: 0.875rem;
    --radius-control: 0.75rem;
}

body {
    font-family: 'Manrope', sans-serif;
    color: var(--ink);
    min-height: 100vh;
    overflow-x: clip;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: var(--radius-panel);
    backdrop-filter: blur(10px);
    box-shadow: none;
}

.dashboard-layout-grid {
    display: grid;
    gap: 1.25rem;
}

.dashboard-block {
    min-width: 0;
}

.dashboard-block-span-full {
    grid-column: 1 / -1;
}

.dashboard-block-shell,
.dashboard-hero,
.dashboard-board-shell,
.dashboard-signals-shell,
.dashboard-side-shell,
.dashboard-matrix-shell {
    box-shadow: none !important;
}

.dashboard-layout-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 1rem;
    background: #fff;
    padding: 0.875rem 1rem;
}

.dashboard-layout-header {
    flex-wrap: nowrap;
}

.dashboard-layout-close {
    flex: 0 0 auto;
}

.dashboard-layout-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.dashboard-layout-order-btn:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.ios-toolbar {
    border: none;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(18px) saturate(1.1);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.10);
}

.toolbar-track {
    min-height: 60px;
}

.toolbar-item {
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-item-mobile-more {
    display: none;
}

.toolbar-icon {
    color: var(--ink);
    border: none;
    background: transparent;
    transition: color 140ms ease, transform 140ms ease;
    outline: none;
}

.toolbar-icon:hover {
    transform: translateY(-1px);
    color: var(--brand);
}

.toolbar-glyph {
    background: rgba(241, 245, 249, 0.92);
    border: none;
    color: inherit;
    transition: background-color 140ms ease;
}

.toolbar-icon:hover .toolbar-glyph {
    background: rgba(255, 237, 224, 0.92);
}

.toolbar-icon.is-active {
    color: #fff;
    background: linear-gradient(135deg, var(--brand-2) 0%, var(--brand) 100%);
    box-shadow: 0 8px 24px rgba(255, 94, 0, 0.18);
}

.toolbar-icon.is-active .toolbar-glyph {
    background: transparent;
    border: none;
    border-radius: 1rem;
}

button.project-type-filter,
button.project-priority-filter,
button.kanban-column-toggle {
    border-color: var(--filter-border);
    background: var(--filter-surface);
    color: var(--filter-text);
    transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

button.project-type-filter:hover,
button.project-priority-filter:hover,
button.kanban-column-toggle:hover {
    transform: translateY(-1px);
    border-color: var(--filter-border-hover);
    background: var(--filter-surface-hover);
    color: #7c2d12;
    box-shadow: 0 10px 20px rgba(255, 94, 0, 0.10);
}

button.project-type-filter.bg-slate-900,
button.project-priority-filter.bg-slate-900,
button.kanban-column-toggle.bg-slate-900 {
    background: linear-gradient(135deg, var(--brand-2) 0%, var(--brand) 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 10px 24px rgba(255, 94, 0, 0.18);
}

button.project-type-filter.bg-slate-900:hover,
button.project-priority-filter.bg-slate-900:hover,
button.kanban-column-toggle.bg-slate-900:hover {
    background: linear-gradient(135deg, #ff9e63 0%, #ff6e14 100%);
}

button[class*="bg-slate-900"],
a[class*="bg-slate-900"],
button[class*="bg-cyan-700"],
a[class*="bg-cyan-700"] {
    background: linear-gradient(135deg, var(--brand-2) 0%, var(--brand) 100%) !important;
    border-color: transparent !important;
    color: #fff !important;
}

button[class*="bg-slate-900"]:hover,
a[class*="bg-slate-900"]:hover,
button[class*="bg-cyan-700"]:hover,
a[class*="bg-cyan-700"]:hover {
    background: linear-gradient(135deg, #ff9e63 0%, #ff6e14 100%) !important;
    color: #fff !important;
}

button[class*="bg-slate-900"]:focus-visible,
a[class*="bg-slate-900"]:focus-visible,
button[class*="bg-cyan-700"]:focus-visible,
a[class*="bg-cyan-700"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(255, 94, 0, 0.16) !important;
}

button[class*="border-slate-300"][class*="bg-white"],
a[class*="border-slate-300"][class*="bg-white"],
button[class*="border-slate-200"][class*="bg-white"],
a[class*="border-slate-200"][class*="bg-white"],
button[class*="border-orange-200"][class*="bg-white"],
a[class*="border-orange-200"][class*="bg-white"],
button[class*="border-orange-300"][class*="bg-orange-50"],
a[class*="border-orange-300"][class*="bg-orange-50"] {
    border-color: var(--filter-border) !important;
    background: var(--filter-surface) !important;
    color: var(--brand-3) !important;
}

button[class*="border-slate-300"][class*="bg-white"]:hover,
a[class*="border-slate-300"][class*="bg-white"]:hover,
button[class*="border-slate-200"][class*="bg-white"]:hover,
a[class*="border-slate-200"][class*="bg-white"]:hover,
button[class*="border-orange-200"][class*="bg-white"]:hover,
a[class*="border-orange-200"][class*="bg-white"]:hover,
button[class*="border-orange-300"][class*="bg-orange-50"]:hover,
a[class*="border-orange-300"][class*="bg-orange-50"]:hover {
    border-color: var(--filter-border-hover) !important;
    background: var(--filter-surface-hover) !important;
    color: #7c2d12 !important;
}

button[class*="border-slate-300"][class*="bg-white"]:focus-visible,
a[class*="border-slate-300"][class*="bg-white"]:focus-visible,
button[class*="border-slate-200"][class*="bg-white"]:focus-visible,
a[class*="border-slate-200"][class*="bg-white"]:focus-visible,
button[class*="border-orange-200"][class*="bg-white"]:focus-visible,
a[class*="border-orange-200"][class*="bg-white"]:focus-visible,
button[class*="border-orange-300"][class*="bg-orange-50"]:focus-visible,
a[class*="border-orange-300"][class*="bg-orange-50"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(255, 94, 0, 0.16) !important;
}

button#kanban-toolbar-reset,
button#kanban-toolbar-toggle,
button#kanban-toolbar-close,
button#open-kanban-toolbar,
button.close-project-modal,
button.close-user-modal,
button.close-risk-modal,
button.close-risk-create-modal,
button.close-incident-modal,
button.close-new-incident-modal,
button.close-modal,
button.close-task-risks-modal,
button.risk-edit,
button.incident-edit,
button.user-edit,
button.project-edit {
    border-color: var(--brand-2);
    background: #fff;
    color: var(--brand);
    transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

button#kanban-toolbar-reset:hover,
button#kanban-toolbar-toggle:hover,
button#kanban-toolbar-close:hover,
button#open-kanban-toolbar:hover,
button.close-project-modal:hover,
button.close-user-modal:hover,
button.close-risk-modal:hover,
button.close-risk-create-modal:hover,
button.close-incident-modal:hover,
button.close-new-incident-modal:hover,
button.close-modal:hover,
button.close-task-risks-modal:hover,
button.risk-edit:hover,
button.incident-edit:hover,
button.user-edit:hover,
button.project-edit:hover {
    transform: translateY(-1px);
    border-color: var(--brand);
    background: #fff7f2;
    color: var(--brand-3);
    box-shadow: 0 10px 20px rgba(255, 94, 0, 0.10);
}

button[data-project-type-filter]:focus-visible,
button[data-project-priority-filter]:focus-visible,
button[data-column-toggle]:focus-visible,
button#kanban-toolbar-reset:focus-visible,
button#kanban-toolbar-toggle:focus-visible,
button#kanban-toolbar-close:focus-visible,
button#open-kanban-toolbar:focus-visible,
button.close-project-modal:focus-visible,
button.close-user-modal:focus-visible,
button.close-risk-modal:focus-visible,
button.close-risk-create-modal:focus-visible,
button.close-incident-modal:focus-visible,
button.close-new-incident-modal:focus-visible,
button.close-modal:focus-visible,
button.close-task-risks-modal:focus-visible,
button.risk-edit:focus-visible,
button.incident-edit:focus-visible,
button.user-edit:focus-visible,
button.project-edit:focus-visible,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(255, 94, 0, 0.16);
}

input#projects-search,
input#kanban-filter-search,
select#kanban-filter-project,
select#kanban-filter-risk,
input.risk-search,
input.incident-search {
    border-color: var(--filter-border);
    background: var(--filter-surface);
    color: var(--ink);
    transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease, transform 140ms ease;
}

input#projects-search:hover,
input#kanban-filter-search:hover,
select#kanban-filter-project:hover,
select#kanban-filter-risk:hover,
input.risk-search:hover,
input.incident-search:hover {
    border-color: var(--filter-border-hover);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 94, 0, 0.08);
}

input#projects-search::placeholder,
input#kanban-filter-search::placeholder,
input.risk-search::placeholder,
input.incident-search::placeholder {
    color: rgba(124, 45, 18, 0.58);
}

input#kanban-filter-blocked {
    accent-color: var(--brand);
}

select#kanban-filter-project,
select#kanban-filter-risk {
    background-image: linear-gradient(45deg, transparent 50%, var(--brand) 50%), linear-gradient(135deg, var(--brand) 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(1em + 2px), calc(100% - 13px) calc(1em + 2px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 2.5rem;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.hover-tooltip {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(100% + 8px);
    background: #111827;
    color: #fff;
    font-size: 11px;
    line-height: 1;
    padding: 7px 9px;
    border-radius: 9px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
    white-space: nowrap;
    max-width: min(320px, calc(100vw - 20px));
    line-height: 1.35;
}

.hover-tooltip::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 100%;
    border: 5px solid transparent;
    border-top-color: #111827;
}

.has-tooltip:hover .hover-tooltip {
    opacity: 1;
}

.pop-bubble {
    position: absolute;
    z-index: 85;
    width: min(440px, 94vw);
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #e2e8f0;
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.14);
    border-radius: var(--radius-panel);
    padding: 13px 15px;
    color: #0f172a;
}

.pop-bubble::after {
    content: '';
    position: absolute;
    bottom: -11px;
    left: var(--bubble-pointer-left, 28px);
    transform: translateX(-50%);
    border-width: 11px 11px 0 11px;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
}

.pop-bubble.is-below::after {
    bottom: auto;
    top: -11px;
    border-width: 0 11px 11px 11px;
    border-color: transparent transparent #fff transparent;
}

.ai-chat-toggle-btn {
    position: relative;
    overflow: visible;
    border-radius: 999px;
    color: var(--ink);
    border: none;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.10);
    backdrop-filter: blur(18px) saturate(1.1);
    transition: transform 140ms ease, box-shadow 140ms ease, color 140ms ease;
}

.site-toolbar .ai-chat-toggle-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    padding: 0;
    margin: 0;
    line-height: 1;
    appearance: none;
    border: none;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.ai-chat-toggle-btn:hover {
    transform: translateY(-1px);
    color: var(--brand);
    box-shadow: 0 12px 34px rgba(255, 94, 0, 0.14);
}

.site-toolbar .ai-chat-toggle-btn:hover {
    box-shadow: none;
}

.ai-chat-toggle-btn:focus-visible {
    outline: 2px solid rgba(255, 94, 0, 0.22);
    outline-offset: 3px;
}

.site-toolbar li:has(> #ai-chat-toggle) {
    display: flex;
    align-items: center;
}

.toolbar-more-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    min-width: 220px;
    display: grid;
    gap: 0.4rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 1.1rem;
    background: rgba(255, 255, 255, 0.98);
    padding: 0.5rem;
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(18px) saturate(1.05);
}

.toolbar-more-link {
    display: block;
    border-radius: 0.9rem;
    border: 1px solid transparent;
    padding: 0.7rem 0.8rem;
    color: var(--ink);
    text-decoration: none;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.toolbar-more-link:hover {
    background: rgba(248, 250, 252, 0.96);
    border-color: rgba(148, 163, 184, 0.24);
}

.toolbar-more-link.is-active {
    background: linear-gradient(135deg, rgba(255, 113, 43, 0.12) 0%, rgba(255, 94, 0, 0.18) 100%);
    border-color: rgba(255, 94, 0, 0.16);
}

.toolbar-more-label {
    display: block;
    font-size: 0.84rem;
    font-weight: 700;
    color: #0f172a;
}

.toolbar-more-hint {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.72rem;
    line-height: 1.35;
    color: #64748b;
}

.ai-chat-widget-ios {
    border: 1px solid rgba(226, 232, 240, 0.95);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.96) 100%);
    backdrop-filter: blur(20px) saturate(1.08);
    box-shadow: 0 22px 54px rgba(15, 23, 42, 0.2);
    border-radius: 14px !important;
}

.ai-chat-header-copy {
    min-width: 0;
}

.ai-chat-header {
    align-items: center;
    min-height: 50px;
    background:
        radial-gradient(circle at 14% 10%, rgba(255, 143, 77, 0.18), transparent 30%),
        linear-gradient(180deg, rgba(255, 247, 240, 0.96) 0%, rgba(255, 255, 255, 0.9) 100%);
    transition: padding 0.18s ease, gap 0.18s ease;
}

.ai-chat-header-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.ai-chat-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brand-2) 0%, var(--brand) 100%);
    color: #fff;
    box-shadow: 0 10px 22px rgba(255, 94, 0, 0.22);
    flex: 0 0 auto;
}

.ai-chat-brand-icon {
    width: 17px;
    height: 17px;
}

.ai-chat-title-stack {
    min-width: 0;
    display: grid;
    gap: 1px;
}

.ai-chat-title-mainline {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.ai-chat-header-controls {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-chat-header-title {
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin: 0;
    font-size: 14px;
    transition: font-size 0.18s ease;
}

.ai-chat-header-subtitle {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #9a3412;
}

.ai-chat-icon-btn {
    position: relative;
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(255, 94, 0, 0.16);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 244, 237, 0.92) 100%);
    color: #9a3412;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.ai-chat-icon-btn:hover {
    transform: translateY(-1px);
    color: var(--brand-3);
    border-color: rgba(255, 94, 0, 0.3);
    background: rgba(255, 249, 245, 0.98);
    box-shadow: 0 8px 18px rgba(255, 94, 0, 0.1);
}

.ai-chat-icon-btn:focus-visible {
    outline: 2px solid rgba(255, 94, 0, 0.18);
    outline-offset: 2px;
}

.ai-chat-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.ai-chat-icon-collapse {
    display: none;
}

#ai-chat-expand[data-expanded="1"] .ai-chat-icon-expand {
    display: none;
}

#ai-chat-expand[data-expanded="1"] .ai-chat-icon-collapse {
    display: block;
}

.ai-chat-close-btn {
    color: #7c2d12;
}

.ai-chat-widget-ios.ai-chat-widget-condensed .ai-chat-header {
    padding-top: 8px;
    padding-bottom: 8px;
    gap: 8px;
}

.ai-chat-widget-ios.ai-chat-widget-condensed .ai-chat-header-title {
    font-size: 13px;
}

.ai-chat-widget-ios.ai-chat-widget-condensed .ai-chat-header-subtitle {
    display: none;
}

.ai-chat-widget-ios.ai-chat-widget-expanded {
    right: 0 !important;
    bottom: 0 !important;
    width: min(52vw, 760px) !important;
    height: 100vh !important;
    max-height: none !important;
    border-right: 0;
    border-bottom: 0;
    border-top: 0;
    border-radius: 0 !important;
}

@media (max-width: 900px) {
    .ai-chat-widget-ios.ai-chat-widget-expanded {
        width: 100vw !important;
    }
}

@media (max-width: 640px) {
    body {
        overflow-x: hidden;
    }

    .ai-chat-widget-ios,
    .ai-chat-widget-ios.ai-chat-widget-expanded {
        position: fixed !important;
        display: flex;
        flex-direction: column;
        inset: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        top: 0 !important;
        width: 100vw !important;
        height: 100svh !important;
        max-height: none !important;
        border-radius: 0 !important;
        border-right: 0;
        border-left: 0;
        border-top: 0;
        box-shadow: none;
    }

    .ai-chat-widget-ios > div:first-child {
        padding: 8px 10px 7px;
        gap: 7px;
        align-items: center;
    }

    .ai-chat-header-title-row {
        gap: 8px;
    }

    .ai-chat-brand-mark {
        width: 30px;
        height: 30px;
        border-radius: 10px;
    }

    .ai-chat-brand-icon {
        width: 15px;
        height: 15px;
    }

    .ai-chat-title-mainline {
        gap: 6px;
    }

    .ai-chat-header-title {
        font-size: 12px;
    }

    .ai-chat-header-subtitle {
        display: none;
    }

    .ai-chat-widget-ios > div:first-child > div:first-child {
        min-width: 0;
        flex: 1 1 auto;
    }

    .ai-chat-widget-ios > div:first-child > div:last-child {
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 6px;
        max-width: none;
    }

    .ai-chat-header-controls {
        gap: 3px;
    }

    .ai-chat-icon-btn {
        width: 30px;
        height: 30px;
    }

    .ai-chat-icon {
        width: 14px;
        height: 14px;
    }

    .ai-chat-status-chip,
    .ai-chat-model-chip {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ai-chat-status-chip {
        min-height: 18px;
        padding: 0 6px;
        font-size: 9px;
    }

    #ai-chat-messages {
        flex: 1 1 auto;
        min-height: 0;
        padding: 10px 10px 10px;
    }

    .ai-chat-inline-status {
        min-height: 22px;
        padding: 8px 14px 10px;
        line-height: 1.4;
    }

    .ai-chat-row-body {
        max-width: calc(100vw - 68px);
    }

    .ai-chat-msg {
        font-size: 14px;
        line-height: 1.5;
        padding: 10px 12px;
    }

    .ai-chat-row-meta {
        font-size: 11px;
    }

    #ai-chat-form {
        position: sticky;
        bottom: 0;
        background: rgba(255, 255, 255, 0.95);
        padding: 10px 12px 14px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
        flex: 0 0 auto;
    }

    .ai-chat-composer-shell {
        min-height: 52px;
        max-height: 104px;
        width: 100%;
        align-items: flex-end;
        box-shadow: none;
        transition: background-color 140ms ease, box-shadow 140ms ease;
    }

    #ai-chat-form textarea {
        flex: 1 1 auto;
        display: block;
        min-height: 40px;
        max-height: 88px;
        font-size: 16px;
        line-height: 1.3;
        overflow-y: auto;
        -webkit-appearance: none;
        resize: none;
        border-color: transparent;
        background: transparent;
        outline: none;
        box-shadow: none;
        padding-top: 6px;
        padding-bottom: 6px;
        -webkit-text-size-adjust: 100%;
    }

    #ai-chat-form textarea::placeholder {
        color: #94a3b8;
    }

    #ai-chat-form textarea:focus {
        border-color: transparent;
        box-shadow: none;
    }

    #ai-chat-form button {
        min-height: 40px;
        flex: none;
    }

    .ai-chat-send-btn {
        align-self: center;
        margin-bottom: 0;
        box-shadow: none;
        transition: transform 140ms ease, filter 140ms ease;
    }

    .ai-chat-actions {
        gap: 8px;
    }

    .ai-chat-action-btn {
        min-height: 40px;
    }
}

.ai-chat-status-chip,
.ai-chat-model-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
    border-radius: 999px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    background: rgba(255, 255, 255, 0.85);
    padding: 0 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    white-space: nowrap;
}

.ai-chat-status-chip.is-busy {
    color: #92400e;
    border-color: rgba(251, 191, 36, 0.9);
    background: rgba(254, 243, 199, 0.95);
}

.ai-chat-model-chip {
    color: #334155;
}

.ai-chat-inline-status {
    min-height: 20px;
    padding: 6px 14px 8px;
    color: #9a3412;
    font-size: 11px;
    line-height: 1.35;
    letter-spacing: 0.01em;
}

.ai-chat-inline-status.hidden {
    display: none;
}

.ai-chat-inline-status.is-busy {
    color: #b45309;
}

.ai-signal-progress-chip {
    display: inline-flex;
    align-items: center;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(14, 165, 233, 0.25);
    background: rgba(240, 249, 255, 0.95);
    padding: 0 10px;
    font-size: 11px;
    font-weight: 700;
    color: #0369a1;
    white-space: nowrap;
}

.ai-signal-progress-chip.is-complete {
    border-color: rgba(16, 185, 129, 0.24);
    background: rgba(236, 253, 245, 0.96);
    color: #047857;
}

[data-ai-signal-card="1"][data-ai-signal-running="1"] {
    border-color: rgba(125, 211, 252, 0.75);
    box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.4), 0 14px 32px rgba(14, 165, 233, 0.08);
}

[data-ai-signal-card="1"][data-ai-signal-running="1"] .apply-ai-signal,
[data-ai-signal-card="1"][data-ai-signal-running="1"] .dismiss-ai-signal {
    opacity: 0.72;
    pointer-events: none;
}

#ai-chat-messages {
    background:
        radial-gradient(circle at 12% -5%, rgba(125, 211, 252, 0.26), transparent 42%),
        radial-gradient(circle at 85% 8%, rgba(251, 191, 36, 0.16), transparent 35%),
        rgba(248, 250, 252, 0.45);
}

.ai-chat-msg {
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.45;
    max-width: 100%;
    overflow-x: hidden;
    overflow-wrap: anywhere;
}

.ai-chat-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 8px;
    opacity: 0;
    transform: translateY(8px) scale(0.985);
    transition: opacity 220ms ease, transform 220ms ease;
}

.ai-chat-row.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.ai-chat-row-loading {
    align-items: center;
}

.ai-chat-row-user {
    flex-direction: row-reverse;
}

.ai-chat-row.is-grouped {
    margin-top: -4px;
}

.ai-chat-avatar {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #334155;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    flex: none;
}

.ai-chat-row-user .ai-chat-avatar {
    color: #ffffff;
    border-color: #1e293b;
    background: #1e293b;
}

.ai-chat-row-body {
    max-width: 84%;
    min-width: 0;
    display: grid;
    gap: 4px;
}

.ai-chat-row-user .ai-chat-row-body {
    justify-items: end;
}

.ai-chat-row-meta {
    font-size: 10px;
    color: #64748b;
    padding: 0 2px;
}

.ai-chat-row.is-grouped .ai-chat-avatar {
    visibility: hidden;
}

.ai-chat-row.is-grouped .ai-chat-row-meta {
    display: none;
}

.ai-chat-msg-assistant {
    color: #0f172a;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-bottom-left-radius: 0.4rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.ai-chat-msg-user {
    color: #fff;
    border-bottom-right-radius: 0.4rem;
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.2);
}

.ai-chat-msg-user-action {
    display: grid;
    gap: 5px;
}

.ai-chat-user-action-tag {
    display: inline-flex;
    width: fit-content;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(255, 255, 255, 0.14);
    padding: 1px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ai-chat-user-action-text {
    display: block;
    overflow-wrap: anywhere;
}


.ai-chat-msg-assistant .ai-md-p {
    margin: 0;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.ai-chat-msg-assistant strong,
.ai-chat-msg-assistant .ai-md-label {
    font-weight: 700;
    color: #0f172a;
}

.ai-chat-msg-assistant .ai-md-label {
    display: inline-block;
    margin-right: 2px;
}

.ai-chat-msg-assistant .ai-md-p + .ai-md-p,
.ai-chat-msg-assistant .ai-md-p + .ai-md-list,
.ai-chat-msg-assistant .ai-md-p + .ai-md-code-wrap,
.ai-chat-msg-assistant .ai-md-p + .ai-md-table-wrap,
.ai-chat-msg-assistant .ai-md-p + .ai-md-quote,
.ai-chat-msg-assistant .ai-md-list + .ai-md-p,
.ai-chat-msg-assistant .ai-md-code-wrap + .ai-md-p,
.ai-chat-msg-assistant .ai-md-table-wrap + .ai-md-p,
.ai-chat-msg-assistant .ai-md-quote + .ai-md-p,
.ai-chat-msg-assistant .ai-md-math-block + .ai-md-p {
    margin-top: 8px;
}

.ai-chat-msg-assistant .ai-md-h1,
.ai-chat-msg-assistant .ai-md-h2,
.ai-chat-msg-assistant .ai-md-h3 {
    margin: 0;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.ai-chat-msg-assistant .ai-md-h1 { font-size: 15px; margin-top: 4px; }
.ai-chat-msg-assistant .ai-md-h2 { font-size: 14px; margin-top: 4px; }
.ai-chat-msg-assistant .ai-md-h3 { font-size: 13px; margin-top: 2px; }

.ai-chat-msg-assistant .ai-md-list {
    margin: 8px 0 0;
    padding-left: 17px;
    display: grid;
    gap: 4px;
}

.ai-chat-msg-assistant .ai-md-list-ordered {
    list-style: decimal;
}

.ai-chat-msg-assistant .ai-md-list:not(.ai-md-list-ordered) {
    list-style: disc;
}

.ai-chat-msg-assistant .ai-md-list li {
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.ai-chat-msg-assistant .ai-md-list li::marker {
    color: var(--brand-3);
    font-weight: 700;
}

.ai-chat-msg-assistant .ai-md-inline-code {
    display: inline;
    border-radius: 6px;
    background: #f1f5f9;
    border: 1px solid #dbe4ee;
    padding: 1px 5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, monospace;
    font-size: 12px;
}

.ai-chat-msg-assistant .ai-md-code-wrap {
    margin-top: 8px;
    border: 1px solid #d6e0ea;
    border-radius: 10px;
    background: #f8fafc;
    overflow: hidden;
}

.ai-chat-msg-assistant .ai-md-code-title {
    border-bottom: 1px solid #e2e8f0;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
    background: #f1f5f9;
}

.ai-chat-msg-assistant .ai-md-code {
    margin: 0;
    padding: 8px 10px;
    max-width: 100%;
    overflow: auto;
    font-size: 12px;
    line-height: 1.45;
    color: #0f172a;
}

.ai-chat-msg-assistant .ai-md-code code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, monospace;
}

.ai-chat-msg-assistant .ai-md-link {
    color: #0369a1;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ai-chat-msg-assistant .ai-md-quote {
    margin: 8px 0 0;
    border-left: 3px solid rgba(255, 94, 0, 0.32);
    padding: 6px 0 6px 12px;
    color: #7c2d12;
    font-style: normal;
    background: linear-gradient(90deg, rgba(255, 244, 237, 0.7) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 0 10px 10px 0;
}

.ai-chat-msg-assistant .ai-md-table-wrap {
    margin-top: 8px;
    max-width: 100%;
    overflow: auto;
    border: 1px solid #dbe4ee;
    border-radius: 10px;
    background: #fff;
}

.ai-chat-msg-assistant .ai-md-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.ai-chat-msg-assistant .ai-md-table th,
.ai-chat-msg-assistant .ai-md-table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 7px 8px;
    text-align: left;
    vertical-align: top;
    line-height: 1.45;
}

.ai-chat-msg-assistant .ai-md-table th {
    font-weight: 700;
    background: #f8fafc;
}

.ai-chat-msg-assistant .ai-md-table tr:last-child td {
    border-bottom: 0;
}

.ai-chat-msg-assistant .ai-md-math-block {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 94, 0, 0.14);
    background: linear-gradient(180deg, rgba(255, 250, 246, 0.98) 0%, rgba(255, 244, 237, 0.88) 100%);
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.ai-chat-msg-assistant .ai-md-math-block .katex-display {
    margin: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.ai-chat-msg-assistant .ai-md-math-block .katex-display > .katex {
    display: inline-block;
    min-width: max-content;
}

.ai-chat-msg-assistant .ai-md-math-inline {
    display: inline-flex;
    align-items: center;
    padding: 0 2px;
}

.ai-chat-msg-assistant .ai-context-snippets {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.ai-chat-msg-assistant .ai-context-snippets-head {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #475569;
}

.ai-chat-msg-assistant .ai-context-snippets-rail {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

.ai-chat-msg-assistant .ai-context-snippet-card {
    min-width: 0;
    display: grid;
    gap: 7px;
    border: 1px solid #dbe4ee;
    border-radius: 11px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: 9px 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.ai-chat-msg-assistant .ai-context-snippet-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.ai-chat-msg-assistant .ai-context-snippet-kind {
    display: inline-flex;
    align-items: center;
    height: 20px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    padding: 0 7px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ai-chat-msg-assistant .ai-context-snippet-code {
    min-width: 0;
    font-size: 11px;
    font-weight: 700;
    color: #0f172a;
    overflow-wrap: anywhere;
}

.ai-chat-msg-assistant .ai-context-snippet-title {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    color: #0f172a;
    overflow-wrap: anywhere;
}

.ai-chat-msg-assistant .ai-context-snippet-meta {
    font-size: 11px;
    line-height: 1.45;
    color: #475569;
    overflow-wrap: anywhere;
}

.ai-chat-msg-assistant .ai-chat-action-preview {
    margin-top: 10px;
    display: grid;
    gap: 8px;
    border: 1px solid rgba(255, 94, 0, 0.16);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 250, 246, 0.98) 0%, rgba(255, 245, 238, 0.94) 100%);
    padding: 10px 12px;
}

.ai-chat-msg-assistant .ai-chat-action-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #9a3412;
}

.ai-chat-msg-assistant .ai-chat-action-summary,
.ai-chat-msg-assistant .ai-chat-action-clarify,
.ai-chat-msg-assistant .ai-chat-action-helper,
.ai-chat-msg-assistant .ai-chat-action-missing {
    font-size: 12px;
    line-height: 1.5;
    color: #7c2d12;
}

.ai-chat-msg-assistant .ai-chat-action-fields {
    display: grid;
    gap: 6px;
}

.ai-chat-msg-assistant .ai-chat-action-field {
    display: grid;
    gap: 2px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 94, 0, 0.1);
    padding: 7px 8px;
}

.ai-chat-msg-assistant .ai-chat-action-key {
    font-size: 11px;
    font-weight: 700;
    color: #9a3412;
}

.ai-chat-msg-assistant .ai-chat-action-value {
    font-size: 12px;
    line-height: 1.45;
    color: #1f2937;
    overflow-wrap: anywhere;
}

.ai-chat-msg-assistant .ai-chat-action-missing-label {
    font-weight: 800;
    color: #b45309;
}

.ai-chat-actions {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ai-chat-actions-busy {
    pointer-events: none;
}

.ai-draft-spinner {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 2px solid rgba(100, 116, 139, 0.28);
    border-top-color: #0f172a;
    animation: aiDraftSpin 0.85s linear infinite;
    flex: none;
}

.ai-form-fill.is-busy {
    opacity: 0.72;
}

@keyframes aiDraftSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ai-chat-action-btn {
    height: 30px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #fff;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 700;
    color: #334155;
    transition: background-color 120ms ease, border-color 120ms ease;
}

.ai-chat-action-btn:hover {
    background: #f8fafc;
}

.ai-chat-action-btn-confirm {
    border-color: #86efac;
    color: #166534;
    background: #f0fdf4;
}

.ai-chat-action-btn-confirm:hover {
    background: #dcfce7;
}

.ai-chat-action-btn-resume {
    border-color: rgba(255, 94, 0, 0.22);
    color: var(--brand-3);
    background: rgba(255, 244, 237, 0.96);
}

.ai-chat-action-btn-resume:hover {
    background: rgba(255, 237, 224, 0.98);
}

.ai-chat-action-btn-retry {
    border-color: rgba(203, 213, 225, 0.9);
    color: #475569;
    background: #fff;
}

.ai-chat-action-btn-retry:hover {
    background: #f8fafc;
}

.ai-chat-action-btn-cancel {
    border-color: #fecaca;
    color: #991b1b;
    background: #fef2f2;
}

.ai-chat-action-btn-cancel:hover {
    background: #fee2e2;
}

.ai-chat-action-btn:disabled {
    opacity: 0.72;
    cursor: default;
}

.ai-chat-msg-loading {
    min-width: 56px;
}

.ai-chat-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    transform: translateY(-2px);
}

.ai-chat-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #64748b;
    opacity: 0.35;
    animation: ai-chat-bounce 1s infinite ease-in-out;
}

.ai-chat-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.ai-chat-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes ai-chat-bounce {
    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.35;
    }
    40% {
        transform: translateY(-3px);
        opacity: 0.9;
    }
}

.pop-bubble p {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: #0f172a;
}

#ui-tooltip.ui-tooltip-compact {
    width: max-content !important;
    max-width: min(280px, calc(100vw - 16px));
}

#ui-tooltip.ui-tooltip-compact #ui-tooltip-body {
    white-space: normal;
    word-break: normal;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(2, 6, 23, 0.58);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.ai-draft-modal-backdrop {
    z-index: 130;
    background:
        radial-gradient(circle at 20% 10%, rgba(56, 189, 248, 0.14), transparent 35%),
        radial-gradient(circle at 82% 88%, rgba(251, 191, 36, 0.14), transparent 30%),
        rgba(2, 6, 23, 0.58);
}

.ai-draft-modal-panel {
    width: min(680px, calc(100vw - 24px));
    border: 1px solid rgba(203, 213, 225, 0.9);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(248, 250, 252, 0.98) 100%);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24);
}

.ai-signal-confirm-panel {
    width: min(640px, calc(100vw - 24px));
}

.ai-draft-modal-panel textarea {
    resize: vertical;
    outline: none;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.ai-draft-modal-panel textarea:focus {
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.ai-draft-history-item {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-backdrop[aria-hidden="true"] {
    display: none !important;
}

.modal-backdrop.active,
.modal-backdrop[aria-hidden="false"] {
    display: flex !important;
}

.modal-panel {
    width: min(680px, 94vw);
    max-height: 90vh;
    overflow: auto;
    background: rgba(255, 255, 255, 0.98);
    border-radius: var(--radius-panel);
    border: 1px solid #e2e8f0;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}

#kanban-toolbar .modal-panel {
    width: min(1120px, 92vw);
    max-height: 92vh;
}

.kpi-card {
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.kpi-card:hover {
    transform: none;
    box-shadow: none;
}

.dashboard-kanban-board {
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

.dashboard-surface,
.dashboard-board-shell {
    max-width: 100%;
    overflow-x: clip;
}

.dashboard-board-shell > * {
    min-width: 0;
}

.dashboard-trend-card {
    min-width: 0;
    box-shadow: none;
}

.dashboard-trend-controls {
    justify-content: flex-end;
}

.dashboard-trend-info {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    padding: 0;
}

.dashboard-kpi-grid .kpi-card,
.dashboard-trends-grid .dashboard-trend-card,
.dashboard-board-shell .kanban-column,
.dashboard-signals-shell .flow-signal-card,
.critical-risk-item,
.incident-item {
    box-shadow: none !important;
}

.task-drawer-backdrop {
    justify-content: flex-end;
    align-items: stretch;
    padding: 8px;
}

.task-drawer-panel {
    width: min(560px, calc(100vw - 12px));
    max-height: calc(100dvh - 16px);
    height: calc(100dvh - 16px);
    margin-left: auto;
    border-radius: 1.5rem;
}

.task-history-line {
    min-width: 0;
}

.flow-signal-card {
    min-width: 0;
}

.flow-signal-actions {
    align-items: stretch;
}

.flow-signal-action {
    flex: 1 1 148px;
}

@media (max-width: 1279px) {
    .dashboard-kanban-board {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(280px, 82vw);
        grid-template-columns: none;
        width: 100% !important;
        max-width: 100%;
        height: auto !important;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        padding-bottom: 6px;
    }

    .dashboard-kanban-board .kanban-column {
        scroll-snap-align: start;
        min-height: min(72vh, 860px);
    }

    .dashboard-flow-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1280px) {
    .dashboard-layout-grid {
        grid-template-columns: repeat(12, minmax(0, 1fr));
    }

    .dashboard-block-span-third {
        grid-column: span 4 / span 4;
    }
}

@media (max-width: 767px) {
    .dashboard-layout-item {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-layout-actions {
        width: 100%;
        justify-content: stretch;
    }

    .dashboard-layout-actions > * {
        flex: 1 1 0;
    }

    .site-header {
        padding: 1rem;
    }

    .site-header-main {
        flex-direction: column;
        align-items: stretch;
        gap: 0.875rem;
    }

    .site-header-brand {
        align-items: flex-start;
    }

    .site-header-brand img {
        height: 2.25rem;
        width: 2.25rem;
    }

    .site-header-user {
        justify-content: space-between;
        width: 100%;
        gap: 0.75rem;
    }

    .auth-shell {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }

    .auth-card {
        padding: 1.25rem;
    }

    .projects-header,
    .entity-page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .projects-header-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .projects-header-actions > * {
        width: 100%;
        justify-content: center;
    }

    #projects-search {
        width: 100%;
        min-width: 0;
    }

    .projects-filter-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.25rem;
        scrollbar-width: thin;
    }

    .projects-filter-chips > * {
        white-space: nowrap;
        flex: 0 0 auto;
    }

    .project-card-count {
        align-self: flex-start;
    }

    .project-card-metrics {
        grid-template-columns: 1fr;
    }

    .settings-tab-list {
        padding-bottom: 0.25rem;
        scrollbar-width: thin;
    }

    .settings-tab-item {
        min-width: 10.75rem;
    }

    .responsive-table-wrap {
        border-radius: 1rem;
        overflow: hidden;
    }

    .user-table-wrap table,
    .user-table-wrap thead,
    .user-table-wrap tbody,
    .user-table-wrap tr,
    .user-table-wrap th,
    .user-table-wrap td {
        display: block;
        width: 100%;
    }

    .user-table-wrap thead {
        display: none;
    }

    .user-table-wrap tbody {
        display: grid;
        gap: 0.75rem;
        padding: 0.75rem;
        background: #f8fafc;
    }

    .user-table-wrap tr {
        border: 1px solid #e2e8f0;
        border-radius: 1rem;
        background: #fff;
        padding: 0.25rem 0;
    }

    .user-table-wrap td {
        border-top: 0;
        padding: 0.55rem 0.85rem;
    }

    .user-table-wrap td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.2rem;
        font-size: 0.6875rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: #64748b;
    }

    .user-actions-cell button {
        width: 100%;
        justify-content: center;
    }

    .entity-card-grid {
        gap: 0.875rem;
    }

    .entity-card-grid > article {
        padding: 1rem;
        border-radius: 1rem;
    }

    .entity-card-grid h2 {
        line-height: 1.45;
    }

    .probability-impact-matrix {
        grid-template-columns: repeat(5, minmax(72px, 1fr));
        overflow-x: auto;
        padding-bottom: 0.25rem;
        scrollbar-width: thin;
    }

    .matrix-cell {
        min-width: 72px;
        font-size: 0.75rem;
        padding: 0.75rem 0.35rem;
    }

    label > span.inline-flex.items-center.gap-1 {
        flex-wrap: wrap;
        row-gap: 0.35rem;
    }

    .dashboard-hero {
        padding: 1rem;
    }

    .dashboard-hero h1 {
        font-size: 1.75rem;
        line-height: 1.15;
    }

    .dashboard-hero-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .dashboard-hero-actions > * {
        justify-content: center;
        width: 100%;
    }

    .dashboard-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-trends-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-kpi-grid .kpi-card {
        border-radius: 1.25rem;
        padding: 0.875rem;
    }

    .dashboard-kpi-grid .kpi-card p.text-3xl {
        font-size: 1.6rem;
        line-height: 1.1;
    }

    .dashboard-kanban-board {
        grid-auto-columns: minmax(260px, 88vw);
        gap: 0.75rem;
        padding-right: 1px;
    }

    .dashboard-kanban-board .kanban-column {
        border-radius: 1.25rem;
        padding: 0.75rem;
    }

    #flow-signals-source,
    #flow-signals-progress-total,
    #refresh-flow-signals,
    #restore-ai-signals {
        width: 100%;
        justify-content: center;
    }

    #flow-signals-critical .flow-signal-card,
    #flow-signals-important .flow-signal-card {
        border-radius: 1rem;
        padding: 0.875rem;
    }

    #flow-signals-critical .flow-signal-card > div:first-child,
    #flow-signals-important .flow-signal-card > div:first-child {
        gap: 0.5rem;
    }

    #flow-signals-critical-progress,
    #flow-signals-important-progress {
        white-space: nowrap;
        flex: none;
    }

    .flow-signal-action {
        flex-basis: 100%;
    }

    #flow-shift-summary .grid {
        grid-template-columns: 1fr;
    }

    .modal-panel {
        width: min(680px, calc(100vw - 20px));
        max-height: calc(100dvh - 20px);
        border-radius: 1rem;
    }

    #kanban-toolbar .modal-panel {
        width: min(1120px, calc(100vw - 20px));
    }

    .modal-panel form[class*="grid"] {
        grid-template-columns: 1fr;
    }

    .modal-panel form [class*="md:col-span-2"],
    .modal-panel form [class*="md:col-span-4"] {
        grid-column: auto;
    }

    .modal-panel form > div:last-child {
        display: grid;
        grid-template-columns: 1fr;
    }

    .modal-panel form > div:last-child > * {
        width: 100%;
        justify-content: center;
    }

    .task-drawer-panel {
        width: calc(100vw - 8px);
        max-height: calc(100dvh - 8px);
        height: calc(100dvh - 8px);
        border-radius: 1.25rem;
    }

    .site-toolbar {
        bottom: 0.5rem;
        max-width: calc(100vw - 0.75rem);
    }

    .site-toolbar .toolbar-track {
        gap: 0.25rem;
        overflow: visible;
        padding-inline: 0.35rem;
    }

    .site-toolbar .toolbar-item,
    .site-toolbar .toolbar-icon {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
    }

    .site-toolbar .toolbar-glyph {
        width: 40px;
        height: 40px;
    }

    .site-toolbar .toolbar-item-mobile-hidden {
        display: none;
    }

    .site-toolbar .toolbar-item-mobile-more {
        display: flex;
    }

    .site-toolbar .toolbar-more-menu {
        right: 0.2rem;
        width: min(240px, calc(100vw - 1rem));
    }

    .site-toolbar .no-scrollbar {
        -ms-overflow-style: auto;
        scrollbar-width: thin;
    }

    .site-toolbar .no-scrollbar::-webkit-scrollbar {
        display: block;
        height: 4px;
    }

    .site-toolbar .no-scrollbar::-webkit-scrollbar-thumb {
        background: rgba(148, 163, 184, 0.8);
        border-radius: 999px;
    }
}

@media (min-width: 768px) {
    .toolbar-more-menu,
    .toolbar-item-mobile-more {
        display: none !important;
    }
}

@media (max-width: 420px) {
    .hover-tooltip {
        white-space: normal;
    }

    .dashboard-kpi-grid {
        grid-template-columns: 1fr;
    }

    .site-header-user {
        flex-direction: column;
        align-items: stretch;
    }
}

.toast-host {
    position: fixed;
    right: 16px;
    top: 16px;
    z-index: 120;
    display: grid;
    justify-items: end;
    gap: 10px;
    width: calc(100vw - 24px);
}

.toast-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    max-width: min(420px, calc(100vw - 24px));
    border-radius: var(--radius-control);
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #0f172a;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.2);
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.35;
}

.toast-item .toast-icon {
    flex: none;
    font-size: 14px;
    line-height: 1;
}

.toast-item .toast-message {
    min-width: 0;
    overflow-wrap: anywhere;
}

.toast-item.error {
    border-color: #fca5a5;
    background: #fff1f2;
    color: #9f1239;
}

.toast-item.success {
    border-color: #cbd5e1;
    background: #f8fafc;
    color: #0f172a;
}

.kanban-card {
    cursor: grab;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.kanban-card:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 94, 0, 0.2);
    box-shadow: 0 14px 22px rgba(15, 23, 42, 0.08);
}

.kanban-card.dragging {
    opacity: 0.45;
}

.kanban-dropzone.sorting-active .kanban-card:not(.dragging) {
    transition: transform 140ms ease, box-shadow 140ms ease;
}

.kanban-dropzone.sorting-active .kanban-card.drop-marker {
    transform: translateY(3px);
}

.kanban-dropzone.sorting-active.drop-tail .kanban-card:not(.dragging):last-of-type {
    transform: translateY(-2px);
}

.kanban-dropzone.drop-active {
    outline: 2px dashed #fb923c;
    outline-offset: 4px;
    border-radius: var(--radius-control);
}

.kanban-card.drop-marker {
    box-shadow: inset 0 3px 0 #fb923c;
}

.kanban-dropzone.drop-tail {
    box-shadow: inset 0 -3px 0 #fb923c;
    border-radius: var(--radius-control);
}

[class*="rounded-2xl"],
[class*="rounded-xl"],
[class*="rounded-lg"],
[class*="rounded-[1.75rem]"],
[class*="rounded-[1.5rem]"] {
    border-radius: var(--radius-panel) !important;
}

.modal-panel,
.glass-panel,
.kanban-column,
.kanban-card,
.kpi-card,
.pop-bubble,
#ui-tooltip,
.toast-item,
[data-project-card="1"],
.task-relations-panel,
.critical-risk-card,
.incident-card {
    border-radius: var(--radius-panel) !important;
}

[data-project-card="1"],
.entity-card-grid > article,
.user-table-wrap tr,
.responsive-table-wrap {
    box-shadow: none !important;
}

button[class*="rounded-"],
input[class*="rounded-"],
select[class*="rounded-"],
textarea[class*="rounded-"] {
    border-radius: var(--radius-control) !important;
}

#ai-chat-toggle,
#ai-chat-toggle.ai-chat-toggle-btn,
#ai-chat-toggle.ai-chat-toggle-btn[class*="rounded-"] {
    border-radius: 999px !important;
}

.critical-risk-card,
.incident-card {
    box-shadow: none !important;
    border-left-width: 1px !important;
}

.probability-impact-matrix {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.matrix-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border-radius: var(--radius-control);
    font-weight: bold;
    text-align: center;
}

.matrix-cell.bg-sky-50 {
    background-color: var(--bg-a);
    color: var(--ink);
}

.matrix-cell.bg-amber-50 {
    background-color: var(--bg-b);
    color: var(--soft);
}

.matrix-cell.bg-rose-50 {
    background-color: var(--brand);
    color: #fff;
}
