/* ==========================================================
   AGENTCHAT NEXUS PROFESSIONAL 2026.08
   Scope strict: data-theme-preset="nexus".
   Presentation only. No markup, behavior or logo replacement.
   ========================================================== */

html[data-theme-preset="nexus"][data-theme="light"] {
    --background: #eef2f6;
    --surface: #ffffff;
    --surface-secondary: #f3f6f8;
    --surface-tertiary: #e5ebf0;
    --text: #102334;
    --text-secondary: #536679;
    --text-muted: #768797;
    --border: #d5dfe7;
    --border-strong: #adbdca;
    --accent: #0a7b82;
    --accent-hover: #07666c;
    --accent-soft: #e0f0f1;
    --sidebar: #f0f4f7;
    --danger: #bf3d49;
    --danger-soft: #f8e7e9;
    --theme-radius: 7px;
    --theme-radius-lg: 10px;
    --theme-glow: rgba(10, 123, 130, 0.15);
    --page: #eef2f6;
    --surface-muted: #f5f7f9;
    --muted: #637689;
    --line: #d5dfe7;
    --line-strong: #adbdca;
    --accent-strong: #07666c;
    --success: #239764;
    --grid-line: rgba(24, 62, 83, 0.035);
    --focus: rgba(10, 123, 130, 0.16);
    --shadow: 0 18px 48px rgba(16, 43, 63, 0.10);
    --nexus-rail: #071826;
    --nexus-rail-hover: #102d40;
    --nexus-rail-active: #154558;
    --nexus-sidebar: #f3f6f8;
    --nexus-header: #ffffff;
    --nexus-button-text: #ffffff;
    --nexus-card-shadow:
        0 1px 2px rgba(18, 43, 62, 0.03),
        0 10px 28px rgba(18, 43, 62, 0.045);
}

html[data-theme-preset="nexus"][data-theme="dark"] {
    --background: #08131d;
    --surface: #0e1b27;
    --surface-secondary: #142431;
    --surface-tertiary: #1c2e3c;
    --text: #e9f0f5;
    --text-secondary: #a6b6c4;
    --text-muted: #7f93a3;
    --border: #263947;
    --border-strong: #3d5567;
    --accent: #58b9bd;
    --accent-hover: #79cbd0;
    --accent-soft: #15383d;
    --sidebar: #0b1924;
    --danger: #ff707b;
    --danger-soft: #40232a;
    --theme-radius: 7px;
    --theme-radius-lg: 10px;
    --theme-glow: rgba(88, 185, 189, 0.17);
    --page: #08131d;
    --surface-muted: #101f2b;
    --muted: #98a9b7;
    --line: #263947;
    --line-strong: #3d5567;
    --accent-strong: #79cbd0;
    --success: #43bd82;
    --grid-line: rgba(157, 191, 210, 0.028);
    --focus: rgba(88, 185, 189, 0.19);
    --shadow: 0 20px 55px rgba(0, 0, 0, 0.30);
    --nexus-rail: #050f18;
    --nexus-rail-hover: #102737;
    --nexus-rail-active: #174252;
    --nexus-sidebar: #0b1924;
    --nexus-header: #0d1a26;
    --nexus-button-text: #06181a;
    --nexus-card-shadow:
        0 1px 2px rgba(0, 0, 0, 0.16),
        0 12px 32px rgba(0, 0, 0, 0.14);
}

html[data-theme-preset="nexus"][data-theme="light"][data-high-contrast="true"] {
    --background: #e7edf2;
    --surface: #ffffff;
    --surface-secondary: #edf2f5;
    --surface-tertiary: #dce5eb;
    --text: #071723;
    --text-secondary: #263f52;
    --text-muted: #415e72;
    --border: #7d95a7;
    --border-strong: #405f73;
    --accent: #005f66;
    --accent-hover: #004c52;
    --accent-soft: #cce9eb;
    --line: #7d95a7;
    --line-strong: #405f73;
}

html[data-theme-preset="nexus"][data-theme="dark"][data-high-contrast="true"] {
    --background: #02070b;
    --surface: #07131d;
    --surface-secondary: #0d202e;
    --surface-tertiary: #163145;
    --text: #ffffff;
    --text-secondary: #dae8f1;
    --text-muted: #b7cad7;
    --border: #5a778b;
    --border-strong: #8aa5b7;
    --accent: #7bd9dd;
    --accent-hover: #a6edf0;
    --accent-soft: #143f45;
    --line: #5a778b;
    --line-strong: #8aa5b7;
}

/* Global canvas */
html[data-theme-preset="nexus"] body {
    color: var(--text);
    background-color: var(--background);
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
        radial-gradient(circle at 92% 2%, var(--theme-glow), transparent 28rem);
    background-size: 32px 32px, 32px 32px, auto;
    background-attachment: fixed;
}

html[data-theme-preset="nexus"] :is(
    button,
    input,
    select,
    textarea,
    a
):focus-visible {
    border-color: var(--accent);
    outline: 2px solid color-mix(in srgb, var(--accent) 32%, transparent);
    outline-offset: 2px;
}

html[data-theme-preset="nexus"] :is(
    .theme-button,
    .logout-button,
    .secondary-button,
    .primary-button,
    .ai-button,
    .login-submit,
    input,
    select,
    textarea
) {
    border-radius: var(--theme-radius);
}

