@import url('./themes.css');
:root {
    /* ===== Colors (DARK defaults) ===== */
    --color-bg-top: #282828;
    /* gradient top */
    --color-bg-base: #252424;
    /* gradient bottom */
    --color-surface: #282828;
    /* primary surface: topbar/sidebar */
    --color-surface-transparent: rgba(80, 80, 80, 0.3);
    /* for modals/overlays */
    --color-surface-alt: rgba(58, 58, 58, 0.1);
    /* secondary surface: cards/inputs/buttons */
    --color-surface-block: #494949dd;
    /* tertiary surface: blocks */
    --color-text: #F1F1F1;
    --color-text-muted: #cccccc;
    --color-icon-dim: #818181;
    --color-brand: #4E46E5;
    /* highlight/brand */
    --color-brand-soft: #d4ce9d;
    /* gradient companion for logo */
    --color-brand-border: #5f5d47;
    /* subtle brand border */
    --color-accent: #81C784;
    /* small accents (e.g. dot) */
    --color-danger: #FF3F3F;
    --color-shadow: rgba(0, 0, 0, 0.20);

    /* Additional colors (not theme-dependent) */
    --orange: #f47b53;
    --yellow: #ffdf38;
    --purple: #8c6eb3;
    --blue: #2b4b59;
    --green: #2ea76b;
    --gray: #b7b7b7;

    /* State/decoration */
    --overlay-hover: rgba(255, 255, 255, .05);
    --brand-tint: color-mix(in srgb, var(--color-brand) 18%, transparent);
    --scrollbar-thumb: rgba(255, 255, 255, .12);

    /* Borders (DARK) */
    --border-faint: rgba(255, 255, 255, .05);
    --border-soft: rgba(255, 255, 255, .05);
    --border-strong: rgba(255, 255, 255, .05);

    /* ===== Layout / motion ===== */
    --layout-sidebar: 320px;
    --focus-ring: 0 0 0 3px rgba(229, 182, 17, .25);
    --radius: 12px;
    --anim-fast: .18s;
    --shadow-elevation: 0 10px 28px var(--color-shadow);

    /* ===== Font Families ===== */
    --font-family-default: system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
    --font-family-sharp: "Inter", sans-serif;
    --font-family-round: "Nunito", sans-serif;
    --font-family-serif: "Roboto Slab", serif;
    --font-family-mono: "Source Code Pro", monospace;
    --font-family-display: "Caveat", cursive;
    --font-family: var(--font-family-default);
    /* Set default */

    /* ===== Font Sizes (Default values) ===== */
    --fs-xsmall: 7.5px;
    /* XX-Small: micro text, captions */
    --fs-legal: 10px;
    /* Micro: fine print, legal text */
    --fs-caption: 11px;
    /* Extra small: badges, group labels */
    --fs-meta: 12px;
    /* Small: subtitles, tooltips, kbd */
    --fs-body: 14px;
    /* Base: main text, inputs, buttons */
    --fs-title-nav: 16px;
    /* Medium: brand title, nav items */
    --fs-title-sub: 18px;
    /* Large: h3 headings, card titles */
    --fs-title-section: 20px;
    /* Extra Large: h2 headings */
    --fs-title-page: 24px;
    /* XX-Large: h1, main page titles */
    --fs-title-hero: 32px;
    /* Display: hero/marketing headlines */
}

fieldset {
    /* Layout & Spacing */
    display: block;
    /* This is the key property that forces the element onto its own line */
    width: 100%;
    /* Ensures it spans the full available width */
    box-sizing: border-box;
    /* Includes padding and border in the element's total width */
    margin: 10px 0px 10px 0px;
    padding: 7px 7px 7px 7px;

    /* Theming */
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);

    /* Animation */
    transition: background-color var(--anim-fast) ease, border-color var(--anim-fast) ease;
}

fieldset {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 10px 0px 10px 0px;
    padding: 12px;
    /* Increased padding for better spacing */
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    transition: background-color var(--anim-fast) ease, border-color var(--anim-fast) ease;
}

legend {
    font-size: var(--fs-caption);
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 0px 0px 0px 6px;
    margin-left: -4px;
}

label {
    display: inline-flex;
    /* Use inline-flex for better alignment */
    align-items: center;
    gap: 8px;
    font-size: var(--fs-meta);
    color: var(--color-text);
    cursor: pointer;
    user-select: none;
    /* Prevent text selection on click */
}

input[type="checkbox"] {
    /* === Reset & Custom Appearance === */
    appearance: none;
    /* Crucial for custom styling */
    background-color: transparent;
    /* Background is now always transparent */
    margin: 0px 0px 0px 10px;
    color: var(--color-brand);
    /* This color is inherited by the checkmark */
    width: 1.2em;
    height: 1.2em;
    border: 1px solid var(--color-text-muted);
    /* Set the border color as requested */
    border-radius: 6px;

    /* === Layout & Transition === */
    display: grid;
    place-content: center;
    cursor: pointer;
    transition: all var(--anim-fast) ease;
}

/* The custom checkmark, created with a pseudo-element */
input[type="checkbox"]::before {
    content: '✓';
    /* This creates the actual checkmark symbol */
    font-size: 1.1em;
    /* Optional: Adjust checkmark size */
    transform: scale(0);
    /* Hidden by default, scales in when checked */
    transform-origin: center;
    transition: transform var(--anim-fast) ease;
}

/* === States === */

/* When checked, the background remains transparent and the border color is the same */
input[type="checkbox"]:checked {
    border-color: var(--color-text-muted);
}

/* When checked, scale the checkmark to make it visible */
input[type="checkbox"]:checked::before {
    transform: scale(1);
}

/* Optional hover effect for better user experience */
input[type="checkbox"]:not(:checked):hover {
    border-color: var(--color-text-muted);
    /* You can change this or remove it */
}

/* Accessibility focus ring */
input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="search"],
input[type="date"],
textarea {
    min-width: 40%;
    padding: 8px 12px;
    display: flex;
    font-size: var(--fs-body);
    color: var(--color-text);
    background-color: var(--color-bg-base);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    transition: border-color var(--anim-fast) ease, background-color var(--anim-fast) ease;
    max-width: 100%;
    width: auto;
}

h2 {
    font-size: var(--fs-title-section);
    color: var(--color-text);
}

span {
    color: var(--color-text);
}

a {
    color: var(--color-text-muted);
    text-decoration: none;
}

select,
button {
    height: 35px;
    background-color: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 6px 12px;
    color: var(--color-text);
    font-size: var(--fs-caption);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    display: flex;
    /* Use flexbox for alignment */
    align-items: center;
    /* Center vertically */
    justify-content: center;
    /* Center horizontally */
}

/* Hover effect for better interactivity */
select:hover,
button:hover {
    background-color: var(--color-surface);
    border-color: var(--color-text-muted);
}


p,
ul,
ol {
    color: var(--color-text-muted);
}

li {
    margin: 4px 0;
}

strong {
    color: var(--color-brand);
    font-weight: 600;
}

iframe,
embed,
object {
    outline: none;
    border: none;
}

.page-host-card {
    outline: none;
}

::-webkit-scrollbar {
    height: 10px;
    width: 10px
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 999px
}



* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

/* In your main HTML file's <style> block */
body {
    margin: 0;
    display: grid;
    grid-template-columns: var(--layout-sidebar) 1fr;
    grid-template-rows: 56px 1fr;
    grid-template-areas: "sidebar topbar" "sidebar main";
    background-color: var(--color-bg-base);
    background-image: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--color-brand) 6%, transparent) 0%, transparent 600px);
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--color-text);
    font: var(--fs-body)/1.35 var(--font-family);

    /* === THIS IS THE LINE TO CHANGE === */
    /* Original */
    /* transition:grid-template-columns var(--anim-fast) ease, background .2s ease, color .2s ease; */

    /* MODIFIED: Remove the grid transition which causes the reflow */
    transition: background .5s ease, color .5s ease;

    height: 100vh;
    overflow: hidden;
}

body.nav-collapsed {
    --layout-sidebar: 90px;
}

/* ===== Spinner Animation Keyframes ===== */
@keyframes spin {

    0%,
    100% {
        box-shadow: .2em 0px 0 0px currentcolor;
    }

    12% {
        box-shadow: .2em .2em 0 0 currentcolor;
    }

    25% {
        box-shadow: 0 .2em 0 0px currentcolor;
    }

    37% {
        box-shadow: -.2em .2em 0 0 currentcolor;
    }

    50% {
        box-shadow: -.2em 0 0 0 currentcolor;
    }

    62% {
        box-shadow: -.2em -.2em 0 0 currentcolor;
    }

    75% {
        box-shadow: 0px -.2em 0 0 currentcolor;
    }

    87% {
        box-shadow: .2em -.2em 0 0 currentcolor;
    }
}


/* ===== Initial Page Pre-loader ===== */
#preloader {
    position: fixed;
    inset: 0;
    background: var(--color-bg-base);
    z-index: 9999;
    display: grid;
    place-items: center;
    transition: opacity 0.5s ease, visibility 0.5s;
    opacity: 1;
    visibility: visible;
}

#preloader .spinner {
    width: 64px;
    height: 64px;
}

/* Hide main content until the preloader is removed */
body:not(.is-loaded)>*:not(#preloader) {
    visibility: hidden;
    opacity: 0;
}

/* Utility class for icon-only buttons */
.btn {
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Topbar */
.topbar {
    grid-area: topbar;
    display: flex;
    align-items: center;
    gap: 10px;
    /*background: var(--color-surface);*/
    padding: 0 24px 0 20px !important;
    /*border-bottom: 1px solid var(--border-faint);*/
    position: sticky;
    top: 0;
    z-index: 5;
    height: 68px !important;
    /* transition moved to inner elements */
}

.topbar .top-nav-items-wrapper,
.topbar .top-actions {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 20px;
    border: 1px solid transparent;
    box-shadow: 0 0 0 transparent;
}

.topbar.is-scrolled .top-nav-items-wrapper,
.topbar.is-scrolled .top-actions {
    padding-top: 4px;
    padding-bottom: 4px;
}

.topbar .burger {
    height: 36px;
    width: 36px;
    border-radius: var(--radius);
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.topbar .burger:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring)
}

.search {
    position: relative;
    flex: 1;
    max-width: 720px;
}

.search input {
    width: 100%;
    height: 36px;
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    color: var(--color-text);
    border-radius: var(--radius);
    padding: 0 36px 0 36px;
    font-family: var(--font-family);
    font-size: var(--fs-body);
}

/* Hide default browser clear button */
.search input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.search input:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: var(--focus-ring);
}

/* Fix for browser autofill color */
.search input:-webkit-autofill,
.search input:-webkit-autofill:hover,
.search input:-webkit-autofill:focus,
.search input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--color-surface-alt) inset !important;
    -webkit-text-fill-color: var(--color-text) !important;
    transition: background-color 5000s ease-in-out 0s;
}

.search .icon,
.search .kbd {
    position: absolute;
    inset-block: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    color: var(--color-text-muted);
}

.search .icon {
    left: 10px;
    width: 18px
}

.search .kbd {
    right: 8px;
    opacity: .75;
    padding: 2px 6px;
    font-size: var(--fs-meta);
    transition: opacity 0.2s;
}

.search:focus-within .kbd {
    opacity: 0;
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 10px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 2;
}

.search-clear:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.search-clear.show {
    opacity: 1;
    visibility: visible;
}

/* Keyboard Navigation Highlight */
.item.focused {
    background: var(--overlay-hover);
    border-color: var(--border-soft);
    box-shadow: inset 3px 0 0 var(--color-brand);
}

.top-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: auto 0;
    position: relative;
    z-index: 10;
    /* gap: 8px; */
    /*margin: 8px 6px;*/
    padding: 9px 14px 9px 14px !important
}

.btn {
    height: 36px;
    display: inline-grid;
    place-items: center;
    padding: 0 12px;
    border-radius: var(--radius);
    cursor: pointer;
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    color: var(--color-text);
    font-size: var(--fs-body);
    position: relative;
    /* ADDED for spinner positioning */
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring)
}

.btn .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-accent);
    box-shadow: 0 0 0 4px rgba(129, 199, 132, .18)
}

/* ===== Settings Panel ===== */
.settings-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 0;
    z-index: 1000;
    box-shadow: var(--shadow-elevation);
    flex-direction: column;
    gap: 0;
}

.settings-panel.show {
    display: flex;
}

/* ===== Profile Wrapper & Panel ===== */
.profile-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.avatar-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 10px;
    transition: transform var(--anim-fast) ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-btn:hover {
    transform: scale(1.05);
}

