/*
 * DigiWorld Admin — premium desktop composition.
 * Additive only: the existing admin styles, theme bundle, and night layer remain intact.
 */

.automation-panel-toggle {
    display: none !important;
}

@media (min-width: 1280px) {
    body[data-no-components="true"] {
        --admin-command-surface: rgba(255, 255, 255, 0.9);
        --admin-command-border: rgba(15, 23, 42, 0.09);
        --admin-command-muted: #667085;
        --admin-command-shadow: 0 18px 48px rgba(15, 23, 42, 0.09);
    }

    body[data-no-components="true"] #dashboardContainer .main-content {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(320px, 370px) !important;
        grid-auto-flow: row;
        align-content: start;
        column-gap: 20px !important;
        row-gap: 20px !important;
        padding: 24px clamp(22px, 2.3vw, 42px) 64px !important;
    }

    body[data-no-components="true"] #dashboardContainer .admin-header {
        grid-column: 1 / -1;
        position: sticky !important;
        top: 14px !important;
        z-index: 90 !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        min-height: 116px !important;
        margin: 0 !important;
        padding: 20px 22px !important;
        overflow: visible !important;
        border-radius: 24px !important;
        background:
            linear-gradient(112deg, rgba(255, 255, 255, 0.97), rgba(255, 248, 242, 0.9)) !important;
        border: 1px solid var(--admin-command-border) !important;
        box-shadow: var(--admin-command-shadow) !important;
        backdrop-filter: blur(24px) saturate(145%);
        -webkit-backdrop-filter: blur(24px) saturate(145%);
    }

    body[data-no-components="true"] #dashboardContainer .admin-header::after {
        content: "";
        position: absolute;
        inset: auto 24px 0;
        height: 1px;
        pointer-events: none;
        background: linear-gradient(90deg, transparent, rgba(245, 114, 36, 0.42), transparent);
    }

    body[data-no-components="true"] #dashboardContainer .header-left {
        min-width: 360px !important;
        flex: 1 1 auto !important;
        align-items: center !important;
    }

    body[data-no-components="true"] #dashboardContainer .header-left > div {
        display: grid;
        gap: 4px;
        align-items: start;
    }

    body[data-no-components="true"] #dashboardContainer .admin-header h1 {
        margin: 0 !important;
        font-size: clamp(1.75rem, 2vw, 2.25rem) !important;
        line-height: 1.08 !important;
        letter-spacing: -0.052em !important;
    }

    body[data-no-components="true"] #dashboardContainer .admin-header .admin-subtitle {
        margin: 1px 0 5px !important;
        max-width: 640px;
        font-size: 0.88rem !important;
        line-height: 1.45 !important;
    }

    body[data-no-components="true"] #dashboardContainer .header-pills {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    body[data-no-components="true"] #dashboardContainer .header-pills .pill {
        min-height: 27px;
        padding: 4px 9px !important;
        font-size: 0.69rem !important;
        box-shadow: none !important;
    }

    body[data-no-components="true"] #dashboardContainer .admin-actions {
        position: static !important;
        display: block !important;
        flex: 0 0 auto;
        width: 650px !important;
        min-width: 0 !important;
    }

    body[data-no-components="true"] #dashboardContainer .actions-compact {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: flex-end !important;
        align-items: center !important;
        width: 100% !important;
        max-width: none;
        gap: 8px !important;
        margin: 0 !important;
    }

    body[data-no-components="true"] #dashboardContainer .header-left .eyebrow {
        width: fit-content !important;
    }

    body[data-no-components="true"] #dashboardContainer .actions-compact .btn {
        width: auto !important;
        min-width: 0 !important;
        min-height: 42px !important;
        padding: 10px 13px !important;
        border-radius: 13px !important;
        white-space: nowrap;
        font-size: 0.78rem !important;
        box-shadow: none !important;
    }

    body[data-no-components="true"] #dashboardContainer .actions-compact .btn:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 12px 25px rgba(15, 23, 42, 0.1) !important;
    }

    body[data-no-components="true"] #dashboardContainer .automation-panel-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    body[data-no-components="true"] #dashboardContainer .automation-panel-toggle[aria-expanded="true"] {
        color: #fff !important;
        border-color: transparent !important;
        background: linear-gradient(135deg, #111827, #334155) !important;
    }

    body[data-no-components="true"] #dashboardContainer .controls-panel {
        position: absolute !important;
        top: calc(100% + 12px) !important;
        right: 20px !important;
        width: min(780px, calc(100vw - var(--admin-premium-sidebar) - 72px)) !important;
        max-height: min(680px, calc(100vh - 166px)) !important;
        margin: 0 !important;
        overflow: auto !important;
        z-index: 110 !important;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-8px) scale(0.985);
        transform-origin: top right;
        border: 1px solid rgba(15, 23, 42, 0.11) !important;
        border-radius: 22px !important;
        background: rgba(255, 255, 255, 0.98) !important;
        box-shadow: 0 30px 90px rgba(15, 23, 42, 0.22) !important;
        transition:
            opacity 160ms ease,
            transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
            visibility 160ms ease;
    }

    body[data-no-components="true"] #dashboardContainer .controls-panel.is-open {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }

    body[data-no-components="true"] #dashboardContainer .controls-panel-header {
        position: sticky;
        top: 0;
        z-index: 3;
        padding: 17px 18px !important;
        background: rgba(255, 255, 255, 0.96) !important;
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }

    body[data-no-components="true"] #dashboardContainer .controls-panel .toggle-stack {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        max-height: none !important;
        padding: 14px !important;
        gap: 10px !important;
        overflow: visible !important;
    }

    body[data-no-components="true"] #dashboardContainer .controls-panel .toggle-wrapper {
        min-height: 58px !important;
        padding: 11px 12px !important;
        border-radius: 15px !important;
    }

    body[data-no-components="true"] #dashboardContainer .controls-panel .toggle-wrapper:last-child {
        grid-column: 1 / -1;
    }

    body[data-no-components="true"] #dashboardContainer .overview-panel {
        grid-column: 1;
        align-self: stretch;
        min-height: 100%;
        margin: 0 !important;
        padding: 22px !important;
        border-radius: 24px !important;
    }

    body[data-no-components="true"] #dashboardContainer .overview-header {
        margin-bottom: 16px !important;
    }

    body[data-no-components="true"] #dashboardContainer .glance-strip {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 11px !important;
    }

    body[data-no-components="true"] #dashboardContainer .glance-card {
        min-height: 126px;
        padding: 17px 15px !important;
        border-radius: 18px !important;
    }

    body[data-no-components="true"] #dashboardContainer .glance-card h4 {
        margin: 8px 0 5px !important;
        font-size: clamp(1.35rem, 1.7vw, 2rem) !important;
    }

    body[data-no-components="true"] #dashboardContainer .quick-actions {
        grid-column: 2;
        display: grid !important;
        grid-template-columns: 1fr !important;
        grid-auto-flow: row !important;
        grid-auto-columns: unset !important;
        align-content: stretch;
        gap: 10px !important;
        min-width: 0;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    body[data-no-components="true"] #dashboardContainer .quick-card {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto !important;
        align-items: center !important;
        gap: 12px !important;
        min-height: 0 !important;
        padding: 14px !important;
        border-radius: 18px !important;
    }

    body[data-no-components="true"] #dashboardContainer .quick-card-icon {
        width: 42px !important;
        height: 42px !important;
        border-radius: 13px !important;
    }

    body[data-no-components="true"] #dashboardContainer .quick-card h4 {
        margin: 0 0 3px !important;
        font-size: 0.9rem !important;
    }

    body[data-no-components="true"] #dashboardContainer .quick-card p {
        margin: 0 !important;
        font-size: 0.73rem !important;
        line-height: 1.4 !important;
    }

    body[data-no-components="true"] #dashboardContainer .quick-card .btn {
        grid-column: auto !important;
        width: auto !important;
        min-height: 38px !important;
        padding: 8px 10px !important;
        font-size: 0.7rem !important;
        white-space: nowrap;
    }

    body[data-no-components="true"] #dashboardContainer #dashboardMessage,
    body[data-no-components="true"] #dashboardContainer .stats-grid,
    body[data-no-components="true"] #dashboardContainer .dashboard,
    body[data-no-components="true"] #dashboardContainer .dashboard-grid {
        grid-column: 1 / -1;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    body[data-no-components="true"] #dashboardContainer .stats-grid {
        gap: 14px !important;
    }

    body[data-no-components="true"] #dashboardContainer .dashboard-card {
        content-visibility: auto;
        contain-intrinsic-size: 520px;
    }

    body[data-no-components="true"] #dashboardContainer .sidebar {
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.23) transparent;
    }

    body[data-no-components="true"] #dashboardContainer .sidebar-nav .nav-link {
        min-height: 40px !important;
        padding-block: 8px !important;
    }

    body.admin-automation-open::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 80;
        background: rgba(15, 23, 42, 0.12);
        backdrop-filter: blur(1.5px);
        -webkit-backdrop-filter: blur(1.5px);
        pointer-events: none;
    }

    html[data-theme="dark"] body[data-no-components="true"],
    body.dark-mode[data-no-components="true"] {
        --admin-command-surface: rgba(7, 12, 26, 0.92);
        --admin-command-border: rgba(148, 163, 184, 0.2);
        --admin-command-muted: #9aa8bd;
        --admin-command-shadow: 0 22px 65px rgba(0, 0, 0, 0.42);
    }

    html[data-theme="dark"] body[data-no-components="true"] #dashboardContainer .admin-header,
    body.dark-mode[data-no-components="true"] #dashboardContainer .admin-header {
        background:
            radial-gradient(circle at 86% 0%, rgba(245, 114, 36, 0.12), transparent 38%),
            rgba(7, 12, 26, 0.93) !important;
        border-color: var(--admin-command-border) !important;
        box-shadow: var(--admin-command-shadow) !important;
    }

    html[data-theme="dark"] body[data-no-components="true"] #dashboardContainer .controls-panel,
    body.dark-mode[data-no-components="true"] #dashboardContainer .controls-panel {
        background: rgba(7, 12, 26, 0.985) !important;
        border-color: rgba(148, 163, 184, 0.24) !important;
        box-shadow: 0 34px 100px rgba(0, 0, 0, 0.58) !important;
    }

    html[data-theme="dark"] body[data-no-components="true"] #dashboardContainer .controls-panel-header,
    body.dark-mode[data-no-components="true"] #dashboardContainer .controls-panel-header {
        background: rgba(10, 17, 34, 0.97) !important;
        border-color: rgba(148, 163, 184, 0.18) !important;
    }
}

@media (min-width: 1280px) and (max-width: 1520px) {
    body[data-no-components="true"] #dashboardContainer .main-content {
        grid-template-columns: minmax(0, 1fr) 320px !important;
        padding-inline: 22px !important;
    }

    body[data-no-components="true"] #dashboardContainer .admin-header {
        align-items: flex-start !important;
    }

    body[data-no-components="true"] #dashboardContainer .actions-compact {
        max-width: none;
    }

    body[data-no-components="true"] #dashboardContainer .admin-actions {
        width: 510px !important;
    }

    body[data-no-components="true"] #dashboardContainer .actions-compact .btn {
        padding-inline: 10px !important;
        font-size: 0.73rem !important;
    }

    body[data-no-components="true"] #dashboardContainer .glance-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    body[data-no-components="true"] #dashboardContainer .controls-panel {
        transition: none !important;
    }
}