html[data-theme-preset="nexus"] :is(
    .admin-card,
    .admin-module-panel,
    .admin-users-list,
    .admin-user-editor,
    .settings-overview-card,
    .settings-workbench,
    .settings-language-card,
    .settings-toggle-card,
    .settings-module-card,
    .workspace-panel,
    .workspace-modal-card,
    .thread-panel,
    .task-card,
    .activity-item,
    .access-panel,
    .zeus-kb-grid form,
    .zeus-source-list
) {
    border-radius: var(--theme-radius-lg);
    box-shadow: var(--nexus-card-shadow);
}

/* Application header */
html[data-theme-preset="nexus"] :is(
    .app-header,
    .admin-header,
    .site-header
) {
    position: relative;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--nexus-header) 96%, transparent);
    background-image: none;
    box-shadow: 0 1px 0 rgba(17, 43, 63, 0.025);
    backdrop-filter: blur(16px);
}

html[data-theme-preset="nexus"] :is(
    .app-header,
    .admin-header,
    .site-header
)::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    pointer-events: none;
    background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #2d79a6), transparent 78%);
    content: "";
    opacity: 0.58;
}

html[data-theme-preset="nexus"] .app-header {
    padding-inline: 15px;
}

html[data-theme-preset="nexus"] .app-header :is(
    .brand strong,
    .brand span:not(.brand-mark),
    .header-user strong,
    .header-user span:not(.user-avatar)
) {
    color: var(--text);
}

html[data-theme-preset="nexus"] .app-header :is(
    .brand span:not(.brand-mark),
    .header-user span:not(.user-avatar)
) {
    opacity: 1;
    color: var(--text-muted);
}

html[data-theme-preset="nexus"] :is(
    .brand-mark,
    .brand-logo,
    .site-brand img,
    .platform-logo img
) {
    object-fit: contain;
    filter: none;
    mix-blend-mode: normal;
}

html[data-theme-preset="nexus"] :is(
    .brand-mark,
    .brand-logo,
    .site-brand img
) {
    border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 4px 13px rgba(10, 40, 58, 0.09);
}

html[data-theme-preset="nexus"] .platform-logo img {
    border: 0;
    background: transparent;
    box-shadow: none;
}

html[data-theme-preset="nexus"] .workspace-search-trigger {
    height: 34px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--theme-radius);
    background: var(--background);
    box-shadow: inset 0 1px 1px rgba(16, 43, 63, 0.025);
}

html[data-theme-preset="nexus"] .workspace-search-trigger:hover,
html[data-theme-preset="nexus"] .workspace-search-trigger:focus-visible {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface-secondary);
}

html[data-theme-preset="nexus"] .workspace-search-trigger kbd {
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    opacity: 1;
}

html[data-theme-preset="nexus"] .app-header-actions :is(
    .theme-button,
    .logout-button,
    .secondary-button,
    .language-switcher,
    select
) {
    min-height: 32px;
    color: var(--text-secondary);
    border-color: var(--border);
    background: var(--surface);
    box-shadow: none;
}

html[data-theme-preset="nexus"] .app-header-actions :is(
    .theme-button,
    .logout-button,
    .secondary-button
):hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface-secondary);
    transform: none;
}

html[data-theme-preset="nexus"] .app-header .header-user {
    border-left-color: var(--border);
}

html[data-theme-preset="nexus"] .user-avatar {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
    border-radius: 8px;
    background: linear-gradient(145deg, var(--accent-soft), var(--surface));
    color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 8%, transparent);
}