.avatar-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.profile-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 12px;
    z-index: 1000;
    box-shadow: var(--shadow-elevation);
    flex-direction: column;
    gap: 8px;
}

.profile-panel.show {
    display: flex;
}

.profile-panel-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 4px;
}

.profile-panel-info .name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text);
}

.profile-panel-info .role {
    color: var(--color-text-muted);
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.8;
}

.profile-panel-logout {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.profile-panel-logout:hover {
    background-color: var(--color-surface-alt);
    color: var(--color-danger);
}

.settings-panel .setting-group {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border-soft);
}

.settings-panel .setting-group:last-child {
    border-bottom: none;
}

.setting-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 12px 16px;
    transition: background-color 0.2s ease;
}

.setting-group-header:hover {
    background-color: var(--overlay-hover);
}

.setting-group-header .toggle-icon {
    width: 10px;
    height: 10px;
    fill: var(--color-text-muted);
    transition: transform 0.2s ease;
}

.setting-group:not(.collapsed) .toggle-icon {
    transform: rotate(90deg);
}

.setting-group-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 1;
    max-height: 800px;
    overflow: visible;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, padding 0.3s ease;
    padding: 4px 16px 16px 16px;
}

.setting-group.collapsed .setting-group-content {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    pointer-events: none;
}

.settings-panel .setting-group .label {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: var(--fs-meta);
    margin: 0;
}

.settings-panel .options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
    gap: 6px;
}

/* Generic Settings Tabs */
.settings-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    padding: 2px;
    background: var(--color-surface-alt);
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
}

.settings-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-family: var(--font-family);
    font-size: var(--fs-caption);
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.settings-tab:hover {
    color: var(--color-text);
}

.settings-tab.active {
    background: var(--color-surface);
    color: var(--color-brand);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Theme Filtering Logic */
#theme-options[data-active-tab="standard"] [data-category="special"],
#theme-options[data-active-tab="special"] [data-theme-set]:not([data-category="special"]) {
    display: none !important;
}

#theme-options {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.settings-panel .option {
    font-family: inherit;
    height: 32px;
    width: 100%;
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    color: var(--color-text);
    border-radius: 8px;
    cursor: pointer;
    display: grid;
    place-items: center;
    position: relative;
    padding: 0;
    font-size: var(--fs-body);
    font-weight: 600;
}

.settings-panel .option:hover {
    border-color: var(--border-strong);
    background-color: var(--overlay-hover);
}

.settings-panel .option.active {
    box-shadow: 0 0 0 2px var(--color-brand);
    border-color: var(--color-brand);
}

/* Theme Card Selector Styling */
.settings-panel .option.theme-card {
    height: auto;
    display: flex;
    flex-direction: column;
    padding: 6px;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
    border-radius: 10px;
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    overflow: hidden;
    text-align: left;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-panel .option.theme-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-brand);
    background-color: var(--color-surface-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.settings-panel .option.theme-card.active {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 2px var(--color-brand);
    background-color: var(--color-surface-hover);
}

.settings-panel .option.theme-card::after {
    display: none !important;
}

/* Font Options Selector Grid & Cards Styling */
#font-options {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.settings-panel .option.font-card {
    height: auto;
    display: flex;
    flex-direction: column;
    padding: 6px;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
    border-radius: 8px;
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    overflow: hidden;
    text-align: center;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-panel .option.font-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-brand);
    background-color: var(--color-surface-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.settings-panel .option.font-card.active {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 2px var(--color-brand);
    background-color: var(--color-surface-hover);
}

.settings-panel .option.font-card::after {
    display: none !important;
}

.font-preview {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 500;
    border-radius: 6px;
    background: var(--color-surface);
    border: 1px solid var(--border-soft);
    color: var(--color-text);
}

.font-name {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text-muted);
}

.settings-panel .option.font-card.active .font-name {
    color: var(--color-brand);
}

/* Font Preview Specific Font Families */
.font-preview-default {
    font-family: var(--font-family-default);
}

.font-preview-sharp {
    font-family: var(--font-family-sharp);
}

.font-preview-round {
    font-family: var(--font-family-round);
}

.font-preview-serif {
    font-family: var(--font-family-serif);
}

.font-preview-mono {
    font-family: var(--font-family-mono);
}

.font-preview-display {
    font-family: var(--font-family-display);
    font-size: 22px;
}

/* Borders options grid & cards styling */
#radius-options {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.settings-panel .option.radius-card {
    height: auto;
    display: flex;
    flex-direction: column;
    padding: 6px;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
    border-radius: 8px;
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    overflow: hidden;
    text-align: center;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-panel .option.radius-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-brand);
    background-color: var(--color-surface-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.settings-panel .option.radius-card.active {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 2px var(--color-brand);
    background-color: var(--color-surface-hover);
}

.settings-panel .option.radius-card::after {
    display: none !important;
}

.radius-preview {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--color-surface);
    border: 1px solid var(--border-soft);
}

.radius-preview .preview-box {
    width: 16px;
    height: 16px;
    border: 2px dashed var(--color-text-muted);
    background: transparent;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.settings-panel .option.radius-card:hover .radius-preview .preview-box,
.settings-panel .option.radius-card.active .radius-preview .preview-box {
    border-color: var(--color-brand);
    border-style: solid;
    opacity: 1;
}

.radius-name {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text-muted);
}

.settings-panel .option.radius-card.active .radius-name {
    color: var(--color-brand);
}

/* Border Radius Previews */
.radius-preview-sharp .preview-box {
    border-radius: 0px;
}

.radius-preview-default .preview-box {
    border-radius: 4px;
}

.radius-preview-round .preview-box {
    border-radius: 8px;
}

/* Font Size options grid & cards styling */
#fontsize-options {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.settings-panel .option.fontsize-card {
    height: auto;
    display: flex;
    flex-direction: column;
    padding: 6px;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
    border-radius: 8px;
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    overflow: hidden;
    text-align: center;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-panel .option.fontsize-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-brand);
    background-color: var(--color-surface-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.settings-panel .option.fontsize-card.active {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 2px var(--color-brand);
    background-color: var(--color-surface-hover);
}

.settings-panel .option.fontsize-card::after {
    display: none !important;
}

.fontsize-preview {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--color-surface);
    border: 1px solid var(--border-soft);
    font-weight: 700;
    color: var(--color-text);
}

.fontsize-name {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text-muted);
}

.settings-panel .option.fontsize-card.active .fontsize-name {
    color: var(--color-brand);
}

/* Font Size Previews */
.fontsize-preview-small {
    font-size: 11px;
}

.fontsize-preview-default {
    font-size: 14px;
}

.fontsize-preview-large {
    font-size: 17px;
}

/* Custom Brand Color Picker Styling */
.custom-color-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 8px;
}

/* Saturation & Brightness area */
.picker-sl-area {
    position: relative;
    height: 120px;
    border-radius: 6px;
    background-color: hsl(260, 100%, 50%);
    cursor: crosshair;
    overflow: hidden;
    border: 1px solid var(--border-soft);
}

.picker-sl-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to right, #fff, transparent);
    z-index: 1;
}

.picker-sl-area::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, #000, transparent);
    z-index: 2;
}

.picker-sl-circle {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 3;
}

/* Controls */
.picker-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.picker-row {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 24px;
}

/* Hue Slider with rainbow track */
.picker-hue-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right,
            #ff0000 0%, #ffff00 17%, #00ff00 33%,
            #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
    outline: none;
    cursor: pointer;
}

.picker-hue-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid var(--color-brand);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.1s ease;
}

.picker-hue-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.picker-hue-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid var(--color-brand);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.1s ease;
}

/* Intensity Slider Wrapper */
.picker-intensity-slider-wrap {
    width: 100%;
    height: 8px;
    display: flex;
    align-items: center;
}

.picker-intensity-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: transparent;
    outline: none;
    cursor: pointer;
    margin: 0;
}

.picker-intensity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid var(--color-brand);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.1s ease;
}

.picker-intensity-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.picker-intensity-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid var(--color-brand);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.1s ease;
}

/* Brightness Slider Wrapper */
.picker-brightness-slider-wrap {
    width: 100%;
    height: 8px;
    display: flex;
    align-items: center;
}

.picker-brightness-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: transparent;
    outline: none;
    cursor: pointer;
    margin: 0;
}

.picker-brightness-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid var(--color-brand);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.1s ease;
}

.picker-brightness-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.picker-brightness-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid var(--color-brand);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.1s ease;
}

/* Values Row */
.values-row {
    justify-content: space-between;
}

.picker-text-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text-muted);
    width: 28px;
}

.picker-hex-input {
    flex: 1;
    background: var(--color-surface);
    border: 1px solid var(--border-soft);
    border-radius: 4px;
    padding: 4px 8px;
    color: var(--color-text);
    font-family: var(--font-family-mono);
    font-size: var(--fs-caption);
    font-weight: 600;
    text-transform: uppercase;
    outline: none;
    width: 80px;
    transition: border-color 0.2s ease;
}

.picker-hex-input:focus {
    border-color: var(--color-brand);
}

.picker-preview-box {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--border-soft);
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
    background-color: var(--color-brand);
    flex-shrink: 0;
}

/* Reset Highlight button styling */
.reset-icon-only-btn {
    position: relative;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    padding: 0;
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}

.reset-icon-only-btn:hover {
    background: var(--overlay-hover);
    color: var(--color-brand);
}

.reset-icon-only-btn .reset-icon {
    width: 14px;
    height: 14px;
    fill: currentColor;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reset-icon-only-btn:hover .reset-icon {
    transform: rotate(-180deg);
}

/* Custom Tooltip for Reset Button */
.reset-icon-only-btn::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: var(--color-bg-top);
    border: 1px solid var(--border-strong);
    color: var(--color-text);
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 20;
    box-shadow: var(--shadow-elevation);
    font-size: var(--fs-meta);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
}

.reset-icon-only-btn:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Theme Preview Live Miniature Dashboard */
.theme-preview {
    position: relative;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--color-surface);
    border: 1px solid var(--border-soft);
}

