* {
    box-sizing: border-box;
}

:root {
    color-scheme: light dark;
    --tensor-banner-from: #0f766e;
    --tensor-banner-to: #14b8a6;
    --tensor-banner-shadow: rgba(15, 118, 110, 0.28);
}

html[data-theme="light"] {
    color-scheme: light;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --tensor-banner-from: #134e4a;
    --tensor-banner-to: #0d9488;
    --tensor-banner-shadow: rgba(6, 95, 87, 0.42);
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    background: #f4f7fb;
    color: #172033;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 32px;
}

.app-loading-blocker {
    align-items: center;
    background: rgba(244, 247, 251, 0.55);
    cursor: wait;
    display: flex;
    inset: 0;
    justify-content: center;
    position: fixed;
    z-index: 100000;
}

.app-loading-blocker[hidden] {
    display: none !important;
}

.app-loading-blocker-label {
    color: #475569;
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    pointer-events: none;
}

html[data-theme="dark"] .app-loading-blocker {
    background: rgba(15, 23, 42, 0.55);
}

html[data-theme="dark"] .app-loading-blocker-label {
    color: #cbd5e1;
}

/* Cursor hints loading; interaction blocking is handled by `.app-loading-blocker` only so the shell can paint without freezing the document behind a semi-transparent overlay. */
html.app-shell-loading {
    cursor: wait;
}

html.app-shell-loading body {
    cursor: wait;
}

h1,
h2,
h3,
h4,
p {
    margin-top: 0;
}

h1 {
    font-size: 40px;
    margin-bottom: 12px;
}

h2 {
    font-size: 24px;
    margin-bottom: 16px;
}

h3 {
    font-size: 17px;
    margin-bottom: 8px;
}

p {
    color: #5d6b82;
    line-height: 1.5;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    background: #2563eb;
    border: 0;
    border-radius: 10px;
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
    padding: 12px 18px;
}

button:hover {
    background: #1d4ed8;
}

.button-link,
.secondary-link {
    border-radius: 10px;
    display: inline-block;
    font-weight: 700;
    padding: 12px 18px;
    text-decoration: none;
}

.button-link {
    background: #2563eb;
    color: #ffffff;
}

.button-link:hover {
    background: #1d4ed8;
}

.secondary-link {
    background: #e2e8f0;
    color: #1e293b;
}

.secondary-link:hover {
    background: #cbd5e1;
}

.auth-controls {
    align-items: center;
    display: flex;
    gap: 10px;
    margin-left: auto;
    min-width: 0;
}