/* Primary navigation rail */
html[data-theme-preset="nexus"] .workspace-rail {
    color: #e8f1f5;
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    background: var(--nexus-rail);
    background-image:
        linear-gradient(180deg, rgba(54, 142, 150, 0.07), transparent 32%),
        linear-gradient(180deg, var(--nexus-rail), color-mix(in srgb, var(--nexus-rail) 88%, #000000));
    box-shadow: inset -1px 0 rgba(255, 255, 255, 0.025);
}

html[data-theme-preset="nexus"] .workspace-rail-button {
    color: rgba(232, 241, 245, 0.63);
    border-radius: 7px;
    transition: color 140ms ease, background 140ms ease, transform 140ms ease;
}

html[data-theme-preset="nexus"] .workspace-rail-button:hover {
    color: #ffffff;
    background: var(--nexus-rail-hover);
    transform: translateY(-1px);
}

html[data-theme-preset="nexus"] .workspace-rail-button.active {
    color: #ffffff;
    background: var(--nexus-rail-active);
    box-shadow: inset 0 0 0 1px rgba(116, 210, 215, 0.08);
}

html[data-theme-preset="nexus"] .workspace-rail-button.active::before {
    top: 12px;
    bottom: 12px;
    width: 3px;
    background: #63c8cc;
    box-shadow: 0 0 12px rgba(99, 200, 204, 0.42);
}

html[data-theme-preset="nexus"] .workspace-rail-icon {
    color: inherit;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.045);
}

html[data-theme-preset="nexus"] .workspace-rail-ai .workspace-rail-icon {
    color: #061c24;
    border-color: rgba(107, 212, 215, 0.3);
    background: linear-gradient(145deg, #6bd4d7, #3ba4ae);
    box-shadow: 0 6px 14px rgba(54, 174, 181, 0.18);
}

html[data-theme-preset="nexus"] .workspace-rail-avatar:not(.avatar-with-photo) {
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 7px;
    background: linear-gradient(145deg, #247987, #174a61);
}

html[data-theme-preset="nexus"] .workspace-rail-avatar.avatar-with-photo {
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 7px;
    background-color: var(--nexus-rail-hover);
}

html[data-theme-preset="nexus"] .workspace-rail-badge {
    border: 2px solid var(--nexus-rail);
    background: #d04a55;
    box-shadow: none;
}

/* Secondary workspace navigation */
html[data-theme-preset="nexus"] .app-body .sidebar {
    color: var(--text);
    border-right: 1px solid var(--border);
    background: var(--nexus-sidebar);
    background-image: none;
    box-shadow: inset -1px 0 rgba(16, 43, 63, 0.02);
}

html[data-theme-preset="nexus"] .app-body .sidebar .nav-heading {
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.15em;
}

html[data-theme-preset="nexus"] .app-body .sidebar :is(
    .nav-item,
    .conversation-list-item,
    .workspace-starred-item
) {
    min-height: 36px;
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    box-shadow: none;
    transform: none;
}

html[data-theme-preset="nexus"] .app-body .sidebar :is(
    .nav-item,
    .conversation-list-item,
    .workspace-starred-item
):hover {
    color: var(--text);
    border-color: color-mix(in srgb, var(--border) 78%, transparent);
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    box-shadow: 0 3px 10px rgba(16, 43, 63, 0.035);
    transform: none;
}

html[data-theme-preset="nexus"] .app-body .sidebar :is(
    .nav-item.active,
    .conversation-list-item.active
) {
    color: var(--text);
    border-color: color-mix(in srgb, var(--accent) 20%, var(--border));
    background: var(--surface);
    background-image: none;
    box-shadow: inset 3px 0 0 var(--accent), 0 3px 12px rgba(16, 43, 63, 0.045);
}

html[data-theme-preset="nexus"] .app-body .sidebar :is(
    .nav-item,
    .conversation-list-item
) span {
    color: inherit;
    opacity: 0.72;
}

html[data-theme-preset="nexus"] .app-body .sidebar :is(
    .nav-count,
    .workspace-conversation-unread
) {
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-secondary);
}

html[data-theme-preset="nexus"] .workspace-starred-section {
    border-bottom-color: var(--border);
}

/* Conversation workspace */
html[data-theme-preset="nexus"] .workspace {
    border: 0;
    background: var(--surface);
}

html[data-theme-preset="nexus"] .conversation-header {
    min-height: 72px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 97%, var(--accent-soft));
    box-shadow: 0 1px 0 rgba(16, 43, 63, 0.02);
}

html[data-theme-preset="nexus"] .conversation-header h1 {
    color: var(--text);
    font-size: 17px;
    font-weight: 780;
    letter-spacing: -0.018em;
}

html[data-theme-preset="nexus"] .conversation-header p {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 10px;
}

html[data-theme-preset="nexus"] .section-eyebrow {
    margin-bottom: 5px;
    color: var(--accent);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 0.15em;
}

html[data-theme-preset="nexus"] .conversation-favorite-button {
    width: 34px;
    height: 34px;
    border-color: var(--border);
    border-radius: 7px;
    background: var(--surface);
    box-shadow: none;
}

html[data-theme-preset="nexus"] .conversation-area {
    padding: 18px 24px 28px;
    background-color: var(--surface);
    background-image:
        linear-gradient(rgba(16, 51, 70, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(16, 51, 70, 0.018) 1px, transparent 1px);
    background-size: 32px 32px;
}

html[data-theme-preset="nexus"] .chat-message {
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
    transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

html[data-theme-preset="nexus"] .chat-message:hover {
    border-color: color-mix(in srgb, var(--border) 68%, transparent);
    background: color-mix(in srgb, var(--surface-secondary) 72%, transparent);
    box-shadow: 0 4px 14px rgba(16, 43, 63, 0.035);
}

html[data-theme-preset="nexus"] .chat-message::before {
    color: var(--accent);
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface-secondary);
}

html[data-theme-preset="nexus"] .chat-message.ai-message {
    border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
    border-left: 3px solid var(--accent);
    background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface));
    box-shadow: 0 5px 18px rgba(16, 78, 87, 0.05);
}

html[data-theme-preset="nexus"] .chat-message.ai-message:hover {
    background: color-mix(in srgb, var(--accent-soft) 62%, var(--surface));
}

html[data-theme-preset="nexus"] .chat-message.ai-message.is-generating {
    background-image: linear-gradient(110deg, var(--accent-soft), var(--surface-secondary));
    box-shadow: inset 3px 0 0 var(--accent), 0 7px 22px var(--theme-glow) !important;
}

html[data-theme-preset="nexus"] .chat-message header strong {
    color: var(--text);
    font-size: 12px;
}

html[data-theme-preset="nexus"] .chat-message header time {
    color: var(--text-muted);
    font-size: 9px;
}

html[data-theme-preset="nexus"] :is(
    .chat-message-body,
    .chat-message.own .chat-message-body,
    .chat-message.ai-message .chat-message-body
) {
    color: var(--text);
    font-size: 12px;
    line-height: 1.62;
}

html[data-theme-preset="nexus"] .message-actionbar {
    gap: 4px;
}

html[data-theme-preset="nexus"] :is(
    .message-action-button,
    .message-reaction-pill
) {
    min-height: 24px;
    color: var(--text-secondary);
    border-color: var(--border);
    border-radius: 5px;
    background: var(--surface);
    box-shadow: none;
}