.preview-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    width: 25%;
    height: 100%;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.preview-header {
    position: absolute;
    left: 25%;
    top: 0;
    width: 75%;
    height: 25%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.preview-content {
    position: absolute;
    left: 25%;
    top: 25%;
    width: 75%;
    height: 75%;
}

.preview-brand {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.theme-name {
    font-size: var(--fs-caption);
    font-weight: 700;
    color: var(--color-text);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Light Theme Preview Colors */
[data-theme-set="light"] .theme-preview {
    background-color: #f6f7fb;
    border-color: #d1d5db;
}

[data-theme-set="light"] .preview-sidebar {
    background-color: #ffffff;
    border-right-color: #e5e7eb;
}

[data-theme-set="light"] .preview-header {
    background-color: #f3f4f6;
    border-bottom-color: #e5e7eb;
}

[data-theme-set="light"] .preview-content {
    background-color: #f9fafb;
}

[data-theme-set="light"] .preview-brand {
    background-color: #4f46e5;
}

/* Dark Theme Preview Colors */
[data-theme-set="dark"] .theme-preview {
    background-color: #1e1e1e;
    border-color: #444;
}

[data-theme-set="dark"] .preview-sidebar {
    background-color: #282828;
    border-right-color: #333;
}

[data-theme-set="dark"] .preview-header {
    background-color: #282828;
    border-bottom-color: #333;
}

[data-theme-set="dark"] .preview-content {
    background-color: #1e1e1e;
}

[data-theme-set="dark"] .preview-brand {
    background-color: #4E46E5;
}

/* Abyss Theme Preview Colors */
[data-theme-set="abyss"] .theme-preview {
    background-color: #13151f;
    border-color: #2a2e3f;
}

[data-theme-set="abyss"] .preview-sidebar {
    background-color: #1d202e;
    border-right-color: #252836;
}

[data-theme-set="abyss"] .preview-header {
    background-color: #1d202e;
    border-bottom-color: #252836;
}

[data-theme-set="abyss"] .preview-content {
    background-color: #13151f;
}

[data-theme-set="abyss"] .preview-brand {
    background-color: #8a71f7;
}

/* Violet Bloom Theme Preview Colors */
[data-theme-set="violet-bloom"] .theme-preview {
    background-color: #1f1526;
    border-color: #3f2d4e;
}

[data-theme-set="violet-bloom"] .preview-sidebar {
    background-color: #2e1f3a;
    border-right-color: #382647;
}

[data-theme-set="violet-bloom"] .preview-header {
    background-color: #2e1f3a;
    border-bottom-color: #382647;
}

[data-theme-set="violet-bloom"] .preview-content {
    background-color: #1f1526;
}

[data-theme-set="violet-bloom"] .preview-brand {
    background-color: #a85ad4;
}

/* Samba Theme Preview Colors */
[data-theme-set="samba"] .theme-preview {
    background-color: #130d1a;
    border-color: #2c1d3c;
}

[data-theme-set="samba"] .preview-sidebar {
    background-color: #1c1428;
    border-right-color: #241934;
}

[data-theme-set="samba"] .preview-header {
    background-color: #1c1428;
    border-bottom-color: #241934;
}

[data-theme-set="samba"] .preview-content {
    background-color: #130d1a;
}

[data-theme-set="samba"] .preview-brand {
    background-color: #D35AE8;
}

/* Black Piano Theme Preview Colors */
[data-theme-set="black-piano"] .theme-preview {
    background-color: #0d0d0d;
    border-color: #262626;
}

[data-theme-set="black-piano"] .preview-sidebar {
    background-color: #161616;
    border-right-color: #202020;
}

[data-theme-set="black-piano"] .preview-header {
    background-color: #161616;
    border-bottom-color: #202020;
}

[data-theme-set="black-piano"] .preview-content {
    background-color: #0d0d0d;
}

[data-theme-set="black-piano"] .preview-brand {
    background-color: #ffffff;
}

/* Matrix Theme Preview Colors */
[data-theme-set="matrix"] .theme-preview {
    background-color: #000000;
    border-color: #00ff41;
}

[data-theme-set="matrix"] .preview-sidebar {
    background-color: #0d0d0d;
    border-right-color: #00ff41;
}

[data-theme-set="matrix"] .preview-header {
    background-color: #0d0d0d;
    border-bottom-color: #00ff41;
}

[data-theme-set="matrix"] .preview-content {
    background-color: #000000;
}

[data-theme-set="matrix"] .preview-brand {
    background-color: #00ff41;
}

/* Fireworks Theme Preview Colors */
[data-theme-set="fireworks"] .theme-preview {
    background-color: #0a0c10;
    border-color: #262e3d;
}

[data-theme-set="fireworks"] .preview-sidebar {
    background-color: #11141b;
    border-right-color: #1e2531;
}

[data-theme-set="fireworks"] .preview-header {
    background-color: #11141b;
    border-bottom-color: #1e2531;
}

[data-theme-set="fireworks"] .preview-content {
    background-color: #0a0c10;
}

[data-theme-set="fireworks"] .preview-brand {
    background-color: #ff3366;
}

/* Pride Rainbow Theme Preview Colors */
[data-theme-set="pride-rainbow"] .theme-preview {
    background-color: #0c0c11;
    border-color: #222233;
}

[data-theme-set="pride-rainbow"] .preview-sidebar {
    background-color: #15151e;
    border-right-color: #1c1c28;
}

[data-theme-set="pride-rainbow"] .preview-header {
    background-color: #15151e;
    border-bottom-color: #1c1c28;
}

[data-theme-set="pride-rainbow"] .preview-content {
    background-color: #0c0c11;
}

[data-theme-set="pride-rainbow"] .preview-brand {
    background: linear-gradient(135deg, #e40303 0%, #ff8c00 30%, #ffed00 50%, #008026 70%, #004dff 100%);
}

/* Pumpkin Spice Theme Preview Colors */
[data-theme-set="pumpkin-spice"] .theme-preview {
    background-color: #0f0a07;
    border-color: #2a1f18;
}

[data-theme-set="pumpkin-spice"] .preview-sidebar {
    background-color: #1c1410;
    border-right-color: #241a14;
}

[data-theme-set="pumpkin-spice"] .preview-header {
    background-color: #1c1410;
    border-bottom-color: #241a14;
}

[data-theme-set="pumpkin-spice"] .preview-content {
    background-color: #0f0a07;
}

[data-theme-set="pumpkin-spice"] .preview-brand {
    background-color: #ff8c2a;
}

/* ========================================= */
/*       PUMPKIN SPICE (HALLOWEEN) THEME     */
/* ========================================= */

/* Corner Decorations: Interactive Pumpkins */
.pumpkin-decoration {
    position: fixed;
    width: 28px;
    height: 28px;
    pointer-events: none;
    z-index: 1000;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='22' r='14' fill='%23ff6600' stroke='%23d45500' stroke-width='1'/%3E%3Cpath d='M19,8 Q22,8 20,4' fill='none' stroke='%232a5a2a' stroke-width='2' stroke-linecap='round'/%3E%3Cg fill='%233a1a0a'%3E%3Cpath d='M14,18 L17,21 L11,21 Z'/%3E%3Cpath d='M26,18 L29,21 L23,21 Z'/%3E%3Cpath d='M13,26 Q20,32 27,26 L26,29 Q20,34 14,29 Z'/%3E%3C/g%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    /* transition: transform 0.3s ease-out, top 0.5s ease-out, left 0.5s ease-out; Removed for JS physics */
    animation: pumpkin-flicker 3s infinite alternate;
}

@keyframes pumpkin-flicker {

    0%,
    100% {
        filter: drop-shadow(0 0 2px rgba(255, 165, 0, 0.3)) brightness(0.9);
        transform: scale(1);
    }

    50% {
        filter: drop-shadow(0 0 8px rgba(255, 100, 0, 0.6)) brightness(1.1);
        transform: scale(1.05);
    }
}

/* Topbar Decoration: Bat Strings */
html[data-theme='pumpkin-spice'] .topbar::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 48px;
    pointer-events: none;
    z-index: 101;
    /* Bat SVG Pattern */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='48' viewBox='0 0 100 48'%3E%3Cpath d='M10,10 Q25,35 50,10 T90,10' fill='none' stroke='%235E4B35' stroke-width='1' opacity='0.4'/%3E%3Cg transform='translate(25, 20) scale(0.6)'%3E%3Cpath d='M0,0 C-5,-5 -10,0 -15,-5 C-10,-10 -5,-5 0,-10 C5,-5 10,-10 15,-5 C10,0 5,-5 0,0 Z' fill='%231a1a1a' /%3E%3C/g%3E%3Cg transform='translate(75, 15) scale(0.8)'%3E%3Cpath d='M0,0 C-8,-5 -16,2 -20,-6 C-14,-10 -6,-6 0,-12 C6,-6 14,-10 20,-6 C16,2 8,-5 0,0 Z' fill='%232b1d14' /%3E%3C/g%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-size: 100px 48px;
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.4));
    animation: bat-float 6s ease-in-out infinite alternate;
    opacity: 0.9;
}

/* Ambient Orange/Purple Glow */
html[data-theme='pumpkin-spice'] .topbar {
    box-shadow: 0 10px 40px -5px rgba(255, 120, 30, 0.1), 0 5px 15px -5px rgba(128, 0, 128, 0.15);
    z-index: 102;
}

@keyframes bat-float {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(4px);
    }
}

/* Witch Hat on Logo */
html[data-theme='pumpkin-spice'] .brand {
    position: relative;
    z-index: 105;
}

html[data-theme='pumpkin-spice'] .brand::after {
    content: '';
    position: absolute;
    top: -12px;
    left: -8px;
    width: 42px;
    height: 42px;
    /* Witch Hat SVG */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50'%3E%3Cdefs%3E%3Cfilter id='s1'%3E%3CfeDropShadow dx='1' dy='1' stdDeviation='1' flood-color='rgba(0,0,0,0.4)'/%3E%3C/filter%3E%3C/defs%3E%3C!-- Hat Cone --%3E%3Cpath d='M10,38 Q25,-5 40,38 Z' fill='%232a1a35' filter='url(%23s1)'/%3E%3C!-- Hat Brim --%3E%3Cpath d='M5,38 Q25,44 45,38' fill='none' stroke='%232a1a35' stroke-width='6' stroke-linecap='round' filter='url(%23s1)'/%3E%3C!-- Band --%3E%3Cpath d='M13,34 Q25,38 37,34' fill='none' stroke='%23ff6600' stroke-width='3' /%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    transform-origin: bottom center;
    transform: rotate(-15deg);
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Wiggle Hat on Hover */
html[data-theme='pumpkin-spice'] .brand:hover::after {
    animation: hat-wiggle 1s ease-in-out infinite;
}

/* Adjust hat when sidebar is open (reusing Holy Jolly logic logic broadly, but specific positions) */
.sidebar:not(.collapsed) html[data-theme='pumpkin-spice'] .brand::after,
html[data-theme='pumpkin-spice'] .sidebar:not(.collapsed) .brand::after {
    transform: rotate(-25deg) scale(1.1) translateX(2px);
}

/* Holly Jolly Theme Preview Colors */
[data-theme-set="holly-jolly"] .theme-preview {
    background-color: #0a1410;
    border-color: #20352b;
}

[data-theme-set="holly-jolly"] .preview-sidebar {
    background-color: #14231c;
    border-right-color: #1a2e24;
}

[data-theme-set="holly-jolly"] .preview-header {
    background-color: #14231c;
    border-bottom-color: #1a2e24;
}

[data-theme-set="holly-jolly"] .preview-content {
    background-color: #0a1410;
}

[data-theme-set="holly-jolly"] .preview-brand {
    background-color: #d84c4c;
}

.settings-panel .option svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.5;
    color: var(--color-text-muted);
}

/* ===== Tooltip for Settings Panel Options ===== */
.settings-panel .option::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-bg-top);
    border: 1px solid var(--border-strong);
    color: var(--color-text);
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 20;
    box-shadow: var(--shadow-elevation);
    font-size: var(--fs-meta);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
}

.settings-panel .option:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ===== Notification History Panel (Refined) ===== */
.notification-history-panel {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 380px;
    max-height: 520px;
    border: 1px solid var(--border-soft);
    border-top: 1px solid color-mix(in srgb, white, transparent 90%);
    border-radius: 16px;
    z-index: 1000;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    flex-direction: column;
    overflow: hidden;
    transform-origin: top right;
    animation: panelSlideIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes panelSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }

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

.notification-history-panel.show {
    display: flex;
}

