:root {
    --ink: #0b0c0b;
    --cream: #101110;
    --gold: #bc9143;
    --line: #2c2e2a;
    --muted: #929087;
    --ui-canvas: #101110;
    --ui-panel: #151614;
    --ui-panel-muted: #1b1c19;
    --ui-ink: #f1eee7;
    --ui-ink-soft: #d1cdc3;
    --ui-muted: #929087;
    --ui-accent: #bc9143;
    --ui-accent-strong: #d0aa61;
    --ui-accent-soft: #2a2418;
    --ui-border: #2c2e2a;
    --ui-danger: #df7e73;
    --ui-warning: #d5a252;
    --ui-success: #78a990;
    --ui-radius-sm: 10px;
    --ui-radius: 16px;
    --ui-radius-lg: 22px;
    --ui-shadow: 0 16px 48px rgba(16, 24, 40, .07);
    --ui-shadow-hover: 0 20px 55px rgba(16, 24, 40, .12);
}

body {
    background: radial-gradient(circle at 92% 4%, #ecebff 0, var(--ui-canvas) 30%, var(--ui-canvas) 100%);
    color: var(--ui-ink);
}

.settings {
    margin: 0 auto;
    max-width: 1180px;
    padding: 48px 32px 96px;
    width: 100%;
}

.page-header {
    align-items: end;
    display: grid;
    gap: 32px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin: 0 0 34px;
}

.page-header-main {
    min-width: 0;
}

.page-back {
    align-items: center;
    color: var(--ui-muted);
    display: inline-flex;
    font-size: 13px;
    font-weight: 700;
    gap: 8px;
    margin-bottom: 32px;
    transition: color .18s ease, transform .18s ease;
}

.page-back:hover {
    color: var(--ui-accent-strong);
    transform: translateX(-2px);
}

.page-header .eyebrow,
.settings > .eyebrow,
.agent-hero .eyebrow {
    color: var(--ui-accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .18em;
    margin: 0 0 10px;
}

.page-header h1,
.settings > h1,
.settings-hero h1,
.agent-hero h1 {
    color: var(--ui-ink);
    font: 700 clamp(40px, 5vw, 64px)/1 'DM Sans', sans-serif;
    letter-spacing: -.055em;
    margin: 0;
    text-wrap: balance;
}

.page-description,
.settings > .muted,
.agent-hero p {
    color: var(--ui-muted);
    font-size: 15px;
    line-height: 1.65;
    margin: 16px 0 0;
    max-width: 760px;
}

.page-header-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.page-header-actions a,
.page-header-actions button {
    white-space: nowrap;
}

.settings button,
.settings .new-chat,
.page-header-actions a {
    border-radius: var(--ui-radius-sm);
    font-weight: 750;
    min-height: 42px;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
}

.settings button:hover,
.page-header-actions a:hover {
    box-shadow: 0 8px 22px rgba(16, 24, 40, .12);
    transform: translateY(-1px);
}

.settings input,
.settings textarea,
.settings select {
    background: var(--ui-panel);
    border-color: var(--ui-border);
    border-radius: var(--ui-radius-sm);
    min-height: 45px;
}

.settings textarea {
    line-height: 1.55;
}

.settings input:focus,
.settings textarea:focus,
.settings select:focus {
    border-color: var(--ui-accent);
    box-shadow: 0 0 0 4px rgba(99, 91, 255, .13);
}

.settings-form,
.settings-card,
.action-card,
.action-create,
.calendar-day,
.contact-card,
.contact-create,
.draft-card,
.draft-create,
.workspace-card,
.workspace-section,
.search-group,
.history-list,
.profile-section,
.profile-save,
.relationship-upcoming,
.relationship-create,
.relationship-card,
.knowledge-starter,
.memory-card,
.improvement-principles > div,
.improvement-roadmap,
.waiting-card,
.invoice-card {
    border-color: var(--ui-border);
    border-radius: var(--ui-radius);
}

.settings-form,
.action-card,
.calendar-day,
.contact-card,
.draft-card,
.workspace-card,
.workspace-section,
.search-group,
.profile-section,
.relationship-upcoming,
.relationship-create,
.relationship-card,
.knowledge-starter,
.memory-card,
.waiting-card,
.invoice-card {
    background: var(--ui-panel);
    box-shadow: 0 1px 0 rgba(16, 24, 40, .02), var(--ui-shadow);
}

.workspace-card,
.search-result,
.calendar-event,
.history-row,
.waiting-card,
.invoice-card {
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.workspace-card:hover,
.search-result:hover,
.waiting-card:hover,
.invoice-card:hover {
    border-color: #b9b5ff;
    box-shadow: var(--ui-shadow-hover);
    transform: translateY(-2px);
}

.settings h2,
.settings h3 {
    color: var(--ui-ink);
}

.settings section > h2,
.queue-heading h2,
.follow-up-heading h2 {
    font-family: 'DM Sans', sans-serif;
    font-weight: 750;
    letter-spacing: -.02em;
}

.action-tabs,
.knowledge-nav,
.settings-nav {
    background: rgba(255, 255, 255, .72);
    border: 1px solid var(--ui-border);
    border-radius: 999px;
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding: 6px;
    scrollbar-width: none;
}

.action-tabs::-webkit-scrollbar,
.knowledge-nav::-webkit-scrollbar,
.settings-nav::-webkit-scrollbar {
    display: none;
}

.action-tabs a,
.knowledge-nav a,
.settings-nav a {
    border: 0;
    border-radius: 999px;
    color: var(--ui-muted);
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 750;
    padding: 10px 15px;
    white-space: nowrap;
}

.action-tabs a.active,
.action-tabs a:hover,
.knowledge-nav a.active,
.knowledge-nav a:hover,
.settings-nav a:hover {
    background: linear-gradient(135deg, #756dff, #584ff0);
    color: #fff;
}

.action-tabs a span {
    background: var(--ui-accent-soft);
    color: var(--ui-accent-strong);
}

.action-tabs a.active span {
    background: rgba(255, 255, 255, .15);
    color: #fff;
}

.notice {
    background: #edf5f0;
    border-color: #bfd3c8;
    border-radius: var(--ui-radius-sm);
    color: #385c4c;
    line-height: 1.5;
    padding: 14px 16px;
}

.settings-hero-status,
.improvement-roadmap,
.home-priority {
    background-color: var(--ink);
}

.donna-sidebar .history p,
.donna-sidebar .sidebar-footer,
.donna-sidebar .sidebar-footer form,
.donna-sidebar .sidebar-footer button {
    background-color: transparent !important;
}

.donna-sidebar .sidebar-footer button {
    border-color: rgba(255, 255, 255, .1) !important;
    box-shadow: none;
}

.settings-hero-status {
    background: radial-gradient(circle at 85% 10%, rgba(123, 113, 255, .42), transparent 42%), #0b1020;
    border: 1px solid rgba(117, 109, 255, .32);
    box-shadow: 0 18px 44px rgba(11, 16, 32, .18);
}

.settings-card-heading h2,
.sources-heading h2,
.agent-hero h1,
.agent-kpis strong,
.invoice-money strong {
    font-family: 'DM Sans', sans-serif;
    letter-spacing: -.035em;
}

.text-link,
.action-meta a,
.queue-heading-actions a,
.attention-summary a,
.priority-heading a {
    color: var(--ui-accent-strong);
}

.secondary-button {
    background: #f4f3ff !important;
    border-color: #dedcff !important;
}

.secondary-button:hover {
    border-color: #aaa5ff !important;
}

.login-shell {
    background:
        radial-gradient(circle at 18% 20%, rgba(117, 109, 255, .22), transparent 30%),
        radial-gradient(circle at 86% 78%, rgba(88, 79, 240, .13), transparent 28%),
        #f5f7fb;
    min-height: 100vh;
    overflow: hidden;
    padding: 40px;
    position: relative;
}

.login-shell::before {
    border: 1px solid rgba(99, 91, 255, .14);
    border-radius: 50%;
    content: '';
    height: min(66vw, 820px);
    left: -22vw;
    position: absolute;
    top: -36vw;
    width: min(66vw, 820px);
}

.login-card {
    background: rgba(255, 255, 255, .9);
    border: 1px solid rgba(226, 231, 240, .92);
    border-radius: 24px;
    box-shadow: 0 28px 90px rgba(16, 24, 40, .14);
    padding: 48px;
    position: relative;
    width: min(460px, 100%);
}

.login-card .mark {
    background: linear-gradient(145deg, #766fff, #4f46e5);
    border: 0;
    box-shadow: 0 12px 28px rgba(99, 91, 255, .24);
    color: #fff;
    font-family: 'DM Sans', sans-serif;
    font-size: 22px;
    font-weight: 800;
}

.login-card h1 {
    color: var(--ui-ink);
    font: 700 40px/1.05 'DM Sans', sans-serif;
    letter-spacing: -.05em;
    margin: 18px 0 10px;
}

.login-card .stack {
    margin-top: 30px;
}

.login-card button {
    background: linear-gradient(135deg, #756dff, #584ff0);
    border-radius: var(--ui-radius-sm);
    box-shadow: 0 12px 28px rgba(99, 91, 255, .24);
    font-weight: 800;
}

.notice.error {
    background: #fbefee;
    border-color: #e4c3bf;
    color: var(--ui-danger);
}

.settings details > summary {
    border-radius: var(--ui-radius-sm);
}

.settings table {
    border-color: var(--ui-border);
    border-radius: var(--ui-radius);
    overflow: hidden;
}

.settings hr {
    border: 0;
    border-top: 1px solid var(--ui-border);
}

@media (max-width: 900px) {
    .settings {
        padding: 34px 24px 88px;
    }

    .page-header {
        align-items: start;
        grid-template-columns: 1fr;
    }

    .page-header-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 760px) {
    .settings {
        padding: 26px 16px 104px;
    }

    .page-header {
        gap: 20px;
        margin-bottom: 25px;
    }

    .page-back {
        margin-bottom: 24px;
    }

    .page-header h1,
    .settings > h1,
    .settings-hero h1,
    .agent-hero h1 {
        font-size: clamp(36px, 11vw, 50px);
    }

    .page-description,
    .settings > .muted {
        font-size: 14px;
        line-height: 1.55;
    }

    .action-tabs,
    .knowledge-nav,
    .settings-nav {
        border-radius: 14px;
        margin-left: -4px;
        margin-right: -4px;
    }

    .settings-form,
    .profile-section {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .page-header-actions,
    .page-header-actions a,
    .page-header-actions button {
        width: 100%;
    }

    .page-header-actions a,
    .page-header-actions button {
        justify-content: center;
        text-align: center;
    }

    .login-shell {
        padding: 18px;
    }

    .login-card {
        border-radius: 20px;
        padding: 30px 24px;
    }

    .login-card h1 {
        font-size: 34px;
    }
}

/*
 * Système visuel Donna.
 * La home n'est plus une exception : graphite, ivoire et laiton deviennent
 * le langage commun de toutes les surfaces de travail.
 */
html {
    background: #0a0b0a;
    color-scheme: dark;
}

body {
    background: #101110;
    color: var(--ui-ink);
}

::selection {
    background: rgba(188, 145, 67, .35);
    color: #fff;
}

body:not(.is-donna-home) .app-shell {
    background: #101110;
    grid-template-columns: 248px minmax(0, 1fr);
}

body:not(.is-donna-home) .app-content {
    background: #101110;
}

body:not(.is-donna-home) .donna-sidebar {
    background: #090a09;
    border-right: 1px solid #272924;
    padding: 26px 20px;
    width: 248px;
}

.donna-sidebar .brand {
    color: #f2eee5;
    font-size: 18px;
}

.donna-sidebar .brand small,
.donna-sidebar .sidebar-section p,
.donna-sidebar .history p {
    color: #77766f;
}

.donna-sidebar .mark,
.login-card .mark {
    background: transparent;
    border: 1px solid #806b41;
    box-shadow: none;
    color: #c89c4d;
}

.donna-sidebar .new-chat {
    background: #171815 !important;
    border: 1px solid #4b402a;
    border-radius: 10px;
    color: #e6d2a6 !important;
    font-weight: 700;
}

.donna-sidebar .new-chat:hover {
    background: #201c14 !important;
    border-color: #8f7138;
}

.donna-sidebar .temporary-chat-button,
.donna-sidebar .sidebar-footer button {
    background: transparent !important;
    border-color: #292b27 !important;
    color: #9d9a92 !important;
}

.donna-sidebar .temporary-chat-button:hover,
.donna-sidebar .sidebar-footer button:hover {
    border-color: #5d5138 !important;
    color: #f1eee7 !important;
}

.donna-sidebar .sidebar-link {
    border-radius: 8px;
    color: #aaa79f;
}

.donna-sidebar .sidebar-link span {
    color: #8e7749;
}

.donna-sidebar .sidebar-link:hover {
    background: #151613;
    border-color: #292b27;
    color: #f2eee5;
}

.donna-sidebar .sidebar-link.active {
    background: #1d1b15;
    border-color: #51452e;
    color: #ead8b0;
}

.donna-sidebar .sidebar-link.active span,
.donna-sidebar .history-all {
    color: #bc9143;
}

.donna-sidebar .history,
.donna-sidebar .sidebar-footer {
    border-color: #272924 !important;
}

.donna-sidebar .history a {
    color: #85837c;
}

.donna-sidebar .history a:hover,
.donna-sidebar .history a.active {
    background: #171815;
    color: #e9e5dc;
}

body:not(.is-donna-home) .settings {
    color: var(--ui-ink);
    max-width: 1220px;
    padding-top: 44px;
}

.page-back {
    color: #77766f;
}

.page-back:hover,
.text-link,
.action-meta a,
.queue-heading-actions a,
.attention-summary a,
.priority-heading a {
    color: var(--ui-accent-strong);
}

.page-header {
    border-bottom: 1px solid #272924;
    padding-bottom: 30px;
}

.page-header .eyebrow,
.settings > .eyebrow,
.agent-hero .eyebrow,
.eyebrow {
    color: var(--ui-accent);
}

.page-header h1,
.settings > h1,
.settings-hero h1,
.agent-hero h1 {
    color: #f2eee5;
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    letter-spacing: -.035em;
}

.page-description,
.settings > .muted,
.agent-hero p,
.muted,
.settings small {
    color: var(--ui-muted);
}

.settings h2,
.settings h3,
.settings h4,
.settings strong {
    color: var(--ui-ink);
}

.settings-form,
.settings-card,
.action-card,
.action-create,
.calendar-day,
.contact-card,
.contact-create,
.draft-card,
.draft-create,
.workspace-card,
.workspace-section,
.search-group,
.history-list,
.profile-section,
.profile-save,
.relationship-upcoming,
.relationship-create,
.relationship-card,
.knowledge-starter,
.memory-card,
.improvement-principles > div,
.improvement-roadmap,
.waiting-card,
.invoice-card,
.deadline-card,
.deadline-form,
.device-card,
.bank-card,
.drive-card,
.calendar-account-card,
.connection-section,
.diagnostic-alert,
.diagnostic-ok,
.settings-overview > a,
.source-accordion,
.agent-configuration,
.agent-mailbox-option,
.email-body,
.email-thread-actions,
.email-action-create,
.email-attachments,
.global-search,
.focused-invoice-intro {
    background: #151614;
    border-color: #2c2e2a;
    box-shadow: none;
    color: var(--ui-ink);
}

.settings-hero-status {
    background: #151614;
    border: 1px solid #3d3525;
    box-shadow: none;
    color: #d7b873;
}

.settings-card,
.action-card,
.calendar-day,
.contact-card,
.draft-card,
.workspace-card,
.workspace-section,
.search-group,
.history-list,
.profile-section,
.relationship-card,
.memory-card,
.waiting-card,
.invoice-card,
.deadline-card,
.device-card,
.connection-section {
    border-radius: 12px;
}

.workspace-card:hover,
.search-result:hover,
.waiting-card:hover,
.invoice-card:hover,
.settings-overview > a:hover {
    background: #191a17;
    border-color: #5e4d2d;
    box-shadow: none;
    transform: translateY(-1px);
}

.settings input,
.settings textarea,
.settings select,
.login-card input,
.chat textarea {
    background: #10110f;
    border: 1px solid #32342f;
    color: #f1eee7;
}

.settings input::placeholder,
.settings textarea::placeholder,
.login-card input::placeholder,
.chat textarea::placeholder {
    color: #686761;
}

.settings input:focus,
.settings textarea:focus,
.settings select:focus,
.login-card input:focus,
.chat textarea:focus {
    border-color: #8c7039;
    box-shadow: 0 0 0 3px rgba(188, 145, 67, .12);
}

.settings select,
.login-card select {
    color-scheme: dark;
}

.settings button,
.settings .new-chat,
.page-header-actions a,
.global-search button,
.login-card button {
    background: #bc9143;
    border: 1px solid #bc9143;
    box-shadow: none;
    color: #0b0c0b;
}

.settings button:hover,
.page-header-actions a:hover,
.global-search button:hover,
.login-card button:hover {
    background: #d0aa61;
    border-color: #d0aa61;
    box-shadow: none;
}

.secondary-button,
.decision-edit,
.decision-back,
.settings .link-button,
.settings button.link-button {
    background: #1b1c19 !important;
    border: 1px solid #363832 !important;
    color: #d0cdc4 !important;
}

.secondary-button:hover,
.decision-edit:hover,
.decision-back:hover,
.settings .link-button:hover {
    border-color: #665431 !important;
    color: #f2eee5 !important;
}

.danger-button,
.decision-ignore,
.link-danger,
.settings .danger {
    background: #241614 !important;
    border-color: #633a35 !important;
    color: #e69a90 !important;
}

.action-tabs,
.knowledge-nav,
.settings-nav {
    background: #121311;
    border-color: #2c2e2a;
    border-radius: 10px;
}

.action-tabs a,
.knowledge-nav a,
.settings-nav a {
    border-radius: 7px;
    color: #8f8c84;
}

.action-tabs a.active,
.action-tabs a:hover,
.knowledge-nav a.active,
.knowledge-nav a:hover,
.settings-nav a.active,
.settings-nav a:hover {
    background: #282217;
    color: #e7d3a8;
}

.action-tabs a span {
    background: #242015;
    color: #cda557;
}

.notice {
    background: #17201a;
    border-color: #345140;
    color: #a8c8b4;
}

.notice.error,
.diagnostic-alert {
    background: #241715;
    border-color: #653d37;
    color: #e49a90;
}

.status-badge,
.draft-status,
.mailbox-state,
.invoice-status,
.area-badge,
.improvement-badges span,
.source-summary-state {
    background: #22231f;
    border-color: #393b35;
    color: #c4c0b6;
}

.status-ready,
.mailbox-state.active,
.draft-status.sent {
    background: #17231c;
    border-color: #365443;
    color: #8fbea3;
}

.mailbox-state.failed,
.draft-status.error,
.invoice-status.needs_review {
    background: #271816;
    border-color: #633a35;
    color: #e59a90;
}

.settings details,
.settings details > summary,
.advanced-fields,
.invoice-more-details,
.improvement-details {
    border-color: #2e302b;
    color: #d4d0c7;
}

.settings details > summary:hover {
    color: #e6d2a6;
}

.settings table,
.message-content table {
    background: #151614;
    border-color: #2c2e2a;
    color: var(--ui-ink);
}

.settings th,
.message-content th {
    background: #0d0e0d;
    border-color: #2c2e2a;
    color: #d7b873;
}

.settings td,
.message-content td {
    border-color: #282a26;
    color: #d3cfc5;
}

.calendar-event,
.search-result,
.history-row,
.workspace-emails article,
.document-list a,
.email-attachments a,
.bank-account-row,
.invoice-essential-grid > div,
.invoice-summary-grid > div {
    border-color: #2c2e2a;
    color: #d7d3ca;
}

.calendar-event:hover,
.search-result:hover,
.history-row:hover,
.document-list a:hover,
.email-attachments a:hover {
    background: #1a1b18;
}

.calendar-event time,
.search-group h2 span,
.invoice-amount strong,
.bank-balance,
.deadline-card time {
    color: #c89c4d;
}

.settings hr {
    border-color: #2c2e2a;
}

body:not(.is-donna-home) .chat {
    background: #101110;
    color: #e9e5dc;
}

body:not(.is-donna-home) .chat > header {
    background: rgba(13, 14, 13, .96);
    border-color: #292b27;
    color: #ece8df;
}

body:not(.is-donna-home) .message .avatar {
    background: #24251f;
    color: #d6d1c7;
}

body:not(.is-donna-home) .message.assistant .avatar {
    background: #0a0b0a;
    border: 1px solid #5b4b2f;
    color: #c99e50;
}

body:not(.is-donna-home) .message-content,
body:not(.is-donna-home) .message-content h1,
body:not(.is-donna-home) .message-content h2,
body:not(.is-donna-home) .message-content h3,
body:not(.is-donna-home) .message-content strong {
    color: #ece8df;
}

body:not(.is-donna-home) .message.pending-reply {
    background: #151614;
    border-color: #2c2e2a;
    box-shadow: none;
}

body:not(.is-donna-home) .message-tools {
    background: #15140f;
    border-color: #403721;
    color: #c6c0b3;
}

body:not(.is-donna-home) .message-tools li {
    background: #10110f;
    border-color: #2f302b;
}

body:not(.is-donna-home) .message-tools li strong {
    color: #ece8df;
}

body:not(.is-donna-home) .message-tools li small em,
body:not(.is-donna-home) .message-content code {
    background: #222018;
    border-color: #3e3828;
    color: #d6c49d;
}

body:not(.is-donna-home) .message-content blockquote {
    background: #1c1a14;
    color: #cec7b9;
}

body:not(.is-donna-home) .composer {
    background: linear-gradient(180deg, rgba(16, 17, 16, 0), #101110 24%);
}

body:not(.is-donna-home) .composer-row textarea {
    background: #151614;
    border-color: #32342f;
    box-shadow: none;
    color: #f1eee7;
}

body:not(.is-donna-home) .composer .voice-mode,
body:not(.is-donna-home) .composer-row > button:last-child {
    background: #bc9143 !important;
    border-color: #bc9143 !important;
    color: #0b0c0b !important;
}

.device-menu > div {
    background: #151614;
    border-color: #2c2e2a;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
}

.login-shell {
    background: #0a0b0a;
    min-height: 100vh;
}

.login-shell::before {
    border-color: rgba(188, 145, 67, .16);
}

.login-card {
    background: #121311;
    border: 1px solid #2b2d29;
    border-radius: 18px;
    box-shadow: none;
}

.login-card h1 {
    color: #f2eee5;
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    letter-spacing: -.035em;
}

.login-card .muted {
    color: #8e8b83;
}

.login-card label {
    color: #d7d3ca;
}

.login-card .error {
    color: #e4948a;
}

.mobile-navigation {
    background: rgba(9, 10, 9, .98) !important;
    border-color: #292b27 !important;
}

.mobile-navigation a {
    color: #777a73 !important;
}

.mobile-navigation a.active {
    color: #f1eee7 !important;
}

.mobile-navigation a.active span {
    color: #c99e50 !important;
}

@media (min-width: 761px) {
    body:not(.is-donna-home) .app-content {
        grid-column: 2;
    }

    body:not(.is-donna-home) .composer {
        left: 248px;
    }
}

@media (max-width: 760px) {
    body:not(.is-donna-home) .app-shell {
        background: #101110;
        display: block;
    }

    body:not(.is-donna-home) .donna-sidebar {
        display: none;
    }

    body:not(.is-donna-home) .settings {
        padding: 24px 16px 108px;
    }

    .page-header {
        padding-bottom: 22px;
    }

    .page-header h1,
    .settings > h1,
    .settings-hero h1,
    .agent-hero h1 {
        font-size: clamp(34px, 11vw, 48px);
    }

    body:not(.is-donna-home) .composer {
        background: linear-gradient(180deg, rgba(16, 17, 16, 0), #101110 24%);
    }
}