html[data-theme-preset="nexus"] :is(
    .message-action-button,
    .message-reaction-pill
):hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface-secondary);
}

html[data-theme-preset="nexus"] .composer {
    min-height: 86px;
    padding: 9px 20px 13px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

html[data-theme-preset="nexus"] .composer textarea {
    min-height: 54px;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    background: var(--surface);
    box-shadow: 0 7px 22px rgba(16, 43, 63, 0.06);
}

html[data-theme-preset="nexus"] .composer textarea:focus {
    border-color: var(--accent);
    box-shadow:
        0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent),
        0 9px 26px rgba(16, 43, 63, 0.07);
}

/* Workspace panels, tasks, activity and dialogs */
html[data-theme-preset="nexus"] :is(
    .workspace-panel,
    .thread-panel,
    .workspace-modal-card
) {
    color: var(--text);
    border-color: var(--border);
    background: var(--surface);
}

html[data-theme-preset="nexus"] :is(
    .workspace-panel-header,
    .thread-panel-header,
    .workspace-modal-header
) {
    border-bottom-color: var(--border);
    background: color-mix(in srgb, var(--surface-secondary) 55%, var(--surface));
}

html[data-theme-preset="nexus"] :is(
    .activity-item,
    .task-card
) {
    color: var(--text);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 3px 14px rgba(16, 43, 63, 0.04);
}

html[data-theme-preset="nexus"] :is(
    .activity-item,
    .task-card
):hover {
    border-color: color-mix(in srgb, var(--accent) 24%, var(--border));
    background: color-mix(in srgb, var(--surface-secondary) 52%, var(--surface));
    transform: translateY(-1px);
}

html[data-theme-preset="nexus"] :is(
    .activity-filter-button,
    .activity-density-button,
    .activity-action-button,
    .task-status-select
) {
    color: var(--text-secondary);
    border-color: var(--border);
    border-radius: 6px;
    background: var(--surface);
}

/* Administration */
html[data-theme-preset="nexus"] .admin-body {
    background: var(--background);
}

html[data-theme-preset="nexus"] .admin-layout {
    background: var(--background);
}

html[data-theme-preset="nexus"] .admin-sidebar {
    color: rgba(235, 244, 247, 0.76);
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    background: var(--nexus-rail);
    background-image:
        linear-gradient(180deg, rgba(60, 155, 162, 0.06), transparent 28%),
        linear-gradient(180deg, var(--nexus-rail), color-mix(in srgb, var(--nexus-rail) 88%, #000000));
}

html[data-theme-preset="nexus"] .admin-sidebar .nav-heading {
    color: rgba(222, 237, 242, 0.38);
    font-size: 9px;
    letter-spacing: 0.16em;
}

html[data-theme-preset="nexus"] .admin-sidebar :is(
    .admin-menu-item,
    a.admin-menu-item
) {
    min-height: 38px;
    color: rgba(235, 244, 247, 0.68);
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    box-shadow: none;
    transition: color 130ms ease, border-color 130ms ease, background 130ms ease;
}

html[data-theme-preset="nexus"] .admin-sidebar :is(
    .admin-menu-item,
    a.admin-menu-item
):hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.06);
    background: var(--nexus-rail-hover);
    transform: none;
}

html[data-theme-preset="nexus"] .admin-sidebar :is(
    .admin-menu-item.active,
    a.admin-menu-item.active
) {
    color: #ffffff;
    border-color: rgba(110, 210, 214, 0.08);
    background: var(--nexus-rail-active);
    background-image: none;
    box-shadow: inset 3px 0 0 #63c8cc;
}

html[data-theme-preset="nexus"] .admin-workspace {
    color: var(--text);
    background: var(--background);
}

html[data-theme-preset="nexus"] .admin-titlebar {
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    box-shadow: 0 1px 0 rgba(16, 43, 63, 0.025);
}

html[data-theme-preset="nexus"] .admin-titlebar h1 {
    color: var(--text);
    font-size: 21px;
    letter-spacing: -0.025em;
}

html[data-theme-preset="nexus"] .admin-titlebar p {
    color: var(--text-muted);
}

html[data-theme-preset="nexus"] .admin-stats {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--theme-radius-lg);
    background: var(--surface);
    box-shadow: var(--nexus-card-shadow);
}

html[data-theme-preset="nexus"] .admin-stats > div {
    border-color: var(--border);
    background: transparent;
}

html[data-theme-preset="nexus"] :is(
    .admin-card,
    .admin-module-panel,
    .admin-users-list,
    .admin-user-editor
) {
    color: var(--text);
    border: 1px solid var(--border);
    background: var(--surface);
}

html[data-theme-preset="nexus"] :is(
    .admin-panel-header,
    .admin-module-panel .admin-panel-header
) {
    border-bottom-color: var(--border);
    background: color-mix(in srgb, var(--surface-secondary) 55%, var(--surface));
}

html[data-theme-preset="nexus"] :is(
    .admin-user-table,
    .admin-data-table,
    .zeus-source-list table
) {
    color: var(--text);
    border-color: var(--border);
    background: var(--surface);
}