.notification-history-header {
    padding: 16px 20px 12px 20px;
    border-bottom: 1px solid var(--border-faint);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notification-history-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.notification-history-clear {
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-history-clear:hover {
    color: var(--color-danger);
    border-color: rgba(244, 67, 54, 0.3);
    background: rgba(244, 67, 54, 0.1);
    transform: translateY(-1px);
}

.notification-history-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    gap: 8px;
}

/* Custom Scrollbar */
.notification-history-list::-webkit-scrollbar {
    width: 6px;
}

.notification-history-list::-webkit-scrollbar-track {
    background: transparent;
}

.notification-history-list::-webkit-scrollbar-thumb {
    background-color: var(--border-soft);
    border-radius: 10px;
}

.notification-history-item {
    margin: 0 16px;
    padding: 12px 14px;
    background: color-mix(in srgb, var(--color-surface-alt), transparent 35%);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    display: flex;
    gap: 14px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    align-items: center;
}

.notification-history-item:hover {
    background-color: var(--color-surface-hover, var(--overlay-hover));
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.notification-history-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-surface);
    border: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-history-icon svg {
    width: 16px;
    height: 16px;
}

.notification-history-item[data-type="success"] .notification-history-icon {
    color: var(--green, #10b981);
    background: color-mix(in srgb, var(--green, #10b981) 10%, transparent);
    border-color: color-mix(in srgb, var(--green, #10b981) 20%, transparent);
}

.notification-history-item[data-type="error"] .notification-history-icon {
    color: var(--color-danger, #ef4444);
    background: color-mix(in srgb, var(--color-danger, #ef4444) 10%, transparent);
    border-color: color-mix(in srgb, var(--color-danger, #ef4444) 20%, transparent);
}

.notification-history-item[data-type="warning"] .notification-history-icon {
    color: var(--yellow, #f59e0b);
    background: color-mix(in srgb, var(--yellow, #f59e0b) 10%, transparent);
    border-color: color-mix(in srgb, var(--yellow, #f59e0b) 20%, transparent);
}

.notification-history-item[data-type="insight"] .notification-history-icon {
    color: var(--purple, #8b5cf6);
    background: color-mix(in srgb, var(--purple, #8b5cf6) 10%, transparent);
    border-color: color-mix(in srgb, var(--purple, #8b5cf6) 20%, transparent);
}

.notification-history-item[data-type="advice"] .notification-history-icon {
    color: var(--blue, #3b82f6);
    background: color-mix(in srgb, var(--blue, #3b82f6) 10%, transparent);
    border-color: color-mix(in srgb, var(--blue, #3b82f6) 20%, transparent);
}

.notification-history-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.notification-history-message {
    font-size: 13px;
    color: var(--color-text);
    line-height: 1.4;
    font-weight: 500;
}

.notification-history-time {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-muted);
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.notification-history-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    background-color: var(--color-danger);
    color: white;
    border-radius: 10px;
    border: 2px solid var(--color-surface);
    display: none;
    font-size: 9px;
    font-weight: 700;
    line-height: 10px;
    text-align: center;
    box-shadow: 0 0 0 1px var(--color-surface);
    z-index: 10;
}

.notification-badge.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sidebar */
.sidebar {
    grid-area: sidebar;
    background: var(--color-surface);
    border-right: 1px solid var(--border-faint);
    position: sticky;
    border-radius: 0px 25px;
    top: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    transition: width var(--anim-fast) ease, transform var(--anim-fast) ease, background .2s ease, color .2s ease;
    width: var(--layout-sidebar);
    overflow: hidden;
    will-change: width, transform;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
}

.logo {
    width: 35px;
    height: 35px;
    flex: 0 0 auto;
    object-fit: contain;
}

.brand .title {
    font-weight: 700;
    text-transform: capitalize;
    font-size: var(--fs-title-nav);
}

.brand .subtitle {
    color: var(--color-text-muted);
    font-size: 10px;
    /* Minimalist size */
    font-weight: 500;
    letter-spacing: 0.02em;
    opacity: 0.7;
    margin-top: 2px;
}

.brand .subtitle .highlight {
    color: var(--color-brand);
    font-weight: 700;
    letter-spacing: 0;
    /* Reset spacing for brand name */
}

nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: auto;
    /*padding-right: 4px;*/
    flex: 1;
    min-height: 0;
}

nav::-webkit-scrollbar {
    width: 10px
}

nav::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 10px
}

.group-label {
    padding: 10px 10px 6px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: var(--fs-caption);
}

.item {
    --pad: 12px;
    display: flex;
    align-items: left;
    gap: 10px;
    padding: 10px var(--pad);
    border-radius: var(--radius);
    cursor: pointer;
    border: 1px solid transparent;
    color: var(--color-text);
    background: transparent;
    position: relative;
    width: 100%;
    font-family: var(--font-family);
    color: var(--color-text);
    transition: background-color 0.2s ease, border-color 0.2s ease;
    align-items: center;
    /* Corrected alignment */
    justify-content: left;
    /* Corrected alignment */
}

/* Group container for root + children */
/* Group container */
.nav-item-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Sub-item container base styles */
.sub-items-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

/* Mobile Toggle Arrow */
.toggle-arrow {
    display: none;
    /* Hidden by default */
    width: 16px;
    height: 16px;
    margin-left: auto;
    transition: transform 0.3s ease;
    color: var(--color-icon-dim);
    cursor: pointer;
    padding: 2px;
}

.toggle-arrow.expanded {
    transform: rotate(90deg);
}

/* Sub-item styles */
.item.sub-item .ic {
    opacity: 1;
    /* Always visible if the row is visible */
}

/* DESKTOP BEHAVIOR (Hover to expand) */
@media (min-width: 1001px) {
    .sub-items-container {
        max-height: 0;
        opacity: 0;
    }

    .nav-item-group:hover .sub-items-container {
        max-height: 500px;
        /* Arbitrary large height */
        opacity: 1;
    }
}

/* MOBILE BEHAVIOR (Click to expand) */
@media (max-width: 1000px) {
    .toggle-arrow {
        display: block;
    }

    .sub-items-container {
        display: none;
        /* Fully hidden by default on mobile */
    }

    .sub-items-container.mobile-expanded {
        display: flex;
    }
}

/* Style for the icon div container */
.item .ic {
    display: inline-block;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    background-color: currentColor;
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-position: center;
}


.item:hover {
    background: var(--overlay-hover);
    border-color: var(--border-soft)
}

.item:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring)
}

.item .caret {
    margin-left: auto;
    width: 16px;
    transition: transform .2s ease;
    opacity: .7;
    color: var(--color-icon-dim)
}

.item.active {
    background: linear-gradient(180deg, color-mix(in srgb, var(--color-brand) 20%, transparent), color-mix(in srgb, var(--color-brand) 10%, transparent));
    border-color: var(--color-surface-transparent);
}

.item .badge {
    margin-left: auto;
    color: #0b1020;
    background: var(--color-brand);
    border-radius: 999px;
    padding: 2px 8px;
    font-weight: 700;
    font-size: var(--fs-caption);
}

.divider {
    height: 1px;
    background: var(--border-faint);
    margin: 8px 0
}

.profile {
    margin-top: auto;
    padding: 10px 14px;
    /* Slightly reduced padding */
    background: linear-gradient(135deg, var(--color-surface-alt) 0%, var(--color-surface) 100%);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    /* Slightly tighter radius */
    display: flex;
    align-items: center;
    gap: 10px;
    /* Reduced gap */
    min-width: 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

/* Hover effect: subtle lift and glow */
.profile:hover {
    transform: translateY(-1px);
    /* More subtle lift */
    box-shadow: 0 6px 16px -4px rgba(0, 0, 0, 0.25);
    border-color: var(--color-brand-border);
    background: linear-gradient(135deg, var(--color-surface-block) 0%, var(--color-surface-alt) 100%);
}

/* Glassy shine effect on hover */
.profile::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.03), transparent);
    /* More subtle shine */
    transform: skewX(-20deg);
    transition: left 0.5s ease;
    pointer-events: none;
}

.profile:hover::after {
    left: 150%;
    transition: left 0.7s ease;
}

.avatar {
    width: 36px;
    /* Smaller avatar */
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--color-brand) 0%, #ff6b6b 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    /* Lighter weight */
    font-size: 13px;
    /* Smaller initials */
    flex: 0 0 auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

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

.avatar span {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.profile .name {
    font-weight: 600;
    font-size: 13px;
    /* Smaller name */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text);
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.profile .role {
    color: var(--color-text-muted);
    font-size: 10px;
    /* Smaller email */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* text-transform: uppercase; Removed uppercase for elegance */
    letter-spacing: 0.02em;
    margin-top: 1px;
    opacity: 0.8;
}

.logout-btn {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    transition: all 0.2s ease;
    opacity: 0;
    transform: translateX(-5px);
}

.profile:hover .logout-btn {
    opacity: 1;
    transform: translateX(0);
}

.logout-btn:hover {
    background-color: var(--color-bg-base);
    color: var(--color-danger);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Collapsed visuals */
.sidebar.collapsed .item span,
.sidebar.collapsed .item .badge,
.sidebar.collapsed .group-label,
.sidebar.collapsed .profile .name,
.sidebar.collapsed .profile .role,
.sidebar.collapsed .profile .meta,
.sidebar.collapsed .profile .logout-btn {
    display: none !important
}

.sidebar.collapsed .item {
    justify-content: center;
    gap: 0
}

.sidebar.collapsed nav {
    padding-right: 0
}

.sidebar.collapsed .divider {
    display: none
}

.sidebar.collapsed .brand {
    justify-content: flex-start !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
}

.sidebar.collapsed .brand .meta,
.sidebar.collapsed .brand .title,
.sidebar.collapsed .brand .subtitle {
    display: block !important;
    white-space: nowrap;
}

.sidebar.collapsed .profile {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    background: transparent;
    /* Optional: remove background in collapsed state if desired, or keep it */
    border-color: transparent;
    /* Optional: cleaner look */
}

/* Tooltip (dark) */
.tooltip {
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--color-bg-top);
    border: 1px solid var(--border-soft);
    color: var(--color-text);
    padding: 6px 8px;
    border-radius: 8px;
    white-space: nowrap;
    display: none;
    pointer-events: none;
    font-size: var(--fs-meta);
}

.sidebar.collapsed .item:hover .tooltip {
    display: block
}

/* Hide tooltip for items inside the popover entirely */
.sidebar.collapsed .sub-items-container .tooltip {
    display: none !important;
}

/* Main */
.main {
    grid-area: main;
    grid-row: 1 / -1;
    /* Faz o main começar do topo, passando por baixo da topbar */
    padding: 68px 0px 0px 0px !important;
    /* Compensa a altura da topbar (68px) */
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    /*overflow: auto;*/
    position: relative;
    outline: none;
    border: none;
}

.page-host-card {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: var(--radius);
    padding: 0px;
    /* Note: We have intentionally left out display:flex and its related properties */
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--border-faint);
    border-radius: var(--radius);
    box-shadow: var(--shadow-elevation);
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--brand-tint);
    border: 1px solid var(--color-brand-border);
    color: var(--color-text);
    font-weight: 600;
}

.kbd {
    opacity: .9;
    padding: 3px 8px;
    font-size: var(--fs-meta);
}

.mobile-logo {
    display: none;
}

/* ===== Fullscreen (Zen) Mode Styles ===== */
body.fullscreen-mode {
    display: block;
    overflow: hidden;
}

body.fullscreen-mode .sidebar,
body.fullscreen-mode .backdrop {
    display: none !important;
}

body.fullscreen-mode .main {
    position: fixed;
    inset: 0;
    z-index: 100;
    padding: 0 !important;
    grid-area: unset;
    height: 100vh;
    width: 100vw;
}

body.fullscreen-mode .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 101;
    background: transparent;
    border: none;
    pointer-events: none;
}

body.fullscreen-mode .topbar>* {
    display: none;
}

body.fullscreen-mode .topbar .top-actions {
    display: flex;
    justify-content: flex-end;
    padding: 10px;
    pointer-events: auto;
}

body.fullscreen-mode .topbar .top-actions>* {
    display: none;
}

body.fullscreen-mode .topbar .top-actions>#fullscreenBtn {
    display: inline-grid;
}


/* ===== Notification System ===== */
#notification-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 360px;
    max-width: 90vw;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.notification-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    padding: 16px;
    border-top-color: color-mix(in srgb, white, transparent 92%);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow-elevation), 0 10px 30px -10px color-mix(in srgb, var(--notif-color) 25%, transparent);
    color: var(--color-text);
    font-size: var(--fs-body);
    pointer-events: auto;
    position: relative;
    overflow: visible;
    opacity: 0;
    transform: translateY(-80px) scale(0.9);
    animation: slideInFromTop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    box-sizing: border-box;
}

.notification-card::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background-color: color-mix(in srgb, var(--color-surface-block, var(--color-surface)), transparent 15%);
    border-left: 1px solid var(--border-soft);
    border-top: 1px solid var(--border-soft);
    box-sizing: border-box;
    z-index: -1;
}

.notification-card:hover {
    transform: scale(1.02) translateY(-2px);
    box-shadow: var(--shadow-elevation), 0 15px 35px -8px color-mix(in srgb, var(--notif-color) 35%, transparent);
    border-color: var(--border-strong);
}

.notification-card.closing {
    animation: slideOutToTop 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

/* Different types of notifications based on data-type attribute */
.notification-card[data-type="error"] {
    --notif-color: var(--color-danger, #ef4444);
    border-left: 4px solid var(--notif-color);
}

.notification-card[data-type="warning"] {
    --notif-color: var(--yellow, #f59e0b);
    border-left: 4px solid var(--notif-color);
}

.notification-card[data-type="success"] {
    --notif-color: var(--green, #10b981);
    border-left: 4px solid var(--notif-color);
}

.notification-card[data-type="insight"] {
    --notif-color: var(--purple, #8b5cf6);
    border-left: 4px solid var(--notif-color);
}

.notification-card[data-type="advice"] {
    --notif-color: var(--blue, #3b82f6);
    border-left: 4px solid var(--notif-color);
}

.notification-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    color: var(--notif-color, var(--color-text));
}

.notification-icon svg {
    width: 100%;
    height: 100%;
}

.notification-content {
    flex-grow: 1;
    line-height: 1.4;
    word-wrap: break-word;
    font-weight: 500;
}

.notification-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin: -4px -4px 0 0;
    padding: 0;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--color-text-muted);
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.notification-close:hover {
    opacity: 1;
    transform: scale(1.1);
    color: var(--color-text);
}

/* Progress Indicator */
.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--notif-color), color-mix(in srgb, var(--notif-color) 40%, white));
    width: 100%;
    transform-origin: left;
    animation: shrinkWidth linear forwards;
}

@keyframes shrinkWidth {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* === Confirmation Dialog Style === */
.notification-confirm-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 999999;
    display: grid;
    place-items: center;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

.notification-confirm-overlay.closing {
    animation: fadeOut 0.3s ease forwards;
}

.notification-card.confirm {
    transform: none;
    animation: confirmZoom 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
    width: 440px;
    max-width: 90vw;
    padding: 24px;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border-left: 4px solid var(--notif-color, var(--color-brand)) !important;
}

@keyframes confirmZoom {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(15px);
    }

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

.notification-card.confirm .notification-icon {
    width: 32px;
    height: 32px;
    margin-top: 0;
    margin-bottom: 12px;
}

.notification-card.confirm .notification-content {
    text-align: center;
    line-height: 1.5;
}

.notification-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    width: 100%;
    margin-top: 20px;
}

.notification-actions button {
    flex: 1;
    height: 40px;
    font-weight: 600;
    font-size: var(--fs-body);
    border-radius: var(--radius, 8px);
    cursor: pointer;
    transition: all 0.2s ease;
}

.notification-actions .btn-proceed {
    background-color: var(--color-brand);
    border: 1px solid transparent;
    color: white;
}

.notification-actions .btn-proceed:hover {
    background-color: color-mix(in srgb, var(--color-brand), white 10%);
    transform: translateY(-1px);
}

.notification-actions .btn-cancel {
    background: transparent;
    border: 1px solid var(--border-soft);
    color: var(--color-text-muted);
}

.notification-actions .btn-cancel:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

/* Notification Panel Tabs */
.notification-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 4px;
    margin: 4px 16px 12px 16px;
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    flex-shrink: 0;
}

.notification-tab {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    padding: 8px 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.notification-tab:hover {
    color: var(--color-text);
}

.notification-tab:active {
    transform: scale(0.95);
}

.notification-tab.active {
    background: var(--color-surface);
    color: var(--color-text);
    font-weight: 600;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
}

/* Hide history items that don't match filter */
.notification-history-item.hidden-by-tab {
    display: none !important;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* === END: New Styles === */

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-80px) scale(0.9);
    }

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

@keyframes slideOutToTop {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(-80px) scale(0.9);
    }
}

/* Responsive */
@media (max-width: 1000px) {
    body {
        grid-template-columns: 1fr;
        grid-template-areas: "topbar" "main"
    }

    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        inset: 0 auto 0 0;
        width: 280px;
        z-index: 10;
    }

    .sidebar.open {
        transform: none;
    }

    .backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .4);
        display: none;
        z-index: 9;
    }

    .backdrop.show {
        display: block
    }

    .mobile-logo {
        display: block;
    }
}

/* Burger Menu */
.burger-wrapper {
    position: relative;
}

.burger-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-elevation);
    z-index: 10000;
    width: 220px;
    padding: 6px;
    flex-direction: column;
    gap: 4px;
}

.burger-menu.show {
    display: flex;
    z-index: 10000;
}

.burger-menu button {
    width: 100%;
    padding: 8px 12px;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    border-radius: 8px;
    font-family: inherit;
    font-size: var(--fs-body);
    position: relative;
    /* ADDED for spinner */
}

.burger-menu button:hover {
    background-color: var(--overlay-hover);
}

.burger-menu button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.burger-menu .menu-divider {
    height: 1px;
    background: var(--border-faint);
    margin: 4px 0;
}

/* Button Loading State */
.is-loading {
    pointer-events: none;
    color: transparent !important;
}

.is-loading>* {
    /* Hide direct children like text or SVG */
    visibility: hidden;
}

.is-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    /* Center the spinner */
    border: 2px solid var(--color-text-muted);
    border-top-color: var(--color-brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===== Page transition loader ===== */

/* MOBILE-FIRST: Default to covering the entire screen */
.page-loader {
    position: fixed;
    inset: 0;

    /* Make the background transparent */
    background-color: transparent;

    /* Remove the blur effect */
    backdrop-filter: none;

    display: grid;
    place-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
}

/* DESKTOP OVERRIDE: Constrain the loader on larger screens */
@media (min-width: 1001px) {
    .page-loader {
        position: absolute;
        top: 56px;
        /* Align below the topbar */
        left: var(--layout-sidebar);
        /* Align next to the sidebar */
        right: 0;
        bottom: 0;
        /* Add transition for the sidebar collapse/expand animation */
        transition: opacity 0.3s ease, visibility 0.3s, left var(--anim-fast) ease;
    }
}

.page-loader.is-active {
    opacity: 1;
    visibility: visible;
}

#contentHost {
    transition: opacity 0.4s ease;
    min-height: 100%;
    /* Prevent collapsing during transition */
}

/* ===== UPDATED: Spinner Style ===== */
.spinner {
    transform: rotateZ(45deg);
    perspective: 1000px;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    color: var(--color-brand);
    position: relative;
}

.spinner:before,
.spinner:after {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: inherit;
    height: inherit;
    border-radius: 50%;
    transform: rotateX(70deg);
    animation: 1s spin linear infinite;
}

.spinner:after {
    color: var(--color-brand-soft);
    transform: rotateY(70deg);
    animation-delay: .4s;
}

/* ===== Search Help Modal ===== */
.search-help-modal {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    max-width: 90vw;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-elevation);
    z-index: 10005;
    display: none;
    flex-direction: column;
    animation: fadeIn 0.2s ease;
}

.search-help-modal.show {
    display: flex;
}

.search-help-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-faint);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-help-title {
    font-weight: 700;
    font-size: var(--fs-title-sub);
}

.search-help-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 20px;
}

.search-help-body {
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.search-help-section h4 {
    color: var(--color-brand-soft);
    margin-bottom: 10px;
    font-size: var(--fs-body);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.search-help-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: var(--fs-meta);
}

.search-help-cmd {
    font-family: var(--font-family-mono);
    background: var(--color-surface-alt);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--color-text);
}

.search-help-desc {
    color: var(--color-text-muted);
}

/* ===== Search Autocomplete ===== */
.search-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-elevation);
    z-index: 10006;
    margin-top: 4px;
    display: none;
    flex-direction: column;
    max-height: 300px;
    overflow-y: auto;
}

.search-autocomplete.show {
    display: flex;
}

.search-autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--fs-body);
    color: var(--color-text);
}

