/* =========================================================
   Estate Note Theme Engine
   ========================================================= */

html {
    color-scheme: light;
}

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

    --estate-color-background: #0b1220;
    --estate-color-surface: #111a2a;
    --estate-color-surface-muted: #162132;
    --estate-color-border: #243247;
    --estate-color-border-strong: #33445d;

    --estate-color-text: #edf2f8;
    --estate-color-text-secondary: #b4c0cf;
    --estate-color-text-muted: #7f8ca0;

    --estate-color-primary: #5b7cfa;
    --estate-color-primary-hover: #7591ff;
    --estate-color-primary-soft: #1b2a52;

    --estate-color-sidebar: #080f1c;
    --estate-color-sidebar-surface: #111c2d;
    --estate-color-sidebar-text: #d4dce7;
    --estate-color-sidebar-muted: #718096;

    --estate-shadow-small:
        0 1px 2px rgba(0, 0, 0, 0.26);
    --estate-shadow-panel:
        -12px 0 36px rgba(0, 0, 0, 0.36);
}

.estate-theme-control {
    position: relative;
}

.estate-theme-menu {
    position: absolute;
    top: calc(100% + 9px);
    right: 0;
    z-index: 120;
    width: 230px;
    padding: 7px;
    background: var(--estate-color-surface);
    border: 1px solid var(--estate-color-border);
    border-radius: 12px;
    box-shadow:
        0 18px 42px rgba(15, 23, 42, 0.17);
}

.estate-theme-menu__item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 11px;
    padding: 10px;
    color: var(--estate-color-text);
    background: transparent;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    text-align: left;
}

.estate-theme-menu__item:hover,
.estate-theme-menu__item.is-active {
    background: var(--estate-color-primary-soft);
}

.estate-theme-menu__item > span:first-child {
    display: inline-flex;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    color: var(--estate-color-primary);
    background: var(--estate-color-surface-muted);
    border-radius: 9px;
}

.estate-theme-menu__item > span:last-child {
    display: flex;
    flex-direction: column;
}

.estate-theme-menu__item strong {
    font-size: 11px;
}

.estate-theme-menu__item small {
    margin-top: 2px;
    color: var(--estate-color-text-muted);
    font-size: 9px;
}

html[data-theme="dark"],
html[data-theme="dark"] body,
html[data-theme="dark"] .estate-body {
    background: var(--estate-color-background);
}

html[data-theme="dark"] .estate-topbar {
    background: rgba(17, 26, 42, 0.94);
}

html[data-theme="dark"] .estate-global-search,
html[data-theme="dark"] .estate-auth-field__input {
    color: var(--estate-color-text);
    background: var(--estate-color-surface-muted);
}

html[data-theme="dark"]
.estate-global-search__shortcut {
    background: var(--estate-color-surface);
}

html[data-theme="dark"] .estate-button--secondary {
    color: var(--estate-color-text);
    background: var(--estate-color-surface);
}

html[data-theme="dark"]
.estate-button--secondary:hover {
    background: var(--estate-color-surface-muted);
}

html[data-theme="dark"] .estate-message {
    background: var(--estate-color-surface);
}

html[data-theme="dark"]
.estate-status-badge {
    color: #86efac;
    background: rgba(22, 101, 52, 0.2);
    border-color: rgba(74, 222, 128, 0.35);
}

html[data-theme="dark"]
.estate-dashboard-summary-card--blue
.estate-dashboard-summary-card__icon {
    color: #7dd3fc;
    background: rgba(3, 105, 161, 0.22);
}

html[data-theme="dark"]
.estate-dashboard-summary-card--violet
.estate-dashboard-summary-card__icon {
    color: #c4b5fd;
    background: rgba(109, 40, 217, 0.22);
}

html[data-theme="dark"]
.estate-dashboard-summary-card--orange
.estate-dashboard-summary-card__icon {
    color: #fdba74;
    background: rgba(194, 65, 12, 0.22);
}

html[data-theme="dark"]
.estate-dashboard-quick-card:hover {
    background: var(--estate-color-surface);
}

html[data-theme="dark"] .estate-auth-body {
    background: var(--estate-color-background);
}

html[data-theme="dark"]
.estate-auth-form-section {
    background: var(--estate-color-background);
}

html[data-theme="dark"]
.estate-auth-field__input::placeholder {
    color: #66758a;
}

html[data-theme="dark"]
.estate-auth-password__toggle:hover {
    background: var(--estate-color-primary-soft);
}

html[data-theme="dark"]
.estate-auth-error {
    color: #fecaca;
    background: rgba(127, 29, 29, 0.24);
    border-color: rgba(248, 113, 113, 0.32);
}

html[data-theme="dark"]
.estate-auth-message {
    color: #bbf7d0;
    background: rgba(22, 101, 52, 0.24);
    border-color: rgba(74, 222, 128, 0.32);
}

html[data-theme="dark"]
.estate-right-panel__empty {
    background: var(--estate-color-surface-muted);
}

html[data-theme="dark"]
.estate-placeholder-table__header {
    background: var(--estate-color-surface-muted);
}


/* =========================================================
   STEP-04F Top Navigation Dark Mode
   ========================================================= */

html[data-theme="dark"]
.estate-topbar-popover,
html[data-theme="dark"]
.estate-command-palette {
    box-shadow:
        0 22px 54px rgba(0, 0, 0, 0.48);
}

html[data-theme="dark"]
.estate-command-backdrop {
    background: rgba(2, 6, 23, 0.72);
}

html[data-theme="dark"]
.estate-profile-menu__logout button {
    color: #fca5a5;
}