html[data-theme-preset="nexus"] :is(
    .admin-user-table,
    .admin-data-table,
    .zeus-source-list table
) th {
    color: var(--text-muted);
    border-color: var(--border);
    background: var(--surface-secondary);
    font-size: 9px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

html[data-theme-preset="nexus"] :is(
    .admin-user-table,
    .admin-data-table,
    .zeus-source-list table
) td {
    color: var(--text-secondary);
    border-color: var(--border);
}

html[data-theme-preset="nexus"] :is(
    .admin-user-table,
    .admin-data-table,
    .zeus-source-list table
) tbody tr:hover {
    background: color-mix(in srgb, var(--surface-secondary) 68%, transparent);
}

html[data-theme-preset="nexus"] :is(
    .admin-user-table tbody tr.selected,
    .admin-data-table tbody tr.selected
) {
    background: color-mix(in srgb, var(--accent-soft) 54%, var(--surface));
}

html[data-theme-preset="nexus"] :is(
    .admin-form-section,
    .admin-selected-user-identity
) {
    border-color: var(--border);
    border-radius: var(--theme-radius);
    background: color-mix(in srgb, var(--surface-secondary) 60%, var(--surface));
}

/* Settings */
html[data-theme-preset="nexus"] .settings-shell {
    max-width: 1560px;
}

html[data-theme-preset="nexus"] .settings-overview-card {
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
}

html[data-theme-preset="nexus"] .settings-overview-card::before {
    width: 3px;
    background: var(--accent);
}

html[data-theme-preset="nexus"] .settings-workbench {
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
}

html[data-theme-preset="nexus"] .settings-tabs {
    border-right: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface-secondary) 70%, var(--surface));
}

html[data-theme-preset="nexus"] .settings-tab {
    min-height: 48px;
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    box-shadow: none;
    transform: none;
}

html[data-theme-preset="nexus"] .settings-tab:hover {
    color: var(--text);
    border-color: var(--border);
    background: var(--surface);
    transform: none;
}

html[data-theme-preset="nexus"] .settings-tab.is-active {
    color: var(--text);
    border-color: color-mix(in srgb, var(--accent) 22%, var(--border));
    background: var(--surface);
    background-image: none;
    box-shadow: inset 3px 0 0 var(--accent), 0 4px 14px rgba(16, 43, 63, 0.04);
}

html[data-theme-preset="nexus"] .settings-panel {
    background: var(--surface);
}

html[data-theme-preset="nexus"] .settings-theme-studio {
    border-color: var(--border);
    border-radius: var(--theme-radius-lg);
    background: color-mix(in srgb, var(--surface-secondary) 62%, var(--surface));
}

html[data-theme-preset="nexus"] .settings-theme-card {
    min-height: 168px;
    color: var(--text);
    border-color: var(--border);
    border-radius: var(--theme-radius-lg);
    background: var(--surface);
    box-shadow: 0 3px 14px rgba(16, 43, 63, 0.035);
}

html[data-theme-preset="nexus"] .settings-theme-card:hover,
html[data-theme-preset="nexus"] .settings-theme-card:focus-visible {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
    box-shadow: 0 8px 24px var(--theme-glow);
    transform: translateY(-1px);
}

html[data-theme-preset="nexus"] .settings-theme-card.is-active {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent), 0 8px 24px var(--theme-glow);
}

html[data-theme-preset="nexus"] :is(
    .settings-language-card,
    .settings-toggle-card,
    .settings-module-card
) {
    color: var(--text);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 3px 14px rgba(16, 43, 63, 0.035);
}

/* Zeus, HR and document surfaces */
html[data-theme-preset="nexus"] :is(
    .zeus-settings-main > form,
    .zeus-kb-grid form,
    .zeus-source-list,
    .admin-module-panel,
    .hr-admin-empty,
    .profile-summary,
    .document-card
) {
    color: var(--text);
    border-color: var(--border);
    background: var(--surface);
}

html[data-theme-preset="nexus"] :is(
    .hr-document-view,
    .hr-document-download,
    .hr-document-delete,
    .zeus-source-delete-button
) {
    border-radius: 6px;
    box-shadow: none;
}

html[data-theme-preset="nexus"] :is(
    .hr-document-view,
    .hr-document-download
) {
    color: var(--text-secondary);
    border-color: var(--border);
    background: var(--surface);
}

/* Login */
html[data-theme-preset="nexus"] .professional-login {
    color: var(--text);
    background-color: var(--background);
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
        radial-gradient(circle at 8% 78%, var(--theme-glow), transparent 30%),
        radial-gradient(circle at 92% 12%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 25%);
    background-size: 32px 32px, 32px 32px, auto, auto;
}

html[data-theme-preset="nexus"] .site-header {
    min-height: 60px;
    height: 60px;
}

html[data-theme-preset="nexus"] .site-brand-copy strong {
    color: var(--text);
}

html[data-theme-preset="nexus"] .site-brand-copy small {
    color: var(--text-muted);
}

html[data-theme-preset="nexus"] .platform-overview h1 {
    color: var(--text);
    font-weight: 760;
    letter-spacing: -0.045em;
}

html[data-theme-preset="nexus"] .platform-overview h1 span,
html[data-theme-preset="nexus"] .eyebrow,
html[data-theme-preset="nexus"] .capability-number {
    color: var(--accent);
}

html[data-theme-preset="nexus"] .platform-summary,
html[data-theme-preset="nexus"] .capability p {
    color: var(--text-secondary);
}