.search-autocomplete-item:hover,
.search-autocomplete-item.active {
    background: var(--overlay-hover);
}

.search-autocomplete-item .cmd {
    font-family: var(--font-family-mono);
    color: var(--color-brand-soft);
    font-weight: 500;
}

.search-autocomplete-item .desc {
    color: var(--color-text-muted);
    font-size: var(--fs-meta);
    margin-left: auto;
}

/* ===== Global Glass Effect (Generic Menu Bar) ===== */
.gmb-glass {
    background-color: color-mix(in srgb, var(--color-surface-block), transparent 60%);
    backdrop-filter: blur(20px) saturate(120%);
    -webkit-backdrop-filter: blur(20px) saturate(120%);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-elevation);
}

/* --- No Data State Styling (Shared from Builder Core) --- */
.quanta-no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--color-text-muted);
    gap: 0.75rem;
    padding: 1rem;
    box-sizing: border-box;
    text-align: center;
    animation: quanta-fade-in 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.quanta-no-data svg {
    width: 48px;
    height: 48px;
    opacity: 0.15;
    /* Very subtle */
    stroke: currentColor;
    stroke-width: 1.5;
    transition: all 0.3s ease;
}

@keyframes quanta-fade-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover Interaction: Bounce & Brand Color */
.quanta-no-data:hover svg {
    stroke: var(--color-brand);
    opacity: 0.8;
    animation: quanta-bounce 0.6s cubic-bezier(0.25, 1.5, 0.5, 1);
}

.quanta-no-data:hover span {
    color: var(--color-brand);
    opacity: 1;
}

@keyframes quanta-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-10px);
    }

    50% {
        transform: translateY(0);
    }

    70% {
        transform: translateY(-5px);
    }
}

.quanta-no-data span {
    font-size: var(--fs-meta, 0.75rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    opacity: 0.5;
    transition: all 0.3s ease;
}

/* ===== Black Piano Theme ===== */
html[data-theme='black-piano'] {
    --color-bg-top: #0d0d0d;
    --color-bg-base: #0d0d0d;
    --color-surface: #161616;
    --color-surface-alt: rgba(255, 255, 255, 0.03);
    --color-surface-block: #1a1a1a;
    --color-text: #f1f1f1;
    --color-text-muted: rgba(241, 241, 241, 0.5);
    --color-brand: #4f46e5;
    --color-danger: #ff3f3f;
    --color-success: #81c784;
    --focus-ring: 0 0 0 3px rgba(229, 182, 17, 0.25);
    --color-shadow: rgba(0, 0, 0, 0.5);
    --overlay-hover: rgba(255, 255, 255, .05);
    --border-faint: rgba(255, 255, 255, .05);
    --border-soft: rgba(255, 255, 255, .05);
    --border-strong: rgba(255, 255, 255, .05);
}

html[data-theme='black-piano'] body {
    background: radial-gradient(circle at 50% -20%, #2a2a2a 0%, #0d0d0d 70%);
}

/* Black Piano Theme Preview style override (removed ::before circle indicator) */

/* ===== Light Theme Overrides for Spotlight Gradient ===== */
html[data-theme='light'] body {
    background: radial-gradient(circle at 50% -20%, var(--color-bg-base) 0%, color-mix(in srgb, var(--color-brand) 8%, var(--color-bg-base)) 70%);
}

/* ===== Global Geometric Background Pattern ===== */
.bg-pattern-container {
    position: fixed;
    top: -10vh;
    left: -10vw;
    width: 120vw;
    height: 120vh;
    z-index: -1;
    overflow: hidden;
    background: transparent;
    pointer-events: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 60%);
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 60%);
}

.bg-pattern-item {
    border: 1px solid rgba(255, 255, 255, 0.02);
    width: 10em;
    height: 10em;
    transform: rotate(45deg);
    margin: 2em;
    float: left;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(0, 0, 0, 0.02) 100%);
}

/* =========================================================
   MODERN FLOATING SIDEBAR REDESIGN OVERRIDES
   ========================================================= */

/* Floating Sidebar Base */
.sidebar {
    margin-left: 16px !important;
    margin-bottom: 16px !important;
    height: calc(100dvh - 32px) !important;
    width: calc(var(--layout-sidebar) - 16px) !important;
    border-radius: 24px !important;
    border: 1px solid var(--border-soft) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
    overflow: visible !important;
    z-index: 10;
}

/* Sidebar Toggle Button */
.sidebar-toggle-wrapper {
    position: absolute;
    right: -14px;
    top: 130px;
    z-index: 101;
}

.sidebar-toggle-btn {
    width: 28px;
    height: 28px;
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, background 0.2s ease;
}

.sidebar-toggle-btn svg {
    width: 24px !important;
    height: 24px !important;
}

.sidebar-toggle-btn svg * {
    stroke: var(--color-text) !important;
    stroke-width: 2.5px !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    fill: none !important;
}

.sidebar-toggle-btn:hover {
    background: var(--color-surface-hover);
}

.sidebar.collapsed .sidebar-toggle-btn {
    transform: rotate(180deg);
}

/* Profile Section at Top */
.sidebar .profile {
    margin-top: 0 !important;
    margin-bottom: 12px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 8px 4px !important;
    border-radius: 0 !important;
}

.sidebar .profile:hover {
    transform: none !important;
    border: none !important;
}

/* Promo Box (Add New Task) */
.sidebar-promo {
    margin-top: auto;
    background: var(--color-surface-alt);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid var(--border-soft);
    transition: opacity var(--anim-fast) ease, margin var(--anim-fast) ease;
}

.sidebar-promo h4 {
    margin: 0;
    font-size: 14px;
    color: var(--color-text);
}

.sidebar-promo p {
    margin: 0;
    font-size: 11px;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.promo-btn {
    background: #ff7e33;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 4px 12px rgba(255, 126, 51, 0.3);
    transition: transform 0.2s ease;
}

.promo-btn:hover {
    transform: scale(1.02);
}

.sidebar.collapsed .sidebar-promo {
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    height: 0;
    padding: 0;
    margin: 0;
    border: none;
}

/* Sub-items Tree Hierarchy Lines */
.sub-items-container {
    margin-left: 24px;
    padding-left: 8px;
    border-left: 1px solid var(--border-soft);
}

.sub-items-container .item.sub-item::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    width: 8px;
    height: 1px;
    background: var(--border-soft);
}