.auth-controls span {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.login-layout {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: calc(100vh - 64px);
}

.login-card {
    max-width: 560px;
    width: 100%;
}

input,
select,
textarea {
    background: #ffffff;
    border: 1px solid #d6deeb;
    border-radius: 10px;
    color: #172033;
    margin-top: 8px;
    padding: 12px;
    width: 100%;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

label {
    color: #334155;
    display: block;
    font-weight: 700;
}

hr {
    border: 0;
    border-top: 1px solid #e2e8f0;
    margin: 28px 0;
}

hr.document-entry-split {
    margin: 18px 0 14px;
}

table {
    border-collapse: collapse;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid #e2e8f0;
    padding: 14px;
    text-align: left;
}

th {
    color: #475569;
    font-size: 13px;
    text-transform: uppercase;
}

.page-header {
    align-items: flex-start;
    background: linear-gradient(135deg, var(--tensor-banner-from), var(--tensor-banner-to));
    border-radius: 18px;
    box-shadow: 0 12px 28px var(--tensor-banner-shadow);
    color: #ffffff;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 22px 26px;
    position: relative;
}

.page-header h1 {
    font-size: 28px;
    line-height: 1.15;
    margin-bottom: 6px;
}

.page-header .subtitle {
    font-size: 15px;
    line-height: 1.4;
    max-width: 780px;
}

.page-header .eyebrow {
    margin-bottom: 4px;
}

.page-header--has-prefs-shortcut {
    position: relative;
}

.page-header > div:first-child {
    flex: 1;
    min-width: 0;
}

.crm-header-shortcuts {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.page-header .crm-header-shortcuts .crm-prefs-shortcut,
.page-header .crm-header-shortcuts .tensor-banner-logout,
.page-header .crm-header-shortcuts a.tensor-erp-launcher {
    order: 1;
}

.page-header .crm-header-shortcuts .tensor-banner-session {
    color: rgba(255, 255, 255, 0.92);
    flex-basis: 100%;
    font-size: 13px;
    font-weight: 700;
    margin-top: 2px;
    max-width: none;
    order: 2;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-header .crm-header-shortcuts .tensor-banner-logout {
    background: rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.96);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 14px;
}

.page-header .crm-header-shortcuts .tensor-banner-logout:hover {
    background: rgba(15, 23, 42, 0.38);
    color: #fff;
}

.crm-prefs-shortcut {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.38);
    text-decoration: none;
    transition: background 0.15s ease, transform 0.1s ease;
}

.crm-prefs-shortcut:hover {
    background: rgba(15, 23, 42, 0.32);
    color: #fff;
}

.crm-prefs-shortcut:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.crm-company-logo-banner {
    display: block;
    max-height: 42px;
    width: auto;
    margin-bottom: 8px;
    object-fit: contain;
}

.crm-btn-working {
    opacity: 0.88;
}

.crm-btn-done-pulse {
    animation: crmPrefsDonePulse 0.85s ease;
}

@keyframes crmPrefsDonePulse {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    40% {
        transform: scale(1.03);
        filter: brightness(1.08);
    }

    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

.crm-pref-logo-preview {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    object-fit: contain;
    margin-top: 4px;
}

html[data-theme="dark"] .crm-pref-logo-preview {
    border-color: #334155;
}

.crm-pref-status-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.crm-pref-status-row {
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

html[data-theme="dark"] .crm-pref-status-row {
    border-color: #334155;
}

.crm-pref-status-actions {
    align-items: flex-end;
}

.crm-pref-subheading {
    font-size: 1rem;
    margin-bottom: 10px;
}

.crm-pref-checklist {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.crm-pref-checklist-item {
    align-items: center;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    display: flex;
    gap: 10px;
    margin: 0;
    padding: 10px 12px;
}

.crm-pref-checklist-item input[type="checkbox"] {
    margin: 0;
    width: auto;
}

.crm-pref-custom-chart-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.crm-pref-custom-chart-row {
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
}

html[data-theme="dark"] .crm-pref-checklist-item,
html[data-theme="dark"] .crm-pref-custom-chart-row {
    border-color: #334155;
}

.crm-prefs-note {
    margin-top: -4px;
}

.page-header p,
.page-header .eyebrow {
    color: #dbeafe;
}

.subtitle {
    font-size: 18px;
    max-width: 780px;
}

.eyebrow {
    color: #2563eb;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.main-nav {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    padding: 8px;
    max-width: 100%;
}

.main-nav a {
    border-radius: 12px;
    color: #475569;
    font-weight: 700;
    padding: 12px 16px;
    text-decoration: none;
}

.brand-item {
    align-items: center;
    color: #1e293b;
    display: flex;
    font-weight: 800;
    gap: 10px;
    padding: 8px 12px;
}

.brand-logo {
    align-items: center;
    background: #dbeafe;
    border-radius: 50%;
    color: #1d4ed8;
    display: flex;
    font-size: 12px;
    height: 32px;
    justify-content: center;
    overflow: hidden;
    width: 32px;
}

.brand-logo img {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.nav-toggle {
    align-items: center;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    display: none;
    flex-direction: column;
    gap: 4px;
    height: 42px;
    justify-content: center;
    padding: 0;
    width: 46px;
}

.nav-toggle:hover {
    background: #dbeafe;
}

.nav-toggle span {
    background: #1d4ed8;
    border-radius: 999px;
    display: block;
    height: 2px;
    width: 20px;
}

.main-nav a:hover,
.main-nav a.active {
    background: #eff6ff;
    color: #1d4ed8;
}

.card,
.stat-card,
.feature-card,
.status-column,
.project-card,
.resource-card,
.user-row {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.card {
    margin-bottom: 24px;
    padding: 28px;
}

.section-heading,
.button-row,
.custom-item {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-heading-controls {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.form-collapsible-panel.is-collapsed {
    display: none;
}

.project-form-section-toggle {
    flex-shrink: 0;
}

.resource-form-toggle {
    flex-shrink: 0;
}

.button-row.compact {
    justify-content: flex-end;
    margin-bottom: 0;
}

.project-board-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.project-board-controls .project-search {
    flex: 1 1 220px;
    margin-bottom: 0;
}

.project-sort {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 0 1 280px;
    font-weight: 600;
}

.project-sort select {
    font-weight: normal;
}

.project-sort-hint {
    font-weight: normal;
    font-size: 0.85rem;
    color: var(--muted-fg, #64748b);
}

.project-search {
    margin-bottom: 20px;
}

.project-form-bottom-actions .page-action-buttons {
    justify-content: flex-start;
}

@media (min-width: 640px) {
    .project-form-bottom-actions .page-action-buttons {
        justify-content: flex-end;
    }
}

.page-action-card {
    align-items: center;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.page-action-card h2,
.page-action-card p {
    margin-bottom: 0;
}

.page-action-buttons {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

.page-action-card .form-message {
    grid-column: 1 / -1;
}

.dashboard-toolbar {
    margin-bottom: 20px;
    padding: 16px 20px;
}

.dashboard-toolbar-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    align-items: flex-end;
}

.dashboard-time-range {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 0 1 240px;
    font-weight: 600;
}

.dashboard-time-range-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted-fg, #64748b);
}

.dashboard-time-range select {
    font-weight: normal;
}

.dashboard-time-range-hint {
    flex: 1 1 280px;
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--muted-fg, #64748b);
}

.dashboard-time-range-hint strong {
    font-weight: 600;
    color: var(--text-color, inherit);
}

.stats-grid,
.feature-grid,
.status-board,
.resource-grid,
.project-status-board {
    display: grid;
    gap: 16px;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 24px;
}

#mainDashboard .stats-grid {
    gap: 10px;
    margin-bottom: 18px;
}

#mainDashboard .stats-grid .stat-card {
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.055);
    padding: 12px 14px;
}

#mainDashboard .stats-grid .stat-card span {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.25;
    text-transform: uppercase;
}

#mainDashboard .stats-grid .stat-card strong {
    font-size: clamp(18px, 2.2vw, 26px);
    margin: 6px 0;
}

#mainDashboard .stats-grid .stat-card small {
    font-size: 11px;
    line-height: 1.35;
}

.dashboard-visual-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

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

.dashboard-panel--full-width {
    grid-column: 1 / -1;
}

.dashboard-chart-placeholder {
    min-height: 180px;
}

.dashboard-pipeline-chart-root {
    min-height: 0;
}

.dashboard-pipeline-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dashboard-pipeline-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
}

.dashboard-pipeline-legend-item {
    align-items: center;
    color: #475569;
    display: inline-flex;
    font-size: 12px;
    gap: 8px;
}

.dashboard-pipeline-legend-marker {
    border-radius: 3px;
    flex-shrink: 0;
    height: 10px;
    width: 10px;
}

.dashboard-pipeline-scroll {
    overflow-x: auto;
    padding-bottom: 4px;
}

.dashboard-panel--full-width .dashboard-chart-caption {
    font-size: 12px;
    line-height: 1.4;
    margin: -4px 0 10px;
}

.dashboard-pipeline-area-svg {
    display: block;
    height: auto;
    max-width: none;
    width: 100%;
}

.dashboard-pipeline-area-grid line {
    stroke: #e2e8f0;
    stroke-width: 1;
}

.dashboard-pipeline-area-ytick {
    fill: #94a3b8;
}

.dashboard-pipeline-area-xlabel {
    fill: #64748b;
}

.dashboard-pipeline-area-layer {
    transition: opacity 0.15s ease;
}

.dashboard-pipeline-area-layer:hover {
    opacity: 1;
}

.dashboard-chart-caption {
    color: #64748b;
    font-size: 13px;
    line-height: 1.45;
    margin: -4px 0 12px;
}

.dashboard-wip-empty-hint {
    max-width: 42em;
}

.dashboard-wip-empty-hint strong {
    color: #334155;
    font-weight: 700;
}

.workload-share-donut--currency .dashboard-donut-center {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 76px;
    position: relative;
    text-align: center;
    z-index: 1;
}

.workload-share-donut--currency .dashboard-donut-center strong {
    font-size: clamp(11px, 2.4vw, 14px);
    font-weight: 800;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.workload-share-donut--currency .dashboard-donut-center small {
    color: #64748b;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
}

.dashboard-donut-layout {
    align-items: stretch;
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr;
    justify-items: center;
}

.dashboard-donut-layout .workload-legend {
    justify-self: stretch;
    width: 100%;
}

.dashboard-donut-layout .workload-legend-item span:last-child {
    max-width: none;
}

.dashboard-value-row {
    display: grid;
    gap: 4px;
    margin-bottom: 8px;
}

.dashboard-value-label {
    align-items: baseline;
    display: flex;
    gap: 6px;
    justify-content: space-between;
}

.dashboard-value-label strong {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.dashboard-value-label span {
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.dashboard-value-bar {
    background: #e2e8f0;
    border-radius: 999px;
    height: 7px;
    overflow: hidden;
}

.dashboard-value-bar span {
    border-radius: inherit;
    display: block;
    height: 100%;
}

.dashboard-alert-list {
    display: grid;
    gap: 10px;
    max-height: 360px;
    overflow: auto;
}

.stat-card {
    min-width: 0;
    padding: 22px;
}

.stat-card span,
.stat-card small {
    color: #64748b;
    display: block;
}

.stat-card strong {
    display: block;
    font-size: clamp(24px, 3vw, 36px);
    margin: 10px 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.feature-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.feature-card {
    display: block;
    padding: 20px;
    text-decoration: none;
}

.feature-card:hover {
    border-color: #93c5fd;
    transform: translateY(-2px);
}

.status-board {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.status-column {
    background: #f8fafc;
    padding: 16px;
}

.project-status-board {
    align-items: start;
    display: flex;
    gap: 18px;
    overflow-x: auto;
    padding: 4px 4px 16px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}

.project-status-board .status-column {
    flex: 0 0 380px;
    scroll-snap-align: start;
}

.project-status-board.dashboard-recent-projects {
    align-items: start;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    overflow-x: visible;
    padding: 0;
    scroll-snap-type: none;
}

.project-status-board.dashboard-recent-projects .project-card {
    margin-top: 0;
}

.column-heading {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 12px;
}

.column-heading h3 {
    margin-bottom: 0;
}

.mini-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    margin-top: 12px;
    padding: 14px;
}

.two-column-layout {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
}

.form-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-width {
    grid-column: 1 / -1;
}

.crm-associated-tensor-project-wrap {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.crm-associated-tensor-project-fields {
    flex: 1 1 240px;
    min-width: 0;
}

.crm-associated-tensor-project-fields > label.full-width {
    margin-bottom: 0;
}

.crm-convert-to-project-button {
    flex: 0 0 auto;
    white-space: nowrap;
}

.secondary-button {
    background: #e2e8f0;
    color: #1e293b;
}

.secondary-button:hover {
    background: #cbd5e1;
}

.danger-button {
    background: #fee2e2;
    color: #b91c1c;
}

.danger-button:hover {
    background: #fecaca;
}

.table-button {
    background: #eff6ff;
    color: #1d4ed8;
    padding: 8px 12px;
}

.compact-table-button {
    font-size: 12px;
    padding: 6px 10px;
}

.secondary-table-button {
    background: #f1f5f9;
    color: #475569;
}

.danger-table-button {
    background: #fee2e2;
    color: #b91c1c;
}

.table-action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.document-table-link {
    word-break: break-word;
    font-size: 0.92em;
    font-weight: 500;
}

.table-wrap {
    overflow-x: auto;
}

.badge {
    border-radius: 999px;
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    padding: 6px 10px;
    white-space: nowrap;
}

.badge.muted {
    background: #f1f5f9;
    color: #475569;
}

.badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.badge.info {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge.success {
    background: #dcfce7;
    color: #166534;
}

.type-badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 10px;
}

.type-badge {
    font-size: 11px;
}

.status-actions,
.project-list,
.checklist,
.timeline,
.user-list {
    display: grid;
    gap: 12px;
}

.status-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.status-actions button {
    border-radius: 999px;
    flex: 0 0 auto;
    font-size: 12px;
    line-height: 1.2;
    min-height: 0;
    padding: 6px 9px;
    width: auto;
}

.project-card,
.user-row {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 16px;
}

.project-status-board .project-card,
.static-card {
    align-items: flex-start;
    color: inherit;
    display: block;
    margin-top: 10px;
    min-width: 240px;
    padding: 10px 12px;
    text-decoration: none;
}

.project-status-board .project-card:hover {
    border-color: #93c5fd;
    transform: translateY(-2px);
}

.project-status-board .project-card .project-avatar {
    border-radius: 12px;
    font-size: 14px;
    height: 44px;
    margin-bottom: 8px;
    width: 44px;
}

.project-status-board .project-card h4 {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 2px;
}

.project-status-board .project-card .type-badge-list {
    gap: 4px;
    margin: 4px 0 6px;
}

.project-status-board .project-card .type-badge {
    font-size: 10px;
}

.project-status-board .project-card .project-card-description {
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    color: #64748b;
    display: -webkit-box;
    font-size: 12px;
    line-height: 1.35;
    margin-bottom: 0;
    overflow: hidden;
}

.project-status-board .project-card > p:not(.project-card-description) {
    font-size: 12px;
    margin-bottom: 4px;
}

.project-status-board .project-card .card-meta {
    font-size: 12px;
    margin-top: 8px;
}

.project-status-board .project-card .project-card-unpaid {
    display: block;
    font-weight: 600;
    margin-top: 4px;
}

.project-status-board .project-card .pic-display {
    font-size: 12px;
    margin-top: 6px;
}

.project-status-board .project-card .project-card-alert {
    font-size: 11px;
    margin-top: 8px;
    padding: 4px 8px;
}

.project-card h4,
.user-row h3 {
    margin-bottom: 4px;
}

.project-card p,
.user-row p {
    margin-bottom: 0;
}

.project-status-board .project-card p {
    margin-bottom: 8px;
}

.card-meta {
    color: #64748b;
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-top: 12px;
}

.empty-state,
.form-message {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 0;
}

.form-message {
    font-weight: 700;
    min-height: 20px;
}

.error-text {
    color: #b91c1c;
}

.hidden {
    display: none !important;
}

.global-alert-widget {
    left: 16px;
    position: fixed;
    top: 16px;
    z-index: 20;
}

.alert-bell {
    align-items: center;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    color: #475569;
    display: flex;
    gap: 8px;
    height: 42px;
    justify-content: center;
    min-width: 42px;
    padding: 0 14px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.alert-bell.has-alerts {
    background: #b45309;
    border-color: #92400e;
    color: #ffffff;
}

.alert-bell strong {
    background: #ffffff;
    border-radius: 999px;
    color: #92400e;
    font-size: 12px;
    line-height: 1;
    padding: 4px 7px;
}

.alert-dot {
    background: #fbbf24;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.25);
    display: inline-block;
    height: 10px;
    width: 10px;
}

.alert-dot.idle {
    background: #94a3b8;
    box-shadow: none;
}

.global-alert-panel {
    margin-top: 10px;
    max-width: 320px;
    width: calc(100vw - 32px);
}

.follow-up-alert-section {
    border-color: #fbbf24;
}

.follow-up-alert-list {
    display: grid;
    gap: 12px;
}

.follow-up-alert-card {
    background: #fffbeb;
    border: 1px solid #fbbf24;
    border-radius: 16px;
    padding: 16px;
}

.follow-up-alert-card.compact {
    box-shadow: 0 16px 40px rgba(146, 64, 14, 0.18);
}

.follow-up-alert-card h3 {
    margin-bottom: 6px;
}

.follow-up-alert-card p {
    color: #92400e;
    margin-bottom: 8px;
}

.alert-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.project-card-alert {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 999px;
    color: #92400e;
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    margin-top: 12px;
    padding: 6px 10px;
}

.progress-update-panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 18px;
}

.progress-update-panel .section-heading {
    margin-bottom: 18px;
}

.paid-terms-panel {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    margin: 18px 0;
    padding: 16px;
}

.compact-heading {
    margin-bottom: 12px;
}

.paid-term-list {
    display: grid;
    gap: 10px;
}

.paid-term-row {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(140px, 1.2fr) minmax(130px, 1fr) minmax(130px, 0.9fr) auto;
}

.paid-term-row .danger-button {
    padding: 10px 12px;
}

.progress-table-wrap {
    margin-top: 0;
}

.checklist label {
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    display: flex;
    gap: 10px;
    padding: 14px;
}

.checklist input {
    margin: 0;
    width: auto;
}

.custom-item {
    margin-bottom: 0;
    margin-top: 18px;
}

.custom-item input {
    flex: 1;
    margin-top: 0;
}

.timeline-item {
    display: grid;
    gap: 12px;
    grid-template-columns: auto 1fr;
}

.timeline-item p {
    margin-bottom: 0;
}

.follow-up-saved-rules-toolbar {
    margin-bottom: 10px;
}

.follow-up-saved-rules-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
}

.follow-up-saved-rules-empty {
    color: #64748b;
    font-size: 13px;
}

.follow-up-saved-rule-button {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    padding: 8px 10px;
    text-align: left;
    width: 100%;
}

.follow-up-saved-rule-button.is-selected {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgb(37 99 235 / 25%);
}

.global-alert-panel-scroll {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: min(70vh, 420px);
    overflow-y: auto;
}

.dot {
    background: #2563eb;
    border-radius: 50%;
    height: 12px;
    margin-top: 4px;
    width: 12px;
}

.resource-card-section {
    margin-top: 24px;
}

.resource-grid {
    align-items: stretch;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.resource-card {
    min-width: 0;
    padding: 16px;
}

.completed-project-summary {
    display: grid;
    gap: 8px;
}

.completed-project-summary p {
    font-weight: 800;
}

.completed-project-type-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.resource-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.resource-filter {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 20px;
}

.workload-dashboard {
    margin-bottom: 16px;
    padding: 18px;
}

.workload-dashboard .section-heading {
    margin-bottom: 10px;
}

.workload-list {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.workload-overview {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    display: grid;
    gap: 12px;
    padding: 14px;
}

.workload-overview-title {
    font-size: 15px;
    margin-bottom: 0;
}

.workload-overview-caption {
    color: #64748b;
    font-size: 13px;
    line-height: 1.45;
    margin: -2px 0 0;
}

.workload-overview-body {
    align-items: stretch;
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr;
    justify-items: center;
}

.workload-overview-body .workload-legend {
    justify-self: stretch;
    width: 100%;
}

.workload-overview-body .workload-legend-item span:last-child {
    max-width: none;
}

.workload-share-donut {
    align-items: center;
    background: #e2e8f0;
    border-radius: 50%;
    display: flex;
    flex: 0 0 auto;
    height: 120px;
    justify-content: center;
    position: relative;
    width: 120px;
}

.workload-share-donut::after {
    background: #ffffff;
    border-radius: 50%;
    content: "";
    height: 72px;
    position: absolute;
    width: 72px;
}

.workload-share-donut span {
    font-size: 20px;
    font-weight: 800;
    position: relative;
    z-index: 1;
}

.workload-legend {
    display: grid;
    gap: 3px;
}

.workload-legend-item {
    align-items: center;
    column-gap: 6px;
    display: flex;
    flex-wrap: nowrap;
    gap: 3px 6px;
    line-height: 1.2;
    min-width: 0;
}

.workload-legend-marker {
    border-radius: 50%;
    flex-shrink: 0;
    height: 7px;
    width: 7px;
}

.workload-legend-item strong {
    flex: 1 1 auto;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workload-legend-item span:last-child {
    flex: 0 1 auto;
    font-size: 11px;
    line-height: 1.2;
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 700px) {
    .workload-list {
        grid-template-columns: 1fr;
    }

    .workload-overview-body {
        gap: 14px;
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .workload-overview-body .workload-legend {
        justify-self: stretch;
        width: 100%;
    }

    .workload-legend {
        width: 100%;
    }

    .workload-legend-item {
        flex-wrap: wrap;
    }

    .workload-legend-item span:last-child {
        flex-basis: 100%;
        margin-left: 13px;
        max-width: none;
    }
}

.avatar,
.project-avatar {
    align-items: center;
    background: #dbeafe;
    border-radius: 50%;
    color: #1d4ed8;
    display: flex;
    font-weight: 800;
    height: 48px;
    justify-content: center;
    margin-bottom: 12px;
    width: 48px;
}

.avatar img,
.project-avatar img {
    border-radius: inherit;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.avatar-small {
    flex: 0 0 auto;
    font-size: 12px;
    height: 34px;
    margin-bottom: 0;
    width: 34px;
}

.avatar-tiny {
    flex: 0 0 auto;
    font-size: 11px;
    height: 26px;
    margin-bottom: 0;
    width: 26px;
}

.project-avatar {
    border-radius: 18px;
    font-size: 18px;
    height: 72px;
    width: 72px;
}

.project-avatar-large {
    height: 112px;
    margin-bottom: 16px;
    width: 112px;
}

.pic-select-row,
.pic-display {
    align-items: center;
    display: flex;
    gap: 10px;
}

.pic-select-row select {
    margin-top: 0;
}

.pic-display {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    margin-top: 12px;
}

.pic-display-compact {
    font-size: 12px;
    margin-top: 8px;
}

.assistant-field {
    display: grid;
    gap: 12px;
}

.assistant-list {
    display: grid;
    gap: 10px;
}

.assistant-row {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: auto minmax(0, 1fr) auto;
}

.assistant-row select {
    margin-top: 0;
}

.assistant-remove-button {
    padding: 10px 12px;
}

.assistant-display {
    display: grid;
    gap: 6px;
}

.preference-list {
    display: grid;
    gap: 10px;
}

.preference-row {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.preference-row input {
    margin-top: 0;
}

.preference-card .section-heading {
    align-items: flex-start;
}

@media (max-width: 1100px) {
    .stats-grid,
    .feature-grid,
    .status-board {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .two-column-layout {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 700px) {
    body {
        padding: 16px;
    }

    h1 {
        font-size: 28px;
        line-height: 1.15;
    }

    h2 {
        font-size: 21px;
    }

    .subtitle {
        font-size: 15px;
    }

    .page-header,
    .card {
        border-radius: 18px;
    }

    .card {
        padding: 20px;
    }

    .page-header {
        align-items: stretch;
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 14px 16px;
    }

    .page-header--has-prefs-shortcut {
        padding-top: 14px;
    }

    .page-header > div:first-child {
        width: 100%;
        min-width: 0;
    }

    .crm-header-shortcuts {
        position: static;
        width: 100%;
        max-width: 100%;
        justify-content: flex-start;
        gap: 8px 10px;
    }

    .page-header .crm-header-shortcuts .tensor-banner-session {
        flex-basis: auto;
        width: 100%;
        max-width: 100%;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        text-align: left;
        word-break: break-word;
    }

    .crm-company-logo-banner {
        max-width: min(240px, 72vw);
        max-height: 40px;
    }

    .page-header h1 {
        font-size: 22px;
        margin-bottom: 4px;
    }

    .page-header .subtitle {
        font-size: 13px;
    }

    .main-nav {
        align-items: center;
        flex-wrap: wrap;
        overflow-x: visible;
        padding: 6px;
        -webkit-overflow-scrolling: touch;
    }

    .nav-toggle {
        display: inline-flex;
        flex: 0 0 46px;
        order: 2;
    }

    .main-nav a {
        flex: 1 1 calc(50% - 8px);
        order: 4;
        padding: 10px 14px;
        text-align: center;
        white-space: nowrap;
    }

    .main-nav:not(.is-open) a,
    .main-nav:not(.is-open) .auth-controls {
        display: none;
    }

    .brand-item {
        flex: 1 1 calc(100% - 56px);
        order: 1;
    }

    .auth-controls {
        flex: 1 0 100%;
        order: 3;
    }

    .brand-item {
        justify-content: flex-start;
        min-width: 0;
    }

    .auth-controls {
        justify-content: space-between;
        margin-left: 0;
    }

    .auth-controls .secondary-button {
        flex: 0 0 auto;
        width: auto;
    }

    .section-heading,
    .button-row,
    .custom-item,
    .page-action-card,
    .page-action-buttons {
        align-items: stretch;
        flex-direction: column;
    }

    .page-action-card {
        display: flex;
    }

    .button-row.compact {
        align-items: stretch;
    }

    button,
    .button-link,
    .secondary-link {
        text-align: center;
        width: 100%;
    }

    .alert-bell {
        width: auto;
    }

    .stats-grid,
    .feature-grid,
    .status-board,
    .dashboard-donut-layout,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-donut-layout {
        justify-items: center;
    }

    .project-status-board {
        gap: 14px;
        margin-left: -4px;
        margin-right: -4px;
        padding: 4px 4px 12px;
        scroll-snap-type: x mandatory;
    }

    .project-status-board.dashboard-recent-projects {
        gap: 12px;
        grid-template-columns: 1fr;
        margin-left: 0;
        margin-right: 0;
        overflow-x: visible;
        padding: 0;
        scroll-snap-type: none;
    }

    .project-status-board .status-column {
        flex-basis: calc(100vw - 56px);
        max-width: 420px;
    }

    .status-board .status-column {
        min-width: 0;
    }

    .project-card,
    .user-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .resource-filter {
        grid-template-columns: 1fr;
    }

    .resource-grid {
        grid-template-columns: 1fr;
    }

    .assistant-row {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .assistant-remove-button {
        grid-column: 2;
        width: auto;
    }

    .paid-term-row {
        grid-template-columns: 1fr;
    }

    .table-wrap table {
        min-width: 520px;
    }

    .table-wrap.crm-plain-table-wrap .crm-plain-table,
    #crmEntityListAnchor table {
        min-width: unset;
    }

    .custom-item input {
        flex: none;
    }
}

@media (max-width: 420px) {
    body {
        padding: 12px;
    }

    h1 {
        font-size: 24px;
    }

    .card {
        padding: 16px;
    }

    .page-header {
        padding: 8px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    .stat-card strong {
        font-size: 30px;
    }

    #mainDashboard .stats-grid .stat-card strong {
        font-size: clamp(16px, 5.5vw, 22px);
    }

    input,
    select,
    textarea {
        padding: 11px;
    }

    .project-status-board .status-column {
        flex-basis: calc(100vw - 48px);
        max-width: 380px;
    }

    .status-actions {
        gap: 6px;
    }

    .status-actions button {
        font-size: 11px;
        padding: 5px 8px;
    }
}

html[data-theme="dark"] body {
    background: #0f172a;
    color: #e2e8f0;
}

html[data-theme="dark"] p {
    color: #94a3b8;
}

html[data-theme="dark"] button {
    background: #3b82f6;
}

html[data-theme="dark"] button:hover {
    background: #2563eb;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background: #111827;
    border-color: #334155;
    color: #e2e8f0;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #64748b;
}

html[data-theme="dark"] label {
    color: #cbd5e1;
}

html[data-theme="dark"] hr,
html[data-theme="dark"] th,
html[data-theme="dark"] td {
    border-color: #334155;
}

html[data-theme="dark"] th {
    color: #94a3b8;
}

html[data-theme="dark"] .main-nav,
html[data-theme="dark"] .card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .feature-card,
html[data-theme="dark"] .status-column,
html[data-theme="dark"] .project-card,
html[data-theme="dark"] .resource-card,
html[data-theme="dark"] .user-row {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .project-status-board .project-card .project-card-description {
    color: #94a3b8;
}

html[data-theme="dark"] .main-nav a {
    color: #cbd5e1;
}

html[data-theme="dark"] .brand-item {
    color: #e2e8f0;
}

html[data-theme="dark"] .brand-logo {
    background: #1e3a8a;
    color: #dbeafe;
}

html[data-theme="dark"] .main-nav a:hover,
html[data-theme="dark"] .main-nav a.active {
    background: #1e3a8a;
    color: #dbeafe;
}

html[data-theme="dark"] .secondary-link,
html[data-theme="dark"] .secondary-button {
    background: #334155;
    color: #e2e8f0;
}

html[data-theme="dark"] .secondary-link:hover,
html[data-theme="dark"] .secondary-button:hover {
    background: #475569;
}

html[data-theme="dark"] .danger-button {
    background: #7f1d1d;
    color: #fecaca;
}

html[data-theme="dark"] .danger-button:hover {
    background: #991b1b;
}

html[data-theme="dark"] .table-button {
    background: #1e3a8a;
    color: #dbeafe;
}

html[data-theme="dark"] .secondary-table-button {
    background: #334155;
    color: #cbd5e1;
}

html[data-theme="dark"] .danger-table-button {
    background: #7f1d1d;
    color: #fecaca;
}

html[data-theme="dark"] .badge.muted {
    background: #334155;
    color: #cbd5e1;
}

html[data-theme="dark"] .badge.warning {
    background: #713f12;
    color: #fde68a;
}

html[data-theme="dark"] .badge.info {
    background: #1e3a8a;
    color: #dbeafe;
}

html[data-theme="dark"] .badge.success {
    background: #14532d;
    color: #bbf7d0;
}

html[data-theme="dark"] .status-column,
html[data-theme="dark"] .mini-card,
html[data-theme="dark"] .progress-update-panel,
html[data-theme="dark"] .paid-terms-panel,
html[data-theme="dark"] .workload-dashboard,
html[data-theme="dark"] .workload-overview,
html[data-theme="dark"] .checklist label {
    background: #111827;
    border-color: #334155;
}

html[data-theme="dark"] .dashboard-wip-empty-hint strong {
    color: #e2e8f0;
}

html[data-theme="dark"] .workload-share-donut::after {
    background: #111827;
}

html[data-theme="dark"] .dashboard-chart-caption {
    color: #94a3b8;
}

html[data-theme="dark"] .dashboard-chart-caption strong {
    color: #e2e8f0;
}

html[data-theme="dark"] .workload-overview-caption {
    color: #94a3b8;
}

html[data-theme="dark"] .workload-share-donut--currency .dashboard-donut-center strong {
    color: #f1f5f9;
}

html[data-theme="dark"] .workload-share-donut--currency .dashboard-donut-center small {
    color: #94a3b8;
}

html[data-theme="dark"] .workload-legend-item strong {
    color: #e2e8f0;
}

html[data-theme="dark"] .dashboard-value-label strong {
    color: #f1f5f9;
}

html[data-theme="dark"] .card-meta,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .form-message {
    color: #94a3b8;
}

html[data-theme="dark"] .error-text {
    color: #fca5a5;
}

html[data-theme="dark"] .alert-bell {
    background: #334155;
    border-color: #475569;
    color: #e2e8f0;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .alert-bell.has-alerts {
    background: #b45309;
    border-color: #d97706;
}

html[data-theme="dark"] .follow-up-alert-section,
html[data-theme="dark"] .follow-up-alert-card {
    border-color: #d97706;
}

html[data-theme="dark"] .follow-up-alert-card {
    background: #422006;
}

html[data-theme="dark"] .follow-up-alert-card.compact {
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .follow-up-alert-card p,
html[data-theme="dark"] .project-card-alert {
    color: #fde68a;
}

html[data-theme="dark"] .project-card-alert {
    background: #713f12;
    border-color: #d97706;
}

html[data-theme="dark"] .avatar,
html[data-theme="dark"] .project-avatar {
    background: #1e3a8a;
    color: #dbeafe;
}

html[data-theme="dark"] .pic-display {
    color: #94a3b8;
}

/* —— Project form: team chat (under Current Preview) —— */

.project-team-chat {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
}

.project-team-chat-heading {
    margin-bottom: 0.35rem;
}

.project-team-chat-heading h3 {
    margin: 0;
    font-size: 1rem;
}

.project-team-chat-hint {
    margin: 0 0 0.65rem;
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--muted-text, #64748b);
}

.project-team-chat-hint code {
    font-size: 0.78em;
    padding: 0.05rem 0.25rem;
    border-radius: 4px;
    background: rgba(148, 163, 184, 0.2);
}

.project-team-chat--disabled .project-chat-compose textarea {
    opacity: 0.6;
}

.project-chat-messages {
    max-height: 240px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
    padding: 0.35rem 0;
}

.project-chat-bubble {
    align-self: flex-start;
    max-width: 100%;
    padding: 0.45rem 0.65rem;
    border-radius: 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    font-size: 0.875rem;
    line-height: 1.45;
}

.project-chat-bubble--mine {
    align-self: flex-end;
    background: #dbeafe;
    border-color: #93c5fd;
}

.project-chat-bubble--mention-you:not(.project-chat-bubble--mine) {
    border-left: 3px solid #d97706;
    padding-left: 0.55rem;
}

.project-chat-meta {
    font-size: 0.7rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.project-chat-body .chat-mention {
    font-weight: 600;
    color: #1d4ed8;
}

.project-chat-compose textarea {
    width: 100%;
    resize: vertical;
    min-height: 4rem;
    margin-bottom: 0.5rem;
    box-sizing: border-box;
}

.project-chat-compose-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.project-chat-compose-row select {
    flex: 1 1 12rem;
    min-width: 8rem;
}

.project-chat-compose-row .primary-button {
    flex-shrink: 0;
}

.crm-chat-empty-hint {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--muted-text, #64748b);
}

html[data-theme="dark"] .project-team-chat {
    border-top-color: rgba(71, 85, 105, 0.6);
}

html[data-theme="dark"] .project-team-chat-hint {
    color: #94a3b8;
}

html[data-theme="dark"] .project-team-chat-hint code {
    background: rgba(71, 85, 105, 0.65);
    color: #e2e8f0;
}

html[data-theme="dark"] .project-chat-bubble {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

html[data-theme="dark"] .project-chat-bubble--mine {
    background: #1e3a5f;
    border-color: #2563eb;
}

html[data-theme="dark"] .project-chat-bubble--mention-you:not(.project-chat-bubble--mine) {
    border-left-color: #fbbf24;
}

html[data-theme="dark"] .project-chat-meta {
    color: #94a3b8;
}

html[data-theme="dark"] .project-chat-body .chat-mention {
    color: #93c5fd;
}

/* --- tensorCRM leads --- */
.crm-toolbar-hint {
    color: #64748b;
    font-size: 13px;
    margin: 0 0 12px;
}

.crm-toolbar.button-row.compact {
    flex-wrap: wrap;
    gap: 8px;
}

.crm-list-search-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    flex: 1 1 12rem;
    min-width: min(100%, 14rem);
    max-width: 22rem;
}

.crm-list-search-label {
    white-space: nowrap;
    color: var(--muted-text, #64748b);
}

.crm-list-search-input {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: inherit;
}

html[data-theme="dark"] .crm-list-search-input {
    border-color: #334155;
    background: #0f172a;
    color: #f1f5f9;
}

.crm-list-filters {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.crm-list-filters-panel {
    margin-left: auto;
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

html[data-theme="dark"] .crm-list-filters-panel {
    border-color: #334155;
    background: #0f172a;
}

/* Leads toolbar: tighter filter controls */
.crm-leads-filters-compact.crm-list-filters-panel {
    padding: 4px 8px;
}

.crm-leads-filters-compact .crm-list-filters {
    gap: 6px;
}

.crm-leads-filters-compact .crm-list-product-filter-label {
    font-size: 12px;
}

.crm-leads-filters-compact .crm-list-campaign-filter,
.crm-leads-filters-compact .crm-list-product-filter,
.crm-leads-filters-compact .crm-list-status-filter,
.crm-leads-filters-compact .crm-list-rating-filter,
.crm-leads-filters-compact .crm-list-owner-filter,
.crm-leads-filters-compact .crm-list-sort-filter {
    gap: 4px;
    font-size: 12px;
}

.crm-leads-filters-compact .crm-list-exclude-unqualified-filter {
    font-size: 12px;
    gap: 4px;
}

.crm-leads-filters-compact .crm-list-sort-filter select {
    padding: 3px 6px;
    font-size: 12px;
    max-width: 6.75rem;
}

.crm-leads-filters-compact .crm-list-campaign-filter select[multiple],
.crm-leads-filters-compact .crm-list-product-filter select[multiple],
.crm-leads-filters-compact .crm-list-rating-filter select[multiple],
.crm-leads-filters-compact .crm-list-status-filter select[multiple],
.crm-leads-filters-compact .crm-list-owner-filter select[multiple] {
    font-size: 11px;
    padding: 2px 4px;
    min-height: 2.1rem;
    max-height: 5rem;
    max-width: 7.25rem;
    width: 7.25rem;
    min-width: 0;
}

.crm-leads-filters-compact .crm-list-campaign-filter select,
.crm-leads-filters-compact .crm-list-rating-filter select {
    padding: 3px 5px;
    font-size: 12px;
    max-width: 7rem;
    width: auto;
}

.crm-list-campaign-filter,
.crm-list-rating-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    white-space: nowrap;
}

.crm-list-campaign-filter select,
.crm-list-rating-filter select {
    font-size: 13px;
    padding: 4px 8px;
    max-width: 11rem;
}

.crm-list-product-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    white-space: nowrap;
}

.crm-list-status-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    white-space: nowrap;
}

.crm-list-exclude-unqualified-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
    color: var(--muted-text, #64748b);
}

.crm-list-exclude-unqualified-filter input {
    margin: 0;
    cursor: pointer;
}

.crm-list-owner-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    white-space: nowrap;
}

.crm-list-product-filter-label {
    color: var(--muted-text, #64748b);
}

/* Compact multi-select: shorter than form `.crm-form-multi-select` */
.crm-list-campaign-filter select[multiple],
.crm-list-product-filter select[multiple],
.crm-list-rating-filter select[multiple],
.crm-list-status-filter select[multiple],
.crm-list-owner-filter select[multiple] {
    font-size: 13px;
    padding: 4px 6px;
    min-height: 2.75rem;
    max-height: 7.5rem;
    max-width: 14rem;
    width: auto;
    vertical-align: middle;
}

.crm-form-multi-select {
    min-height: 6.5rem;
    min-width: min(18rem, 100%);
}

.crm-multi-select-hint {
    margin: -0.35rem 0 0.5rem;
    font-size: 0.8rem;
    color: var(--muted-text, #64748b);
    grid-column: 1 / -1;
}

.crm-multi-select-hint kbd {
    font-size: 0.85em;
    padding: 0.05rem 0.35rem;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
}

html[data-theme="dark"] .crm-multi-select-hint kbd {
    border-color: #475569;
    background: #1e293b;
}

.crm-list-sort-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    white-space: nowrap;
}

.crm-list-sort-filter select {
    font-size: 13px;
    padding: 4px 8px;
}

@media (max-width: 640px) {
    .crm-list-search-wrap {
        flex: 1 1 100%;
        max-width: none;
        width: 100%;
    }

    .crm-list-sort-filter {
        width: 100%;
    }

    .crm-list-sort-filter select {
        flex: 1;
        min-width: 0;
    }
    .crm-list-filters-panel {
        margin-left: 0;
        width: 100%;
    }

    .crm-list-filters {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .crm-list-campaign-filter {
        width: 100%;
    }

    .crm-list-campaign-filter select {
        flex: 1;
        min-width: 0;
        max-width: none;
    }

    .crm-list-rating-filter {
        width: 100%;
    }

    .crm-list-rating-filter select {
        flex: 1;
        min-width: 0;
        max-width: none;
    }

    .crm-list-campaign-filter {
        width: 100%;
    }

    .crm-list-rating-filter {
        width: 100%;
    }

    .crm-list-product-filter {
        width: 100%;
    }

    .crm-list-status-filter {
        width: 100%;
    }

    .crm-list-owner-filter {
        width: 100%;
    }

    .crm-list-campaign-filter select[multiple],
    .crm-list-product-filter select[multiple],
    .crm-list-rating-filter select[multiple],
    .crm-list-status-filter select[multiple],
    .crm-list-owner-filter select[multiple] {
        flex: 1;
        min-width: 0;
        max-width: none;
        width: 100%;
        max-height: 10rem;
    }

    /* Undo fixed desktop widths inside leads compact toolbar */
    .crm-leads-filters-compact .crm-list-sort-filter select {
        max-width: none;
    }

    .crm-leads-filters-compact .crm-list-campaign-filter select[multiple],
    .crm-leads-filters-compact .crm-list-product-filter select[multiple],
    .crm-leads-filters-compact .crm-list-rating-filter select[multiple],
    .crm-leads-filters-compact .crm-list-status-filter select[multiple],
    .crm-leads-filters-compact .crm-list-owner-filter select[multiple] {
        width: 100%;
        max-width: none;
    }
}

.account-related-section {
    margin-top: 1.25rem;
}

.crm-plain-table-wrap {
    margin-top: 8px;
}

.crm-plain-table {
    border-collapse: collapse;
    font-size: 14px;
    table-layout: auto;
    width: max-content;
}

/* Tasks / Cases generic entity lists (not using .crm-plain-table) */
#crmEntityListAnchor table {
    table-layout: auto;
    width: max-content;
}

.crm-plain-table th,
.crm-plain-table td {
    border: 1px solid #cbd5e1;
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
}

.crm-plain-table thead th {
    background: #f1f5f9;
    font-weight: 700;
}

.crm-plain-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.crm-plain-table a {
    color: #0f766e;
    font-weight: 700;
    text-decoration: none;
}

.crm-plain-table a:hover {
    text-decoration: underline;
}

.crm-list-row-num {
    width: 2.5rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--muted-text, #64748b);
}

.lead-pipeline-section {
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 0;
    padding-bottom: 16px;
}

.lead-form-toolbar-card .button-row {
    margin: 0;
}

.lead-form-toolbar-layout {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
}

.lead-toolbar-save-status {
    flex: 1 1 auto;
    margin: 0;
    min-height: 1.35em;
    text-align: right;
}

@media (max-width: 520px) {
    .lead-toolbar-save-status {
        flex-basis: 100%;
        text-align: left;
    }
}

.lead-pipeline-bar .lead-pipeline-sep {
    color: #94a3b8;
    padding: 0 2px;
}

.lead-pipeline-bar button.lead-pipeline-active {
    box-shadow: 0 0 0 2px #14b8a6;
}

.lead-pipeline-bar.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

html[data-theme="dark"] .crm-plain-table th,
html[data-theme="dark"] .crm-plain-table td {
    border-color: #334155;
}

html[data-theme="dark"] .crm-plain-table thead th {
    background: #1e293b;
}

html[data-theme="dark"] .crm-plain-table tbody tr:nth-child(even) {
    background: #0f172a;
}

html[data-theme="dark"] .crm-plain-table a {
    color: #2dd4bf;
}

html[data-theme="dark"] .lead-pipeline-section {
    border-bottom-color: #334155;
}

.crm-assign-owner-dialog {
    padding: 0;
    border: none;
    border-radius: 12px;
    max-width: min(440px, 94vw);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
}

.crm-assign-owner-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
}

.crm-dialog-panel {
    padding: 20px 22px;
}

.lead-owner-actions {
    grid-column: 1 / -1;
}

html[data-theme="dark"] .crm-assign-owner-dialog {
    background: #1e293b;
    color: #e2e8f0;
}

.opp-closed-outcome-row {
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px dashed #cbd5e1;
}

html[data-theme="dark"] .opp-closed-outcome-row {
    border-top-color: #475569;
}

/* —— tensorCRM dashboard charts —— */
.crm-dashboard-main {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.crm-dashboard-stats-wrap {
    margin-bottom: 0;
}

.crm-dashboard-stats.crm-dashboard-stats {
    margin-bottom: 0;
}

.crm-dashboard-stat-card {
    border-left: 4px solid transparent;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.crm-dashboard-stat-card:hover {
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
}

html[data-theme="dark"] .crm-dashboard-stat-card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.crm-dashboard-charts {
    align-items: stretch;
}

.crm-chart-panel .crm-chart-title {
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.crm-chart-panel .dashboard-chart-caption {
    margin-bottom: 14px;
}

.crm-chart-panel[hidden] {
    display: none !important;
}

.crm-chart-canvas-wrap {
    height: 260px;
    position: relative;
    width: 100%;
}

.crm-chart-canvas-wrap--donut {
    height: 280px;
    margin: 0 auto;
    max-width: 360px;
}

.crm-chart-canvas-wrap--wide {
    height: 300px;
}

@media (max-width: 720px) {
    .crm-chart-canvas-wrap,
    .crm-chart-canvas-wrap--donut,
    .crm-chart-canvas-wrap--wide {
        height: 240px;
    }
}

html[data-theme="dark"] .crm-chart-panel .crm-chart-title {
    color: #f1f5f9;
}

html[data-theme="dark"] .crm-chart-panel .dashboard-chart-caption {
    color: #94a3b8;
}

/* —— Form pages: back to list —— */
.crm-form-page-header {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: space-between;
}

.crm-form-page-header-main {
    flex: 1;
    min-width: min(100%, 220px);
}

.crm-form-page-header .crm-back-to-list {
    flex-shrink: 0;
}

@media (max-width: 520px) {
    .crm-form-page-header .crm-back-to-list {
        text-align: center;
        width: 100%;
    }
}

.crm-inline-form-toolbar {
    margin-bottom: 6px;
    margin-top: 4px;
}

.lead-document-actions {
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.crm-inline-label {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
}

p.crm-follow-up-soon {
    color: #b45309;
    font-weight: 500;
}

html[data-theme="dark"] p.crm-follow-up-soon {
    color: #fbbf24;
}

/* Opportunity pipeline: brief outcome celebration */
@keyframes opp-outcome-pop {
    0% {
        opacity: 0;
        transform: scale(0.35) rotate(-18deg);
    }

    55% {
        opacity: 1;
        transform: scale(1.08) rotate(6deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes opp-outcome-sparkle {
    0%,
    100% {
        filter: drop-shadow(0 0 0 rgba(250, 204, 21, 0));
        transform: translateY(0) rotate(0deg);
    }

    40% {
        filter: drop-shadow(0 0 14px rgba(250, 204, 21, 0.85));
        transform: translateY(-6px) rotate(-8deg);
    }

    70% {
        filter: drop-shadow(0 0 22px rgba(52, 211, 153, 0.65));
        transform: translateY(4px) rotate(8deg);
    }
}

@keyframes opp-outcome-confetti {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(0.4);
    }

    25% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateY(-120vh) rotate(720deg);
    }
}

@keyframes opp-outcome-sad-shake {
    0%,
    100% {
        transform: translateX(0) rotate(0deg);
    }

    20% {
        transform: translateX(-6px) rotate(-4deg);
    }

    40% {
        transform: translateX(7px) rotate(4deg);
    }

    60% {
        transform: translateX(-4px) rotate(-3deg);
    }

    80% {
        transform: translateX(3px) rotate(2deg);
    }
}

@keyframes opp-outcome-droop {
    0% {
        opacity: 0;
        transform: translateY(-28px) scale(0.85);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.opp-outcome-fx {
    align-items: center;
    display: flex;
    inset: 0;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    transition: opacity 0.38s ease;
    z-index: 300000;
}

.opp-outcome-fx.is-visible {
    opacity: 1;
}

.opp-outcome-fx__backdrop {
    background: radial-gradient(circle at 50% 35%, rgba(254, 249, 195, 0.55), rgba(244, 247, 251, 0.05));
    inset: 0;
    position: absolute;
}

html[data-theme="dark"] .opp-outcome-fx__backdrop {
    background: radial-gradient(circle at 50% 35%, rgba(250, 204, 21, 0.18), rgba(15, 23, 42, 0.65));
}

.opp-outcome-fx__backdrop--muted {
    background: radial-gradient(circle at 50% 40%, rgba(148, 163, 184, 0.35), rgba(244, 247, 251, 0.08));
}

html[data-theme="dark"] .opp-outcome-fx__backdrop--muted {
    background: radial-gradient(circle at 50% 40%, rgba(71, 85, 105, 0.45), rgba(15, 23, 42, 0.72));
}

.opp-outcome-fx__card {
    animation: opp-outcome-pop 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    align-items: center;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 22px 55px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(250, 204, 21, 0.35);
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(92vw, 340px);
    padding: 28px 36px;
    position: relative;
    text-align: center;
}

html[data-theme="dark"] .opp-outcome-fx__card {
    background: #1e293b;
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(250, 204, 21, 0.22);
}

.opp-outcome-fx__card--sad {
    animation: opp-outcome-droop 0.75s ease-out both;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(148, 163, 184, 0.45);
}

html[data-theme="dark"] .opp-outcome-fx__card--sad {
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(71, 85, 105, 0.55);
}

.opp-outcome-fx__emoji {
    display: block;
    font-size: clamp(3.5rem, 14vw, 5rem);
    line-height: 1;
}

.opp-outcome-fx--won .opp-outcome-fx__emoji {
    animation: opp-outcome-sparkle 1.25s ease-in-out infinite;
}

.opp-outcome-fx--lost .opp-outcome-fx__emoji {
    animation: opp-outcome-sad-shake 0.85s ease-in-out both;
}

.opp-outcome-fx__label {
    color: #0f172a;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

html[data-theme="dark"] .opp-outcome-fx__label {
    color: #f1f5f9;
}

.opp-outcome-fx__card--sad .opp-outcome-fx__label {
    color: #475569;
}

html[data-theme="dark"] .opp-outcome-fx__card--sad .opp-outcome-fx__label {
    color: #cbd5e1;
}

.opp-outcome-fx__confetti {
    inset: 0;
    overflow: hidden;
    position: absolute;
}

.opp-outcome-fx__confetti span {
    animation: opp-outcome-confetti 2.2s linear forwards;
    border-radius: 2px;
    height: 10px;
    opacity: 0;
    position: absolute;
    top: 100%;
    width: 10px;
}

.opp-outcome-fx__confetti span:nth-child(1) {
    animation-delay: 0s;
    background: #fbbf24;
    left: 12%;
}

.opp-outcome-fx__confetti span:nth-child(2) {
    animation-delay: 0.08s;
    background: #34d399;
    height: 8px;
    left: 28%;
    width: 8px;
}

.opp-outcome-fx__confetti span:nth-child(3) {
    animation-delay: 0.04s;
    background: #60a5fa;
    left: 44%;
}

.opp-outcome-fx__confetti span:nth-child(4) {
    animation-delay: 0.12s;
    background: #f472b6;
    height: 7px;
    left: 58%;
    width: 7px;
}

.opp-outcome-fx__confetti span:nth-child(5) {
    animation-delay: 0.06s;
    background: #a78bfa;
    left: 72%;
}

.opp-outcome-fx__confetti span:nth-child(6) {
    animation-delay: 0.1s;
    background: #fde047;
    height: 9px;
    left: 86%;
    width: 9px;
}

/* tensorERP launcher — same glass chip as .crm-prefs-shortcut; inside .crm-header-shortcuts */
a.tensor-erp-launcher {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 2.35rem;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.38);
    transition: none;
}

a.tensor-erp-launcher:hover,
a.tensor-erp-launcher:active {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(15, 23, 42, 0.18);
    border-color: rgba(255, 255, 255, 0.38);
}

a.tensor-erp-launcher:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