html[data-theme-preset="nexus"] .platform-capabilities {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--theme-radius-lg);
    background: color-mix(in srgb, var(--surface) 76%, transparent);
    box-shadow: 0 8px 24px rgba(16, 43, 63, 0.04);
}

html[data-theme-preset="nexus"] .capability {
    border-color: var(--border);
    background: transparent;
}

html[data-theme-preset="nexus"] .access-panel {
    color: var(--text);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    background: color-mix(in srgb, var(--surface) 97%, var(--accent-soft));
}

html[data-theme-preset="nexus"] .form-field input {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface);
}

html[data-theme-preset="nexus"] .form-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

html[data-theme-preset="nexus"] :is(
    .primary-button,
    .ai-button,
    .login-submit
) {
    color: var(--nexus-button-text);
    border-color: var(--accent);
    background: var(--accent);
    background-image: linear-gradient(135deg, var(--accent), var(--accent-hover));
    box-shadow: 0 7px 18px var(--theme-glow);
}

html[data-theme-preset="nexus"] :is(
    .primary-button,
    .ai-button,
    .login-submit
):hover {
    color: var(--nexus-button-text);
    border-color: var(--accent-hover);
    background: var(--accent-hover);
    box-shadow: 0 10px 24px var(--theme-glow);
    transform: translateY(-1px);
}

/* Settings preview for Nexus */
.settings-theme-preview.is-nexus {
    border-color: #b9c9d4;
    border-radius: 8px;
    background: #eef2f6;
}

.settings-theme-preview.is-nexus::before {
    background: #ffffff;
    box-shadow: inset 7px 0 #071826, inset 10px 0 #0a7b82;
}

.settings-theme-preview.is-nexus i {
    background: linear-gradient(180deg, #f3f6f8, #e4ebf0);
}

.settings-theme-preview.is-nexus b {
    background: #0a7b82;
}

.settings-theme-preview.is-nexus em {
    background: #7db9bd;
}

/* Density and accessibility */
html[data-theme-preset="nexus"][data-density="compact"] .conversation-header {
    min-height: 62px;
    padding-block: 9px;
}

html[data-theme-preset="nexus"][data-density="compact"] .chat-message {
    padding-block: 7px;
}

html[data-theme-preset="nexus"][data-density="compact"] .admin-sidebar :is(
    .admin-menu-item,
    a.admin-menu-item
) {
    min-height: 34px;
}

html[data-theme-preset="nexus"][data-reduce-motion="true"] *,
html[data-theme-preset="nexus"][data-reduce-motion="true"] *::before,
html[data-theme-preset="nexus"][data-reduce-motion="true"] *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
}

/* ==========================================================
   NEXUS COLOR SKIN
   Selector cromatic izolat, inspirat din referința furnizată.
   ========================================================== */

html[data-theme-preset="nexus"][data-theme="light"][data-nexus-skin="green"] {
    --accent: #15803d;
    --accent-hover: #166534;
    --accent-soft: #dcfce7;
    --theme-glow: rgba(21, 128, 61, 0.20);
    --nexus-button-text: #ffffff;
    --nexus-header-aura: rgba(34, 197, 94, 0.10);
}

html[data-theme-preset="nexus"][data-theme="dark"][data-nexus-skin="green"] {
    --accent: #4ade80;
    --accent-hover: #86efac;
    --accent-soft: #123b26;
    --theme-glow: rgba(74, 222, 128, 0.24);
    --nexus-button-text: #052e16;
    --nexus-header-aura: rgba(74, 222, 128, 0.11);
}

html[data-theme-preset="nexus"][data-theme="light"][data-nexus-skin="lime"] {
    --accent: #4d7c0f;
    --accent-hover: #3f6212;
    --accent-soft: #ecfccb;
    --theme-glow: rgba(101, 163, 13, 0.20);
    --nexus-button-text: #ffffff;
    --nexus-header-aura: rgba(132, 204, 22, 0.11);
}

html[data-theme-preset="nexus"][data-theme="dark"][data-nexus-skin="lime"] {
    --accent: #a3e635;
    --accent-hover: #bef264;
    --accent-soft: #2d3e11;
    --theme-glow: rgba(163, 230, 53, 0.23);
    --nexus-button-text: #1a2e05;
    --nexus-header-aura: rgba(163, 230, 53, 0.11);
}

html[data-theme-preset="nexus"][data-theme="light"][data-nexus-skin="navy"] {
    --accent: #174a84;
    --accent-hover: #123b6a;
    --accent-soft: #dce9f8;
    --theme-glow: rgba(23, 74, 132, 0.21);
    --nexus-button-text: #ffffff;
    --nexus-header-aura: rgba(23, 74, 132, 0.10);
}

html[data-theme-preset="nexus"][data-theme="dark"][data-nexus-skin="navy"] {
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --accent-soft: #172f4e;
    --theme-glow: rgba(96, 165, 250, 0.24);
    --nexus-button-text: #082f49;
    --nexus-header-aura: rgba(96, 165, 250, 0.11);
}

html[data-theme-preset="nexus"][data-theme="light"][data-nexus-skin="blue"] {
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: #dbeafe;
    --theme-glow: rgba(37, 99, 235, 0.21);
    --nexus-button-text: #ffffff;
    --nexus-header-aura: rgba(37, 99, 235, 0.10);
}