/* Collapsed Popover Menu for Nav Items */
@media (min-width: 769px) {
    .sidebar.collapsed nav {
        overflow: visible !important;
    }

    .sidebar.collapsed .nav-item-group {
        position: relative;
    }

    /* Force sub-items container to inline accordion (pushing items down) */
    .sidebar.collapsed .nav-item-group:hover .sub-items-container,
    .sidebar.collapsed .nav-item-group:focus-within .sub-items-container {
        position: relative !important;
        left: 58px !important;
        /* Popover background starts right where curves end */
        top: 0 !important;
        margin-top: 4px !important;
        margin-bottom: 12px !important;
        background: var(--color-surface-alt) !important;
        /* Solid brown color */
        border-radius: 16px !important;
        padding: 8px !important;
        /* Normal padding, no extra space for lines */
        box-shadow: var(--shadow-elevation) !important;
        width: 160px !important;
        /* Fixed width */
        min-width: 160px !important;
        z-index: 9999 !important;
        max-height: 1000px !important;
        opacity: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: visible !important;
        pointer-events: auto !important;
        visibility: visible !important;
        border: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* Override any max-height 0 that might be stuck */
    .sidebar.collapsed .sub-items-container {
        max-height: 0 !important;
        opacity: 0 !important;
        pointer-events: none;
        visibility: hidden;
        margin-left: 0 !important;
        border-left: none !important;
        transition: max-height 0.3s ease, opacity 0.3s ease !important;
    }

    /* Vertical tree line (drawn to the left of the container, over the sidebar) */
    .sidebar.collapsed .nav-item-group:hover .sub-items-container::before {
        display: block !important;
        content: '' !important;
        position: absolute !important;
        left: -28px !important;
        /* Exact center of the parent icon (30px from group left) */
        top: -4px !important;
        /* Starts exactly at the bottom of the parent item box to prevent overlap */
        bottom: 44px !important;
        /* Drops down exactly to the top of the last curve */
        width: 2px !important;
        background: var(--color-text-muted) !important;
        border: none !important;
        opacity: 0.3 !important;
        /* Adding subtle opacity so it isn't overly bright */
    }

    /* Spacing and styling for items inside popover */
    .sidebar.collapsed .sub-items-container .item.sub-item {
        position: relative !important;
        padding: 12px 16px !important;
        margin: 4px 0 !important;
        background: transparent !important;
        border-radius: 12px !important;
        justify-content: flex-start !important;
        border: none !important;
        /* OVERRIDE INLINE JS BORDER */
    }

    /* Hide icons in the popover to match the reference design */
    .sidebar.collapsed .sub-items-container .item.sub-item .ic {
        display: none !important;
    }

    .sidebar.collapsed .sub-items-container .item.sub-item:hover {
        background: var(--overlay-hover) !important;
    }

    /* Force text visible in popover */
    .sidebar.collapsed .sub-items-container .item span:not(.tooltip) {
        display: block !important;
        opacity: 1 !important;
        width: auto !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        white-space: nowrap !important;
        color: var(--color-text-muted) !important;
        transition: color 0.2s ease !important;
        margin-left: 0 !important;
    }

    .sidebar.collapsed .sub-items-container .item.sub-item:hover span:not(.tooltip) {
        color: var(--color-text) !important;
    }

    /* Inner tree curved lines (no left border to prevent double-line overlap!) */
    .sidebar.collapsed .sub-items-container .item.sub-item::before {
        display: block !important;
        content: '' !important;
        position: absolute !important;
        left: -36px !important;
        /* Starts exactly at the vertical line (-28px from container) */
        top: calc(50% - 12px) !important;
        /* Positions bottom border at exact vertical center of item */
        width: 28px !important;
        /* Spans 28px to end EXACTLY at the popover left edge (-8px) */
        height: 12px !important;
        /* Height is exactly the radius to draw only the curve */
        border-left: none !important;
        /* Prevent vertical overlap with main line */
        border-bottom: 2px solid var(--color-text-muted) !important;
        border-bottom-left-radius: 12px !important;
        background: transparent !important;
    }
}

/* =========================================
   COMPLEX MAC DOCK SIDEBAR REDESIGN
   ========================================= */

/* Independent Brand Header (always expanded, not part of sidebar) */
.brand.independent-brand {
    position: fixed !important;
    left: 30px !important;
    top: 6px !important;
    /* Centered in 68px topbar: (68 - 56) / 2 */
    height: 56px !important;
    padding-left: 0 !important;
    z-index: 10 !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
}

.brand.independent-brand .logo {
    width: 45px !important;
    height: 45px !important;
    flex: 0 0 auto !important;
    object-fit: contain !important;

    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    transform-origin: left center !important;
    opacity: 1 !important;
    transform: scale(1) translateX(0) !important;
    margin-right: 0 !important;
}

.brand.independent-brand.is-scrolled .logo {
    width: 0px !important;
    height: 0px !important;
    opacity: 0 !important;
    transform: scale(0.5) translateX(-20px) !important;
    margin-right: -12px !important;
    /* Counteracts the parent's gap: 12px */
    pointer-events: none !important;
}

.brand.independent-brand .meta {
    display: block !important;
}

.brand.independent-brand .title {
    font-weight: 700 !important;
    text-transform: capitalize !important;
    font-size: var(--fs-title-nav) !important;
    color: var(--color-text) !important;
}

.brand.independent-brand .subtitle {
    color: var(--color-text-muted) !important;
    font-size: 10px !important;
    font-weight: 500 !important;
    letter-spacing: 0.02em !important;
    opacity: 0.7 !important;
    margin-top: 2px !important;
}

.brand.independent-brand .subtitle .highlight {
    color: var(--color-brand) !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
}

/* The outer sidebar container, styled as a mac dock container */
#sidebar.sidebar.mac-dock-container {
    position: fixed !important;
    left: 20px !important;
    top: 75px !important;
    height: calc(100vh - 104px) !important;
    width: 70px !important;
    margin: 0 !important;
    background: var(--color-surface) !important;
    border: 1px solid var(--border-soft) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-elevation) !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 16px 0 !important;
    box-sizing: border-box !important;
    z-index: 10 !important;
    transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    font-family: var(--font-family) !important;
    overflow: visible !important;
    align-items: center !important;
}

/* Make inner sidebar-part transparent in Mac Dock layout */
#sidebar.sidebar.mac-dock-container .sidebar-part {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    width: 100% !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

#sidebar.sidebar.mac-dock-container .sidebar-part.main-part {
    overflow: visible !important;
    flex: 1 !important;
}

#sidebar.sidebar.mac-dock-container.is-expanded {
    width: var(--layout-sidebar) !important;
    align-items: stretch !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
}

/* Hide original toggle button when redesigned toggle is active */
#sidebar.mac-dock-container .sidebar-toggle-wrapper,
#sidebar.mac-dock-container #sidebar-toggle-btn {
    display: none !important;
}

/* Items Wrapper */
.mac-dock-items-wrapper {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    flex-grow: 1 !important;
    overflow: visible !important;
}

.mac-dock-container.is-expanded .mac-dock-items-wrapper {
    align-items: stretch !important;
}

/* Individual Dock Item */
.mac-dock-item {
    width: 48px !important;
    height: var(--item-h, 48px) !important;
    position: relative !important;
    cursor: pointer !important;
    background: transparent !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    transition: height 0.2s cubic-bezier(0.25, 1, 0.5, 1) !important;
    will-change: height !important;
    border: none !important;
    padding: 0 !important;
    margin: 6px 0 !important;
}

.mac-dock-items-wrapper.is-interacting .mac-dock-item {
    transition: none !important;
}

.mac-dock-items-wrapper.is-interacting .mac-dock-item-main {
    transition: background 0.2s !important;
}

.mac-dock-container.is-expanded .mac-dock-item {
    width: 100% !important;
    height: auto !important;
    min-height: 48px !important;
    transition: none !important;
    margin: 2px 0 !important;
}

/* Container for Zoom Effect */
.mac-dock-item-main {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 48px !important;
    width: 48px !important;
    position: relative !important;
    border-radius: var(--radius) !important;
    background: transparent !important;
    transform-origin: left center !important;
    transform: scale(var(--item-scale, 1)) !important;
    transition: background 0.2s, transform 0.2s cubic-bezier(0.25, 1, 0.5, 1) !important;
    will-change: transform !important;
    z-index: 2 !important;
}

.mac-dock-item:hover .mac-dock-item-main {
    background: var(--overlay-hover) !important;
}

.mac-dock-container.is-expanded .mac-dock-item-main {
    width: 100% !important;
    justify-content: flex-start !important;
    padding-left: 12px !important;
    background: transparent !important;
    transform: scale(var(--item-scale, 1)) !important;
}

/* Mask Icon Styles */
.mac-dock-item-main .ic {
    width: 22px !important;
    height: 22px !important;
    background-color: var(--color-icon-dim) !important;
    flex-shrink: 0 !important;
    transition: background-color 0.2s !important;
    mask-size: contain !important;
    -webkit-mask-size: contain !important;
    mask-repeat: no-repeat !important;
    -webkit-mask-repeat: no-repeat !important;
    mask-position: center !important;
    -webkit-mask-position: center !important;
}

.mac-dock-container.is-expanded .mac-dock-item-main .ic {
    margin-right: 16px !important;
}

.mac-dock-item:hover .mac-dock-item-main .ic,
.mac-dock-item.active .mac-dock-item-main .ic {
    background-color: var(--color-text) !important;
}

.mac-dock-label {
    display: none !important;
    color: var(--color-text) !important;
    font-size: var(--fs-body) !important;
    white-space: nowrap !important;
    pointer-events: none !important;
    font-weight: 500 !important;
}

.mac-dock-container.is-expanded .mac-dock-label {
    display: block !important;
}

.mac-dock-chevron {
    display: none !important;
    width: 16px !important;
    height: 16px !important;
    margin-left: auto !important;
    margin-right: 12px !important;
    transition: transform 0.2s ease !important;
    color: var(--color-icon-dim) !important;
}

.mac-dock-chevron svg {
    width: 100% !important;
    height: 100% !important;
}

.mac-dock-container.is-expanded .mac-dock-chevron {
    display: block !important;
}

.mac-dock-container.is-expanded .mac-dock-item:hover .mac-dock-chevron {
    transform: rotate(180deg) !important;
}

/* Active State Indicator */
.mac-dock-item.active .mac-dock-item-main::before {
    content: '' !important;
    position: absolute !important;
    left: -8px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 4px !important;
    height: 4px !important;
    border-radius: 50% !important;
    background: var(--color-brand) !important;
}

.mac-dock-container.is-expanded .mac-dock-item.active .mac-dock-item-main::before {
    left: 4px !important;
    height: 16px !important;
    border-radius: 2px !important;
}

/* Badge Indicator */
.mac-dock-badge {
    position: absolute !important;
    top: 4px !important;
    right: 4px !important;
    background: var(--color-danger) !important;
    color: #fff !important;
    font-size: var(--fs-caption) !important;
    font-weight: bold !important;
    min-width: 18px !important;
    height: 18px !important;
    border-radius: 9px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 0 4px !important;
    box-sizing: border-box !important;
    z-index: 3 !important;
}

.mac-dock-container.is-expanded .mac-dock-badge {
    right: 12px !important;
    top: 14px !important;
}

/* Separator Line */
.mac-dock-separator {
    width: 40px !important;
    height: 1px !important;
    background: var(--border-soft) !important;
    margin: 12px auto !important;
    transition: width 0.3s !important;
}

.mac-dock-container.is-expanded .mac-dock-separator {
    width: 90% !important;
}

/* Bottom Toggle Button */
.mac-dock-toggle {
    margin-top: auto !important;
    margin-bottom: 0px !important;
    width: 48px !important;
    height: 48px !important;
    align-self: center !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    cursor: pointer !important;
    border-radius: var(--radius) !important;
    color: var(--color-icon-dim) !important;
    transition: background 0.2s, width 0.3s !important;
}

.mac-dock-toggle:hover {
    background: var(--overlay-hover) !important;
    color: var(--color-text) !important;
}

.mac-dock-toggle svg {
    width: 24px !important;
    height: 24px !important;
    transition: transform 0.3s ease !important;
}

.mac-dock-container.is-expanded .mac-dock-toggle {
    width: 100% !important;
    justify-content: flex-end !important;
    padding-right: 16px !important;
}

.mac-dock-container.is-expanded .mac-dock-toggle svg {
    transform: rotate(180deg) !important;
}

/* =========================================
   TOOLTIPS AND SUBPAGES (Base CSS)
   ========================================= */
.mac-dock-subpages {
    display: none !important;
    background: var(--color-surface-block) !important;
    border: 1px solid var(--border-soft) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-elevation) !important;
    z-index: 10000 !important;
    transform: scale(1) !important;
}

.mac-dock-item:hover .mac-dock-subpages {
    display: block !important;
}

/* Subpage item styling */
#sidebar.mac-dock-container .mac-dock-subpage-item.item {
    all: unset !important;
    display: block !important;
    box-sizing: border-box !important;
    padding: 8px 16px !important;
    font-size: var(--fs-body) !important;
    color: var(--color-text-muted) !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    transition: color 0.2s, background 0.2s !important;
    border-radius: 6px !important;
    margin: 2px 4px !important;
    text-align: left !important;
    background: transparent !important;
}

