/* ============================================
   CSS Variables & Reset
   ============================================ */
html {
    font-size: 16px;
}

:root {
    --app-font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    --app-mono-font-family: "Consolas", "Monaco", "Courier New", monospace;
    --primary-color: var(--opendw-primary, #0f62fe);
    --primary-dark: var(--opendw-primary-hover, #0353e9);
    --secondary-color: #e6edf5;
    --danger-color: #dc2626;
    --success-color: #16a34a;
    --warning-color: #d97706;
    --text-primary: #102a43;
    --text-secondary: #526b82;
    --text-tertiary: #7b91a6;
    --bg-primary: #f4f7fb;
    --bg-card: #ffffff;
    --bg-secondary: #eef3f8;
    --bg-hover: #e7f0f8;
    --header-bg: #f8fafc;
    --border-color: #d8e2ec;
    --shadow-sm: 0 1px 2px rgba(16, 42, 67, 0.06);
    --shadow-md: 0 6px 16px rgba(16, 42, 67, 0.08);
    --shadow-lg: 0 14px 30px rgba(16, 42, 67, 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --topbar-height: 52px;
    --sidebar-icon-size: 36px;
    --sidebar-width-expanded: var(--fuse-opendw-sidebar-width, 188px);
    --sidebar-width-collapsed: var(--fuse-opendw-sidebar-collapsed-width, 48px);
    --sidebar-current-width: var(--sidebar-width-collapsed);
    --rightbar-rail-width: var(--fuse-opendw-utility-rail-width, 48px);
    --rightbar-icon-size: 34px;
    --rightbar-panel-width: var(--sidebar-width-expanded);
    --rightbar-width-expanded: calc(var(--rightbar-panel-width) + var(--rightbar-rail-width));
    --rightbar-width-collapsed: var(--rightbar-rail-width);
    --rightbar-current-width: var(--rightbar-width-collapsed);
    --glass-frame-bottom-gap: 72px;
    --transition: all 0.2s ease;
    --widget-surface: #ffffff;
    --widget-surface-soft: #f8fbfd;
    --widget-surface-elevated: #ffffff;
    --widget-surface-muted: #f3f7fb;
    --widget-border-color: #d8e2ec;
    --widget-border-soft: #e6edf5;
    --widget-shadow: 0 8px 20px rgba(16, 42, 67, 0.08);
    --widget-shadow-soft: 0 4px 12px rgba(16, 42, 67, 0.06);
    --widget-item-shadow: 0 6px 16px rgba(16, 42, 67, 0.08);
    --widget-text-primary: #102a43;
    --widget-text-secondary: #526b82;
    --widget-chip-bg: #eef3f8;
    --widget-chip-text: #334e68;
    --widget-input-bg: #ffffff;
    --widget-input-border: #d8e2ec;
    --widget-scrollbar: rgba(82, 107, 130, 0.36);
    --widget-scrollbar-hover: rgba(82, 107, 130, 0.56);
    --widget-scrollbar-track: rgba(216, 226, 236, 0.52);
    --widget-accent-soft: rgba(23, 105, 170, 0.1);
    --widget-note-bg: #f8fbfd;
    --widget-note-border: #e6edf5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--app-font-family);
    background: #f4f7fb;
    color: var(--text-primary);
    min-height: 100vh;
    padding-left: var(--sidebar-current-width);
    /* Default sidebar width to prevent overlap */
    transition: padding-left 0.3s ease, padding-right 0.3s ease;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0.08) 100%);
    pointer-events: none;
    z-index: -1;
}

/* body.sidebar-open is now default */

body.sidebar-collapsed {
    --sidebar-current-width: var(--sidebar-width-collapsed);
    padding-left: var(--sidebar-current-width);
    transition: padding-left 0.3s ease, padding-right 0.3s ease;
}

body.sidebar-open {
    --sidebar-current-width: var(--sidebar-width-expanded);
    padding-left: var(--sidebar-current-width);
    transition: padding-left 0.3s ease, padding-right 0.3s ease;
}

body.rightbar-collapsed {
    --rightbar-current-width: var(--rightbar-width-collapsed);
    padding-right: var(--rightbar-current-width);
    transition: padding-left 0.3s ease, padding-right 0.3s ease;
}

body.rightbar-open {
    --rightbar-current-width: var(--rightbar-width-expanded);
    padding-right: var(--rightbar-current-width);
    transition: padding-left 0.3s ease, padding-right 0.3s ease;
}

body.sidebar-state-restoring,
body.rightbar-state-restoring,
body.sidebar-state-restoring .sidebar,
body.rightbar-state-restoring .rightbar,
body.sidebar-state-restoring .header,
body.rightbar-state-restoring .header,
body.sidebar-state-restoring .dashboard-pages-bar {
    transition: none !important;
}

body.sidebar-hidden {
    --sidebar-current-width: 0px;
    padding-left: 0;
    transition: padding-left 0.3s ease, padding-right 0.3s ease;
}

body.rightbar-state-restoring .rightbar *,
body.rightbar-state-restoring .rightbar *::before,
body.rightbar-state-restoring .rightbar *::after {
    animation: none !important;
    transition: none !important;
}

.rightbar-snapshot-placeholder {
    display: grid;
    align-content: start;
    gap: 10px;
    min-height: 100%;
    padding: 18px 16px;
}

.rightbar-snapshot-placeholder span {
    display: block;
    height: 10px;
    border-radius: 4px;
    background: var(--surface-subtle, #f1f5f9);
}

.rightbar-snapshot-placeholder span:nth-child(1) {
    width: 64%;
}

.rightbar-snapshot-placeholder span:nth-child(2) {
    width: 92%;
}

.rightbar-snapshot-placeholder span:nth-child(3) {
    width: 78%;
}

/* ============================================
   Left Sidebar Menu
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width-expanded);
    height: 100vh;
    background: #0f4f83;
    border-right: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 4px 0 14px rgba(16, 42, 67, 0.16);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, transform 0.3s ease;
    overflow: visible;
}

.sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
}

/* ============================================
   Right Sidebar
   ============================================ */
.rightbar {
    position: fixed;
    right: 0;
    top: 0;
    width: var(--rightbar-width-expanded);
    height: 100vh;
    background: #ffffff;
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 14px rgba(16, 42, 67, 0.08);
    z-index: 190;
    display: flex;
    flex-direction: row;
    transition: width 0.3s ease, transform 0.3s ease;
    overflow: hidden;
}

.rightbar.collapsed {
    width: var(--rightbar-width-collapsed);
}

.rightbar-panel {
    width: var(--rightbar-panel-width);
    min-width: 0;
    flex: 0 0 var(--rightbar-panel-width);
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    transition: width 0.3s ease, flex-basis 0.3s ease, opacity 0.2s ease, visibility 0.2s ease;
}

.rightbar.collapsed .rightbar-panel {
    width: 0;
    flex-basis: 0;
    border-right: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    overflow: hidden;
}

@media (min-width: 769px) {
    body.rightbar-maximized .rightbar.is-maximized {
        position: fixed;
        inset: var(--topbar-height) 0 0 0;
        z-index: 230;
        display: grid;
        width: auto;
        max-width: none;
        height: auto;
        grid-template-columns: minmax(0, 1fr) var(--rightbar-rail-width);
        overflow: hidden;
        border-left: 0;
        box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
    }

    body.rightbar-maximized .rightbar.is-maximized .rightbar-panel {
        width: 100%;
        max-width: none;
        flex: 1 1 auto;
    }

    body.rightbar-maximized .rightbar.is-maximized .rightbar-widget-host {
        padding: 1rem 1.25rem;
    }

    body.rightbar-maximized .rightbar.is-maximized .rightbar-widget-content {
        width: 100%;
        height: 100%;
        min-height: 0;
    }
}

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary-color) 72%, white);
    outline-offset: 2px;
}

.rightbar-panel-header {
    min-height: var(--topbar-height);
    padding: 0.75rem 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}