html[data-theme-preset="nexus"][data-theme="dark"][data-nexus-skin="blue"] {
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --accent-soft: #172f4e;
    --theme-glow: rgba(96, 165, 250, 0.24);
    --nexus-button-text: #082f49;
    --nexus-header-aura: rgba(96, 165, 250, 0.11);
}

html[data-theme-preset="nexus"][data-theme="light"][data-nexus-skin="orange"] {
    --accent: #c2410c;
    --accent-hover: #9a3412;
    --accent-soft: #ffedd5;
    --theme-glow: rgba(234, 88, 12, 0.20);
    --nexus-button-text: #ffffff;
    --nexus-header-aura: rgba(249, 115, 22, 0.11);
}

html[data-theme-preset="nexus"][data-theme="dark"][data-nexus-skin="orange"] {
    --accent: #fb923c;
    --accent-hover: #fdba74;
    --accent-soft: #48200e;
    --theme-glow: rgba(251, 146, 60, 0.24);
    --nexus-button-text: #431407;
    --nexus-header-aura: rgba(251, 146, 60, 0.11);
}

html[data-theme-preset="nexus"][data-theme="light"][data-nexus-skin="red"] {
    --accent: #dc2626;
    --accent-hover: #b91c1c;
    --accent-soft: #fee2e2;
    --theme-glow: rgba(220, 38, 38, 0.20);
    --nexus-button-text: #ffffff;
    --nexus-header-aura: rgba(239, 68, 68, 0.10);
}

html[data-theme-preset="nexus"][data-theme="dark"][data-nexus-skin="red"] {
    --accent: #f87171;
    --accent-hover: #fca5a5;
    --accent-soft: #481a1a;
    --theme-glow: rgba(248, 113, 113, 0.24);
    --nexus-button-text: #450a0a;
    --nexus-header-aura: rgba(248, 113, 113, 0.11);
}

html[data-theme-preset="nexus"][data-theme="light"][data-nexus-skin="violet"] {
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-soft: #ede9fe;
    --theme-glow: rgba(124, 58, 237, 0.21);
    --nexus-button-text: #ffffff;
    --nexus-header-aura: rgba(139, 92, 246, 0.10);
}

html[data-theme-preset="nexus"][data-theme="dark"][data-nexus-skin="violet"] {
    --accent: #a78bfa;
    --accent-hover: #c4b5fd;
    --accent-soft: #312252;
    --theme-glow: rgba(167, 139, 250, 0.24);
    --nexus-button-text: #2e1065;
    --nexus-header-aura: rgba(167, 139, 250, 0.11);
}

html[data-theme-preset="nexus"][data-theme="light"][data-nexus-skin="cyan"] {
    --accent: #0f766e;
    --accent-hover: #115e59;
    --accent-soft: #ccfbf1;
    --theme-glow: rgba(13, 148, 136, 0.20);
    --nexus-button-text: #ffffff;
    --nexus-header-aura: rgba(20, 184, 166, 0.10);
}

html[data-theme-preset="nexus"][data-theme="dark"][data-nexus-skin="cyan"] {
    --accent: #2dd4bf;
    --accent-hover: #5eead4;
    --accent-soft: #123c39;
    --theme-glow: rgba(45, 212, 191, 0.24);
    --nexus-button-text: #042f2e;
    --nexus-header-aura: rgba(45, 212, 191, 0.11);
}

html[data-theme-preset="nexus"] .nexus-skin-picker {
    position: fixed;
    top: 50%;
    left: 0;
    z-index: 850;
    display: flex;
    align-items: center;
    width: max-content;
    font-family: inherit;
    transform: translate3d(-160px, -50%, 0);
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme-preset="nexus"] .nexus-skin-picker[hidden] {
    display: none !important;
}

html[data-theme-preset="nexus"] .nexus-skin-picker.is-open {
    transform: translate3d(0, -50%, 0);
}

html[data-theme-preset="nexus"] .nexus-skin-panel {
    box-sizing: border-box;
    width: 160px;
    min-height: 126px;
    padding: 15px 13px 14px;
    color: var(--text);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
    border-left: 0;
    border-radius: 0 16px 16px 0;
    box-shadow: 0 18px 46px rgba(15, 39, 64, 0.18);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

html[data-theme-preset="nexus"] .nexus-skin-panel h2 {
    margin: 0 0 10px;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0.01em;
}

html[data-theme-preset="nexus"] .nexus-skin-palette {
    display: grid;
    grid-template-columns: repeat(4, 28px);
    gap: 10px 8px;
    width: max-content;
}

html[data-theme-preset="nexus"] .nexus-skin-swatch {
    position: relative;
    box-sizing: border-box;
    display: block;
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    background: var(--nexus-swatch-color);
    border: 2px solid color-mix(in srgb, var(--surface) 92%, white);
    border-radius: 8px;
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--nexus-swatch-color) 42%, var(--border)),
        0 4px 10px color-mix(in srgb, var(--nexus-swatch-color) 24%, transparent);
    transition:
        transform 150ms ease,
        box-shadow 150ms ease;
    appearance: none;
}

html[data-theme-preset="nexus"] .nexus-skin-swatch:hover {
    transform: translateY(-2px) scale(1.04);
}

html[data-theme-preset="nexus"] .nexus-skin-swatch:focus-visible {
    outline: 3px solid var(--text);
    outline-offset: 3px;
}

html[data-theme-preset="nexus"] .nexus-skin-swatch.is-selected {
    box-shadow:
        0 0 0 2px var(--surface),
        0 0 0 4px var(--text),
        0 6px 14px color-mix(in srgb, var(--nexus-swatch-color) 28%, transparent);
}