#sidebar.mac-dock-container .mac-dock-subpage-item.item:hover,
#sidebar.mac-dock-container .mac-dock-subpage-item.item.active {
    color: var(--color-text) !important;
    background: var(--overlay-hover) !important;
}

.mac-dock-flyout-header {
    font-size: var(--fs-body) !important;
    color: var(--color-text) !important;
    padding: 10px 16px !important;
    white-space: nowrap !important;
    text-align: left !important;
}

.mac-dock-item[data-has-subpages="true"] .mac-dock-flyout-header {
    color: var(--color-brand) !important;
    font-size: var(--fs-caption) !important;
    text-transform: uppercase !important;
    border-bottom: 1px solid var(--border-soft) !important;
    margin-bottom: 4px !important;
    padding: 10px 16px 6px 16px !important;
    letter-spacing: 0.5px !important;
}

/* =========================================
   COLLAPSED STATE OVERRIDES (Floating Pill)
   ========================================= */
.mac-dock-container:not(.is-expanded) .mac-dock-subpages {
    position: absolute !important;
    left: calc(100% + 36px) !important;
    top: 0 !important;
    min-width: max-content !important;
}

/* Invisible bridge for hover transition to subpage */
.mac-dock-container:not(.is-expanded) .mac-dock-subpages::before {
    content: '' !important;
    position: absolute !important;
    left: -36px !important;
    top: 0 !important;
    width: 36px !important;
    height: 100% !important;
    background: transparent !important;
    z-index: 1 !important;
}

/* =========================================
   EXPANDED STATE OVERRIDES (Sidebar Drawer)
   ========================================= */
.mac-dock-container.is-expanded .mac-dock-subpages {
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 0 0 36px !important;
    display: block !important;
    max-height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    transition: max-height 0.3s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.2s ease, padding 0.3s ease !important;
}

.mac-dock-container.is-expanded .mac-dock-item:hover .mac-dock-subpages {
    max-height: 400px !important;
    padding-bottom: 8px !important;
    opacity: 1 !important;
}

.mac-dock-container.is-expanded .mac-dock-subpages::before {
    display: none !important;
}

.mac-dock-container.is-expanded .mac-dock-flyout-header {
    display: none !important;
}

/* ===== Layout Override for 'no-template' tag (No Sidebar) ===== */
body.no-template {
    --layout-sidebar: 0px !important;
    grid-template-columns: 1fr !important;
    grid-template-areas: "topbar" "main" !important;
}

body.no-template #sidebar,
body.no-template #sidebar.sidebar.mac-dock-container,
body.no-template #sidebar.sidebar.mac-dock-container.is-expanded,
body.no-template .sidebar,
body.no-template .burger,
body.no-template #burger {
    display: none !important;
}

/* ===== Layout Override for 'top-bar-disabled' tag (No Top Bar) ===== */
body.top-bar-disabled {
    grid-template-rows: 1fr !important;
    grid-template-areas: "sidebar main" !important;
}

body.no-template.top-bar-disabled {
    grid-template-rows: 1fr !important;
    grid-template-columns: 1fr !important;
    grid-template-areas: "main" !important;
}

body.top-bar-disabled .topbar {
    display: none !important;
}

/* ===== Layout Override for 'sidebar-mode-top' (Top Navigation Mode) ===== */
body.sidebar-mode-top {
    --layout-sidebar: 0px !important;
    grid-template-columns: 1fr !important;
    grid-template-areas: "topbar" "main" !important;
}

body.sidebar-mode-top #sidebar,
body.sidebar-mode-top #sidebar.sidebar.mac-dock-container,
body.sidebar-mode-top #sidebar.sidebar.mac-dock-container.is-expanded,
body.sidebar-mode-top .sidebar,
body.sidebar-mode-top .burger,
body.sidebar-mode-top #burger,
body.sidebar-mode-top #sidebar-toggle-btn {
    display: none !important;
}

/* ===== Top Navigation Bar Styling ===== */
.topbar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Space out logo, top-nav, and top-actions */
}

.top-nav {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    /* Center the top navigation menu */
    align-items: center;
    margin: 0;
    z-index: 10;
    border-radius: 20px;
    pointer-events: auto;
}

.top-nav-items-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    height: 100%;
}

/* Top Navigation Items */
.top-nav-items-wrapper .mac-dock-item {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    height: 40px !important;
    width: auto !important;
    /* Allow dynamic width based on text */
    padding: 0 14px !important;
    margin: 4px !important;
    border-radius: var(--radius) !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    color: var(--color-text-muted) !important;
    flex-direction: row !important;
}

.top-nav-items-wrapper .mac-dock-item-main {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    height: 100% !important;
    width: auto !important;
    /* Allow dynamic width based on text */
    padding: 0 !important;
    margin: 0 !important;
    transform: none !important;
    /* Disable zoom physics completely */
    background: transparent !important;
}

.top-nav-items-wrapper .mac-dock-item .ic {
    display: inline-block !important;
    width: 18px !important;
    height: 18px !important;
    background-color: currentColor !important;
    mask-size: contain !important;
    -webkit-mask-size: contain !important;
    mask-repeat: no-repeat !important;
    -webkit-mask-repeat: no-repeat !important;
    mask-position: center !important;
    -webkit-mask-position: center !important;
}

.top-nav-items-wrapper .mac-dock-item .mac-dock-label {
    font-size: 13px !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    color: currentColor !important;
    display: none !important;
    pointer-events: auto !important;
}

.top-nav-items-wrapper .mac-dock-item:not(.top-icon-only) .mac-dock-label {
    display: block !important;
}

/* Hover & Active States */
.top-nav-items-wrapper .mac-dock-item:hover {
    background: var(--overlay-hover) !important;
    color: var(--color-text) !important;
}

.top-nav-items-wrapper .mac-dock-item:hover .mac-dock-item-main {
    background: transparent !important;
}

.top-nav-items-wrapper .mac-dock-item.active {
    background: linear-gradient(180deg, color-mix(in srgb, var(--color-brand) 20%, transparent), color-mix(in srgb, var(--color-brand) 10%, transparent)) !important;
    color: var(--color-brand, var(--color-text)) !important;
    box-shadow: 0 4px 12px -2px color-mix(in srgb, var(--color-brand) 15%, transparent) !important;
}

.top-nav-items-wrapper .mac-dock-item.active .mac-dock-item-main::before {
    display: none !important;
    content: none !important;
}

/* Custom Display Options for Top Navigation Layouts (Icon only, Title only) */
.top-nav-items-wrapper .mac-dock-item.top-icon-only .mac-dock-label {
    display: none !important;
}

.top-nav-items-wrapper .mac-dock-item.top-title-only .ic {
    display: none !important;
}

/* Tooltip controls: Hide tooltips unless it's icon-only layout */
.top-nav-items-wrapper .mac-dock-item:not(.top-icon-only) .tooltip {
    display: none !important;
}

.top-nav-items-wrapper .mac-dock-item.top-icon-only:hover .tooltip {
    display: block !important;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
}

/* Separators */
.top-nav-separator {
    width: 1px;
    height: 18px;
    background: var(--border-soft);
    margin: 0 8px;
}

/* Chevrons */
.top-nav-items-wrapper .mac-dock-chevron {
    width: 12px !important;
    height: 12px !important;
    margin-left: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: currentColor !important;
    opacity: 0.7 !important;
}

.top-nav-items-wrapper .mac-dock-chevron svg {
    width: 100%;
    height: 100%;
}

/* Dropdown / Subpages for Top Navigation */
.top-nav-items-wrapper .mac-dock-subpages {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    min-width: 180px;
    padding: 6px;
    flex-direction: column;
    gap: 2px;
    z-index: 100;
}

.top-nav-items-wrapper .mac-dock-item:hover .mac-dock-subpages {
    display: flex;
}

.top-nav-items-wrapper .mac-dock-flyout-header {
    display: none !important;
    /* Hide header in top dropdowns */
}

.top-nav-items-wrapper .mac-dock-subpage-item {
    padding: 8px 12px;
    border-radius: calc(var(--radius) - 2px);
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.top-nav-items-wrapper .mac-dock-subpage-item:hover {
    background: var(--overlay-hover);
    color: var(--color-text);
}

.top-nav-items-wrapper .mac-dock-subpage-item.active {
    background: color-mix(in srgb, var(--color-brand) 12%, transparent);
    color: var(--color-brand);
}

/* ===== Generic Right Side Panel (Lateral Drawer) ===== */
.generic-right-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100vh;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    border-left: 1px solid var(--border-soft);
    box-sizing: border-box;
}

.generic-right-panel.show {
    right: 0;
}

/* Left Mode for Generic Panel */
.generic-right-panel.left-mode {
    right: auto;
    left: -420px;
    border-left: none;
    border-right: 1px solid var(--border-soft);
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.15);
    transition: left 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.generic-right-panel.left-mode.show {
    left: 0;
}

.generic-right-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-soft);
    background: transparent;
}

.generic-right-panel-title {
    font-size: var(--fs-title-sub, 16px);
    font-weight: 700;
    margin: 0;
    color: var(--color-text);
}