.rightbar-panel-title {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rightbar-panel-title div {
    min-width: 0;
    display: grid;
    gap: 0.1rem;
}

.rightbar-panel-title-line {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.rightbar-panel-title-line strong {
    min-width: 0;
    flex: 1 1 auto;
}

.rightbar-panel-title strong {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rightbar-panel-title small {
    color: var(--text-tertiary);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1;
    text-transform: uppercase;
}

.rightbar-panel-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 10px;
    background: var(--bg-hover);
    color: var(--primary-color);
    display: inline-grid;
    place-items: center;
    font-size: 1.05rem;
}

.rightbar-panel-icon svg {
    width: 19px;
    height: 19px;
}

.rightbar-panel-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.rightbar-panel-action {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
    transition: var(--transition);
}

.rightbar-panel-action svg {
    width: 18px;
    height: 18px;
}

.rightbar-panel-action:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.rightbar-panel-maximize[aria-pressed="true"] {
    background: var(--bg-hover);
    color: var(--primary-color);
}

.rightbar-panel-new-chat:not(.hidden) {
    width: auto;
    min-width: 0;
    padding: 0 0.65rem;
    gap: 0.35rem;
    border: 1px solid rgba(23, 105, 170, 0.16);
    border-radius: 0.55rem;
    background: rgba(23, 105, 170, 0.08);
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 800;
}

.rightbar-panel-new-chat span {
    white-space: nowrap;
}

.rightbar-panel-new-chat:hover {
    background: rgba(23, 105, 170, 0.14);
    color: var(--primary-color);
}

.rightbar-panel-config:hover {
    background: rgba(23, 105, 170, 0.1);
    color: var(--primary-color);
}

.rightbar-widget-host {
    flex: 1;
    min-height: 0;
    padding: 0.85rem;
    overflow-y: auto;
}

.rightbar-widget-content {
    min-height: 100%;
}

.rightbar-widget-content .widget-loading,
.rightbar-widget-content .widget-error {
    min-height: 180px;
}

.rightbar-rail {
    width: var(--rightbar-rail-width);
    min-width: var(--rightbar-rail-width);
    flex: 0 0 var(--rightbar-rail-width);
    padding: 0.75rem 0.5rem;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    overflow-x: visible;
    overflow-y: auto;
}

.rightbar-rail-section {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
}

.rightbar-rail-brand {
    flex: 0 0 auto;
}

.rightbar-rail-utilities,
.rightbar-rail-widgets {
    flex: 0 0 auto;
}

.rightbar-rail-widgets {
    min-height: 0;
}

.rightbar-icon-list,
.rightbar-utility-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
}

.rightbar-rail-item {
    position: relative;
    width: var(--rightbar-icon-size);
    height: var(--rightbar-icon-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.rightbar-rail-item > .rightbar-icon-btn {
    width: 100%;
    height: 100%;
}

.rightbar-icon-btn,
.rightbar-toggle {
    width: var(--rightbar-icon-size);
    height: var(--rightbar-icon-size);
    min-width: var(--rightbar-icon-size);
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.rightbar-widget-icon-image,
.rightbar-widget-icon-text {
    width: 22px;
    height: 22px;
    display: block;
}

.rightbar-widget-icon-text {
    display: inline-grid;
    place-items: center;
    color: inherit;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
}

.rightbar-widget-icon-image {
    object-fit: contain;
}

.rightbar-rail-menu-trigger {
    position: absolute;
    top: -5px;
    right: -5px;
    z-index: 3;
    width: 20px;
    height: 20px;
    min-width: 20px;
    padding: 0;
    border: 2px solid var(--bg-card, #ffffff);
    border-radius: 999px;
    background: var(--bg-card, #ffffff);
    color: var(--text-secondary, #64748b);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
}

.rightbar-rail-menu-trigger:hover,
.rightbar-rail-menu-trigger[aria-expanded="true"] {
    background: var(--bg-hover, #eff6ff);
    color: var(--primary-color, #1769aa);
}

.rightbar-rail-menu-trigger svg {
    width: 12px;
    height: 12px;
    transform: rotate(90deg);
}

body.dashboard-edit-mode :is(.rightbar-widget-rail-item, .rightbar-utility-rail-item) .rightbar-rail-menu-trigger {
    display: inline-flex;
}

.rightbar-rail-action-menu.widget-action-menu {
    position: fixed;
    z-index: 1200;
    top: auto;
    right: auto;
    min-width: 168px;
    display: grid;
    gap: 4px;
    padding: 5px;
    border: 1px solid var(--border-color, #dbe3ef);
    border-radius: 9px;
    background: var(--bg-card, #ffffff);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
}

.rightbar-icon-btn:hover,
.rightbar-toggle:hover {
    background: var(--bg-hover);
    color: var(--primary-color);
}

.rightbar-utility-toggle {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.rightbar:not(.collapsed) .rightbar-utility-toggle {
    color: var(--primary-color);
}

.rightbar-widget-icon.active {
    background: rgba(23, 105, 170, 0.1);
    color: var(--primary-color);
    box-shadow: inset 0 0 0 1px rgba(23, 105, 170, 0.24);
}

.rightbar-widget-icon.active::before {
    content: '';
    position: absolute;
    left: -0.5rem;
    top: 50%;
    width: 3px;
    height: var(--rightbar-icon-size);
    border-radius: 999px;
    background: var(--primary-color);
    transform: translateY(-50%);
}

.rightbar-icon-btn svg,
.rightbar-toggle-icon,
.rightbar-toggle-icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

.rightbar-empty-state {
    min-height: 110px;
    padding: 1rem 0.85rem;
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-secondary);
    display: grid;
    place-items: center;
    gap: 0.5rem;
    text-align: center;
    font-size: 0.84rem;
}

.rightbar-empty-icon,
.rightbar-empty-icon svg {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

.rightbar-rail-divider {
    width: 24px;
    height: 1px;
    margin: 0.3rem 0;
    background: var(--border-color);
}

.rightbar-add-btn {
    color: var(--text-primary);
}

.rightbar-rail-spacer {
    flex: 1;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .sidebar-brand-copy,
.sidebar.collapsed .menu-text,
.sidebar.collapsed .submenu-arrow,
.sidebar.collapsed .sidebar-search,
.sidebar.collapsed .menu-section-title:not(.is-collapsed),
.sidebar.collapsed .submenu {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    height: var(--topbar-height);
    padding: 0;
    justify-content: center;
}

.sidebar.collapsed .sidebar-logo {
    justify-content: center;
}

.sidebar.collapsed .menu-link {
    display: grid;
    place-items: center;
    width: var(--sidebar-icon-size);
    height: var(--sidebar-icon-size);
    padding: 0;
    margin: 0 auto;
    border-radius: 12px;
}

.sidebar.collapsed .menu-icon {
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    margin: 0;
    font-size: 1.3rem;
}

.sidebar.collapsed .menu-item {
    margin: 0.22rem 0;
}

.sidebar.collapsed .menu-item.linked-apps {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    margin: 0.22rem 0;
}

.sidebar.collapsed .menu-item.linked-apps.is-empty {
    display: none;
}

.sidebar.collapsed .menu-item.linked-apps .menu-link {
    margin: 0 auto;
}

.sidebar.collapsed .menu-item.active .menu-link {
    box-shadow: inset 0 0 0 1px rgba(182, 228, 255, 0.4);
}

.sidebar.collapsed .menu-item.active .menu-link::before {
    content: '';
    position: absolute;
    left: -13px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: var(--sidebar-icon-size);
    background: linear-gradient(180deg, #7ef4f3 0%, #6fc9ff 100%);
    border-radius: 0 2px 2px 0;
    display: block;
}

.sidebar-section-rail-trigger {
    display: none;
}

.sidebar.collapsed .sidebar-section-heading.is-collapsed {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0.22rem 0;
    min-height: var(--sidebar-icon-size);
    position: relative;
}

.sidebar.collapsed .sidebar-section-heading.is-collapsed .sidebar-section-label,
.sidebar.collapsed .sidebar-section-heading.is-collapsed .menu-section-actions {
    display: none;
}

.sidebar.collapsed .sidebar-section-heading.is-collapsed .sidebar-section-rail-trigger {
    width: var(--sidebar-icon-size);
    height: var(--sidebar-icon-size);
    display: grid;
    place-items: center;
    margin: 0 auto;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #e5f3ff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar.collapsed .sidebar-section-heading.is-collapsed .sidebar-section-rail-trigger:hover,
.sidebar.collapsed .sidebar-section-heading.is-collapsed .sidebar-section-rail-trigger:focus-visible {
    background: rgba(139, 211, 251, 0.22);
    color: #ffffff;
    outline: none;
}

.sidebar.collapsed .sidebar-section-heading.is-collapsed.has-active-child .sidebar-section-rail-trigger {
    background: linear-gradient(135deg, rgba(152, 226, 255, 0.38) 0%, rgba(114, 206, 250, 0.24) 100%);
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(182, 228, 255, 0.4);
}

.sidebar.collapsed .sidebar-section-heading.is-collapsed.has-active-child .sidebar-section-rail-trigger::before {
    content: '';
    position: absolute;
    left: -13px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: var(--sidebar-icon-size);
    background: linear-gradient(180deg, #7ef4f3 0%, #6fc9ff 100%);
    border-radius: 0 2px 2px 0;
    display: block;
}

.sidebar-section-flyout {
    position: fixed;
    z-index: 2500;
    display: grid;
    gap: 0.55rem;
    min-width: 236px;
    max-width: calc(100vw - 88px);
    padding: 0.7rem;
    border: 1px solid rgba(199, 230, 249, 0.35);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(11, 83, 137, 0.98) 0%, rgba(7, 66, 118, 0.98) 100%);
    color: #f4fbff;
    box-shadow: 0 18px 45px rgba(5, 33, 62, 0.28);
}

.sidebar-section-flyout.hidden {
    display: none !important;
}

.sidebar-section-flyout-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.2rem 0.25rem 0.55rem;
    border-bottom: 1px solid rgba(199, 230, 249, 0.2);
}

.sidebar-section-flyout-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: #e9f7ff;
    flex: 0 0 auto;
}

.sidebar-section-flyout-icon svg,
.sidebar-section-flyout-link-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.sidebar-section-flyout-header small,
.sidebar-section-flyout-header strong {
    display: block;
    line-height: 1.1;
}

.sidebar-section-flyout-header small {
    color: rgba(226, 244, 255, 0.72);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sidebar-section-flyout-header strong {
    margin-top: 0.1rem;
    color: #ffffff;
    font-size: 0.94rem;
    font-weight: 700;
}

.sidebar-section-flyout-list {
    display: grid;
    gap: 0.25rem;
}

.sidebar-section-flyout-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 42px;
    padding: 0.55rem 0.65rem;
    border-radius: 11px;
    color: #e8f5ff;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 650;
    transition: all 0.2s ease;
}

.sidebar-section-flyout-link:hover,
.sidebar-section-flyout-link:focus-visible {
    background: rgba(139, 211, 251, 0.18);
    color: #ffffff;
    outline: none;
}

.sidebar-section-flyout-link.active {
    background: rgba(139, 211, 251, 0.24);
    color: #ffffff;
}

.sidebar-section-flyout-link-icon {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.sidebar-section-flyout-link-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-section-flyout-badge {
    min-width: 1.35rem;
    height: 1.25rem;
    margin-left: auto;
    padding: 0 0.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.55rem;
    height: var(--topbar-height);
    padding: 0 1.25rem;
    border-bottom: 0;
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand-copy {
    flex: 1;
    min-width: 0;
    max-width: calc(var(--sidebar-width-expanded) - 112px);
    display: grid;
    gap: 0.1rem;
    color: #ebf7ff;
    line-height: 1.05;
}

.sidebar-brand-copy span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0;
    white-space: nowrap;
}

.sidebar-brand-copy small {
    width: fit-content;
    padding: 0.12rem 0.38rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #d9eefc;
    font-size: 0.66rem;
    font-weight: 700;
}

.logo-icon {
    font-size: 1.5rem;
    background: linear-gradient(135deg, #68d7ff 0%, #8ff7ed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ebf7ff;
    white-space: nowrap;
}

.sidebar-toggle {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    border-radius: 50%;
    box-shadow: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #d9ecfb;
    transition: all 0.2s ease;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-toggle-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}

.rightbar-utility-icon {
    flex: 0 0 auto;
}

.rightbar-utility-icon.active {
    background: rgba(23, 105, 170, 0.1);
    color: var(--primary-color);
    box-shadow: inset 0 0 0 1px rgba(23, 105, 170, 0.24);
}

.rightbar-utility-icon[data-unread-count]:not([data-unread-count=""])::after {
    content: attr(data-unread-count);
    position: absolute;
    top: -2px;
    right: -3px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
}

.rightbar-utility-icon.active::before {
    content: '';
    position: absolute;
    left: -0.5rem;
    top: 50%;
    width: 3px;
    height: var(--rightbar-icon-size);
    border-radius: 999px;
    background: var(--primary-color);
    transform: translateY(-50%);
}

.rightbar-utility-divider {
    margin-top: 0;
    margin-bottom: 0;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-version-badge {
    flex-shrink: 0;
}

/* Sidebar Search */
.sidebar-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem;
    padding: 0.6rem 0.9rem;
    background: rgba(216, 236, 251, 0.12);
    border: 1px solid rgba(187, 220, 245, 0.35);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.sidebar-search:focus-within {
    border-color: #93dcff;
    box-shadow: 0 0 0 3px rgba(147, 220, 255, 0.22);
}

.sidebar-search .search-icon {
    font-size: 0.9rem;
    color: #cae6fa;
}

.sidebar-search .search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.85rem;
    color: #f4fbff;
    outline: none;
}

.sidebar-search .search-input::placeholder {
    color: #c1dbef;
}

/* Sidebar Menu */
.sidebar-menu {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.5rem 0;
    list-style: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(176, 223, 250, 0.72) rgba(255, 255, 255, 0.08);
}

.sidebar-menu::-webkit-scrollbar,
.sidebar-actions-menu::-webkit-scrollbar {
    width: 8px;
}

.sidebar-menu::-webkit-scrollbar-track,
.sidebar-actions-menu::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
}

.sidebar-menu::-webkit-scrollbar-thumb,
.sidebar-actions-menu::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(193, 233, 255, 0.88) 0%, rgba(130, 198, 240, 0.86) 100%);
    border-radius: 999px;
    border: 1px solid rgba(9, 72, 122, 0.16);
}

.sidebar-menu::-webkit-scrollbar-thumb:hover,
.sidebar-actions-menu::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(214, 241, 255, 0.95) 0%, rgba(148, 209, 246, 0.92) 100%);
}

.sidebar-footer {
    position: relative;
    z-index: 3;
    padding: 0.75rem;
    border-top: 1px solid rgba(188, 220, 244, 0.22);
    background: linear-gradient(180deg, rgba(10, 82, 136, 0.82) 0%, rgba(8, 72, 126, 0.96) 100%);
    flex-shrink: 0;
}

.sidebar-footer-actions {
    position: relative;
}

.sidebar-actions-toggle {
    width: 100%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    text-align: left;
}

.sidebar-actions-toggle:hover {
    background: rgba(139, 211, 251, 0.22);
}

.sidebar-user-toggle {
    min-height: 46px;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(245, 251, 255, 0.96) 0%, rgba(196, 225, 245, 0.92) 100%);
    color: #0c4b77;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 10px 20px rgba(6, 49, 86, 0.16);
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.sidebar-user-avatar.has-icon {
    font-size: 1.1rem;
    background: rgba(245, 251, 255, 0.92);
}

.sidebar-user-avatar.has-image {
    background: rgba(245, 251, 255, 0.92);
    padding: 0;
}

.sidebar-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sidebar.collapsed .sidebar-footer {
    padding: 0.5rem 0;
}

.sidebar.collapsed .sidebar-footer-actions {
    display: flex;
    justify-content: center;
}

.sidebar.collapsed .sidebar-actions-toggle {
    width: var(--sidebar-icon-size);
    height: var(--sidebar-icon-size);
    justify-content: center;
    padding: 0;
}

.sidebar.collapsed .sidebar-user-avatar {
    width: 34px;
    height: 34px;
    font-size: 0.76rem;
}

.sidebar-actions-menu {
    position: absolute;
    left: calc(100% + 12px);
    right: auto;
    bottom: 0;
    top: auto;
    min-width: 240px;
    z-index: 220;
}

.sidebar-footer-actions.open .sidebar-actions-menu {
    display: flex;
}

.sidebar:not(.collapsed) .sidebar-actions-menu {
    left: 0;
    right: 0;
    bottom: calc(100% + 0.6rem);
    min-width: 0;
}

.linked-apps-toggle {
    width: 100%;
    border: none;
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    font: inherit;
}

.linked-apps-toggle:hover {
    background: rgba(139, 211, 251, 0.16);
}

.menu-item {
    margin: 0.15rem 0.75rem;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    color: #e5f3ff;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    position: relative;
    font-size: 0.9rem;
    font-weight: 500;
}

button.menu-link {
    width: 100%;
    border: none;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.menu-link:hover {
    background: rgba(139, 211, 251, 0.22);
    color: #ffffff;
}

.menu-item.active .menu-link {
    background: linear-gradient(135deg, rgba(152, 226, 255, 0.38) 0%, rgba(114, 206, 250, 0.24) 100%);
    color: #ffffff;
    font-weight: 500;
}

.menu-item.active .menu-link::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: var(--sidebar-icon-size);
    background: linear-gradient(180deg, #7ef4f3 0%, #6fc9ff 100%);
    border-radius: 0 2px 2px 0;
}

.menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 1rem;
    text-align: center;
    flex-shrink: 0;
}

.menu-icon svg,
.menu-icon img,
.btn-icon svg,
.menu-section-action-icon svg {
    width: 1.12rem;
    height: 1.12rem;
    display: block;
}

.menu-icon img {
    border-radius: 6px;
    object-fit: contain;
}

.menu-text {
    flex: 1;
    white-space: nowrap;
}

.menu-summary-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.38rem;
    margin-left: auto;
    padding: 0 0.48rem;
    border-radius: 0.45rem;
    background: var(--ta-brand-600, #1769aa);
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.16);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
}

.menu-summary-badge.hidden {
    display: none;
}

.sidebar.collapsed .menu-summary-badge {
    position: absolute;
    top: 0.22rem;
    right: 0.18rem;
    min-width: 1.12rem;
    height: 1.12rem;
    margin-left: 0;
    padding: 0 0.28rem;
    border: 2px solid var(--ta-white, #ffffff);
    border-radius: 999px;
    font-size: 0.58rem;
}

.submenu-arrow {
    font-size: 0.7rem;
    color: #c5dff1;
    transition: transform 0.2s ease;
}

.menu-item.has-submenu.open .submenu-arrow {
    transform: rotate(90deg);
}

.dashboard-menu-item {
    position: relative;
}

.dashboard-menu-parent {
    padding-right: 2.8rem;
}

.dashboard-menu-toggle {
    position: absolute;
    top: 20px;
    right: 0.55rem;
    transform: translateY(-50%);
    width: 1.9rem;
    height: 1.9rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: #c5dff1;
    cursor: pointer;
}

.dashboard-menu-toggle:hover,
.dashboard-menu-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.dashboard-menu-chevron,
.dashboard-menu-chevron svg {
    width: 1rem;
    height: 1rem;
    display: block;
    transition: transform 0.2s ease;
}

.dashboard-menu-chevron {
    transform: rotate(-90deg);
}

.dashboard-menu-item.open .dashboard-menu-chevron {
    transform: rotate(0);
}

.dashboard-menu-list {
    padding: 0.2rem 0 0.25rem 2.65rem;
}

.dashboard-menu-item:not(.open) .dashboard-menu-list {
    max-height: 0;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
}

.dashboard-menu-item.open .dashboard-menu-list {
    max-height: min(52vh, 560px);
    overflow-y: auto;
}

.dashboard-menu-entry {
    list-style: none;
    min-width: 0;
}

.dashboard-menu-link {
    min-height: 2rem;
    padding: 0.38rem 0.55rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: var(--radius-sm);
    color: #d7edfc;
    text-decoration: none;
    font-size: 0.82rem;
    transition: all 0.2s ease;
}

.dashboard-menu-link:hover,
.dashboard-menu-link.active {
    background: rgba(139, 211, 251, 0.16);
    color: #ffffff;
}

.dashboard-menu-bullet {
    width: 0.42rem;
    height: 0.42rem;
    flex: 0 0 auto;
    border: 1px solid currentColor;
    border-radius: 999px;
    opacity: 0.7;
}

.dashboard-menu-link.active .dashboard-menu-bullet {
    border-color: #7ef4f3;
    background: #7ef4f3;
    opacity: 1;
}

.dashboard-menu-name {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-menu-default {
    flex: 0 0 auto;
    color: #a8d9f5;
    font-size: 0.62rem;
    font-weight: 650;
}

.dashboard-menu-actions {
    margin-top: 0.3rem;
    padding-top: 0.3rem;
    display: grid;
    gap: 0.15rem;
    border-top: 1px solid rgba(173, 206, 232, 0.2);
    list-style: none;
}

.dashboard-menu-actions button {
    min-height: 1.9rem;
    padding: 0.35rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: #c5dff1;
    font: inherit;
    font-size: 0.76rem;
    text-align: left;
    cursor: pointer;
}

.dashboard-menu-actions button:hover {
    background: rgba(139, 211, 251, 0.16);
    color: #ffffff;
}

.sidebar-dashboard-flyout .sidebar-dashboard-flyout-action {
    width: 100%;
    border: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
    text-align: left;
}

.sidebar-dashboard-flyout .sidebar-section-flyout-link-icon .dashboard-menu-bullet {
    display: inline-block;
}

.sidebar.collapsed .dashboard-menu-toggle {
    display: none;
}

.widget-action-wrap.open {
    z-index: 801;
}

/* Menu Divider & Section Title */
.menu-divider {
    height: 1px;
    background: rgba(173, 206, 232, 0.3);
    margin: 0.75rem 1rem;
}

.menu-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #c8e0f2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.5rem 1.5rem;
    margin-top: 0.25rem;
}

.menu-section-title-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.menu-section-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.menu-section-action {
    width: 26px;
    height: 26px;
    border: 1px solid rgba(199, 230, 249, 0.28);
    border-radius: 999px;
    background: rgba(224, 240, 252, 0.14);
    color: #ecf7ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.menu-section-action:hover {
    background: rgba(198, 229, 249, 0.24);
    border-color: rgba(216, 240, 255, 0.36);
    transform: translateY(-1px);
}

.menu-section-action-icon {
    font-size: 0.9rem;
    line-height: 1;
}

/* Submenu */
.submenu {
    list-style: none;
    padding: 0.25rem 0 0.25rem 1.5rem;
    margin: 0.25rem 0 0 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.menu-item.has-submenu.open .submenu {
    max-height: 500px;
}

.submenu-label {
    font-size: 0.7rem;
    color: #c3def2;
    padding: 0.35rem 0.75rem;
    font-weight: 500;
}

.submenu-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    color: #d7edfc;
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.submenu-link:hover {
    background: rgba(139, 211, 251, 0.22);
    color: #ffffff;
}

.submenu-icon {
    font-size: 0.9rem;
}

/* Adjust main content when sidebar is present - handled by body padding */

/* ============================================
   Header Styles
   ============================================ */
.header {
    background: #f8fafc;
    backdrop-filter: none;
    min-height: var(--topbar-height);
    padding: 0.48rem 1.25rem 0.48rem 1rem;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    box-shadow: none;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header.notification-panel-open {
    z-index: 1200;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-brand-copy {
    display: flex;
    align-items: center;
}

.header-page-title {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.header-page-title > span {
    flex: 0 0 auto;
    padding: 0.26rem 0.58rem;
    border-radius: 999px;
    background: rgba(32, 156, 255, 0.11);
    color: #1f6f9f;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.header-page-title div {
    min-width: 0;
    display: grid;
    gap: 0.12rem;
}

.header-page-title h1 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.18rem;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.1;
}

.header-page-title p {
    margin: 0;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-left h1 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--text-primary);
}

.version-badge {
    background: linear-gradient(135deg, #1f8dd9 0%, #40b9ef 100%);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    position: relative;
    flex: 0 0 auto;
    margin-left: auto;
}

.topbar-leading {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.topbar-leading > :is(.header-page-title, .dashboard-pages-bar) {
    min-width: 0;
    flex: 0 1 auto;
}

.topbar-sidebar-toggle {
    flex: 0 0 auto;
}

.topbar-global-search {
    position: relative;
    flex: 0 1 340px;
    min-width: 190px;
    height: 42px;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0 0.7rem;
    border: 1px solid var(--opendw-border, var(--border-color));
    border-radius: var(--opendw-radius-md, 10px);
    background: var(--opendw-surface, #ffffff);
    color: var(--opendw-text-muted, var(--text-secondary));
}

.topbar-leading > .topbar-global-search {
    flex: 0 1 340px;
    order: 1;
}

.topbar-leading > :is(.header-page-title, .dashboard-pages-bar) {
    order: 2;
}

.topbar-global-search:focus-within {
    border-color: var(--opendw-primary, var(--primary-color));
    box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.12);
}

.topbar-global-search-icon {
    width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 18px;
}

.topbar-global-search-icon svg {
    width: 18px;
    height: 18px;
}

.topbar-mobile-search-trigger,
.topbar-mobile-search-close {
    display: none;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.topbar-mobile-search-trigger svg,
.topbar-mobile-search-close svg {
    width: 18px;
    height: 18px;
}

.topbar-global-search input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--opendw-text, var(--text-primary));
    font: inherit;
    font-size: 0.84rem;
}

.topbar-global-search kbd {
    flex: 0 0 auto;
    padding: 0.16rem 0.38rem;
    border: 1px solid var(--opendw-border, var(--border-color));
    border-radius: 6px;
    background: var(--opendw-surface-muted, var(--bg-secondary));
    color: var(--opendw-text-muted, var(--text-secondary));
    font-size: 0.66rem;
    font-family: inherit;
}

.topbar-global-search-results {
    position: absolute;
    top: calc(100% + 0.45rem);
    left: 0;
    right: 0;
    z-index: 1300;
    max-height: min(420px, 65vh);
    padding: 0.4rem;
    overflow-y: auto;
    border: 1px solid var(--opendw-border, var(--border-color));
    border-radius: var(--opendw-radius-md, 10px);
    background: var(--opendw-surface, #ffffff);
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.16);
}

.topbar-global-search-results a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.7rem;
    border-radius: 8px;
    color: var(--opendw-text, var(--text-primary));
    text-decoration: none;
}

.topbar-global-search-results a:hover,
.topbar-global-search-results a:focus-visible {
    background: var(--opendw-primary-soft, var(--bg-hover));
    outline: none;
}

.topbar-global-search-results small,
.topbar-global-search-empty {
    color: var(--opendw-text-muted, var(--text-secondary));
    font-size: 0.72rem;
}

.topbar-global-search-empty {
    padding: 0.75rem;
}

.topbar-current-date {
    color: var(--opendw-text-muted, var(--text-secondary));
    font-size: 0.78rem;
    font-weight: 650;
    white-space: nowrap;
}

.topbar-account-trigger {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.25rem 0.45rem 0.25rem 0.3rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--opendw-text, var(--text-primary));
    text-decoration: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: none;
}

.topbar-account-trigger:hover {
    background: var(--opendw-primary-soft, var(--bg-hover));
}

.topbar-account-menu-shell {
    position: relative;
    flex: 0 0 auto;
}

.topbar-account-menu-shell.open .topbar-account-trigger {
    background: var(--opendw-primary-soft, var(--bg-hover));
}

.topbar-account-chevron {
    width: 16px;
    height: 16px;
    display: inline-grid;
    place-items: center;
    color: var(--opendw-text-muted, var(--text-secondary));
    transition: transform 0.18s ease;
}

.topbar-account-chevron svg {
    width: 14px;
    height: 14px;
}

.topbar-account-menu-shell.open .topbar-account-chevron {
    transform: rotate(180deg);
}

.topbar-account-avatar {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--opendw-primary-soft, var(--bg-hover));
    color: var(--opendw-primary, var(--primary-color));
    font-size: 0.76rem;
    font-weight: 700;
}

.topbar-account-avatar img,
.topbar-account-avatar svg,
.topbar-account-menu-avatar img,
.topbar-account-menu-avatar svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.topbar-account-copy {
    min-width: 0;
    max-width: 132px;
    display: grid;
}

.topbar-account-copy strong,
.topbar-account-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-account-copy strong {
    font-size: 0.76rem;
}

.topbar-account-copy small {
    color: var(--opendw-text-muted, var(--text-secondary));
    font-size: 0.66rem;
}

.topbar-account-menu-shell.open .topbar-account-menu {
    display: flex;
}

.topbar-account-menu {
    top: calc(100% + 0.55rem);
    right: 0;
    min-width: 260px;
    padding: 0.65rem;
    background: var(--opendw-surface, #ffffff);
    border-color: var(--opendw-border, var(--border-color));
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

.topbar-account-menu-summary {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.35rem 0.35rem 0.55rem;
}

.topbar-account-menu-avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--opendw-primary-soft, var(--bg-hover));
    color: var(--opendw-primary, var(--primary-color));
    font-size: 0.82rem;
    font-weight: 700;
}

.topbar-account-menu-copy {
    min-width: 0;
    display: grid;
    gap: 0.15rem;
}

.topbar-account-menu-copy strong,
.topbar-account-menu-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-account-menu-copy strong {
    color: var(--opendw-text, var(--text-primary));
    font-size: 0.86rem;
}

.topbar-account-menu-copy small {
    color: var(--opendw-text-muted, var(--text-secondary));
    font-size: 0.72rem;
}

.topbar-account-menu .top-actions-group-label {
    color: var(--opendw-text-muted, var(--text-secondary));
}

.topbar-account-menu .top-actions-separator {
    background: var(--opendw-border, var(--border-color));
}

.header-notification-wrapper {
    position: relative;
    z-index: 1210;
}

.header-utility-group {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.18rem 0.22rem 0.18rem 0.3rem;
    border: 1px solid rgba(179, 212, 237, 0.34);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.52);
    box-shadow: 0 10px 22px rgba(35, 96, 146, 0.06);
    overflow: visible;
}

.top-actions-toggle {
    display: inline-flex;
}

.top-actions-menu {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    min-width: 230px;
    padding: 0.55rem;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: rgba(247, 252, 255, 0.98);
    box-shadow: 0 16px 30px rgba(17, 68, 104, 0.18);
    z-index: 210;
}

.header-right.open .top-actions-menu {
    display: flex;
}

.sidebar-footer-actions .sidebar-actions-menu {
    top: auto;
    right: auto;
    left: calc(100% + 12px);
    bottom: 0;
    max-height: min(70vh, 420px);
    overflow-y: auto;
    border: 1px solid rgba(185, 227, 251, 0.34);
    background: linear-gradient(180deg, rgba(20, 102, 159, 0.96) 0%, rgba(12, 79, 133, 0.97) 100%);
    box-shadow: 0 18px 34px rgba(7, 47, 80, 0.32);
    backdrop-filter: blur(14px);
}

.sidebar:not(.collapsed) .sidebar-footer-actions .sidebar-actions-menu {
    left: 0;
    right: 0;
    bottom: calc(100% + 0.6rem);
}

.top-actions-menu .btn {
    width: 100%;
    justify-content: flex-start;
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
}

.top-actions-menu .btn .btn-icon {
    font-size: 0.95rem;
}

.top-actions-group {
    display: grid;
    gap: 0.35rem;
}

.top-actions-theme-picker {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 0.4rem;
    padding: 0.1rem 0 0.25rem;
}

.theme-mode-switcher {
    display: grid;
    gap: 0.4rem;
}

.theme-mode-option {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.55rem;
    padding: 0.55rem 0.7rem;
    border-radius: 10px;
    border: 1px solid rgba(213, 225, 235, 0.9);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    font-weight: 700;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.theme-mode-option:hover,
.theme-mode-option.active {
    background: rgba(232, 244, 255, 0.96);
    border-color: rgba(61, 142, 220, 0.36);
    color: var(--primary-color);
    box-shadow: 0 8px 18px rgba(21, 86, 130, 0.1);
}

.theme-mode-icon {
    width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 22px;
    border-radius: 999px;
    background: rgba(61, 142, 220, 0.1);
    color: currentColor;
    line-height: 1;
    font-size: 0.86rem;
}

.top-actions-group-label {
    padding: 0.2rem 0.2rem 0.05rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(208, 234, 250, 0.72);
}

.top-actions-separator {
    height: 1px;
    margin: 0.1rem 0;
    background: linear-gradient(90deg, rgba(204, 232, 249, 0) 0%, rgba(204, 232, 249, 0.32) 20%, rgba(204, 232, 249, 0.32) 80%, rgba(204, 232, 249, 0) 100%);
}

.sidebar-actions-menu .btn {
    background: rgba(224, 240, 252, 0.14);
    border: 1px solid rgba(199, 230, 249, 0.18);
    color: #ecf7ff;
}

.sidebar-actions-menu .btn:hover {
    background: rgba(198, 229, 249, 0.24);
    border-color: rgba(216, 240, 255, 0.28);
    color: #ffffff;
}

.sidebar-actions-menu .btn.btn-outline {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(205, 232, 250, 0.48);
    color: #f4fbff;
}

.sidebar-actions-menu .btn.btn-secondary {
    background: rgba(205, 228, 245, 0.16);
    color: #eef8ff;
}

.user-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.header-icon-btn,
.notification-btn,
.user-avatar-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
    align-items: center;
}

.header-icon-btn,
.header-notification-wrapper .notification-btn {
    background: linear-gradient(135deg, rgba(246, 251, 254, 0.98) 0%, rgba(221, 237, 248, 0.98) 100%);
    border: 1px solid rgba(191, 214, 229, 0.9);
    color: #5f7f98;
    box-shadow: 0 8px 18px rgba(27, 97, 146, 0.12);
    border-radius: 50%;
}

.header-icon-btn:hover,
.header-notification-wrapper .notification-btn:hover {
    background: linear-gradient(135deg, rgba(250, 253, 255, 0.98) 0%, rgba(224, 239, 249, 0.98) 100%);
    color: #355a76;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(22, 85, 130, 0.18);
}

.header-store-btn svg {
    width: 22px;
    height: 22px;
}

.dashboard-header-action svg,
.dashboard-edit-toggle svg,
.dashboard-add-widget-action svg {
    width: 22px;
    height: 22px;
    display: block;
}

.header-icon-svg {
    width: 22px;
    height: 22px;
    display: block;
    stroke: currentColor;
    stroke-width: 1.95;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    vector-effect: non-scaling-stroke;
}

.help-btn .header-icon-svg,
.notification-btn .header-icon-svg,
.btn-header-store .header-icon-svg {
    width: 22px;
    height: 22px;
    transform: none;
    transform-origin: center;
}

.user-avatar-btn {
    border-radius: 50%;
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, rgba(244, 249, 253, 0.96) 0%, rgba(214, 231, 244, 0.98) 100%);
    border: 1px solid rgba(191, 214, 229, 0.9);
    color: #0f4e7b;
    box-shadow: 0 6px 14px rgba(27, 97, 146, 0.12);
}

.user-avatar-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(22, 85, 130, 0.2);
}

.user-avatar-icon {
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
}

.btn-header-store {
    width: 42px;
    height: 42px;
    border-radius: 50%;
}

.header-utility-group .btn-icon-only {
    border-radius: 50%;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.hidden {
    display: none !important;
}

.menu-link-muted {
    opacity: 0.7;
}

/* ============================================
   Button Styles
   ============================================ */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
}

.btn-header-primary {
    height: 36px;
    padding: 0 0.95rem;
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(15, 109, 182, 0.18);
}

.btn-header-primary .btn-label {
    font-size: 0.82rem;
    font-weight: 700;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #d5dbdb;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-small {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

/* ============================================
   Dashboard Grid
   ============================================ */
.dashboard-container {
    padding: 1.25rem 1.5rem 1.9rem;
    max-width: 1600px;
    margin: 0 auto 1.5rem;
}

.dashboard-pages-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0 1rem 0 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.header-dashboard-tabs {
    align-self: center;
}

.dashboard-pages-tabs {
    display: flex;
    align-items: center;
    gap: 0.36rem;
    min-width: 0;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
}

.dashboard-pages-tabs::-webkit-scrollbar {
    height: 6px;
}

.dashboard-pages-tabs::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(93, 135, 164, 0.28);
}

.dashboard-page-tab-wrap {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    flex: 0 0 auto;
}

.dashboard-page-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 38px;
    max-width: 220px;
    padding: 0.48rem 2rem 0.48rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
    position: relative;
}

.dashboard-page-tab span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-page-tab small {
    padding: 0.12rem 0.42rem;
    border-radius: 999px;
    background: rgba(32, 156, 255, 0.12);
    color: #1b6fa9;
    font-size: 0.68rem;
    line-height: 1.2;
}

.dashboard-page-tab:hover {
    background: rgba(232, 244, 252, 0.78);
    border-color: rgba(125, 171, 206, 0.18);
    color: var(--text-primary);
}

.dashboard-page-tab.active {
    background: linear-gradient(135deg, #178bd8 0%, #31b8e8 100%);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(24, 137, 216, 0.22);
}

.dashboard-page-tab.active small {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.dashboard-page-edit,
.dashboard-page-delete,
.dashboard-page-add-tab {
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(125, 171, 206, 0.18);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.64);
    cursor: pointer;
    transition: var(--transition);
}

.dashboard-page-edit,
.dashboard-page-delete {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 999px;
    opacity: 0;
    pointer-events: none;
    font-size: 0.78rem;
}

.dashboard-page-edit {
    right: 1.75rem;
}

.dashboard-page-delete {
    right: 0.32rem;
    font-size: 1rem;
}

.dashboard-page-tab-wrap.confirming-delete .dashboard-page-tab {
    padding-right: 4.45rem;
    background: rgba(255, 239, 237, 0.92);
    border-color: rgba(220, 74, 65, 0.24);
    color: #8e332f;
}

.dashboard-page-tab-wrap.confirming-delete .dashboard-page-tab.active {
    background: linear-gradient(135deg, #d94e48 0%, #ef776e 100%);
    color: #ffffff;
}

.dashboard-page-delete-confirm {
    position: absolute;
    top: 50%;
    right: 0.32rem;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.16rem;
    border: 1px solid rgba(220, 74, 65, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 18px rgba(120, 42, 37, 0.12);
    transform: translateY(-50%);
}

.dashboard-page-confirm-action {
    display: inline-grid;
    width: 24px;
    height: 24px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.dashboard-page-confirm-action svg {
    width: 15px;
    height: 15px;
}

.dashboard-page-confirm-action.confirm {
    color: #c83d36;
}

.dashboard-page-confirm-action.confirm:hover {
    background: rgba(255, 226, 223, 0.96);
    color: #a8322d;
}

.dashboard-page-confirm-action.cancel:hover {
    background: rgba(232, 244, 252, 0.96);
    color: var(--primary-color);
}

.dashboard-page-tab-wrap:hover .dashboard-page-edit,
.dashboard-page-tab-wrap:hover .dashboard-page-delete,
.dashboard-page-tab-wrap.active .dashboard-page-edit:focus-visible,
.dashboard-page-tab-wrap.active .dashboard-page-delete:focus-visible {
    opacity: 1;
    pointer-events: auto;
}

.dashboard-page-delete:disabled {
    opacity: 0 !important;
    pointer-events: none;
}

.dashboard-page-edit:hover {
    color: var(--primary-color);
    border-color: rgba(32, 156, 255, 0.38);
    background: rgba(232, 244, 252, 0.96);
}

.dashboard-page-delete:hover {
    color: #c83d36;
    border-color: rgba(220, 74, 65, 0.3);
    background: rgba(255, 234, 232, 0.96);
}

.dashboard-page-add-tab {
    width: 36px;
    height: 36px;
    margin-left: 0.15rem;
    margin-bottom: 0;
    border-radius: 999px;
    background: rgba(232, 244, 252, 0.82);
    font-size: 1.25rem;
    font-weight: 700;
    flex-shrink: 0;
}

.dashboard-page-add-tab:hover {
    color: var(--primary-color);
    background: #ffffff;
    border-color: rgba(32, 156, 255, 0.32);
}

.dashboard-hero {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.3rem;
    position: relative;
}

.dashboard-hero.is-hidden {
    display: none;
}

.dashboard-hero-collapsed {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    grid-column: 1 / -1;
    padding: 0.95rem 1.15rem;
    border-radius: 22px;
    border: 1px solid rgba(125, 171, 206, 0.24);
    background: linear-gradient(135deg, rgba(252, 254, 255, 0.96) 0%, rgba(240, 247, 253, 0.92) 100%);
    box-shadow: 0 18px 40px rgba(29, 88, 128, 0.08);
    backdrop-filter: blur(12px);
}

.dashboard-hero-collapsed.is-visible {
    display: flex;
    margin-bottom: 1rem;
}

.dashboard-hero-collapsed-copy {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
}

.dashboard-hero-collapsed-title {
    font-size: 1.08rem;
    line-height: 1.15;
    letter-spacing: 0;
    color: #163650;
}

.dashboard-hero-collapsed-meta {
    color: #64849e;
    font-size: 0.84rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-hero-main {
    grid-column: span 7;
}

.dashboard-hero-side {
    grid-column: span 5;
}

.dashboard-hero-main,
.dashboard-hero-side {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(125, 171, 206, 0.24);
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(252, 254, 255, 0.96) 0%, rgba(240, 247, 253, 0.92) 100%);
    box-shadow: 0 18px 40px rgba(29, 88, 128, 0.09);
    backdrop-filter: blur(12px);
}

.dashboard-hero-main {
    padding: 1.2rem;
    display: grid;
    gap: 0.95rem;
}

.dashboard-hero-dismiss {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(129, 171, 208, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: #60809d;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(107, 139, 178, 0.12);
    transition: all 0.2s ease;
    z-index: 2;
}

.dashboard-hero-dismiss:hover {
    background: #ffffff;
    color: #274e77;
    transform: translateY(-1px);
}

.dashboard-hero-main::after,
.dashboard-hero-side::after {
    content: '';
    position: absolute;
    inset: auto -10% -35% auto;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(88, 205, 255, 0.22) 0%, rgba(88, 205, 255, 0) 70%);
    pointer-events: none;
}

.dashboard-hero-intro {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 0.55rem;
    padding: 1.15rem 1.15rem 1.05rem;
    border-radius: 22px;
    background:
        linear-gradient(90deg, rgba(255, 192, 71, 0.13) 0%, rgba(77, 171, 247, 0.11) 48%, rgba(107, 207, 255, 0.08) 100%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.44) 0%, rgba(255, 255, 255, 0.06) 100%);
    border: 1px solid rgba(135, 183, 213, 0.18);
}

.dashboard-hero-eyebrow {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #5d87a4;
    margin-bottom: 0.55rem;
}

.dashboard-hero-title {
    font-size: 2.15rem;
    line-height: 1.02;
    letter-spacing: 0;
    color: #163650;
    margin-bottom: 0.6rem;
}

.dashboard-hero-subtitle {
    max-width: none;
    font-size: 0.96rem;
    line-height: 1.64;
    text-wrap: pretty;
    color: var(--text-secondary);
    margin: 0;
}

.dashboard-hero-meta {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 0.9rem;
}

.dashboard-hero-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.7rem;
    margin-top: 0;
}

.hero-summary-card {
    display: grid;
    gap: 0.3rem;
    padding: 0.9rem 0.95rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(130, 180, 210, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.hero-summary-label {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.hero-summary-value {
    font-size: 1rem;
    font-weight: 700;
    color: #163650;
    letter-spacing: 0;
}

.dashboard-hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 1rem;
}

.dashboard-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.72rem;
    border-radius: 999px;
    background: rgba(226, 239, 248, 0.86);
    border: 1px solid rgba(139, 181, 209, 0.24);
    color: #35607d;
    font-size: 0.8rem;
    font-weight: 600;
}

.dashboard-hero-side {
    padding: 1.2rem 1.15rem;
    display: grid;
    gap: 0.85rem;
    align-content: center;
}

.dashboard-hero-focus {
    display: grid;
    gap: 0.42rem;
    padding: 1rem 1rem 1.05rem;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(20, 111, 180, 0.9) 0%, rgba(71, 181, 240, 0.78) 100%);
    color: white;
    box-shadow: 0 14px 32px rgba(18, 103, 167, 0.2);
}

.hero-focus-kicker {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.82;
}

.hero-focus-title {
    font-size: 1.02rem;
    line-height: 1.3;
    letter-spacing: 0;
}

.hero-focus-copy {
    font-size: 0.84rem;
    line-height: 1.58;
    opacity: 0.9;
}

.dashboard-hero-metric {
    display: grid;
    gap: 0.2rem;
    padding: 0.9rem 0.95rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(130, 180, 210, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.metric-label {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.metric-value {
    font-size: 1.02rem;
    color: #163650;
}

.dashboard-hero-actions {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.dashboard-hero-actions .btn {
    border-radius: 14px;
    min-height: 44px;
    box-shadow: 0 12px 24px rgba(21, 92, 142, 0.1);
}

.dashboard-grid {
    position: relative;
    display: block;
    min-height: 80px;
    --gs-item-margin: 6px;
    --dashboard-widget-radius: 14px;
}

.dashboard-grid > .grid-stack-item > .grid-stack-item-content {
    overflow: visible;
    border-radius: var(--dashboard-widget-radius);
}

.dashboard-grid > .grid-stack-item.widget-action-menu-open,
.dashboard-grid > .grid-stack-item.widget-action-menu-open > .grid-stack-item-content {
    z-index: 800 !important;
    overflow: visible;
}

.dashboard-grid > .grid-stack-item > .ui-resizable-se {
    right: 12px;
    bottom: 12px;
    width: 24px;
    height: 24px;
    border-radius: 0;
    background: transparent !important;
    background-image: none !important;
    color: color-mix(in srgb, var(--opendw-primary, #0f62fe) 58%, var(--opendw-text-muted, #64748b));
    cursor: nwse-resize;
    transform: none !important;
    opacity: 0;
    transition: opacity 0.16s ease;
}

.dashboard-grid > .grid-stack-item > .ui-resizable-se::before,
.dashboard-grid > .grid-stack-item > .ui-resizable-se::after {
    content: '';
    position: absolute;
    box-sizing: border-box;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    border-radius: 0 0 2px 0;
    pointer-events: none;
}

.dashboard-grid > .grid-stack-item > .ui-resizable-se::before {
    right: 3px;
    bottom: 3px;
    width: 12px;
    height: 12px;
}

.dashboard-grid > .grid-stack-item > .ui-resizable-se::after {
    right: 7px;
    bottom: 7px;
    width: 5px;
    height: 5px;
    opacity: 0.62;
}

.dashboard-grid.is-editing > .grid-stack-item:hover > .ui-resizable-se,
.dashboard-grid.is-editing > .grid-stack-item > .ui-resizable-se:focus-visible {
    opacity: 0.78;
}

.dashboard-grid .grid-stack-placeholder > .placeholder-content {
    border: 2px dashed color-mix(in srgb, var(--opendw-primary, #0f62fe) 42%, transparent);
    border-radius: var(--dashboard-widget-radius);
    background: color-mix(in srgb, var(--opendw-primary, #0f62fe) 8%, transparent);
}

.plugin-host-page {
    min-height: 0;
    overflow: hidden;
}

.plugin-app-host,
.opendw-plugin-iframe {
    width: 100%;
    height: calc(100dvh - var(--header-height, 64px) - 32px);
    min-height: 0;
    border: 0;
}

.plugin-host-error {
    margin: 20px;
    padding: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 6px;
}

.plugin-host-error p {
    margin: 6px 0 0;
    color: var(--text-secondary);
}

body.dashboard-edit-mode .dashboard-grid:not(:empty) {
    border-bottom: 1px dashed rgba(15, 98, 254, 0.2);
}

.dashboard-workspace .dashboard-hero-main,
.dashboard-workspace .dashboard-hero-side,
.dashboard-hero-collapsed {
    border-color: var(--opendw-border, #e5e7eb);
    background: var(--opendw-surface, #ffffff);
    box-shadow: var(--opendw-shadow-card, 0 1px 2px rgba(15, 23, 42, 0.05));
    backdrop-filter: none;
}

.dashboard-workspace .dashboard-hero-main::after,
.dashboard-workspace .dashboard-hero-side::after {
    display: none;
}

.dashboard-workspace .dashboard-hero-intro {
    border-color: var(--opendw-border, #e5e7eb);
    background: linear-gradient(90deg, var(--opendw-primary-soft, #eff6ff) 0%, rgba(255, 255, 255, 0.72) 100%);
}

.dashboard-workspace .dashboard-hero-eyebrow,
.dashboard-hero-collapsed .dashboard-hero-eyebrow {
    color: var(--opendw-text-muted, #64748b);
}

.dashboard-workspace .dashboard-hero-title,
.dashboard-hero-collapsed-title,
.dashboard-workspace .hero-summary-value,
.dashboard-workspace .metric-value {
    color: var(--opendw-text, #0f172a);
}

.dashboard-workspace .dashboard-hero-subtitle,
.dashboard-hero-collapsed-meta,
.dashboard-workspace .hero-summary-label,
.dashboard-workspace .metric-label,
.dashboard-workspace .hero-focus-copy {
    color: var(--opendw-text-muted, #64748b);
}

.dashboard-quick-actions {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.65rem;
}

.dashboard-quick-action {
    min-height: 76px;
    padding: 0.72rem;
    border: 1px solid var(--opendw-border, #e5e7eb);
    border-radius: var(--opendw-radius-lg, 12px);
    background: var(--opendw-surface, #ffffff);
    color: var(--opendw-text, #0f172a);
    cursor: pointer;
    display: grid;
    align-content: center;
    justify-items: start;
    gap: 0.44rem;
    font: inherit;
    font-weight: 700;
    text-align: left;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.dashboard-quick-action:hover,
.dashboard-quick-action:focus-visible {
    border-color: rgba(15, 98, 254, 0.28);
    background: var(--opendw-primary-soft, #eff6ff);
    color: var(--opendw-primary, #0f62fe);
    outline: none;
    transform: translateY(-1px);
}

.dashboard-quick-action.primary {
    border-color: rgba(15, 98, 254, 0.28);
    background: var(--opendw-primary, #0f62fe);
    color: #ffffff;
}

.dashboard-quick-action.primary:hover,
.dashboard-quick-action.primary:focus-visible {
    background: var(--opendw-primary-hover, #0353e9);
    color: #ffffff;
}

.dashboard-quick-action-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    display: inline-grid;
    place-items: center;
    background: var(--opendw-surface-muted, #f9fafb);
    color: currentColor;
    font-weight: 700;
    line-height: 1;
}

.dashboard-quick-action.primary .dashboard-quick-action-icon {
    background: rgba(255, 255, 255, 0.16);
}

.dashboard-workspace .dashboard-hero-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-workspace .hero-summary-card,
.dashboard-workspace .dashboard-hero-metric {
    border-color: var(--opendw-border, #e5e7eb);
    background: var(--opendw-surface-muted, #f9fafb);
    box-shadow: none;
}

.dashboard-workspace .dashboard-hero-focus {
    border: 1px solid rgba(15, 98, 254, 0.18);
    background: var(--opendw-primary-soft, #eff6ff);
    color: var(--opendw-text, #0f172a);
    box-shadow: none;
}

.dashboard-workspace .hero-focus-kicker {
    color: var(--opendw-primary, #0f62fe);
    opacity: 1;
}

.dashboard-workspace .dashboard-hero-side {
    align-content: stretch;
}

.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.72rem;
}

/* ============================================
   Widget Styles
   ============================================ */
.widget {
    background: var(--widget-surface);
    backdrop-filter: none;
    border-radius: 18px;
    box-shadow: var(--opendw-shadow-card, 0 1px 2px rgba(15, 23, 42, 0.05));
    border: 1px solid var(--widget-border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.widget::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.18) 100%);
    pointer-events: none;
}

body.theme-preset-noir .widget::before {
    background: linear-gradient(90deg, rgba(155, 193, 227, 0.16) 0%, rgba(155, 193, 227, 0.04) 100%);
}

.dashboard-grid .widget {
    position: relative;
    width: 100%;
    height: 100%;
}

.widget:hover {
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    border-color: rgba(15, 98, 254, 0.24);
    transform: translateY(-1px);
}

.widget.editing {
    border-color: var(--warning-color);
}

.dashboard-grid.is-editing .widget {
    cursor: grab;
}

.grid-stack-item.ui-draggable-dragging .widget {
    cursor: grabbing;
}

.grid-stack-item.ui-draggable-dragging .widget,
.grid-stack-item.ui-resizable-resizing .widget {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transform: none;
}

.widget.widget-just-added {
    animation: dashboardWidgetAdded 1.2s ease-out;
}

@keyframes dashboardWidgetAdded {
    0%, 30% { box-shadow: 0 0 0 4px rgba(15, 98, 254, 0.2), 0 12px 30px rgba(15, 98, 254, 0.16); }
    100% { box-shadow: var(--opendw-shadow-card, 0 1px 2px rgba(15, 23, 42, 0.05)); }
}

.widget.drag-over {
    border-color: var(--success-color);
    background: rgba(39, 174, 96, 0.1);
}

/* AI Assistant Widget Styles */
.ai-assistant-widget {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 0.75rem;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-right: 0.25rem;
}

.ai-welcome {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: var(--radius-md);
}

.ai-avatar {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    flex-shrink: 0;
}

.ai-welcome-text {
    flex: 1;
}

.ai-welcome-text strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.ai-welcome-text p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.ai-message {
    display: flex;
    gap: 0.5rem;
    max-width: 90%;
}

.ai-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.ai-message.bot .ai-message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.ai-message.user .ai-message-avatar {
    background: var(--primary-color);
}

.ai-message-content {
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    line-height: 1.4;
}

.ai-message.bot .ai-message-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

.ai-message.user .ai-message-content {
    background: var(--primary-color);
    color: white;
}

.ai-input-area {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.ai-input {
    flex: 1;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.ai-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.ai-send-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-sm);
}

.ai-typing {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
}

.ai-typing span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.ai-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

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

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

/* Widget Header */
.widget-header {
    padding: 0.88rem 1rem 0.78rem;
    border-bottom: 1px solid var(--widget-border-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--widget-surface);
    flex-shrink: 0;
}

.widget-title {
    flex: 1 1 auto;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.98rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0;
    min-width: 0;
}

.widget-title-icon {
    width: 30px;
    height: 30px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--widget-surface-muted);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
    font-size: 0.95rem;
    line-height: 1;
    flex: 0 0 auto;
}

.app-glyph {
    width: 30px;
    height: 30px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: var(--widget-surface-muted);
    color: var(--widget-text-primary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
}

.app-glyph.app-glyph-image {
    overflow: hidden;
    padding: 4px;
}

.app-glyph img,
.rightbar-panel-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.widget-error {
    display: grid;
    justify-items: center;
    gap: 0.55rem;
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.widget-error-mark {
    width: 42px;
    height: 42px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger-color);
    font-weight: 700;
    font-size: 1.2rem;
}

.widget-error-title {
    font-weight: 700;
    color: var(--text-primary);
}

.widget-error-actions {
    display: flex;
    justify-content: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-top: 0.45rem;
}

.code-widget-runtime-shell {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background: transparent;
}

.code-widget-runtime-shell.is-staging {
    position: absolute;
    inset: 0.92rem 1rem 1rem;
    height: auto;
    visibility: hidden;
    pointer-events: none;
}

.code-widget-runtime-host {
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
    background: transparent;
    container-type: inline-size;
}

.widget-title-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.widget-refresh-meta {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    flex: 0 0 auto;
    color: var(--widget-text-secondary, var(--text-secondary));
    font-size: 0.66rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: 0;
}

.widget-refresh-meta[hidden] {
    display: none !important;
}

.widget-refresh-spinner,
.widget-refresh-status-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
}

.widget-refresh-spinner {
    display: none;
    border: 1.5px solid color-mix(in srgb, var(--primary-color) 25%, transparent);
    border-top-color: var(--primary-color);
    animation: widget-refresh-spin 0.75s linear infinite;
}

.widget-refresh-status-dot {
    background: #16a34a;
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.1);
}

.widget-refresh-meta:is(.is-loading, .is-refreshing) .widget-refresh-spinner {
    display: inline-block;
}

.widget-refresh-meta:is(.is-loading, .is-refreshing) .widget-refresh-status-dot {
    display: none;
}

.widget-refresh-meta.is-error {
    color: #9a6700;
}

.widget-refresh-meta.is-error .widget-refresh-status-dot {
    background: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.13);
}

.rightbar-panel-refresh-meta {
    color: var(--text-tertiary);
    font-size: 0.62rem;
}

@keyframes widget-refresh-spin {
    to {
        transform: rotate(360deg);
    }
}

.widget-controls {
    flex: 0 0 auto;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.widget:hover .widget-controls,
.widget:focus-within .widget-controls {
    opacity: 1;
    transform: translateY(0);
}

.widget-btn {
    width: 30px;
    height: 30px;
    border: 1px solid var(--widget-border-soft);
    border-radius: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--widget-text-secondary);
    transition: var(--transition);
    box-shadow: var(--widget-shadow-soft);
    background: var(--widget-surface-muted);
}

.widget-btn svg {
    width: 15px;
    height: 15px;
}

.widget-btn:hover {
    transform: translateY(-1px);
    background: var(--widget-surface-elevated);
}

.widget-btn:focus-visible {
    outline: 2px solid rgba(67, 180, 255, 0.42);
    outline-offset: 2px;
}

.widget-btn-config {
    color: #2f6fa0;
}

.widget-btn-refresh {
    color: #2a9a7a;
}

.widget-btn-delete {
    color: #d05b64;
}

.widget-btn-delete:hover {
    color: #c64f57;
}

.widget-delete-confirm {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.18rem 0.22rem;
    border-radius: 999px;
    background: rgba(208, 91, 100, 0.08);
    border: 1px solid rgba(208, 91, 100, 0.18);
}

.widget-btn-delete-confirm {
    color: #c64f57;
    background: rgba(255, 255, 255, 0.92);
}

.widget-btn-delete-confirm:hover {
    color: #b6454e;
    background: rgba(255, 255, 255, 1);
}

.widget-btn-delete-cancel {
    color: var(--widget-text-secondary);
    background: rgba(255, 255, 255, 0.9);
}

.widget-btn-delete-cancel:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 1);
}

/* Widget Content */
.widget-content {
    position: relative;
    padding: 0.92rem 1rem 1rem;
    flex: 1;
    overflow: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.widget-content::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

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

.widget-content::-webkit-scrollbar-track {
    background: transparent;
}

.widget,
.widget * {
    scrollbar-width: thin;
    scrollbar-color: var(--widget-scrollbar) var(--widget-scrollbar-track);
}

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

.widget ::-webkit-scrollbar-button {
    width: 0;
    height: 0;
    display: none;
}

.widget ::-webkit-scrollbar-track {
    background: var(--widget-scrollbar-track);
    border-radius: 999px;
}

.widget ::-webkit-scrollbar-thumb {
    background: var(--widget-scrollbar);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
    min-height: 36px;
}

.widget ::-webkit-scrollbar-thumb:hover {
    background: var(--widget-scrollbar-hover);
    background-clip: padding-box;
}

/* Widget Loading State */
.widget-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    flex-direction: column;
    gap: 0.8rem;
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(255,255,255,0.92) 0%, rgba(239,246,252,0.84) 100%);
    border: 1px dashed rgba(124, 169, 212, 0.24);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--secondary-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Modal Styles
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

.modal-overlay.active {
    display: flex;
}

.template-selection-modal {
    z-index: 1200;
    backdrop-filter: blur(4px);
}

.template-selection-content {
    width: min(1040px, calc(100vw - 2rem));
    max-width: 1040px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.template-selection-header {
    padding: 1.15rem 1.35rem;
    background: var(--bg-card);
}

.template-selection-grid {
    display: block;
}

.template-selection-heading {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.template-selection-heading-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #0f62fe;
}

.template-selection-heading-icon svg {
    width: 21px;
    height: 21px;
}

.template-selection-eyebrow {
    display: block;
    margin-bottom: 0.15rem;
    color: #0f62fe;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}

.template-selection-heading h2 {
    margin: 0;
    font-size: 1.05rem;
}

.template-selection-heading p {
    margin: 0.2rem 0 0;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.45;
}

.template-selection-body {
    flex: 1 1 auto;
    max-height: min(68vh, 680px);
    padding: 1.15rem 1.35rem;
    background: #f8fafc;
}

.template-onboarding-modes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.template-onboarding-mode {
    position: relative;
    min-height: 126px;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 16px;
    align-items: start;
    gap: 0.65rem;
    padding: 0.9rem;
    border: 1px solid #d8e1ec;
    border-radius: 8px;
    background: #fff;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.template-onboarding-mode:hover:not(:disabled) {
    border-color: #93c5fd;
    box-shadow: 0 6px 18px rgba(15, 98, 254, 0.08);
}

.template-onboarding-mode.active {
    border-color: #0f62fe;
    background: #f4f8ff;
    box-shadow: 0 0 0 2px rgba(15, 98, 254, 0.09);
}

.template-onboarding-mode:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.template-onboarding-mode-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eef4fb;
    color: #426282;
}

.template-onboarding-mode.active .template-onboarding-mode-icon {
    background: #dbeafe;
    color: #0f62fe;
}

.template-onboarding-mode-icon svg {
    width: 18px;
    height: 18px;
}

.template-onboarding-mode-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.template-onboarding-mode-copy strong {
    font-size: 0.88rem;
}

.template-onboarding-mode-copy small {
    min-height: 40px;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.74rem;
    line-height: 1.4;
}

.template-onboarding-mode-copy > span {
    margin-top: 0.45rem;
    color: #0f62fe;
    font-size: 0.69rem;
    font-weight: 600;
}

.template-onboarding-radio {
    width: 16px;
    height: 16px;
    margin-top: 0.1rem;
    border: 1.5px solid #9aaabe;
    border-radius: 50%;
    background: #fff;
}

.template-onboarding-mode.active .template-onboarding-radio {
    border: 4px solid #0f62fe;
}

.template-onboarding-summary {
    min-height: 190px;
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.1fr);
    align-items: center;
    gap: 1.25rem;
    margin-top: 0.85rem;
    padding: 1rem;
    border: 1px solid #dfe7f0;
    border-radius: 8px;
    background: #fff;
}

.template-onboarding-summary h3 {
    margin: 0.3rem 0 0.4rem;
    font-size: 1rem;
}

.template-onboarding-summary p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.55;
}

.template-onboarding-summary-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: #087a57;
    font-size: 0.69rem;
    font-weight: 700;
    text-transform: uppercase;
}

.template-onboarding-summary-label svg {
    width: 14px;
    height: 14px;
}

.template-onboarding-template-count {
    display: inline-block;
    margin-top: 0.65rem;
    padding: 0.28rem 0.5rem;
    border-radius: 6px;
    background: #ecfdf5;
    color: #087a57;
    font-size: 0.7rem;
    font-weight: 600;
}

.template-onboarding-summary-visual {
    height: 150px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0.55rem;
    padding: 0.75rem;
    border: 1px dashed #a9bdd3;
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(100, 116, 139, 0.08) 1px, transparent 1px),
        linear-gradient(rgba(100, 116, 139, 0.08) 1px, transparent 1px),
        #f8fbff;
    background-size: 24px 24px;
}

.template-onboarding-summary-visual span {
    border: 1px dashed #cbd8e6;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.72);
}

.template-onboarding-default-preview .template-minimap-shell {
    margin: 0;
}

.template-onboarding-default-preview .template-minimap-grid {
    aspect-ratio: 16 / 7;
}

.template-onboarding-catalog {
    margin-top: 0.85rem;
    padding-top: 0.9rem;
    border-top: 1px solid #dfe7f0;
}

.template-onboarding-catalog-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.template-onboarding-catalog-heading span {
    color: #0f62fe;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}

.template-onboarding-catalog-heading h3 {
    margin: 0.15rem 0 0;
    font-size: 0.95rem;
}

.template-onboarding-catalog-heading p {
    max-width: 420px;
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.72rem;
    line-height: 1.4;
    text-align: right;
}

.template-onboarding-catalog-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.template-onboarding-choice {
    position: relative;
    min-width: 0;
    padding: 0.7rem;
    border: 1px solid #d8e1ec;
    border-radius: 8px;
    background: #fff;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.template-onboarding-choice:hover,
.template-onboarding-choice.active {
    border-color: #0f62fe;
    box-shadow: 0 4px 14px rgba(15, 98, 254, 0.1);
}

.template-onboarding-choice.active {
    box-shadow: 0 0 0 2px rgba(15, 98, 254, 0.09);
}

.template-onboarding-choice > strong,
.template-onboarding-choice > small {
    display: block;
}

.template-onboarding-choice > strong {
    margin-top: 0.55rem;
    font-size: 0.82rem;
}

.template-onboarding-choice > small {
    min-height: 34px;
    margin-top: 0.2rem;
    color: var(--text-secondary);
    font-size: 0.7rem;
    line-height: 1.4;
}

.template-onboarding-choice-check {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    z-index: 2;
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #0f62fe;
    color: #fff;
}

.template-onboarding-choice.active .template-onboarding-choice-check {
    display: inline-flex;
}

.template-onboarding-choice-check svg {
    width: 13px;
    height: 13px;
    stroke-width: 3;
}

.template-onboarding-choice .template-card-badge {
    top: 0.55rem;
    left: 0.55rem;
    right: auto;
    border-radius: 5px;
    background: #087a57;
    box-shadow: none;
}

.template-onboarding-choice .template-card-badge-default {
    background: #526579;
}

.template-onboarding-choice .template-card-reason {
    display: block;
    margin: 0.5rem 0 0;
    padding: 0.35rem 0.45rem;
    border-radius: 6px;
    background: #eef6ff;
    color: #245b91;
    font-size: 0.67rem;
}

.template-selection-footer {
    min-height: 62px;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.35rem;
    background: #fff;
}

.template-selection-footer-note {
    color: var(--text-secondary);
    font-size: 0.74rem;
}

.template-selection-submit {
    min-width: 190px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-color: #0f62fe !important;
    background: #0f62fe !important;
    color: #fff !important;
    box-shadow: 0 5px 14px rgba(15, 98, 254, 0.2) !important;
}

.template-selection-submit:hover:not(:disabled) {
    border-color: #0756df !important;
    background: #0756df !important;
}

.template-selection-submit svg,
.template-selection-submit-icon {
    width: 16px;
    height: 16px;
}

.template-selection-submit-icon {
    display: inline-flex;
}

@media (max-width: 820px) {
    .template-selection-modal {
        padding: 0.75rem;
    }

    .template-selection-content {
        width: 100%;
        max-height: calc(100vh - 1.5rem);
    }

    .template-selection-body {
        max-height: none;
    }

    .template-onboarding-modes,
    .template-onboarding-catalog-grid {
        grid-template-columns: 1fr;
    }

    .template-onboarding-mode {
        min-height: 0;
    }

    .template-onboarding-mode-copy small {
        min-height: 0;
    }

    .template-onboarding-summary {
        grid-template-columns: 1fr;
    }

    .template-onboarding-catalog-heading {
        display: block;
    }

    .template-onboarding-catalog-heading p {
        margin-top: 0.35rem;
        text-align: left;
    }
}

@media (max-width: 520px) {
    .template-selection-header,
    .template-selection-body,
    .template-selection-footer {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .template-selection-heading p,
    .template-selection-footer-note {
        display: none;
    }

    .template-selection-footer {
        justify-content: stretch;
    }

    .template-selection-submit {
        width: 100%;
    }
}

.template-card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
    padding: 0.75rem;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.template-minimap-shell {
    margin: 0.45rem 0 0.75rem;
    padding: 0.45rem;
    border-radius: 10px;
    border: 1px solid rgba(119, 170, 206, 0.26);
    background: linear-gradient(180deg, rgba(239, 247, 253, 0.96) 0%, rgba(227, 239, 248, 0.92) 100%);
}

.template-minimap-grid {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 8px;
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(116, 168, 206, 0.14) 1px, transparent 1px),
        linear-gradient(rgba(116, 168, 206, 0.14) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(228, 241, 251, 0.96) 100%);
    background-size: calc(100% / 12) calc(100% / 6), calc(100% / 12) calc(100% / 6), 100% 100%;
}

.template-minimap-block {
    position: absolute;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 0.2rem;
    border-radius: 6px;
    border: 1px solid hsla(var(--tile-hue), 60%, 56%, 0.28);
    background: linear-gradient(135deg,
            hsla(var(--tile-hue), 88%, 71%, 0.92) 0%,
            hsla(calc(var(--tile-hue) + 16), 78%, 60%, 0.96) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32);
    color: rgba(19, 54, 80, 0.78);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    overflow: hidden;
}

.template-minimap-block span {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.template-minimap-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    font-size: 0.76rem;
}

.template-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: rgba(64, 145, 200, 0.7);
}

.template-card-preview {
    height: 58px;
    border-radius: 8px;
    margin-bottom: 0.55rem;
}

.template-card-preview-empty {
    border: 1px dashed var(--border-color);
    background:
        linear-gradient(90deg, rgba(100, 116, 139, 0.12) 1px, transparent 1px),
        linear-gradient(rgba(100, 116, 139, 0.12) 1px, transparent 1px),
        var(--bg-secondary);
    background-size: 24px 24px;
}

.template-card h3 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.template-card p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    min-height: 32px;
    line-height: 1.35;
    margin-bottom: 0.4rem;
}

.template-card-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #1ba7d8 0%, #35d0c4 100%);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 6px 14px rgba(25, 145, 180, 0.24);
}

.template-card-reason {
    margin-bottom: 0.4rem;
    padding: 0.42rem 0.55rem;
    border-radius: 8px;
    background: rgba(27, 167, 216, 0.1);
    color: #14658d;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.35;
}

.template-card-meta {
    font-size: 0.72rem;
    color: var(--primary-color);
    font-weight: 600;
}

.template-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 1.3rem 1rem;
    color: var(--text-secondary);
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

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

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.config-header {
    background: var(--primary-color);
    color: white;
}

.config-header h2 {
    color: white;
}

.config-header .close-btn {
    color: white;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    max-height: 60vh;
}

.modal-footer {
    padding: 1rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: var(--bg-primary);
}

/* ============================================
   Widget Store Modal
   ============================================ */
.widget-store-modal {
    width: 90%;
    max-width: 1000px;
    border-radius: 20px;
    border: 1px solid var(--widget-border-color);
    background: var(--opendw-surface, #ffffff);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
    backdrop-filter: none;
    color: var(--widget-text-primary);
}

.widget-store-modal .modal-header {
    padding: 1.15rem 1.35rem 1rem;
    border-bottom: 1px solid var(--widget-border-soft);
    background: var(--opendw-surface, #ffffff);
}

.widget-store-modal .modal-header h2 {
    color: var(--widget-text-primary);
}

.widget-store-modal .modal-body {
    padding: 1.2rem 1.25rem 1.25rem;
    background: var(--opendw-bg, #f6f8fb);
}

.widget-store-modal .modal-footer {
    background: rgba(255, 255, 255, 0.8);
    border-top: 1px solid var(--widget-border-soft);
}

.store-search {
    margin-bottom: 1.5rem;
}

.store-search input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--widget-input-border);
    border-radius: 14px;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--widget-input-bg);
    color: var(--widget-text-primary);
}

.store-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.store-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.category-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--widget-border-soft);
    border-radius: 999px;
    background: var(--widget-chip-bg);
    color: var(--widget-chip-text);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
    box-shadow: var(--widget-shadow-soft);
}

.category-btn:hover {
    border-color: var(--primary-color);
    color: var(--widget-text-primary);
}

.category-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.store-empty-state {
    grid-column: 1 / -1;
    min-height: 160px;
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    color: var(--text-secondary);
    display: grid;
    place-items: center;
    font-weight: 700;
    text-align: center;
}

.store-widget-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--widget-border-soft);
    border-radius: 16px;
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    background: var(--opendw-surface, #ffffff);
    box-shadow: var(--opendw-shadow-card, 0 1px 2px rgba(15, 23, 42, 0.05));
}

.store-widget-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    border-color: rgba(15, 98, 254, 0.28);
}

.store-widget-card.added {
    opacity: 0.6;
    pointer-events: none;
}

.store-widget-preview {
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    position: relative;
    background: var(--opendw-primary-soft, #eff6ff);
}

.store-widget-preview.dynamic-preview {
    background: var(--store-preview-bg, var(--widget-surface-soft));
}

.template-card-preview.dynamic-preview {
    background: var(--template-preview-bg, linear-gradient(135deg,#4facfe 0%,#00f2fe 100%));
}

.store-widget-badges {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    left: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.template-minimap-utilities {
    padding: 6px 2px 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-secondary, #475569);
    overflow-wrap: anywhere;
}

.store-widget-preview .badge {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-featured {
    background: var(--danger-color);
    color: white;
}

.badge-new {
    background: var(--success-color);
    color: white;
}

.store-widget-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 1rem;
}

.store-widget-title {
    font-weight: 600;
    color: var(--widget-text-primary);
    margin-bottom: 0.5rem;
}

.store-widget-desc {
    font-size: 0.85rem;
    color: var(--widget-text-secondary);
    line-height: 1.4;
    margin-bottom: 1rem;
}

.store-widget-config {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.5rem 0.65rem;
    margin-bottom: 0.85rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--widget-border-soft);
    border-radius: 10px;
    background: var(--widget-surface-muted);
}

.store-widget-config--placement-only {
    display: block;
    margin-bottom: 0.75rem;
    padding: 0;
    border: 0;
    background: transparent;
}

.store-widget-placement {
    display: grid;
    grid-column: 1 / -1;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 3px;
    min-width: 0;
    padding: 3px;
    border: 1px solid var(--widget-border-soft);
    border-radius: 11px;
    background: var(--widget-surface-muted);
}

.store-widget-placement-option {
    position: relative;
    min-width: 0;
    cursor: pointer;
}

.store-widget-placement-option > input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.store-widget-placement-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    min-height: 32px;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--widget-text-secondary);
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1;
    transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.store-widget-placement-content > svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
}

.store-widget-placement-option:hover .store-widget-placement-content {
    color: var(--widget-text-primary);
}

.store-widget-placement-option > input:checked + .store-widget-placement-content {
    border-color: color-mix(in srgb, var(--primary-color) 22%, var(--widget-border-soft));
    background: var(--widget-surface);
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.09);
}

.store-widget-placement-option > input:focus-visible + .store-widget-placement-content {
    outline: 3px solid color-mix(in srgb, var(--primary-color) 18%, transparent);
    outline-offset: 1px;
}

.store-widget-config-label {
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    color: var(--widget-text-muted);
    font-weight: 700;
}

.store-widget-select {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--widget-border-soft);
    border-radius: 8px;
    background: var(--widget-surface);
    color: var(--widget-text-primary);
    padding: 0.35rem 0.55rem;
    font: inherit;
    font-size: 0.82rem;
    outline: none;
}

.store-widget-select:focus {
    border-color: rgba(32, 156, 255, 0.58);
    box-shadow: 0 0 0 3px rgba(32, 156, 255, 0.12);
}

.store-widget-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.store-widget-category {
    font-size: 0.75rem;
    color: var(--widget-chip-text);
    background: var(--widget-chip-bg);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
}

.add-widget-btn {
    padding: 0.4rem 0.8rem;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
}

.add-widget-btn:hover {
    background: #229954;
}

.widget-generic {
    padding: 1rem;
    font-size: 0.85rem;
}

.widget-generic-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.widget-generic-json {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 0.75rem;
    overflow: auto;
    max-height: 240px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ============================================
   Dashboard Page Modal
   ============================================ */
#dashboardPageModal .dashboard-page-modal {
    width: min(700px, calc(100vw - 32px));
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
    overflow: hidden;
}

.dashboard-page-modal .modal-header {
    min-height: 64px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
}

.dashboard-page-modal-heading {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    min-width: 0;
}

.dashboard-page-modal-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    background: #eff6ff;
    color: #0f62fe;
}

.dashboard-page-modal-icon svg {
    width: 20px;
    height: 20px;
}

.dashboard-page-modal .modal-header h2 {
    margin: 0;
    color: #0f172a;
    font-size: 1rem;
    font-weight: 780;
    line-height: 1.3;
}

.dashboard-page-modal .modal-header p {
    max-width: 540px;
    margin: 4px 0 0;
    color: #667085;
    font-size: 0.78rem;
    line-height: 1.45;
}

.dashboard-page-modal-close {
    width: 32px;
    min-width: 32px;
    height: 32px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #ffffff;
    color: #475467;
    box-shadow: none;
}

.dashboard-page-modal-close:hover {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #0f62fe;
}

.dashboard-page-modal .modal-body {
    padding: 16px 18px;
    background: #ffffff;
}

.dashboard-page-form {
    display: grid;
    gap: 12px;
}

.dashboard-page-name-panel {
    display: grid;
    gap: 8px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.dashboard-page-name-panel .form-label {
    margin: 0;
    color: #344054;
    font-size: 0.74rem;
    font-weight: 720;
}

.dashboard-page-name-panel .form-input {
    height: 42px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #ffffff;
    color: #101828;
    font-size: 0.86rem;
    box-shadow: none;
}

.dashboard-page-name-panel .form-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.10);
}

.dashboard-page-create-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.dashboard-create-option,
.dashboard-template-choice,
.dashboard-manage-item {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: none;
}

.dashboard-create-option,
.dashboard-template-choice {
    position: relative;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    min-height: 84px;
    padding: 11px 12px;
    text-align: left;
    color: #101828;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.dashboard-create-option::after,
.dashboard-template-choice::after {
    content: "";
    position: absolute;
    top: 12px;
    right: 12px;
    width: 12px;
    height: 12px;
    border: 1px solid #d0d5dd;
    border-radius: 50%;
    background: #ffffff;
}

.dashboard-create-option-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid #dbeafe;
    border-radius: 9px;
    background: #eff6ff;
    color: #0f62fe;
}

.dashboard-create-option-icon svg {
    width: 18px;
    height: 18px;
}

.dashboard-create-option-copy {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding-right: 12px;
}

.dashboard-create-option strong,
.dashboard-template-choice strong {
    color: #101828;
    font-size: 0.86rem;
    font-weight: 760;
    line-height: 1.25;
}

.dashboard-create-option-copy > span,
.dashboard-template-choice-copy > span,
.dashboard-manage-item span {
    color: #667085;
    font-size: 0.76rem;
    line-height: 1.45;
}

.dashboard-create-option:hover,
.dashboard-template-choice:hover,
.dashboard-create-option.active,
.dashboard-template-choice.active {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.08);
}

.dashboard-create-option.active,
.dashboard-template-choice.active {
    background: #f0f7ff;
}

.dashboard-create-option.active::after,
.dashboard-template-choice.active::after {
    border-color: #0f62fe;
    background: #0f62fe;
    box-shadow: inset 0 0 0 2px #ffffff;
}

.dashboard-template-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-height: 190px;
    overflow: auto;
    padding-right: 3px;
}

.dashboard-template-picker-heading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 1px 3px;
}

.dashboard-template-picker-heading strong {
    color: #344054;
    font-size: 0.76rem;
    font-weight: 720;
}

.dashboard-template-picker-heading span {
    color: #667085;
    font-size: 0.72rem;
}

.dashboard-template-choice {
    min-height: 72px;
    align-items: center;
}

.dashboard-template-choice-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #eff6ff;
    color: #0f62fe;
}

.dashboard-template-choice-icon svg {
    width: 17px;
    height: 17px;
}

.dashboard-template-choice-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding-right: 14px;
}

.dashboard-template-choice-copy strong,
.dashboard-template-choice-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-template-empty {
    padding: 1rem;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #667085;
    text-align: center;
}

.dashboard-page-manage-list {
    display: grid;
    margin-top: 16px;
    gap: 0.65rem;
}

.dashboard-manage-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0.95rem;
}

.dashboard-manage-item.active {
    border-color: #60a5fa;
    background: #f0f7ff;
}

.dashboard-manage-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dashboard-page-modal .modal-footer {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.dashboard-page-modal .modal-footer .btn {
    min-height: 36px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 720;
}

@media (max-width: 768px) {
    .dashboard-pages-bar {
        align-items: center;
        flex-direction: row;
        margin-right: 0.55rem;
    }

    .dashboard-pages-tabs {
        width: 100%;
    }

    .dashboard-page-tab {
        max-width: 180px;
    }

    .dashboard-page-modal .modal-header {
        padding: 16px;
    }

    .dashboard-page-modal-heading {
        grid-template-columns: 36px minmax(0, 1fr);
    }

    .dashboard-page-modal-icon {
        width: 36px;
        height: 36px;
    }

    .dashboard-page-modal .modal-body {
        padding: 14px;
    }

    .dashboard-page-name-panel {
        padding: 12px;
    }

    .dashboard-page-create-options {
        grid-template-columns: 1fr;
    }

    .dashboard-template-picker {
        grid-template-columns: 1fr;
        max-height: 220px;
    }

    .dashboard-create-option,
    .dashboard-template-choice {
        min-height: 0;
    }

    .dashboard-manage-item {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-manage-actions {
        justify-content: flex-start;
    }

    .dashboard-page-modal .modal-footer {
        padding: 12px 14px;
    }
}

/* ============================================
   Widget Config Modal
   ============================================ */
.widget-config-modal {
    width: 90%;
    max-width: 600px;
    border-radius: 28px;
    border: 1px solid rgba(125, 171, 206, 0.24);
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(243,248,252,0.96) 100%);
    box-shadow: 0 28px 60px rgba(22, 70, 107, 0.18);
    overflow: hidden;
}

.config-section {
    margin-bottom: 2rem;
}

.config-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.widget-config-shell {
    display: grid;
    gap: 1rem;
}

.config-section-surface,
.config-section-empty {
    padding: 1.2rem 1.25rem 1.25rem;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(248, 252, 255, 0.96) 0%, rgba(239, 247, 252, 0.94) 100%);
    border: 1px solid rgba(125, 171, 206, 0.2);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.68);
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.1rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-help {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.share-dashboard-template-hint {
    margin: 0 0 1.25rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-group-toggle {
    display: grid;
    align-content: start;
}

.toggle-input-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 44px;
}

.toggle-input-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.form-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.config-empty-state {
    padding: 0.95rem 1rem;
    border-radius: 16px;
    border: 1px dashed rgba(125, 171, 206, 0.28);
    background: rgba(255,255,255,0.78);
    color: var(--text-secondary);
    line-height: 1.6;
}

.widget-config-modal .modal-header {
    padding: 1.15rem 1.35rem 1rem;
    border-bottom: 1px solid rgba(125, 171, 206, 0.18);
}

.widget-config-modal .config-header {
    background: linear-gradient(135deg, rgba(32, 156, 255, 0.12) 0%, rgba(120, 200, 255, 0.12) 100%);
    color: var(--text-primary);
}

.widget-config-modal .modal-header h2 {
    font-size: 1.22rem;
    font-weight: 700;
    color: #15384f;
}

.widget-config-modal .modal-body {
    padding: 1.25rem;
    max-height: 68vh;
    background: linear-gradient(180deg, rgba(245, 250, 254, 0.9) 0%, rgba(238, 246, 252, 0.78) 100%);
}

.widget-config-modal .modal-footer {
    padding: 1rem 1.25rem 1.2rem;
    border-top: 1px solid rgba(125, 171, 206, 0.16);
    background: rgba(255,255,255,0.86);
}

.widget-config-modal .close-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(125,171,206,0.22);
    color: #214b68;
}

.widget-config-modal .close-btn:hover {
    background: #fff;
    box-shadow: 0 10px 18px rgba(28, 83, 120, 0.12);
}

@media (max-width: 768px) {
    .widget-config-modal {
        width: calc(100% - 20px);
        max-width: none;
    }

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

    .widget-config-modal .modal-body {
        padding: 1rem;
        max-height: 72vh;
    }
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: toastSlideIn 0.3s ease;
    min-width: 300px;
}

/* Standalone legacy toast element (id="toast", used without a .toast-container
   wrapper). Without its own fixed positioning it sits in normal document flow
   at full viewport width, doubling the page's scrollable width. */
#toast.toast {
    position: fixed;
    right: 2rem;
    bottom: 2rem;
    z-index: 2000;
    min-width: 0;
    opacity: 0;
    pointer-events: none;
    animation: none;
    transition: opacity 0.2s ease;
}

#toast.toast.show {
    opacity: 1;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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

.toast-icon {
    font-size: 1.25rem;
}

.toast-message {
    flex: 1;
    font-size: 0.9rem;
}

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-error {
    border-left: 4px solid var(--danger-color);
}

.toast-warning {
    border-left: 4px solid var(--warning-color);
}

.toast-info {
    border-left: 4px solid var(--primary-color);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(8, 1fr);
    }

    .widget-xl {
        grid-column: span 8;
    }

    .widget-lg {
        grid-column: span 8;
    }

    .widget-md {
        grid-column: span 4;
    }

    .header {
        min-height: 56px;
        padding: 0.2rem 0.85rem;
        gap: 0.75rem;
    }

    .header-right {
        margin-left: auto;
        gap: 0.4rem;
        row-gap: 0.25rem;
        flex-wrap: nowrap;
        justify-content: flex-end;
        align-items: center;
        max-width: none;
    }

    .topbar-global-search {
        flex-basis: 240px;
    }

    .topbar-current-date,
    .topbar-account-copy {
        display: none;
    }

    .header-utility-group {
        gap: 0.34rem;
        padding: 0.2rem 0.3rem;
    }

    .btn-header-primary .btn-label {
        display: none;
    }

    .btn-header-primary {
        width: 40px;
        padding: 0;
        justify-content: center;
    }

    .dashboard-container {
        padding: 1.1rem;
    }

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

    .dashboard-quick-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .header {
        align-items: center;
    }

    .header-right {
        max-width: 100%;
    }

    body.rightbar-open,
    body.rightbar-collapsed {
        padding-right: var(--rightbar-width-collapsed);
    }

    .rightbar:not(.collapsed) {
        width: min(416px, 100vw);
        z-index: 240;
    }

    .rightbar-panel {
        width: calc(min(416px, 100vw) - var(--rightbar-rail-width));
        flex-basis: calc(min(416px, 100vw) - var(--rightbar-rail-width));
    }
}

@media (max-width: 768px) {
    :root {
        --topbar-height: 56px;
        --sidebar-width-collapsed: 56px;
        --rightbar-rail-width: 56px;
        --rightbar-panel-width: min(260px, calc(100vw - 56px));
        --rightbar-width-expanded: min(316px, 90vw);
        --rightbar-width-collapsed: 56px;
        --sidebar-icon-size: 38px;
        --rightbar-icon-size: 38px;
    }

    body,
    body.sidebar-open,
    body.sidebar-collapsed {
        padding-left: 0;
        padding-bottom: 64px;
    }

    body.rightbar-open,
    body.rightbar-collapsed {
        padding-right: 0;
    }

    .sidebar {
        width: min(280px, 84vw);
        transform: translateX(-100%);
        z-index: 310;
    }

    .sidebar.collapsed {
        width: min(280px, 84vw);
        transform: translateX(-100%);
    }

    .sidebar:not(.collapsed) {
        width: min(280px, 84vw);
        transform: translateX(0);
    }

    .rightbar {
        top: auto;
        bottom: 0;
        width: 100vw;
        height: 64px;
        border-top: 1px solid var(--border-color);
        border-left: 0;
        z-index: 300;
        overflow: visible;
    }

    .rightbar.collapsed,
    .rightbar:not(.collapsed) {
        width: 100vw;
    }

    .rightbar:not(.collapsed) {
        top: 0;
        height: 100vh;
    }

    .rightbar-panel {
        position: absolute;
        inset: 0 0 64px;
        width: 100vw;
        height: calc(100vh - 64px);
        flex-basis: auto;
        border-right: 0;
    }

    .rightbar-panel-maximize {
        display: none !important;
    }

    .rightbar-rail {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100vw;
        min-width: 100vw;
        height: 64px;
        padding: 0.35rem 0.55rem;
        flex: 0 0 64px;
        flex-direction: row;
        justify-content: flex-start;
        gap: 0.55rem;
        overflow-x: auto;
        overflow-y: hidden;
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
    }

    .rightbar-rail-section,
    .rightbar-icon-list,
    .rightbar-utility-list {
        width: auto;
        flex-direction: row;
        flex: 0 0 auto;
    }

    .rightbar-rail-divider {
        width: 1px;
        height: 28px;
        margin: 0 0.15rem;
    }

    .header {
        min-height: var(--topbar-height);
        padding: 0.35rem 0.6rem;
        gap: 0.5rem;
        align-items: center;
    }

    .topbar-global-search {
        min-width: 0;
        flex: 1 1 150px;
        height: 38px;
    }

    .topbar-global-search kbd {
        display: none;
    }

    .topbar-account-trigger {
        padding: 0;
        border: 0;
        background: transparent;
    }

    .header-left {
        min-width: 0;
        gap: 0.5rem;
        flex: 1;
    }

    .header-left h1 {
        font-size: 1.1rem;
        line-height: 1.1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 44vw;
    }

    .header-page-title {
        gap: 0.5rem;
    }

    .header-page-title > span,
    .header-page-title p {
        display: none;
    }

    .header-page-title h1 {
        max-width: 46vw;
        overflow: hidden;
        font-size: 1rem;
        line-height: 1.1;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-right {
        margin-left: auto;
        gap: 0.3rem;
        flex-wrap: nowrap;
        justify-content: flex-end;
        max-width: none;
        white-space: nowrap;
    }

    .top-actions-toggle {
        width: 30px;
        height: 30px;
        padding: 0;
        justify-content: center;
        align-items: center;
    }

    .top-actions-menu {
        position: absolute;
        top: calc(100% + 0.35rem);
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        min-width: 180px;
        padding: 0.45rem;
        border: 1px solid var(--border-color);
        border-radius: 10px;
        background: rgba(246, 252, 255, 0.98);
        box-shadow: 0 10px 24px rgba(15, 74, 114, 0.2);
        z-index: 210;
    }

    .header-right.open .top-actions-menu {
        display: flex;
    }

    .top-actions-menu .btn {
        width: 100%;
        height: 34px;
        justify-content: flex-start;
        font-size: 0.82rem;
        padding: 0 0.55rem;
        gap: 0.4rem;
    }

    .top-actions-menu .btn .btn-icon {
        font-size: 0.95rem;
    }

    .top-actions-theme-picker {
        gap: 0.35rem;
        padding-bottom: 0.2rem;
    }

    .theme-option-compact .theme-option-swatch {
        width: 24px;
        height: 24px;
    }

    .header-utility-group .notification-btn,
    .header-utility-group .user-avatar-btn,
    .header-utility-group .top-actions-toggle,
    .header-utility-group .btn-header-primary {
        width: 34px;
        height: 34px;
    }

    .help-btn .header-icon-svg,
    .notification-btn .header-icon-svg,
    .btn-header-store .header-icon-svg {
        width: 21px;
        height: 21px;
        transform: none;
    }

    .header-utility-group {
        padding: 0.18rem 0.26rem;
        gap: 0.25rem;
    }

    .dashboard-container {
        padding: 0.7rem;
        margin-top: 0.5rem;
    }

    .dashboard-hero {
        gap: 0.75rem;
        margin-bottom: 0.9rem;
    }

    .dashboard-hero-collapsed {
        padding: 0.9rem 1rem;
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-hero-expand {
        width: 100%;
        justify-content: center;
    }

    .dashboard-hero-main,
    .dashboard-hero-side {
        grid-column: auto;
        border-radius: 18px;
    }

    .dashboard-hero-main {
        padding: 1rem;
    }

    .dashboard-hero-side {
        padding: 0.95rem;
    }

    .dashboard-hero-title {
        font-size: 1.48rem;
    }

    .dashboard-hero-subtitle {
        font-size: 0.86rem;
        line-height: 1.55;
    }

    .dashboard-hero-intro {
        padding: 0.95rem 0.95rem 0.9rem;
        border-radius: 18px;
    }

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

    .dashboard-quick-actions,
    .dashboard-kpi-grid,
    .dashboard-workspace .dashboard-hero-summary {
        grid-template-columns: 1fr;
    }

    .dashboard-hero-actions .btn {
        flex: 1 1 0;
        justify-content: center;
    }

    .modal {
        width: calc(100% - 1rem);
        margin: 0.5rem;
    }
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 3.2rem 2rem;
    color: var(--opendw-text-muted, #64748b);
    border-radius: 20px;
    background: var(--opendw-surface, #ffffff);
    border: 1px dashed var(--opendw-border-strong, #d1d5db);
    box-shadow: var(--opendw-shadow-card, 0 1px 2px rgba(15, 23, 42, 0.05));
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: var(--opendw-primary-soft, #eff6ff);
    color: var(--opendw-primary, #0f62fe);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state-desc {
    margin-bottom: 1.5rem;
}

.empty-state .btn {
    min-height: 44px;
    border-radius: 14px;
    box-shadow: 0 12px 24px rgba(20, 92, 142, 0.12);
}

.dashboard-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    padding: 32px 24px 28px;
    text-align: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.dashboard-launcher-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    text-align: left;
}

.dashboard-empty-state-icon {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    place-items: center;
    border: 1px solid #cfe0ff;
    border-radius: 8px;
    background: #edf4ff;
    color: var(--opendw-primary, #0f62fe);
}

.dashboard-empty-state-icon svg {
    width: 23px;
    height: 23px;
}

.dashboard-empty-state-copy {
    display: flex;
    max-width: 560px;
    flex-direction: column;
    align-items: flex-start;
}

.dashboard-empty-state-kicker {
    display: block;
    margin-bottom: 6px;
    color: var(--opendw-primary, #0f62fe);
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.25;
    text-transform: uppercase;
}

.dashboard-empty-state .empty-state-title {
    margin: 0 0 5px;
    font-size: 1.125rem;
    line-height: 1.35;
}

.dashboard-empty-state .empty-state-desc {
    margin: 0;
    line-height: 1.5;
    color: #475569;
    font-size: 14px;
}

.dashboard-launcher-guide {
    display: grid;
    width: min(100%, 840px);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.dashboard-launcher-step {
    display: grid;
    min-width: 0;
    min-height: 88px;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    padding: 15px;
    border: 1px solid var(--opendw-border, #dbe3ee);
    border-radius: 8px;
    background: var(--opendw-surface, #ffffff);
    color: var(--opendw-text, #172033);
    text-align: left;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.035);
}

.dashboard-launcher-step-number {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 50%;
    background: #eaf2ff;
    color: #0f62fe;
    font-size: 0.75rem;
    font-weight: 700;
}

.dashboard-launcher-step strong,
.dashboard-launcher-step small {
    display: block;
}

.dashboard-launcher-step strong {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.35;
}

.dashboard-launcher-step small {
    margin-top: 4px;
    color: var(--opendw-text-muted, #64748b);
    font-size: 0.75rem;
    line-height: 1.4;
}

body:not(.admin-app-page) .dashboard-empty-state .btn.dashboard-empty-state-action {
    min-height: 40px;
    margin-top: 18px;
    padding: 0 16px;
    border: 1px solid var(--opendw-primary, #0f62fe);
    border-radius: var(--fuse-control-radius, 6px);
    background: var(--opendw-primary, #0f62fe);
    color: #ffffff;
    box-shadow: none;
    white-space: nowrap;
}

body:not(.admin-app-page) .dashboard-empty-state .btn.dashboard-empty-state-action:hover {
    border-color: var(--opendw-primary-hover, #0b4fd1);
    background: var(--opendw-primary-hover, #0b4fd1);
    color: #ffffff;
}

.dashboard-empty-state-action .btn-icon,
.dashboard-empty-state-action .btn-icon svg {
    width: 18px;
    height: 18px;
}

.dashboard-launcher-about {
    width: min(100%, 1080px);
    margin-top: 34px;
    padding-top: 24px;
    border-top: 1px solid var(--opendw-border, #dbe3ee);
}

.dashboard-launcher-about-heading {
    margin-bottom: 14px;
    text-align: left;
}

.dashboard-launcher-about-heading h4 {
    margin: 0;
    color: var(--opendw-text, #172033);
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.4;
}

.dashboard-launcher-about-heading p {
    margin: 4px 0 0;
    color: var(--opendw-text-muted, #64748b);
    font-size: 0.8125rem;
    line-height: 1.5;
}

.dashboard-launcher-about-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.dashboard-launcher-about-card {
    display: grid;
    min-width: 0;
    min-height: 218px;
    grid-template-rows: auto 1fr auto;
    gap: 16px;
    padding: 20px;
    border: 1px solid var(--opendw-border, #dbe3ee);
    border-radius: 8px;
    background: var(--opendw-surface, #ffffff);
    color: var(--opendw-text, #172033);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.045);
    text-align: left;
    text-decoration: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.dashboard-launcher-about-card:hover {
    border-color: #b8cced;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
}

.dashboard-launcher-about-icon {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 8px;
}

.dashboard-launcher-about-icon svg {
    width: 22px;
    height: 22px;
}

.dashboard-launcher-about-card--blue .dashboard-launcher-about-icon {
    background: #eaf2ff;
    color: #0f62fe;
}

.dashboard-launcher-about-card--green .dashboard-launcher-about-icon {
    background: #e4f7ee;
    color: #07845b;
}

.dashboard-launcher-about-card--violet .dashboard-launcher-about-icon {
    background: #f0ebff;
    color: #6750c9;
}

.dashboard-launcher-about-copy {
    display: block;
}

.dashboard-launcher-about-copy small,
.dashboard-launcher-about-copy strong,
.dashboard-launcher-about-copy > span {
    display: block;
}

.dashboard-launcher-about-copy small {
    margin-bottom: 6px;
    color: var(--opendw-text-muted, #64748b);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
}

.dashboard-launcher-about-copy strong {
    margin-bottom: 8px;
    font-size: 0.9375rem;
    line-height: 1.4;
}

.dashboard-launcher-about-copy > span {
    color: var(--opendw-text-muted, #64748b);
    font-size: 0.8125rem;
    line-height: 1.55;
}

.dashboard-launcher-about-link {
    color: var(--opendw-primary, #0f62fe);
    font-size: 0.78125rem;
    font-weight: 700;
}

@media (max-width: 720px) {
    .dashboard-empty-state {
        min-height: 0;
        padding: 24px 20px;
    }

    .dashboard-launcher-heading {
        align-items: flex-start;
    }

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

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

    .dashboard-launcher-about-card {
        min-height: 0;
    }

    body:not(.admin-app-page) .dashboard-empty-state .btn.dashboard-empty-state-action {
        width: 100%;
        max-width: 320px;
    }
}

@media (min-width: 721px) and (max-width: 1100px) {
    .dashboard-launcher-guide {
        width: min(100%, 640px);
    }

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

    .dashboard-launcher-about-card {
        min-height: 0;
    }
}

/* ============================================
   Drop Zone Placeholder
   ============================================ */
.drop-placeholder {
    border: 2px dashed var(--primary-color);
    border-radius: var(--radius-lg);
    background: rgba(52, 152, 219, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-weight: 500;
    position: absolute;
    pointer-events: none;
}

.shortcut-config-list {
    display: grid;
    gap: 0.85rem;
}

.shortcut-config-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid rgba(125, 171, 206, 0.2);
    background: linear-gradient(180deg, rgba(255,255,255,0.94) 0%, rgba(243,248,252,0.92) 100%);
}

.shortcut-config-item-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
}

.shortcut-editor-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
    gap: 0.75rem 0.9rem;
    align-items: start;
}

.shortcut-editor-grid .form-group {
    margin-bottom: 0;
}

.shortcut-url-group,
.shortcut-description-group {
    grid-column: 1 / -1;
}

.shortcut-url-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.55rem;
    align-items: center;
}

.shortcut-fetch-btn {
    white-space: nowrap;
    min-height: 42px;
    padding-inline: 0.8rem;
}

.shortcut-icon-composer {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.shortcut-icon-current {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(125, 171, 206, 0.26);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
    cursor: pointer;
    padding: 0;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.shortcut-icon-current:hover {
    border-color: rgba(32, 156, 255, 0.55);
    box-shadow: 0 8px 18px rgba(22, 85, 130, 0.12);
    transform: translateY(-1px);
}

.shortcut-icon-preview-img {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    object-fit: contain;
    display: block;
}

.shortcut-icon-picker-popover {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
    width: min(300px, calc(100vw - 3rem));
    padding: 0.65rem;
    border: 1px solid rgba(125, 171, 206, 0.26);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 38px rgba(22, 70, 107, 0.18);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.14s ease, transform 0.14s ease;
}

.shortcut-icon-picker-popover.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.shortcut-icon-picker-title {
    margin-bottom: 0.45rem;
    font-size: 0.76rem;
    font-weight: 700;
    color: #6f8ba2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.shortcut-icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    scrollbar-width: thin;
    min-width: 0;
}

.shortcut-active-group {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    min-height: 42px;
    justify-self: start;
}

.shortcut-active-group .form-label {
    margin-bottom: 0;
}

.shortcut-active-group .toggle-input-wrap {
    min-height: 0;
}

.shortcut-icon-choice {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 1px solid rgba(125, 171, 206, 0.26);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.shortcut-icon-choice-img {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    object-fit: contain;
    display: block;
}

@media (max-width: 640px) {
    .shortcut-editor-grid {
        grid-template-columns: 1fr;
    }

    .shortcut-url-field {
        grid-template-columns: 1fr;
    }

    .shortcut-fetch-btn {
        width: 100%;
    }
}

.shortcut-icon-choice:hover,
.shortcut-icon-choice.active {
    border-color: var(--primary-color);
    background: rgba(32, 156, 255, 0.12);
    box-shadow: 0 8px 18px rgba(22, 85, 130, 0.12);
    transform: translateY(-1px);
}

.shortcut-config-icon-img {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    object-fit: contain;
    display: inline-block;
}

.shortcut-config-item-url {
    font-size: 0.85rem;
    color: var(--primary-color);
    word-break: break-all;
}

.shortcut-config-item-desc {
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.shortcut-config-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-content: start;
    justify-content: flex-end;
}

.widget-config-actions-inline {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ============================================
   Note Widget - Sổ tay điện tử
   ============================================ */
.note-widget {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
}

.note-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.note-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
}

.note-btn-add {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.note-btn-add:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.note-search {
    flex: 1;
    min-width: 120px;
}

.note-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    transition: var(--transition);
}

.note-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.note-list {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
    padding-right: 0.25rem;
}

.note-item {
    background: #fff9c4;
    border-radius: var(--radius-md);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    min-height: 100px;
    position: relative;
}

.note-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Note Colors */
.note-yellow {
    background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%);
    border-left: 4px solid #f9a825;
}

.note-blue {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-left: 4px solid #1976d2;
}

.note-green {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-left: 4px solid #388e3c;
}

.note-red {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-left: 4px solid #d32f2f;
}

.note-purple {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    border-left: 4px solid #7b1fa2;
}

.note-orange {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-left: 4px solid #f57c00;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.note-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    flex: 1;
    word-break: break-word;
}

.note-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    opacity: 0;
    transition: var(--transition);
}

.note-item:hover .note-actions {
    opacity: 1;
}

.note-pin {
    font-size: 0.7rem;
}

.note-action-btn {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 4px;
    padding: 0.2rem 0.3rem;
    cursor: pointer;
    font-size: 0.65rem;
    transition: var(--transition);
}

.note-action-btn:hover {
    background: rgba(0, 0, 0, 0.15);
}

.note-content {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.note-footer {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

.note-time {
    font-size: 0.65rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.note-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-secondary);
    text-align: center;
}

.note-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.note-empty p {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Note Editor Modal */
.note-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.note-modal.active {
    opacity: 1;
    visibility: visible;
}

.note-editor {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: var(--transition);
}

.note-modal.active .note-editor {
    transform: scale(1);
}

.note-editor-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.note-editor-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.note-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.note-close-btn:hover {
    color: var(--danger-color);
}

.note-editor-body {
    padding: 1rem;
    overflow-y: auto;
    max-height: calc(80vh - 130px);
}

.note-editor-body .form-group {
    margin-bottom: 1rem;
}

.note-editor-body label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.note-editor-body input,
.note-editor-body textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: var(--transition);
}

.note-editor-body input:focus,
.note-editor-body textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.note-editor-body textarea {
    min-height: 120px;
    resize: vertical;
}

.note-color-picker {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.note-color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
}

.note-color-option:hover {
    transform: scale(1.1);
}

.note-color-option.selected {
    border-color: var(--text-primary);
}

.note-color-option[data-color="yellow"] {
    background: #fff59d;
}

.note-color-option[data-color="blue"] {
    background: #bbdefb;
}

.note-color-option[data-color="green"] {
    background: #c8e6c9;
}

.note-color-option[data-color="red"] {
    background: #ffcdd2;
}

.note-color-option[data-color="purple"] {
    background: #e1bee7;
}

.note-color-option[data-color="orange"] {
    background: #ffe0b2;
}

.note-editor-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.note-editor-footer .btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.note-editor-footer .btn-cancel {
    background: var(--secondary-color);
    color: var(--text-primary);
}

.note-editor-footer .btn-cancel:hover {
    background: #d5dbdb;
}

.note-editor-footer .btn-save {
    background: var(--primary-color);
    color: white;
}

.note-editor-footer .btn-save:hover {
    background: var(--primary-dark);
}

.note-pin-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.note-pin-toggle input {
    width: auto;
}

/* ============================================
   Contact Widget - Danh bạ
   ============================================ */
.contact-widget {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    container-type: inline-size;
    container-name: contact-widget;
}

.contact-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.contact-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
}

.contact-btn-add {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.contact-btn-add:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.4);
}

.contact-search {
    flex: 1;
    min-width: 120px;
}

.contact-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    transition: var(--transition);
}

.contact-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.contact-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 0.25rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.contact-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.contact-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    background-color: #3498db;
}

.contact-info {
    flex: 1;
    min-width: 0;
    padding-right: 0.25rem;
}

.contact-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    line-height: 1.25;
}

.contact-star {
    font-size: 0.7rem;
}

.contact-dept {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-phone {
    font-size: 0.75rem;
    color: var(--primary-color);
}

.contact-actions {
    display: inline-flex;
    gap: 0.25rem;
    opacity: 0;
    transition: var(--transition);
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.12rem;
    box-shadow: 0 4px 12px rgba(12, 67, 108, 0.12);
}

.contact-item:hover .contact-actions {
    opacity: 1;
    pointer-events: auto;
}

@container contact-widget (min-width: 380px) {
    .contact-item {
        padding-right: 6rem;
    }

    .contact-actions {
        opacity: 1;
        pointer-events: auto;
    }
}

.contact-action-btn {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 4px;
    padding: 0.3rem 0.4rem;
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition);
}

.contact-action-btn:hover {
    background: rgba(0, 0, 0, 0.15);
}

.contact-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-secondary);
    text-align: center;
}

.contact-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.contact-empty p {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

@container contact-widget (max-width: 360px) {
    .contact-item {
        gap: 0.45rem;
        padding: 0.45rem;
    }

    .contact-avatar {
        width: 34px;
        height: 34px;
        min-width: 34px;
        min-height: 34px;
        font-size: 0.72rem;
    }

    .contact-name {
        font-size: 0.78rem;
    }

    .contact-dept {
        font-size: 0.68rem;
    }

    .contact-phone {
        display: none;
    }

    .contact-actions {
        display: none;
    }
}

@container contact-widget (max-width: 300px) {
    .contact-toolbar {
        gap: 0.4rem;
        margin-bottom: 0.5rem;
    }

    .contact-btn {
        padding: 0.38rem 0.55rem;
        font-size: 0.72rem;
    }

    .contact-search-input {
        padding: 0.38rem 0.55rem;
        font-size: 0.72rem;
    }

    .contact-item {
        gap: 0.38rem;
        padding: 0.4rem;
    }

    .contact-avatar {
        width: 30px;
        height: 30px;
        min-width: 30px;
        min-height: 30px;
        font-size: 0.68rem;
    }

    .contact-name {
        font-size: 0.74rem;
    }

    .contact-dept {
        display: none;
    }
}

/* Contact Editor Modal */
.contact-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.contact-modal.active {
    opacity: 1;
    visibility: visible;
}

.contact-editor {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: var(--transition);
}

.contact-modal.active .contact-editor {
    transform: scale(1);
}

.contact-editor-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.contact-editor-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.contact-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
    transition: var(--transition);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.contact-editor-body {
    padding: 1rem;
    overflow-y: auto;
    max-height: calc(80vh - 130px);
}

.contact-editor-body .form-group {
    margin-bottom: 1rem;
}

.contact-editor-body .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.contact-editor-body label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.contact-editor-body input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: var(--transition);
}

.contact-editor-body input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.contact-editor-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.contact-editor-footer .btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.contact-editor-footer .btn-cancel {
    background: var(--secondary-color);
    color: var(--text-primary);
}

.contact-editor-footer .btn-cancel:hover {
    background: #d5dbdb;
}

.contact-editor-footer .btn-save {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.contact-editor-footer .btn-save:hover {
    opacity: 0.9;
}

.contact-favorite-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.contact-favorite-toggle input {
    width: auto;
}

@media (max-width: 480px) {
    .header {
        padding: 0.35rem 0.45rem;
        gap: 0.35rem;
        overflow: visible;
    }

    .topbar-leading {
        flex: 1 1 auto;
        gap: 0.35rem;
    }

    .topbar-global-search {
        display: none;
    }

    .header-left h1 {
        font-size: 1rem;
    }

    .header-left .version-badge {
        display: none;
    }

    .header-right {
        max-width: none;
        gap: 0.25rem;
        flex-wrap: nowrap;
        flex: 0 0 auto;
        overflow: visible;
    }

    .header-right .btn,
    .notification-btn,
    .user-avatar-btn {
        width: 32px;
        height: 32px;
    }

    .top-actions-menu .btn {
        width: 100%;
        height: 32px;
    }

    .top-actions-toggle {
        width: 32px;
        height: 32px;
    }

    .help-btn .header-icon-svg,
    .notification-btn .header-icon-svg,
    .btn-header-store .header-icon-svg {
        width: 20px;
        height: 20px;
        transform: none;
    }

    .top-actions-menu {
        min-width: 170px;
        right: -0.15rem;
    }

    .topbar-account-menu {
        width: min(280px, calc(100vw - 16px));
        min-width: 0;
        right: 0;
    }

    .dashboard-container {
        padding: 0.55rem;
    }

    .contact-editor-body .form-row {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Settings Modal Styles
   ============================================ */
.settings-section {
    margin-bottom: 2rem;
}

.settings-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.theme-options {
    display: flex;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.theme-mode-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.theme-option {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem;
    border: none;
    background: transparent;
    cursor: pointer;
}

.theme-option-swatch {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 2px solid rgba(125, 171, 206, 0.22);
    box-shadow: 0 14px 26px rgba(22, 70, 107, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.theme-option-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #214b68;
}

.theme-option:hover .theme-option-swatch,
.theme-option.active .theme-option-swatch {
    transform: translateY(-2px) scale(1.03);
    border-color: var(--primary-color);
    box-shadow: 0 18px 32px rgba(21, 86, 130, 0.18);
}

.theme-option.active .theme-option-label {
    color: var(--primary-color);
}

.theme-mode-card {
    min-height: 92px;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--bg-card);
}

.theme-mode-card-icon {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(61, 142, 220, 0.1);
    color: var(--primary-color);
    font-size: 1.05rem;
}

.theme-mode-card:hover,
.theme-mode-card.active {
    border-color: var(--primary-color);
    background: var(--bg-hover);
}

.theme-option-civic {
    background:
        radial-gradient(circle at 32% 24%, rgba(255,255,255,0.96) 0 18%, transparent 19%),
        linear-gradient(135deg, #f8fafc 0%, #e6edf5 46%, #1769aa 100%);
}

.theme-option-productivity {
    background:
        radial-gradient(circle at 32% 24%, rgba(255,255,255,0.96) 0 18%, transparent 19%),
        linear-gradient(135deg, #f7f8fb 0%, #e8edf4 52%, #64748b 100%);
}

.theme-option-glass {
    background:
        radial-gradient(circle at 32% 24%, rgba(255,255,255,0.98) 0 18%, transparent 19%),
        linear-gradient(135deg, #ecf8ff 0%, #bfe8ff 48%, #38bdf8 100%);
}

.theme-option-enterprise {
    background:
        radial-gradient(circle at 32% 24%, rgba(255,255,255,0.96) 0 18%, transparent 19%),
        linear-gradient(135deg, #f3f6f9 0%, #dbe3ec 52%, #334155 100%);
}

.theme-option-blueglass {
    background:
        radial-gradient(circle at 30% 25%, rgba(255,255,255,0.95) 0 18%, transparent 19%),
        linear-gradient(135deg, #eaf5fd 0%, #cfe7f8 38%, #9fd4f0 100%);
}

.theme-option-mist {
    background:
        radial-gradient(circle at 32% 24%, rgba(255,255,255,0.95) 0 18%, transparent 19%),
        linear-gradient(135deg, #f8fbfe 0%, #e8f0f7 52%, #d9e7f1 100%);
}

.theme-option-sand {
    background:
        radial-gradient(circle at 32% 24%, rgba(255,255,255,0.95) 0 18%, transparent 19%),
        linear-gradient(135deg, #fff9ef 0%, #f8ead1 52%, #efd3a5 100%);
}

.theme-option-noir {
    background:
        radial-gradient(circle at 32% 24%, rgba(255,255,255,0.18) 0 16%, transparent 17%),
        linear-gradient(135deg, #223245 0%, #121b27 48%, #080d13 100%);
}

body.theme-preset-civic,
body.theme-preset-blueglass {
    background: #f4f7fb;
    --primary-color: #1769aa;
    --primary-dark: #0f4f83;
    --secondary-color: #e6edf5;
    --text-primary: #102a43;
    --text-secondary: #526b82;
    --text-tertiary: #7b91a6;
    --bg-primary: #f4f7fb;
    --bg-card: #ffffff;
    --bg-secondary: #eef3f8;
    --bg-hover: #e7f0f8;
    --header-bg: #f8fafc;
    --border-color: #d8e2ec;
    --widget-surface: #ffffff;
    --widget-surface-soft: #f8fbfd;
    --widget-surface-elevated: #ffffff;
    --widget-surface-muted: #f3f7fb;
    --widget-border-color: #d8e2ec;
    --widget-border-soft: #e6edf5;
    --widget-shadow: 0 8px 20px rgba(16, 42, 67, 0.08);
    --widget-shadow-soft: 0 4px 12px rgba(16, 42, 67, 0.06);
    --widget-item-shadow: 0 6px 16px rgba(16, 42, 67, 0.08);
    --widget-text-primary: #102a43;
    --widget-text-secondary: #526b82;
    --widget-chip-bg: #eef3f8;
    --widget-chip-text: #334e68;
    --widget-input-bg: #ffffff;
    --widget-input-border: #d8e2ec;
    --widget-scrollbar: rgba(82, 107, 130, 0.36);
    --widget-scrollbar-hover: rgba(82, 107, 130, 0.56);
    --widget-scrollbar-track: rgba(216, 226, 236, 0.52);
    --widget-accent-soft: rgba(23, 105, 170, 0.1);
    --widget-note-bg: #f8fbfd;
    --widget-note-border: #e6edf5;
}

body.theme-preset-glass {
    background: linear-gradient(180deg, #eef9ff 0%, #e2f2fb 100%);
    --widget-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(247, 252, 255, 0.86) 100%);
    --widget-surface-soft: linear-gradient(180deg, rgba(255, 255, 255, 0.62) 0%, rgba(247, 252, 255, 0.18) 100%);
    --widget-surface-elevated: linear-gradient(150deg, rgba(255, 255, 255, 0.99) 0%, rgba(242, 248, 252, 0.95) 100%);
    --widget-surface-muted: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(239, 246, 252, 0.93) 100%);
    --widget-border-color: rgba(125, 171, 206, 0.24);
    --widget-border-soft: rgba(125, 171, 206, 0.18);
    --widget-shadow: 0 14px 34px rgba(31, 91, 133, 0.1);
    --widget-shadow-soft: 0 12px 24px rgba(117, 148, 184, 0.08);
    --widget-item-shadow: 0 16px 32px rgba(118, 148, 186, 0.1);
    --widget-text-primary: #17395b;
    --widget-text-secondary: #6f88a0;
    --widget-chip-bg: rgba(255, 255, 255, 0.78);
    --widget-chip-text: #637b93;
    --widget-input-bg: rgba(255, 255, 255, 0.96);
    --widget-input-border: rgba(122, 167, 209, 0.16);
    --widget-scrollbar: rgba(122, 162, 202, 0.44);
    --widget-scrollbar-hover: rgba(102, 148, 192, 0.62);
    --widget-scrollbar-track: rgba(146, 186, 219, 0.14);
    --widget-accent-soft: rgba(67, 180, 255, 0.12);
    --widget-note-bg: rgba(248, 252, 255, 0.96);
    --widget-note-border: rgba(125, 171, 206, 0.16);
}

body.theme-preset-productivity {
    background: linear-gradient(180deg, #f7f8fb 0%, #eef2f7 100%);
    --widget-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(246, 250, 253, 0.9) 100%);
    --widget-surface-soft: linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(247, 251, 254, 0.28) 100%);
    --widget-surface-elevated: linear-gradient(150deg, rgba(255, 255, 255, 0.99) 0%, rgba(245, 249, 252, 0.96) 100%);
    --widget-surface-muted: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(243, 247, 251, 0.95) 100%);
    --widget-border-color: rgba(163, 186, 204, 0.24);
    --widget-border-soft: rgba(163, 186, 204, 0.18);
    --widget-shadow: 0 14px 34px rgba(77, 104, 128, 0.08);
    --widget-shadow-soft: 0 12px 24px rgba(97, 119, 140, 0.08);
    --widget-item-shadow: 0 16px 32px rgba(95, 117, 138, 0.08);
    --widget-text-primary: #20364a;
    --widget-text-secondary: #71869a;
    --widget-chip-bg: rgba(255, 255, 255, 0.82);
    --widget-chip-text: #627b90;
    --widget-input-bg: rgba(255, 255, 255, 0.98);
    --widget-input-border: rgba(157, 181, 201, 0.16);
    --widget-scrollbar: rgba(146, 168, 186, 0.4);
    --widget-scrollbar-hover: rgba(128, 152, 171, 0.58);
    --widget-scrollbar-track: rgba(181, 199, 214, 0.16);
    --widget-accent-soft: rgba(100, 153, 196, 0.12);
    --widget-note-bg: rgba(250, 252, 255, 0.96);
    --widget-note-border: rgba(163, 186, 204, 0.14);
}

body.theme-preset-enterprise {
    background: linear-gradient(180deg, #f3f6f9 0%, #e9eef4 100%);
    --widget-surface: linear-gradient(180deg, rgba(255, 253, 248, 0.95) 0%, rgba(250, 241, 223, 0.88) 100%);
    --widget-surface-soft: linear-gradient(180deg, rgba(255, 252, 245, 0.76) 0%, rgba(248, 239, 222, 0.26) 100%);
    --widget-surface-elevated: linear-gradient(150deg, rgba(255, 254, 250, 0.99) 0%, rgba(249, 240, 223, 0.95) 100%);
    --widget-surface-muted: linear-gradient(145deg, rgba(255, 252, 245, 0.98) 0%, rgba(247, 236, 214, 0.94) 100%);
    --widget-border-color: rgba(208, 184, 145, 0.26);
    --widget-border-soft: rgba(208, 184, 145, 0.18);
    --widget-shadow: 0 14px 34px rgba(139, 113, 72, 0.1);
    --widget-shadow-soft: 0 12px 24px rgba(148, 126, 91, 0.08);
    --widget-item-shadow: 0 16px 32px rgba(142, 120, 84, 0.1);
    --widget-text-primary: #4b3521;
    --widget-text-secondary: #8b6f52;
    --widget-chip-bg: rgba(255, 250, 240, 0.82);
    --widget-chip-text: #846748;
    --widget-input-bg: rgba(255, 252, 246, 0.96);
    --widget-input-border: rgba(201, 178, 139, 0.18);
    --widget-scrollbar: rgba(181, 152, 109, 0.42);
    --widget-scrollbar-hover: rgba(163, 132, 88, 0.58);
    --widget-scrollbar-track: rgba(206, 181, 144, 0.18);
    --widget-accent-soft: rgba(214, 164, 88, 0.14);
    --widget-note-bg: rgba(255, 251, 245, 0.96);
    --widget-note-border: rgba(206, 181, 144, 0.16);
}

body.theme-preset-noir {
    background:
        radial-gradient(circle at top, rgba(83, 128, 170, 0.18) 0%, transparent 40%),
        linear-gradient(180deg, #111927 0%, #0b1119 100%);
    --widget-surface: linear-gradient(180deg, rgba(23, 35, 50, 0.96) 0%, rgba(14, 22, 33, 0.94) 100%);
    --widget-surface-soft: linear-gradient(180deg, rgba(31, 45, 63, 0.72) 0%, rgba(17, 27, 39, 0.2) 100%);
    --widget-surface-elevated: linear-gradient(150deg, rgba(25, 38, 54, 0.98) 0%, rgba(16, 24, 36, 0.95) 100%);
    --widget-surface-muted: linear-gradient(145deg, rgba(30, 45, 63, 0.96) 0%, rgba(21, 31, 45, 0.94) 100%);
    --widget-border-color: rgba(105, 141, 176, 0.24);
    --widget-border-soft: rgba(105, 141, 176, 0.18);
    --widget-shadow: 0 16px 36px rgba(1, 7, 16, 0.42);
    --widget-shadow-soft: 0 12px 28px rgba(3, 10, 20, 0.34);
    --widget-item-shadow: 0 18px 34px rgba(2, 8, 17, 0.38);
    --widget-text-primary: #e8f0f9;
    --widget-text-secondary: #9db0c4;
    --widget-chip-bg: rgba(29, 44, 61, 0.92);
    --widget-chip-text: #d6e2ee;
    --widget-input-bg: rgba(18, 29, 42, 0.96);
    --widget-input-border: rgba(105, 141, 176, 0.22);
    --widget-scrollbar: rgba(110, 145, 178, 0.48);
    --widget-scrollbar-hover: rgba(142, 177, 209, 0.72);
    --widget-scrollbar-track: rgba(19, 31, 45, 0.64);
    --widget-accent-soft: rgba(85, 160, 226, 0.18);
    --widget-note-bg: rgba(19, 31, 45, 0.96);
    --widget-note-border: rgba(104, 139, 175, 0.16);
}

body.theme-preset-noir .news-filter-btn {
    background: var(--widget-chip-bg);
    color: var(--widget-chip-text);
    border-color: var(--widget-border-soft);
    box-shadow: var(--widget-shadow-soft);
}

body.theme-preset-noir .news-filter-btn:hover,
body.theme-preset-noir .news-filter-btn.active {
    background: linear-gradient(135deg, #1f7fd1 0%, #2e93f4 100%);
    color: #fff;
    border-color: transparent;
}

body.theme-preset-noir .news-category-badge {
    background: rgba(31, 47, 67, 0.92) !important;
    color: #d6e5f2 !important;
    border: 1px solid rgba(104, 139, 175, 0.18);
}

body.theme-preset-noir .notification-unread-banner {
    background: linear-gradient(145deg, rgba(78, 38, 48, 0.9) 0%, rgba(54, 24, 33, 0.86) 100%);
    border-color: rgba(233, 94, 111, 0.2);
    box-shadow: 0 14px 24px rgba(17, 5, 10, 0.2);
}

body.theme-preset-noir .notification-item {
    background: linear-gradient(150deg, rgba(27, 40, 56, 0.98) 0%, rgba(19, 29, 42, 0.95) 100%) !important;
    border-color: rgba(104, 139, 175, 0.18) !important;
    box-shadow: 0 16px 30px rgba(3, 10, 20, 0.3) !important;
}

body.theme-preset-noir .notification-item:hover {
    background: linear-gradient(150deg, rgba(31, 47, 66, 0.98) 0%, rgba(22, 34, 49, 0.96) 100%) !important;
    box-shadow: 0 18px 34px rgba(3, 10, 20, 0.38);
}

body.theme-preset-noir .dashboard-page-modal {
    background: linear-gradient(180deg, rgba(23, 35, 50, 0.96) 0%, rgba(14, 22, 33, 0.94) 100%);
    border-color: rgba(105, 141, 176, 0.24);
    box-shadow: 0 18px 36px rgba(1, 7, 16, 0.42);
}

body.theme-preset-noir .dashboard-pages-bar {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

body.theme-preset-noir .header-dashboard-tabs {
    box-shadow: none;
}

body.theme-preset-noir .dashboard-page-modal .modal-body {
    background: linear-gradient(180deg, rgba(18, 29, 42, 0.96) 0%, rgba(13, 22, 33, 0.94) 100%);
}

body.theme-preset-noir .dashboard-page-tab {
    background: transparent;
    color: var(--widget-text-secondary);
}

body.theme-preset-noir .dashboard-page-tab:hover {
    background: rgba(29, 44, 61, 0.92);
    color: var(--widget-text-primary);
}

body.theme-preset-noir .dashboard-page-tab.active {
    background: linear-gradient(135deg, #1d74be 0%, #249bd7 100%);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(3, 12, 24, 0.35);
}

body.theme-preset-noir .dashboard-page-tab small {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

body.theme-preset-noir .dashboard-page-edit,
body.theme-preset-noir .dashboard-page-delete,
body.theme-preset-noir .dashboard-page-add-tab {
    background: rgba(19, 31, 45, 0.72);
    color: var(--widget-text-secondary);
    border-color: rgba(105, 141, 176, 0.22);
}

body.theme-preset-noir .dashboard-page-tab-wrap.confirming-delete .dashboard-page-tab {
    background: rgba(64, 31, 35, 0.86);
    border-color: rgba(255, 125, 115, 0.26);
    color: #ffd6d1;
}

body.theme-preset-noir .dashboard-page-tab-wrap.confirming-delete .dashboard-page-tab.active {
    background: linear-gradient(135deg, #9e3a3a 0%, #d05b50 100%);
    color: #ffffff;
}

body.theme-preset-noir .dashboard-page-delete-confirm {
    background: rgba(20, 31, 45, 0.94);
    border-color: rgba(255, 125, 115, 0.22);
    box-shadow: 0 10px 20px rgba(2, 8, 17, 0.26);
}

body.theme-preset-noir .dashboard-page-confirm-action {
    color: var(--widget-text-secondary);
}

body.theme-preset-noir .dashboard-page-confirm-action.confirm {
    color: #ffaaa2;
}

body.theme-preset-noir .dashboard-page-confirm-action.confirm:hover {
    background: rgba(74, 35, 39, 0.96);
    color: #ffd8d4;
}

body.theme-preset-noir .dashboard-page-confirm-action.cancel:hover {
    background: rgba(29, 44, 61, 0.96);
    color: var(--widget-text-primary);
}

body.theme-preset-noir .dashboard-page-edit:hover,
body.theme-preset-noir .dashboard-page-delete:hover,
body.theme-preset-noir .dashboard-page-add-tab:hover {
    background: rgba(29, 44, 61, 0.96);
    color: var(--widget-text-primary);
}

body.theme-preset-noir .dashboard-page-delete:hover {
    color: #ff9b94;
    border-color: rgba(255, 125, 115, 0.28);
    background: rgba(64, 31, 35, 0.94);
}

body.theme-preset-noir .dashboard-create-option.active,
body.theme-preset-noir .dashboard-template-choice.active,
body.theme-preset-noir .dashboard-manage-item.active {
    background: linear-gradient(150deg, rgba(29, 44, 61, 0.98) 0%, rgba(20, 31, 45, 0.96) 100%);
    border-color: rgba(85, 160, 226, 0.42);
}

body.theme-preset-noir .dashboard-quick-action,
body.theme-preset-noir .dashboard-workspace .hero-summary-card,
body.theme-preset-noir .dashboard-workspace .dashboard-hero-metric {
    background: var(--widget-surface-muted) !important;
    border-color: var(--widget-border-soft) !important;
    color: var(--widget-text-primary) !important;
}

body.theme-preset-noir .dashboard-workspace .dashboard-hero-intro,
body.theme-preset-noir .dashboard-workspace .dashboard-hero-focus {
    background: rgba(29, 44, 61, 0.82) !important;
    border-color: rgba(85, 160, 226, 0.24) !important;
}

body.theme-preset-noir .dashboard-quick-action:hover,
body.theme-preset-noir .dashboard-quick-action:focus-visible {
    background: rgba(31, 78, 121, 0.42) !important;
    color: #eaf6ff !important;
}

body.theme-preset-noir .dashboard-quick-action.primary {
    background: #1d74be !important;
    border-color: rgba(96, 165, 250, 0.42) !important;
    color: #ffffff !important;
}

body.theme-preset-noir .notification-icon {
    background: rgba(34, 50, 70, 0.96);
}

body.theme-preset-noir .notification-title,
body.theme-preset-noir .notification-time {
    color: var(--widget-text-primary) !important;
}

body.theme-preset-noir .notification-time {
    color: var(--widget-text-secondary) !important;
}

body.theme-preset-noir .note-search-input,
body.theme-preset-noir .contact-search-input,
body.theme-preset-noir .ai-input {
    background: var(--widget-input-bg);
    border-color: var(--widget-input-border);
    color: var(--widget-text-primary);
}

body.theme-preset-noir .note-search-input::placeholder,
body.theme-preset-noir .contact-search-input::placeholder,
body.theme-preset-noir .ai-input::placeholder {
    color: var(--widget-text-secondary);
}

body.theme-preset-noir .note-item {
    box-shadow: 0 14px 24px rgba(3, 10, 20, 0.28);
}

body.theme-preset-noir .note-yellow {
    background: linear-gradient(135deg, rgba(89, 72, 20, 0.96) 0%, rgba(70, 55, 16, 0.94) 100%);
    color: #fff6cf;
}

body.theme-preset-noir .note-blue {
    background: linear-gradient(135deg, rgba(27, 56, 92, 0.96) 0%, rgba(18, 43, 74, 0.94) 100%);
    color: #e4f1ff;
}

body.theme-preset-noir .note-green {
    background: linear-gradient(135deg, rgba(26, 70, 45, 0.96) 0%, rgba(19, 55, 35, 0.94) 100%);
    color: #dcffe9;
}

body.theme-preset-noir .note-red {
    background: linear-gradient(135deg, rgba(95, 35, 42, 0.96) 0%, rgba(73, 25, 31, 0.94) 100%);
    color: #ffe3e6;
}

body.theme-preset-noir .note-purple {
    background: linear-gradient(135deg, rgba(70, 42, 92, 0.96) 0%, rgba(54, 30, 74, 0.94) 100%);
    color: #f2e5ff;
}

body.theme-preset-noir .note-orange {
    background: linear-gradient(135deg, rgba(98, 57, 20, 0.96) 0%, rgba(78, 43, 14, 0.94) 100%);
    color: #ffead8;
}

body.theme-preset-noir .note-item .note-title,
body.theme-preset-noir .note-item .note-content,
body.theme-preset-noir .note-item .note-date {
    color: inherit;
}

body.theme-preset-noir .note-action-btn {
    background: rgba(255, 255, 255, 0.1);
    color: inherit;
}

body.theme-preset-noir .calendar-header-info,
body.theme-preset-noir .calendar-stats .stat-item,
body.theme-preset-noir .event-time-badge {
    background: linear-gradient(145deg, rgba(29, 44, 61, 0.96) 0%, rgba(21, 32, 46, 0.94) 100%) !important;
    border-color: rgba(104, 139, 175, 0.18) !important;
    box-shadow: 0 12px 24px rgba(3, 10, 20, 0.28) !important;
}

body.theme-preset-noir .calendar-date,
body.theme-preset-noir .calendar-stats .stat-value,
body.theme-preset-noir .event-time-badge {
    color: #eef5fc !important;
}

body.theme-preset-noir .calendar-stats .stat-label,
body.theme-preset-noir .calendar-stats .stat-item,
body.theme-preset-noir .calendar-tab {
    color: #b8cadb !important;
}

body.theme-preset-noir .header {
    background: linear-gradient(92deg, rgba(18, 29, 42, 0.96) 0%, rgba(15, 24, 35, 0.94) 62%, rgba(19, 30, 43, 0.98) 100%);
    border-bottom: 1px solid rgba(96, 133, 168, 0.18);
}

body.theme-preset-noir .header-left h1,
body.theme-preset-noir .header-brand-copy,
body.theme-preset-noir .header-page-title h1,
body.theme-preset-noir .header-left {
    color: #e8f0f9;
}

body.theme-preset-noir .header-page-title > span {
    background: rgba(85, 160, 226, 0.18);
    color: #bfdbf3;
}

body.theme-preset-noir .header-page-title p {
    color: #9fb4c8;
}

body.theme-preset-noir .header-utility-group {
    background: rgba(19, 31, 45, 0.82);
    border-color: rgba(104, 139, 175, 0.2);
    box-shadow: 0 12px 24px rgba(3, 10, 20, 0.26);
}

body.theme-preset-noir .header-icon-btn,
body.theme-preset-noir .header-notification-wrapper .notification-btn {
    background: linear-gradient(135deg, rgba(33, 49, 68, 0.96) 0%, rgba(19, 31, 45, 0.98) 100%);
    border-color: rgba(104, 139, 175, 0.24);
    color: #aac0d4;
    box-shadow: 0 8px 18px rgba(2, 8, 16, 0.3);
}

body.theme-preset-noir .header-icon-btn:hover,
body.theme-preset-noir .header-notification-wrapper .notification-btn:hover {
    background: rgba(37, 55, 76, 0.85);
    color: #edf5fc;
}

body.theme-preset-noir .user-avatar-btn {
    background: linear-gradient(135deg, rgba(33, 49, 68, 0.96) 0%, rgba(19, 31, 45, 0.98) 100%);
    border-color: rgba(104, 139, 175, 0.24);
    color: #f0f6fb;
    box-shadow: 0 8px 18px rgba(2, 8, 16, 0.3);
}

body.theme-preset-noir .dashboard-hero-main,
body.theme-preset-noir .dashboard-hero-side,
body.theme-preset-noir .hero-summary-card,
body.theme-preset-noir .dashboard-hero-metric {
    background: var(--widget-surface) !important;
    border-color: var(--widget-border-color) !important;
    box-shadow: var(--widget-shadow) !important;
    color: var(--widget-text-primary);
}

body.theme-preset-noir .dashboard-hero-collapsed {
    background: var(--widget-surface) !important;
    border-color: var(--widget-border-color) !important;
    box-shadow: var(--widget-shadow) !important;
    color: var(--widget-text-primary);
}

body.theme-preset-noir .dashboard-hero-collapsed-title {
    color: var(--widget-text-primary) !important;
}

body.theme-preset-noir .dashboard-hero-collapsed-meta,
body.theme-preset-noir .dashboard-hero-collapsed .dashboard-hero-eyebrow {
    color: var(--widget-text-secondary) !important;
}

body.theme-preset-noir .dashboard-hero-intro {
    background:
        linear-gradient(90deg, rgba(82, 156, 225, 0.14) 0%, rgba(52, 89, 145, 0.12) 48%, rgba(124, 198, 255, 0.08) 100%),
        linear-gradient(180deg, rgba(33, 51, 71, 0.58) 0%, rgba(21, 32, 46, 0.14) 100%);
    border-color: rgba(104, 139, 175, 0.18);
}

body.theme-preset-noir .dashboard-hero-subtitle,
body.theme-preset-noir .hero-summary-label,
body.theme-preset-noir .dashboard-hero-metric-label {
    color: var(--widget-text-secondary) !important;
}

body.theme-preset-noir .dashboard-hero-focus {
    background: linear-gradient(135deg, rgba(28, 96, 158, 0.94) 0%, rgba(44, 131, 200, 0.76) 100%) !important;
    border: 1px solid rgba(108, 163, 212, 0.24);
    box-shadow: 0 18px 34px rgba(3, 12, 24, 0.36);
}

body.theme-preset-noir .dashboard-hero-chip {
    background: rgba(26, 41, 58, 0.92);
    border-color: rgba(104, 139, 175, 0.2);
    color: #d9e8f6;
}

body.theme-preset-noir .modal-overlay {
    background: rgba(4, 10, 18, 0.62);
    backdrop-filter: blur(12px);
}

body.theme-preset-noir .widget-config-modal {
    background: var(--widget-surface) !important;
    border-color: var(--widget-border-color) !important;
    box-shadow: 0 28px 56px rgba(2, 8, 17, 0.52) !important;
    color: var(--widget-text-primary);
}

body.theme-preset-noir .widget-config-modal .config-header,
body.theme-preset-noir .widget-config-modal .config-section {
    background: linear-gradient(180deg, rgba(21, 33, 47, 0.96) 0%, rgba(15, 24, 36, 0.94) 100%) !important;
    border-color: rgba(104, 139, 175, 0.18) !important;
    box-shadow: 0 14px 28px rgba(2, 8, 17, 0.32) !important;
}

body.theme-preset-noir .widget-config-modal .modal-header,
body.theme-preset-noir .widget-config-modal .modal-footer {
    background: linear-gradient(180deg, rgba(18, 29, 42, 0.98) 0%, rgba(14, 22, 33, 0.96) 100%) !important;
    border-color: rgba(104, 139, 175, 0.18) !important;
}

body.theme-preset-noir .widget-config-modal .modal-body {
    background: linear-gradient(180deg, rgba(13, 21, 32, 0.94) 0%, rgba(10, 16, 25, 0.9) 100%) !important;
}

body.theme-preset-noir .widget-config-modal .modal-header h2,
body.theme-preset-noir .widget-config-modal .config-section h3,
body.theme-preset-noir .widget-config-modal .form-group label {
    color: var(--widget-text-primary) !important;
}

body.theme-preset-noir .widget-config-modal .config-section p,
body.theme-preset-noir .widget-config-modal .help-text,
body.theme-preset-noir .widget-config-modal .field-help {
    color: var(--widget-text-secondary) !important;
}

body.theme-preset-noir .widget-config-modal input,
body.theme-preset-noir .widget-config-modal textarea,
body.theme-preset-noir .widget-config-modal select {
    background: var(--widget-input-bg) !important;
    border-color: var(--widget-input-border) !important;
    color: var(--widget-text-primary) !important;
}

body.theme-preset-noir .widget-config-modal input::placeholder,
body.theme-preset-noir .widget-config-modal textarea::placeholder {
    color: rgba(157, 176, 196, 0.72) !important;
}

body.theme-preset-noir .widget-config-modal .close-btn {
    background: rgba(21, 33, 47, 0.92) !important;
    border-color: rgba(104, 139, 175, 0.2) !important;
    color: #d6e2ee !important;
    box-shadow: 0 12px 22px rgba(2, 8, 17, 0.24);
}

body.theme-preset-noir .widget-config-modal .close-btn:hover {
    background: rgba(28, 43, 61, 0.96) !important;
}

body.theme-preset-noir .widget-store-modal {
    background: var(--widget-surface) !important;
    border-color: var(--widget-border-color) !important;
    box-shadow: 0 28px 56px rgba(2, 8, 17, 0.52) !important;
}

body.theme-preset-noir .widget-store-modal .modal-header {
    background: linear-gradient(180deg, rgba(18, 29, 42, 0.98) 0%, rgba(14, 22, 33, 0.96) 100%) !important;
    border-color: rgba(104, 139, 175, 0.18) !important;
}

body.theme-preset-noir .widget-store-modal .modal-body {
    background: linear-gradient(180deg, rgba(13, 21, 32, 0.94) 0%, rgba(10, 16, 25, 0.9) 100%) !important;
}

body.theme-preset-noir .widget-store-modal .modal-footer {
    background: linear-gradient(180deg, rgba(18, 29, 42, 0.98) 0%, rgba(14, 22, 33, 0.96) 100%) !important;
    border-color: rgba(104, 139, 175, 0.18) !important;
}

body.theme-preset-noir .widget-store-modal .store-widget-preview {
    background: linear-gradient(180deg, rgba(24, 37, 52, 0.96) 0%, rgba(18, 28, 40, 0.92) 100%) !important;
}

body.theme-preset-noir .widget-store-modal .store-widget-card,
body.theme-preset-noir .widget-store-modal .category-btn,
body.theme-preset-noir .widget-store-modal .store-widget-category,
body.theme-preset-noir .widget-store-modal .store-search input {
    border-color: rgba(104, 139, 175, 0.18) !important;
}

body.theme-preset-noir .notification-panel {
    background: linear-gradient(180deg, rgba(18, 29, 42, 0.98) 0%, rgba(12, 19, 29, 0.96) 100%) !important;
    border-color: rgba(104, 139, 175, 0.2) !important;
    box-shadow: 0 24px 46px rgba(2, 8, 17, 0.42) !important;
    backdrop-filter: none !important;
}

body.theme-preset-noir .notification-header {
    background: linear-gradient(180deg, rgba(22, 34, 49, 0.98) 0%, rgba(16, 25, 37, 0.96) 100%) !important;
    border-color: rgba(104, 139, 175, 0.18) !important;
}

body.theme-preset-noir .notification-header h3,
body.theme-preset-noir .notification-title {
    color: var(--widget-text-primary) !important;
}

body.theme-preset-noir .notification-message,
body.theme-preset-noir .notification-time,
body.theme-preset-noir .notification-empty {
    color: var(--widget-text-secondary) !important;
}

body.theme-preset-noir .notification-list {
    background: transparent !important;
}

body.theme-preset-noir .notification-panel .notification-item {
    background: linear-gradient(180deg, rgba(21, 33, 47, 0.98) 0%, rgba(17, 27, 39, 0.94) 100%) !important;
    border-color: rgba(104, 139, 175, 0.14) !important;
}

body.theme-preset-noir .notification-panel .notification-item:hover {
    background: rgba(28, 43, 61, 0.74) !important;
}

body.theme-preset-noir .notification-panel .notification-item.unread {
    background: rgba(31, 55, 81, 0.52) !important;
}

body.theme-preset-noir .notification-panel .notification-icon {
    background: rgba(33, 50, 69, 0.94) !important;
}

body.theme-preset-noir .notification-icon-action {
    background: rgba(29, 44, 61, 0.92) !important;
    color: #d8e6f4 !important;
    border-color: rgba(104, 139, 175, 0.18) !important;
    box-shadow: 0 10px 20px rgba(2, 8, 17, 0.22);
}

body.theme-preset-noir .notification-icon-action:hover {
    background: rgba(35, 53, 73, 0.96) !important;
    color: #eef5fc !important;
}

body.theme-preset-noir .notification-tabs {
    background: linear-gradient(180deg, rgba(18, 28, 40, 0.92) 0%, rgba(14, 22, 33, 0.86) 100%) !important;
    border-color: rgba(104, 139, 175, 0.14) !important;
}

body.theme-preset-noir .notification-tab {
    background: rgba(24, 37, 52, 0.9) !important;
    border-color: rgba(104, 139, 175, 0.18) !important;
    color: #c4d4e3 !important;
}

body.theme-preset-noir .notification-tab:hover {
    background: rgba(31, 48, 68, 0.96) !important;
    color: #edf4fb !important;
}

body.theme-preset-noir .notification-tab.active {
    background: linear-gradient(135deg, rgba(44, 107, 168, 0.34) 0%, rgba(23, 74, 123, 0.46) 100%) !important;
    border-color: rgba(101, 156, 210, 0.34) !important;
    color: #f4f9ff !important;
}

body.theme-preset-noir .notification-tab-count {
    background: rgba(240, 99, 114, 0.18) !important;
    color: #ffd8dd !important;
}

body.theme-preset-noir .notification-peek {
    background: linear-gradient(180deg, rgba(18, 29, 42, 0.98) 0%, rgba(12, 19, 29, 0.96) 100%) !important;
    border-color: rgba(104, 139, 175, 0.2) !important;
    box-shadow: 0 24px 46px rgba(2, 8, 17, 0.42) !important;
}

body.theme-preset-noir .notification-peek-copy strong {
    color: var(--widget-text-primary) !important;
}

body.theme-preset-noir .widget-config-modal .shortcut-icon-choice {
    background: rgba(21, 33, 47, 0.92) !important;
    border-color: rgba(104, 139, 175, 0.22) !important;
    color: var(--widget-text-primary) !important;
}

body.theme-preset-noir .widget-config-modal .shortcut-icon-choice:hover,
body.theme-preset-noir .widget-config-modal .shortcut-icon-choice.active {
    background: rgba(32, 78, 116, 0.58) !important;
    border-color: rgba(93, 173, 226, 0.62) !important;
}

body.theme-preset-noir .widget-config-modal .shortcut-icon-current,
body.theme-preset-noir .widget-config-modal .shortcut-icon-choice {
    background: rgba(21, 33, 47, 0.92) !important;
    border-color: rgba(104, 139, 175, 0.22) !important;
    color: var(--widget-text-primary) !important;
}

body.theme-preset-noir .widget-config-modal .shortcut-icon-picker-popover {
    background: rgba(16, 26, 38, 0.98) !important;
    border-color: rgba(104, 139, 175, 0.24) !important;
    box-shadow: 0 22px 44px rgba(2, 8, 17, 0.48) !important;
}

body.theme-preset-noir .widget-config-modal .shortcut-icon-picker-title {
    color: var(--widget-text-secondary) !important;
}

body.theme-preset-noir .notification-peek-copy span {
    color: var(--widget-text-secondary) !important;
}

body.theme-preset-noir .notification-peek-icon {
    background: rgba(29, 44, 61, 0.92) !important;
}

body.theme-preset-noir .notification-icon-action.danger {
    color: #f09aaa !important;
}

body.theme-preset-noir .notification-icon-action.danger:hover {
    background: rgba(68, 35, 44, 0.96) !important;
    color: #ffd6de !important;
}

/* ============================================
   Notification Bell & Panel
   ============================================ */
.notification-wrapper {
    position: relative;
}

.notification-peek {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(320px, calc(100vw - 32px));
    padding: 0.85rem 0.9rem;
    border-radius: 18px;
    border: 1px solid rgba(166, 198, 222, 0.26);
    background: linear-gradient(180deg, rgba(253, 255, 255, 0.98) 0%, rgba(244, 249, 253, 0.96) 100%);
    box-shadow: 0 20px 38px rgba(22, 70, 107, 0.14);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    z-index: 1010;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.notification-peek.active {
    opacity: 1;
    transform: translateY(0);
}

.notification-peek-icon {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
    background: rgba(52, 152, 219, 0.16);
}

.notification-peek-icon.success {
    background: rgba(39, 174, 96, 0.16);
}

.notification-peek-icon.warning {
    background: rgba(243, 156, 18, 0.18);
}

.notification-peek-icon.error {
    background: rgba(231, 76, 60, 0.16);
}

.notification-peek-copy {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
}

.notification-peek-copy strong {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.notification-peek-copy span {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-icon-only {
    padding: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
}

@media (max-height: 860px) {
    .sidebar-search {
        margin: 0.7rem 0.9rem;
        padding: 0.52rem 0.82rem;
    }

    .dashboard-hero {
        gap: 0.8rem;
        margin-bottom: 0.85rem;
    }

    .dashboard-hero-main {
        padding: 1.15rem;
    }

    .dashboard-hero-side {
        padding: 1rem 0.95rem;
        gap: 0.72rem;
    }

    .dashboard-hero-title {
        font-size: 1.88rem;
    }

    .dashboard-hero-subtitle {
        font-size: 0.9rem;
        line-height: 1.55;
    }

    .dashboard-hero-intro {
        padding: 1rem 1rem 0.95rem;
    }

    .dashboard-hero-summary {
        gap: 0.55rem;
    }

    .hero-summary-card,
    .dashboard-hero-focus,
    .dashboard-hero-metric {
        padding: 0.82rem 0.88rem;
    }

    .widget-header {
        padding: 0.86rem 0.92rem 0.72rem;
    }

    .widget-content {
        padding: 0.88rem 0.92rem 0.92rem;
    }
}

.btn-icon-only:hover {
    background: rgba(0, 0, 0, 0.1);
}

.notification-btn {
    position: relative;
    font-size: 1.2rem;
}

.header-notification-wrapper .notification-btn.has-unread {
    border-color: rgba(239, 68, 68, 0.34) !important;
    background:
        radial-gradient(circle at 68% 28%, rgba(239, 68, 68, 0.18), transparent 28%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(239, 247, 255, 0.98) 100%) !important;
    color: #164e83 !important;
    box-shadow: 0 10px 24px rgba(15, 82, 130, 0.15), 0 0 0 4px rgba(239, 68, 68, 0.06) !important;
}

.header-notification-wrapper .notification-btn.has-unread .header-icon-svg {
    animation: notificationBellPulse 1.9s ease-in-out infinite;
}

@keyframes notificationBellPulse {
    0%, 72%, 100% {
        transform: rotate(0deg);
    }
    78% {
        transform: rotate(-8deg);
    }
    86% {
        transform: rotate(7deg);
    }
    94% {
        transform: rotate(-4deg);
    }
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: linear-gradient(135deg, #ff6a7a 0%, #ef334d 100%);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(25%, -25%);
    border: 2px solid rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 16px rgba(222, 56, 82, 0.32);
}

.notification-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 360px;
    max-height: 480px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 249, 253, 0.96) 100%);
    border: 1px solid rgba(125, 171, 206, 0.22);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(28, 83, 120, 0.16);
    backdrop-filter: none;
    z-index: 1220;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.header-notification-wrapper .notification-panel {
    right: 64px;
}

@media (max-width: 640px) {
    .header-notification-wrapper .notification-panel {
        right: 0;
        width: min(360px, calc(100vw - 1.5rem));
    }
}

.notification-panel.active {
    display: flex;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid rgba(125, 171, 206, 0.18);
    background: linear-gradient(180deg, rgba(250, 253, 255, 0.96) 0%, rgba(242, 248, 252, 0.9) 100%);
}

.notification-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.notification-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.notification-tabs {
    display: flex;
    gap: 0.55rem;
    padding: 0.75rem 1rem 0.7rem;
    border-bottom: 1px solid rgba(125, 171, 206, 0.14);
    background: linear-gradient(180deg, rgba(248, 252, 255, 0.82) 0%, rgba(243, 248, 252, 0.72) 100%);
}

.notification-tab {
    border: 1px solid rgba(179, 205, 226, 0.32);
    background: rgba(244, 249, 253, 0.94);
    color: #5d7890;
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    font-size: 0.82rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    transition: all 0.18s ease;
}

.notification-tab:hover {
    background: rgba(236, 244, 251, 0.98);
    color: #294861;
}

.notification-tab.active {
    background: linear-gradient(135deg, rgba(30, 144, 255, 0.16) 0%, rgba(24, 116, 205, 0.12) 100%);
    color: #195884;
    border-color: rgba(77, 157, 220, 0.34);
}

.notification-tab-count {
    min-width: 20px;
    height: 20px;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: rgba(236, 93, 109, 0.14);
    color: #c14556;
    font-size: 0.72rem;
    align-items: center;
    justify-content: center;
}

.notification-icon-action {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(179, 205, 226, 0.34);
    border-radius: 11px;
    background: rgba(245, 249, 253, 0.96);
    color: #4a6780;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    box-shadow: 0 8px 18px rgba(28, 83, 120, 0.08);
}

.notification-icon-action svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 1.9;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.notification-icon-action:hover {
    background: rgba(235, 244, 251, 0.98);
    color: #24435d;
    transform: translateY(-1px);
}

.notification-icon-action.danger {
    color: #cf5566;
}

.notification-icon-action.danger:hover {
    background: rgba(255, 238, 241, 0.98);
    color: #bb4053;
}

.notification-list {
    flex: 1;
    overflow-y: auto;
    max-height: 350px;
    background: transparent;
}

.notification-panel .notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    align-items: flex-start;
    background: linear-gradient(180deg, rgba(250, 253, 255, 0.96) 0%, rgba(244, 249, 253, 0.9) 100%);
    border-radius: 18px;
    border: 1px solid rgba(168, 199, 221, 0.18);
    margin: 0.7rem 0.8rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
}

.notification-panel .notification-item:hover {
    background: var(--bg-secondary);
}

.notification-panel .notification-item.unread {
    background: linear-gradient(180deg, rgba(242, 249, 255, 0.98) 0%, rgba(235, 245, 252, 0.94) 100%);
}

.notification-panel .notification-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.3rem;
    background: rgba(52, 152, 219, 0.14);
}

.notification-panel .notification-icon.success { background: rgba(39, 174, 96, 0.15); }
.notification-panel .notification-icon.warning { background: rgba(243, 156, 18, 0.16); }
.notification-panel .notification-icon.error { background: rgba(231, 76, 60, 0.14); }
.notification-panel .notification-icon.system { background: rgba(122, 107, 255, 0.14); }

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.notification-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
}

.notification-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.9rem;
    background: transparent;
}

.notification-footer {
    padding: 0.75rem 0.9rem 0.9rem;
    border-top: 1px solid rgba(125, 171, 206, 0.16);
    background: linear-gradient(180deg, rgba(248, 252, 255, 0.92) 0%, rgba(240, 247, 252, 0.96) 100%);
}

.notification-view-all {
    min-height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(77, 157, 220, 0.28);
    background: rgba(255, 255, 255, 0.82);
    color: #195884;
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    transition: all 0.18s ease;
}

.notification-view-all svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.notification-view-all:hover {
    background: rgba(235, 244, 251, 0.98);
    color: #0f4f83;
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(22, 85, 130, 0.12);
}

html.opendw-reduced-motion *,
html.opendw-reduced-motion *::before,
html.opendw-reduced-motion *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

html.opendw-hide-product-version .sidebar-version,
html.opendw-hide-product-version [data-product-version] {
    display: none !important;
}

/* Context-aware AI actions */
.context-ai-host {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 34px;
}

.context-ai-field-label,
.news-editor-label-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.context-ai-field-label {
    min-height: 34px;
    margin-bottom: 6px;
}

.context-ai-field-label > label {
    margin: 0;
}

.context-ai-inline-host {
    flex: 0 0 auto;
}

.context-ai-inline-host.context-ai-host:empty {
    display: none;
    min-height: 0;
}

.context-ai-loading {
    width: 20px;
    height: 20px;
    border: 2px solid #dce8f8;
    border-top-color: #1769e0;
    border-radius: 50%;
    animation: context-ai-spin 0.8s linear infinite;
}

@keyframes context-ai-spin {
    to { transform: rotate(360deg); }
}

.context-ai-trigger {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 10px 0 7px;
    border: 1px solid #bfd6f7;
    border-radius: 7px;
    background: #f4f8ff;
    color: #135fc7;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 650;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.context-ai-trigger:hover {
    border-color: #75a9ee;
    background: #edf5ff;
    box-shadow: 0 2px 8px rgba(35, 105, 196, 0.12);
}

.context-ai-trigger:focus-visible {
    outline: 2px solid rgba(23, 105, 224, 0.24);
    outline-offset: 2px;
}

.context-ai-trigger:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.context-ai-mark {
    display: inline-grid;
    width: 23px;
    height: 23px;
    place-items: center;
    border-radius: 6px;
    background: #1769e0;
    color: #fff;
    font-size: 0.62rem;
    font-weight: 750;
    line-height: 1;
}

.context-ai-chevron {
    color: #58779f;
    font-size: 0.8rem;
}

.context-ai-menu {
    position: absolute;
    z-index: 1080;
    top: calc(100% + 7px);
    right: 0;
    width: min(330px, calc(100vw - 32px));
    padding: 6px;
    max-height: min(420px, calc(100vh - 96px));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid #d5dfed;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 16px 36px rgba(24, 52, 89, 0.18);
}

.context-ai-menu[hidden] {
    display: none;
}

.context-ai-menu.is-upward {
    top: auto;
    bottom: calc(100% + 7px);
}

.context-ai-menu-head {
    display: grid;
    gap: 2px;
    padding: 8px 9px 10px;
    border-bottom: 1px solid #e6ecf4;
}

.context-ai-menu-head strong {
    color: #172b4d;
    font-size: 0.8rem;
}

.context-ai-menu-head span {
    color: #6b7d95;
    font-size: 0.7rem;
}

.context-ai-menu > button {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 50px;
    padding: 7px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #1e2c42;
    text-align: left;
    cursor: pointer;
}

.context-ai-menu > button:hover {
    background: #f1f6fd;
}

.context-ai-menu > button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.context-ai-menu > button > span:last-child {
    display: grid;
    gap: 2px;
}

.context-ai-menu > button strong,
.context-ai-menu > button small {
    overflow: hidden;
    text-overflow: ellipsis;
}

.context-ai-menu > button strong {
    color: #1c3150;
    font-size: 0.77rem;
    white-space: nowrap;
}

.context-ai-menu > button small {
    color: #6b7d95;
    font-size: 0.68rem;
    line-height: 1.3;
}

.context-ai-action-icon {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border: 1px solid #cfe0f7;
    border-radius: 7px;
    background: #edf5ff;
    color: #1769e0;
    font-size: 0.65rem;
    font-weight: 750;
}

.context-ai-menu > button.is-loading .context-ai-action-icon {
    color: transparent;
}

.context-ai-menu > button.is-loading .context-ai-action-icon::after {
    content: "";
    width: 13px;
    height: 13px;
    border: 2px solid #b8d1f2;
    border-top-color: #1769e0;
    border-radius: 50%;
    animation: context-ai-spin 0.8s linear infinite;
}

.context-ai-preview-backdrop {
    position: fixed;
    /* Contextual AI previews can be opened from an app modal at z-index 2000. */
    z-index: 3200;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(28, 41, 60, 0.42);
    backdrop-filter: blur(2px);
}

.context-ai-preview {
    display: flex;
    flex-direction: column;
    width: min(720px, 100%);
    max-height: min(760px, calc(100vh - 40px));
    overflow: hidden;
    border: 1px solid #d6dfec;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(16, 39, 71, 0.28);
}

.context-ai-preview > header,
.context-ai-preview > footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
}

.context-ai-preview > header {
    border-bottom: 1px solid #e2e8f1;
}

.context-ai-preview > header h2 {
    margin: 2px 0 0;
    color: #172b4d;
    font-size: 1rem;
}

.context-ai-preview-kicker {
    color: #1769e0;
    font-size: 0.62rem;
    font-weight: 750;
    text-transform: uppercase;
}

.context-ai-close {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 1px solid #d7e0ec;
    border-radius: 7px;
    background: #f8fafc;
    color: #4d617b;
    font-size: 1.15rem;
    cursor: pointer;
}

.context-ai-preview-body {
    display: grid;
    gap: 12px;
    min-height: 0;
    padding: 16px;
    overflow: auto;
}

.context-ai-result-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: #6b7d95;
    font-size: 0.7rem;
}

.context-ai-preview-body label {
    display: grid;
    gap: 7px;
    color: #42546c;
    font-size: 0.76rem;
    font-weight: 650;
}

.context-ai-processing {
    display: grid;
    justify-items: center;
    gap: 10px;
    min-height: 260px;
    align-content: center;
    padding: 28px;
    color: #51647d;
    text-align: center;
}

.context-ai-processing strong {
    color: #172b4d;
    font-size: 0.95rem;
}

.context-ai-processing [data-context-ai-progress] {
    max-width: 480px;
    font-size: 0.78rem;
    line-height: 1.55;
}

.context-ai-processing-partial {
    width: min(100%, 560px);
    max-height: 160px;
    margin: 2px 0 0;
    padding: 12px;
    overflow: auto;
    border: 1px solid #d8e3f1;
    border-radius: 7px;
    background: #f8fbff;
    color: #263b57;
    font: inherit;
    font-size: 0.78rem;
    line-height: 1.55;
    text-align: left;
    white-space: pre-wrap;
}

.context-ai-processing-spinner,
.context-ai-processing-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 50%;
}

.context-ai-processing-spinner {
    border: 3px solid #d9e7fb;
    border-top-color: #1769e0;
    animation: context-ai-spin 0.8s linear infinite;
}

.context-ai-processing-mark {
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: #c5222f;
    font-size: 1.1rem;
    font-weight: 750;
}

.context-ai-processing.is-error strong {
    color: #a61b29;
}

.context-ai-result {
    width: 100%;
    min-height: 260px;
    padding: 12px;
    resize: vertical;
    border: 1px solid #cfd9e7;
    border-radius: 7px;
    background: #fff;
    color: #172b4d;
    font: inherit;
    font-size: 0.86rem;
    line-height: 1.55;
}

.context-ai-result:focus {
    border-color: #4b8ee8;
    outline: 2px solid rgba(23, 105, 224, 0.14);
}

.context-ai-preview > footer {
    justify-content: flex-end;
    border-top: 1px solid #e2e8f1;
    background: #f8fafc;
}

@media (max-width: 560px) {
    .context-ai-trigger > span:nth-child(2),
    .context-ai-chevron {
        display: none;
    }

    .context-ai-trigger {
        padding-right: 6px;
    }

    .context-ai-result-meta {
        flex-direction: column;
    }
}

/* Shared application dialogs replace browser-native alert/confirm/prompt surfaces. */
body.opendw-dialog-open {
    overflow: hidden;
}

.opendw-dialog-backdrop {
    position: fixed;
    z-index: 5000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.46);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 140ms ease;
}

.opendw-dialog-backdrop.is-visible {
    opacity: 1;
}

.opendw-dialog {
    width: min(460px, 100%);
    max-height: calc(100dvh - 40px);
    overflow: hidden;
    border: 1px solid #d8e0eb;
    border-radius: 8px;
    background: #fff;
    color: #172033;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24);
    transform: translateY(8px) scale(0.985);
    transition: transform 160ms ease;
}

.opendw-dialog-backdrop.is-visible .opendw-dialog {
    transform: translateY(0) scale(1);
}

.opendw-dialog-header {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px 12px 18px;
    border-bottom: 1px solid #e2e8f0;
}

.opendw-dialog-header h2 {
    margin: 0;
    color: #101828;
    font-size: 0.98rem;
    font-weight: 800;
}

.opendw-dialog-close {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    border: 1px solid #dbe3ee;
    border-radius: 7px;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
}

.opendw-dialog-close:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #0f62fe;
}

.opendw-dialog-close svg {
    width: 15px;
    height: 15px;
}

.opendw-dialog-form {
    display: flex;
    min-height: 0;
    flex-direction: column;
}

.opendw-dialog-body {
    display: grid;
    justify-items: center;
    gap: 9px;
    padding: 16px 20px 18px;
    overflow-y: auto;
    text-align: center;
}

.opendw-dialog-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid #bfdbfe;
    border-radius: 50%;
    background: #eff6ff;
    color: #0f62fe;
}

.opendw-dialog-icon svg {
    width: 22px;
    height: 22px;
}

.opendw-dialog.is-danger .opendw-dialog-icon {
    border-color: #fecaca;
    background: #fff1f2;
    color: #dc2626;
}

.opendw-dialog.is-warning .opendw-dialog-icon {
    border-color: #fde68a;
    background: #fffbeb;
    color: #d97706;
}

.opendw-dialog-body h3 {
    margin: 2px 0 0;
    color: #101828;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.4;
}

.opendw-dialog-body > p {
    max-width: 390px;
    margin: 0;
    color: #667085;
    font-size: 0.78rem;
    line-height: 1.5;
}

.opendw-dialog-field {
    display: grid;
    width: 100%;
    gap: 6px;
    margin-top: 4px;
    color: #475467;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: left;
}

.opendw-dialog-input {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid #cfd8e6;
    border-radius: 7px;
    outline: 0;
    background: #fff;
    color: #172033;
    font: inherit;
    font-size: 0.84rem;
}

.opendw-dialog-input:focus {
    border-color: #0f62fe;
    box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.12);
}

.opendw-dialog-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-height: 58px;
    padding: 10px 14px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.opendw-dialog-footer .btn {
    min-height: 38px;
    padding-inline: 15px;
}

.opendw-dialog-confirm.btn-danger {
    border-color: #dc2626;
    background: #dc2626;
    color: #fff;
}

.opendw-dialog-confirm.btn-primary {
    border-color: #0f62fe;
    background: #0f62fe;
    color: #fff;
}

.opendw-dialog-confirm.btn-primary:hover {
    border-color: #0b55dc;
    background: #0b55dc;
}

.opendw-dialog-confirm.btn-danger:hover {
    border-color: #b91c1c;
    background: #b91c1c;
}

@media (max-width: 520px) {
    .opendw-dialog-backdrop {
        align-items: end;
        padding: 12px;
    }

    .opendw-dialog {
        width: 100%;
        max-height: calc(100dvh - 24px);
    }

    .opendw-dialog-body {
        padding-inline: 16px;
    }
}