html[data-theme-preset="nexus"] .nexus-skin-swatch.is-selected::after {
    position: absolute;
    inset: 0;
    display: grid;
    color: #ffffff;
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
    content: "✓";
    place-items: center;
}

html[data-theme-preset="nexus"] .nexus-skin-swatch.is-green {
    --nexus-swatch-color: #16a34a;
}

html[data-theme-preset="nexus"] .nexus-skin-swatch.is-lime {
    --nexus-swatch-color: #84c341;
}

html[data-theme-preset="nexus"] .nexus-skin-swatch.is-navy {
    --nexus-swatch-color: #174a84;
}

html[data-theme-preset="nexus"] .nexus-skin-swatch.is-blue {
    --nexus-swatch-color: #2f6fed;
}

html[data-theme-preset="nexus"] .nexus-skin-swatch.is-orange {
    --nexus-swatch-color: #f59e0b;
}

html[data-theme-preset="nexus"] .nexus-skin-swatch.is-red {
    --nexus-swatch-color: #f2444e;
}

html[data-theme-preset="nexus"] .nexus-skin-swatch.is-violet {
    --nexus-swatch-color: #7c5ce7;
}

html[data-theme-preset="nexus"] .nexus-skin-swatch.is-cyan {
    --nexus-swatch-color: #14b8b1;
}

html[data-theme-preset="nexus"] .nexus-skin-toggle {
    box-sizing: border-box;
    display: grid;
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    color: var(--accent);
    cursor: pointer;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
    border-left: 0;
    border-radius: 0 999px 999px 0;
    box-shadow: 10px 12px 30px rgba(15, 39, 64, 0.14);
    place-items: center;
    appearance: none;
}

html[data-theme-preset="nexus"] .nexus-skin-toggle svg {
    display: block;
    fill: currentColor;
    transition: transform 220ms ease;
}

html[data-theme-preset="nexus"] .nexus-skin-picker.is-open .nexus-skin-toggle svg {
    transform: rotate(36deg);
}

html[data-theme-preset="nexus"] .nexus-skin-toggle:hover {
    color: var(--accent-hover);
    background: var(--surface-secondary);
}

html[data-theme-preset="nexus"] .nexus-skin-toggle:focus-visible {
    outline: 3px solid var(--accent-soft);
    outline-offset: 3px;
}

html[data-theme-preset="nexus"][data-theme="dark"] .nexus-skin-panel,
html[data-theme-preset="nexus"][data-theme="dark"] .nexus-skin-toggle {
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.38);
}

@supports not (color: color-mix(in srgb, white, black)) {
    html[data-theme-preset="nexus"] .nexus-skin-panel,
    html[data-theme-preset="nexus"] .nexus-skin-toggle {
        background: var(--surface);
        border-color: var(--border);
    }

    html[data-theme-preset="nexus"] .nexus-skin-swatch {
        border-color: var(--surface);
    }
}

@media (max-width: 680px) {
    html[data-theme-preset="nexus"] .nexus-skin-picker {
        top: auto;
        bottom: calc(84px + env(safe-area-inset-bottom, 0px));
        transform: translate3d(-160px, 0, 0);
    }

    html[data-theme-preset="nexus"] .nexus-skin-picker.is-open {
        transform: translate3d(0, 0, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    html[data-theme-preset="nexus"] .nexus-skin-picker,
    html[data-theme-preset="nexus"] .nexus-skin-swatch,
    html[data-theme-preset="nexus"] .nexus-skin-toggle svg {
        transition: none;
    }
}

@media (forced-colors: active) {
    html[data-theme-preset="nexus"] .nexus-skin-panel,
    html[data-theme-preset="nexus"] .nexus-skin-toggle,
    html[data-theme-preset="nexus"] .nexus-skin-swatch {
        forced-color-adjust: auto;
    }
}

@media (max-width: 1180px) {
    html[data-theme-preset="nexus"] .app-header {
        padding-inline: 11px;
    }

    html[data-theme-preset="nexus"] .conversation-area {
        padding-inline: 18px;
    }

    html[data-theme-preset="nexus"] .admin-workspace {
        padding-inline: 20px;
    }
}

@media (max-width: 900px) {
    html[data-theme-preset="nexus"] .app-body .sidebar {
        background: var(--surface);
        box-shadow: 18px 0 46px rgba(3, 17, 27, 0.22);
    }

    html[data-theme-preset="nexus"] .conversation-header {
        padding: 11px 15px;
    }

    html[data-theme-preset="nexus"] .conversation-area {
        padding: 14px 12px 22px;
    }

    html[data-theme-preset="nexus"] .composer {
        padding-inline: 12px;
    }

    html[data-theme-preset="nexus"] .settings-tabs {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
}

@media (max-width: 680px) {
    html[data-theme-preset="nexus"] .site-header {
        padding-inline: 14px;
    }

    html[data-theme-preset="nexus"] .platform-capabilities {
        border-radius: 8px;
    }

    html[data-theme-preset="nexus"] .conversation-header h1 {
        font-size: 15px;
    }

    html[data-theme-preset="nexus"] .chat-message {
        padding-right: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html[data-theme-preset="nexus"] *,
    html[data-theme-preset="nexus"] *::before,
    html[data-theme-preset="nexus"] *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