.generic-right-panel-close {
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    color: var(--color-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    box-shadow: 0 4px 12px var(--color-shadow, rgba(0, 0, 0, 0.1));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.generic-right-panel-close svg {
    width: 32px;
    height: 32px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.generic-right-panel-close:hover {
    color: var(--color-text);
    background: var(--color-brand, #e5b611);
    border-color: var(--color-brand, #e5b611);
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--color-brand, #e5b611) 40%, transparent);
}

.generic-right-panel-close:hover svg {
    transform: rotate(90deg);
}

.generic-right-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.generic-right-panel-body .settings-panel,
.generic-right-panel-body .notification-history-panel {
    display: none !important;
    position: static !important;
    width: 100% !important;
    max-height: none !important;

    padding: 0 !important;
}

.generic-right-panel-body .settings-panel.show,
.generic-right-panel-body .notification-history-panel.show {
    display: flex !important;
}

/* Adjust nested panels elements padding and scroll */
.generic-right-panel-body .settings-panel {
    overflow-y: visible !important;
}

.generic-right-panel-body .notification-history-panel {
    overflow-y: visible !important;
}

.generic-right-panel-body .notification-history-list {
    max-height: none !important;
    overflow-y: visible !important;
}

/* Adjust notification tabs for sidebar layout */
.generic-right-panel-body .notification-tabs {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 4px !important;
    padding: 4px !important;
    background: var(--color-surface-alt);
    border-radius: var(--radius);
}

.generic-right-panel-body .notification-tab {
    font-size: 11px !important;
    padding: 6px 4px !important;
    text-align: center !important;
}

/* Header Tabs and badges inside the right drawer panel */
.generic-right-panel-tabs {
    display: flex;
    gap: 4px;
    padding: 2px;
    background: var(--color-surface-alt);
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
}

.generic-right-panel-tab {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    padding: 6px 12px;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.generic-right-panel-tab:hover {
    color: var(--color-text);
    background: var(--color-surface-hover);
}

.generic-right-panel-tab.active {
    background: var(--color-surface);
    color: var(--color-brand);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.generic-right-panel-tab svg {
    display: block;
}

.generic-right-panel-tab-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    background-color: var(--color-danger);
    border-radius: 50%;
    display: none;
}

.generic-right-panel-tab-badge.show {
    display: block;
}

/* Top Bar Panel Items promotion logic (hidden by default, shown when data-pending="true") */
.top-actions .btn.panel-item {
    display: none !important;
}

.top-actions .btn.panel-item[data-pending="true"] {
    display: inline-flex !important;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .generic-right-panel {
        width: 100% !important;
        right: -100%;
    }

    .generic-right-panel.left-mode {
        right: auto;
        left: -100%;
    }
}

/* Responsive adjustments for brand logo (placed at the end to override desktop !important) */
@media (max-width: 1000px) {
    .brand.independent-brand {
        display: none !important;
    }
}

/* Ensure the independent brand logo stays on top of the fullscreen brand wrapper */
body.no-template:has(.brand-page-wrapper) .brand.independent-brand {
    z-index: 10000 !important;
    top: 40px !important;
    left: 60px !important;
}

/* Ensure text is always readable (white/light) on the dark video background */
body.no-template:has(.brand-page-wrapper) .brand.independent-brand .title {
    color: #ffffff !important;
}

body.no-template:has(.brand-page-wrapper) .brand.independent-brand .subtitle {
    color: rgba(255, 255, 255, 0.6) !important;
}

body.no-template:has(.brand-page-wrapper) .brand.independent-brand .subtitle .highlight {
    color: #ffffff !important;
}

/* Hide the redundant text logo from brand.html when the independent brand header is visible */
body.no-template:has(.brand-page-wrapper) .brand-logo-group {
    display: none !important;
}

/* Push navigation links to the right when the independent brand logo is shown */
body.no-template:has(.brand-page-wrapper) .brand-nav {
    margin-left: auto !important;
}

/* ===== Mobile Floating Sidebar Toggle ===== */
.mobile-sidebar-toggle {
    display: none;
}

@media (max-width: 1000px) {
    .mobile-sidebar-toggle {
        display: flex !important;
        position: fixed !important;
        left: 0 !important;
        top: 76px !important;
        width: 48px !important;
        height: 48px !important;
        background-color: var(--color-surface, #1e1e1e) !important;
        border: 1px solid var(--border-soft, #333) !important;
        border-left: none !important;
        border-radius: 0 24px 24px 0 !important;
        z-index: 10001 !important;
        align-items: center !important;
        justify-content: center !important;
        color: var(--color-text) !important;
        box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.15) !important;
        cursor: pointer !important;
        transition: transform 0.3s ease !important;
    }

    .sidebar.open~.mobile-sidebar-toggle {
        display: none !important;
    }
}

/* ===== Generic Right Panel: Left Fullscreen Mode ===== */
.generic-right-panel.left-fullscreen {
    right: auto !important;
    left: -100vw !important;
    width: 100vw !important;
    max-width: 100vw !important;
    border-left: none !important;
    border-right: 1px solid var(--border-soft);
    transition: left 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.generic-right-panel.left-fullscreen.show {
    left: 0 !important;
}

/* Make sure the header handles its own display when hidden by JS */
.generic-right-panel.left-fullscreen .generic-right-panel-header {
    border-bottom: none !important;
    padding: 0 !important;
}

/* Normalize any children (like sidebar) moved inside the left-fullscreen body */
.generic-right-panel.left-fullscreen .generic-right-panel-body {
    padding: 0 !important;
}

.generic-right-panel.left-fullscreen .generic-right-panel-body>*,
.generic-right-panel.left-mode .generic-right-panel-body>* {
    display: flex !important;
    position: relative !important;
    transform: none !important;
    inset: auto !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
}

/* Override Mac Dock sidebar width inside Generic Right Panel */
.generic-right-panel.left-fullscreen .generic-right-panel-body>#sidebar.mac-dock-container,
.generic-right-panel.left-mode .generic-right-panel-body>#sidebar.mac-dock-container {
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    border-radius: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* Hide Mac Dock sidebar on mobile when it is not inside the GenericRightPanel */
@media (max-width: 1000px) {
    body>#sidebar.sidebar.mac-dock-container {
        display: none !important;
    }
}

/* --- TV Spatial Navigation Styles --- */
body[data-device-type="tv"] :focus:not(.superflix-movie-card),
body[data-device-type="tv"] [data-tv-focused="true"]:not(.superflix-movie-card) {
    outline: 2px solid var(--color-brand) !important;
    outline-offset: 0 !important;
    box-shadow: 0 10px 25px color-mix(in srgb, var(--color-brand) 40%, rgba(0, 0, 0, 0.6)) !important;
    z-index: 99 !important;
}

body[data-device-type="tv"] {
    /* Provide smooth scrolling globally for TV */
    scroll-behavior: smooth;
    cursor: none !important;
    pointer-events: none !important;
}

body[data-device-type="tv"] * {
    cursor: none !important;
}

/* --- TV Generic Section Animations --- */
body[data-device-type="tv"] [data-tv-section] {
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform-origin: center center;
    will-change: opacity, transform;
}

body[data-device-type="tv"] [data-tv-section][data-tv-section-status="previous"],
body[data-device-type="tv"] [data-tv-section][data-tv-section-status="next"] {
    opacity: 0.5;
}

body[data-device-type="tv"] [data-tv-section][data-tv-section-status="active"] {
    opacity: 1;
    transform: scale(1);
    z-index: 10;
}

/* --- TV Fullscreen Override for Video --- */
body[data-device-type="tv"] .superflix-video-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #000 !important;
    max-width: none !important;
    max-height: none !important;
}

body[data-device-type="tv"] .superflix-player-wrapper {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    position: static !important;
}

body[data-device-type="tv"] .superflix-modal-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    border-radius: 0 !important;
    border: none !important;
    transform: none !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
}

body[data-device-type="tv"] #superflix-ctrl-play,
body[data-device-type="tv"] #superflix-ctrl-prev,
body[data-device-type="tv"] #superflix-ctrl-next,
body[data-device-type="tv"] #superflix-ctrl-pip,
body[data-device-type="tv"] .superflix-volume-wrapper,
body[data-device-type="tv"] #superflix-ctrl-settings,
body[data-device-type="tv"] #superflix-ctrl-audio,
body[data-device-type="tv"] .superflix-controls-progress-wrapper {
    display: none !important;
}

body[data-device-type="tv"] .superflix-search-input-box {
    display: none !important;
}

/* Global spatial navigation scrollbar hidden styles */
body[data-device-type="tv"] * {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

body[data-device-type="tv"] *::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}


/* Styles extracted from template.html */
/* Custom Profile Panel Styles */
.profile-wrapper {
    position: relative;
}

.profile-panel {
    width: 260px !important;
    padding: 14px !important;
    border-radius: var(--radius) !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3) !important;
    background: var(--color-surface) !important;
    border: 1px solid var(--border-soft) !important;
}

.profile-panel-info {
    padding: 2px 4px 6px 4px !important;
}

.profile-panel-info .name {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--color-text) !important;
    margin-bottom: 2px;
}

.profile-panel-info .email {
    font-size: 11px !important;
    color: var(--color-text-muted) !important;
    word-break: break-all;
    line-height: 1.3;
}

.profile-panel-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 4px;
}

.profile-panel-section .section-title {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    opacity: 0.8;
}

.profile-panel-section .profile-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 150px;
    overflow-y: auto;
    padding-right: 4px;
}

.profile-panel-section .profile-list::-webkit-scrollbar {
    width: 4px;
}

.profile-panel-section .profile-list::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb, var(--border-soft));
    border-radius: var(--radius);
}

.profile-panel-section .profile-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    background: var(--color-surface-alt);
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
}

.profile-panel-section .project-name {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text);
    text-transform: capitalize;
}

.profile-panel-section .role-badge {
    font-size: 9px;
    font-weight: 600;
    color: var(--color-brand);
    background: var(--color-surface);
    border: 1px solid var(--border-soft);
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Fix visibility and overrides of .logout-btn in profile panel */
.profile-panel .logout-btn {
    opacity: 1 !important;
    transform: none !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    justify-content: flex-start !important;
    display: flex !important;
}

.back-btn-wrapper {
    margin: 0 auto;
    align-items: center !important;
    justify-content: flex-start !important;
}

.back-btn-item {
    gap: 8px;
    width: 48px;
    text-decoration: none;
    color: var(--color-text-muted);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-size: var(--fs-meta);
    height: 48px;
}

.back-btn-item .ic {
    width: 14px;
    height: 14px;
    mask-image: url('https://api.iconify.design/lucide:arrow-left.svg');
    -webkit-mask-image: url('https://api.iconify.design/lucide:arrow-left.svg');
    background-color: currentColor;
}

.back-btn-item span:not(.tooltip) {
    font-weight: 500;
}

.sidebar.collapsed .back-btn-wrapper {
    padding: 0;
}

.sidebar:not(.collapsed) .back-btn-wrapper {
    margin: 0;
}

.sidebar:not(.collapsed) .back-btn-item {
    width: auto;
}

.sidebar.collapsed .back-btn-item {
    gap: 0;
    justify-content: center;
}

/* Hover effect for the back button */
a[href="{{ PORTAL_BASE_URL }}"]:hover {
    background-color: var(--color-surface-alt);
    border-color: var(--border-soft);
    color: var(--color-text);
}

/* Normalize Top Actions Buttons */
.top-actions .btn,
.top-actions .burger,
.top-actions .expandable-search {
    flex: 0 0 auto !important;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: var(--radius) !important;
    background: var(--color-surface-alt) !important;
    border: 1px solid var(--border-soft) !important;
    box-sizing: border-box !important;
    color: var(--color-text) !important;
    transition: all 0.2s ease;
}

/* Hide all other actions in fullscreen mode */
body.fullscreen-mode .top-actions>*:not(#fullscreenBtn) {
    display: none !important;
}

/* Expandable Search in Top Actions */
.expandable-search {
    position: relative;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    justify-content: flex-start !important;
    /* Left-align the icon */
    overflow: hidden !important;
}

.expandable-search:hover,
.expandable-search:focus-within,
.expandable-search:has(input:not(:placeholder-shown)) {
    width: 280px !important;
    border-color: var(--color-brand) !important;
}

.expandable-search input {
    width: 100% !important;
    height: 100% !important;
    padding: 0 36px 0 36px !important;
    background: transparent !important;
    border: none !important;
    color: transparent !important;
    cursor: pointer !important;
    transition: color 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    outline: none !important;
    box-shadow: none !important;
}

.expandable-search input::placeholder {
    color: transparent !important;
}

.expandable-search:hover input,
.expandable-search:focus-within input,
.expandable-search input:not(:placeholder-shown) {
    color: var(--color-text) !important;
    cursor: text !important;
}

.expandable-search:hover input::placeholder,
.expandable-search:focus-within input::placeholder {
    color: var(--color-text-muted) !important;
}

.expandable-search .icon {
    position: absolute;
    left: 9px !important;
    pointer-events: none;
    z-index: 2;
}

.expandable-search .kbd {
    position: absolute;
    right: 8px !important;
    opacity: 0 !important;
    transition: opacity 0.3s;
    z-index: 2;
}

.expandable-search:hover .kbd {
    opacity: 0.75 !important;
}

.expandable-search:focus-within .kbd,
.expandable-search:has(input:not(:placeholder-shown)) .kbd {
    opacity: 0 !important;
}

/* ===== BioBaron Theme ===== */
html[data-theme='biobaron'] {
    --color-brand: #1B6B2E;
    --color-bg-top: #0E3B1A;
    --color-accent: #8CC63F;
    --color-brand-soft: #A8D86B;
    --color-bg-base: #F0F7EC;
    --color-surface: #FFFFFF;
    --color-text: #1A2E1F;
    --color-text-muted: #5A7A63;
    --color-shadow: rgba(27, 107, 46, 0.12);
}

html[data-theme='biobaron'] .topbar {}

/* ===== RP Ambiental Theme ===== */
html[data-theme='rp_ambiental'] {
    --color-bg-top: #0A2540;
    --color-brand: #004B87;
    --color-accent: #00E676;
    --color-bg-base: #F7F9FC;
    --color-surface: #FFFFFF;
    --color-surface-transparent: rgba(255, 255, 255, 0.8);
    --color-text: #1A202C;
    --color-text-muted: #718096;
    --color-icon-dim: #A0AEC0;
    --color-shadow: rgba(0, 0, 0, 0.08);
}

html[data-theme='rp_ambiental'] .topbar {}

/* ═══════════════════════════════════════
   FEATURED SERVICES GRID (Landpage Component)
   ═══════════════════════════════════════ */
.featured-services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    margin-top: 40px;
}

.featured-service-card {
    background: var(--color-surface);
    border-radius: var(--radius, 16px);
    padding: 36px;
    box-shadow: var(--shadow-elevation, 0 4px 16px rgba(0, 0, 0, 0.12));
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--border-soft);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.featured-service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent-gradient, var(--color-brand));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.featured-service-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover, 0 10px 40px rgba(0, 0, 0, 0.18));
    border-color: var(--border-strong);
}

.featured-service-card:hover::before {
    transform: scaleX(1);
}

.featured-service-icon {
    width: 64px;
    height: 64px;
    background: var(--color-surface-alt, rgba(27, 107, 46, 0.1));
    border-radius: 8px; /* like var(--radius-sm) */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--color-brand);
    margin-bottom: 20px;
    transition: all 0.3s;
}

.featured-service-card:hover .featured-service-icon {
    background: var(--accent-gradient, var(--color-brand));
    color: #fff;
}

.featured-service-card h3 {
    font-size: 1.3rem;
    color: var(--color-text);
    margin-bottom: 12px;
    font-weight: 700;
}

.featured-service-card p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.featured-service-features {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    border-top: 1px solid var(--border-soft);
    padding-top: 16px;
    margin-top: auto; /* Pushes list to bottom */
}

.featured-service-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    font-size: 0.95rem;
    color: var(--color-text-muted);
}

.featured-service-features li i {
    color: var(--color-accent);
    font-size: 1rem;
}
