/* =============================================================================
   The shell of cPanel's new UI: NCA Lite's ShellLayout, ShellTopbar and ShellSidebar
   (src/app/layouts, src/app/shell), descendant-scoped under .si-cp. Tokens only.

   One difference from NCA Lite: the window scrolls, not the canvas. The legacy widgets cPanel's pages use
   (dhtmlx date picker, jQuery UI, the drop-down menus) place themselves against the window, so the top bar,
   the sidebar and the page header are sticky instead of the canvas being the scroller.

   The pages inside are still the legacy ones: .cp-legacy is the bridge that gives them the type and the
   module cards until each page is migrated (Claude-Docs/Requirements/UI_restyle/2026-11-20/analysis.md).
   ============================================================================= */

/* == ShellLayout ============================================================== */

.si-cp .shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--si-color-background);
    color: var(--si-color-on-background);
}

.si-cp .shell__body {
    position: relative;
    display: flex;
    flex: 1;
    min-height: 0;
}

.si-cp .shell__sidebar {
    position: sticky;
    top: var(--si-layout-topbar-height);
    display: flex;
    flex: none;
    height: calc(100vh - var(--si-layout-topbar-height));
    z-index: var(--si-z-sidebar);
}

.si-cp .shell__canvas {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.si-cp .shell__canvas > * {
    flex-shrink: 0;
}

/* Under the sticky top bar, not at the top of the window. */
.si-cp .shell__canvas > .si-page-header {
    top: var(--si-layout-topbar-height);
}

.si-cp .shell__scrim {
    display: none;
}

.si-cp .shell-page {
    width: 100%;
    max-width: var(--si-layout-container-max);
    padding: var(--si-space-lg);
}

/* == ShellTopbar ============================================================== */

.si-cp .shell-topbar {
    position: sticky;
    top: 0;
    display: flex;
    flex: none;
    align-items: center;
    gap: var(--si-space-md);
    height: var(--si-layout-topbar-height);
    padding: 0 var(--si-space-lg);
    background: var(--si-color-surface-container-lowest);
    border-bottom: 1px solid var(--si-color-outline-variant);
    box-shadow: var(--si-elev-1);
    z-index: var(--si-z-topbar);
}

.si-cp .shell-topbar__menu-button {
    display: none;
    flex: none;
    align-items: center;
    padding: var(--si-space-sm);
    background: none;
    border: 0;
    border-radius: var(--si-radius-md);
    color: var(--si-color-on-surface-variant);
    cursor: pointer;
    transition: background-color var(--si-dur-fast) var(--si-ease);
}

.si-cp .shell-topbar__menu-button:hover {
    background: var(--si-color-surface-container-low);
}

.si-cp .shell-topbar__menu-button:focus-visible {
    outline: none;
    box-shadow: var(--si-focus-ring);
}

.si-cp .shell-topbar__start {
    display: flex;
    flex: 1;
    align-items: center;
    min-width: 0;
}

.si-cp .shell-topbar__home,
.si-cp .shell-topbar__home:hover {
    display: flex;
    align-items: center;
    gap: var(--si-space-12);
    min-width: 0;
    color: var(--si-color-on-surface);
    text-decoration: none;
}

.si-cp .shell-topbar__brand {
    display: block;
    height: 40px;
    width: auto;
}

.si-cp .shell-topbar__product {
    padding-left: var(--si-space-12);
    border-left: 1px solid var(--si-color-outline-variant);
    white-space: nowrap;
}

.si-cp .shell-topbar__logout {
    height: 36px;
}

/* == ShellSidebar ============================================================= */

.si-cp .shell-sidebar {
    display: flex;
    flex: none;
    flex-direction: column;
    width: var(--si-layout-sidebar-width);
    height: 100%;
    padding: var(--si-space-md) 0;
    overflow: hidden;
    background: var(--si-color-surface-container-lowest);
    border-right: 1px solid var(--si-color-surface-container-high);
}

.si-cp .shell-sidebar__sections {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--si-color-surface-container-highest) transparent;
}

.si-cp .shell-sidebar__section {
    padding: 0 var(--si-space-md);
    margin-bottom: var(--si-space-md);
}

.si-cp .shell-sidebar__title {
    padding-left: 6px;
    margin: 0 0 10px;
    color: var(--si-color-on-surface-muted);
    text-transform: uppercase;
}

.si-cp .shell-sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: var(--si-space-xs);
}

.si-cp .shell-sidebar__item {
    display: flex;
    align-items: center;
    gap: var(--si-space-12);
    padding: 11px var(--si-space-12);
    border-radius: var(--si-radius-nav);
    color: var(--si-color-on-surface-soft);
    font-size: var(--si-size-nav);
    line-height: var(--si-lh-nav);
    font-weight: var(--si-weight-nav);
    text-decoration: none;
    transition: background-color var(--si-dur-fast) var(--si-ease);
}

.si-cp .shell-sidebar__item:hover,
.si-cp .shell-sidebar__item:focus {
    background: var(--si-color-surface-container-low);
    color: var(--si-color-on-surface-soft);
    text-decoration: none;
}

.si-cp .shell-sidebar__item:focus-visible {
    outline: none;
    box-shadow: var(--si-focus-ring);
}

.si-cp .shell-sidebar__item--active,
.si-cp .shell-sidebar__item--active:hover,
.si-cp .shell-sidebar__item--active:focus {
    background: var(--si-color-primary-soft);
    color: var(--si-color-primary-container);
}

.si-cp .shell-sidebar__item .si-icon {
    flex: none;
    color: var(--si-color-secondary);
}

.si-cp .shell-sidebar__item--active .si-icon {
    color: var(--si-color-primary-container);
}

.si-cp .shell-sidebar__label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* == Modules: the classic blue title bar becomes a card ======================== */

.si-cp .cp-legacy {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.si-cp .cp-module-cell {
    padding: 0 0 var(--si-space-lg) !important;
    vertical-align: top;
}

.si-cp .cp-module {
    overflow: hidden;
}

.si-cp .cp-module__head {
    padding: var(--si-space-md) var(--si-space-20);
    border-bottom: 1px solid var(--si-color-surface-container-low);
}

.si-cp .cp-module__title {
    margin: 0;
    color: var(--si-color-on-surface);
}

.si-cp .cp-module__body {
    padding: var(--si-space-20);
    overflow-x: auto;
}

/* A module whose content brings its own frame (an SI data table, a section of its own) sits flush. */
.si-cp .cp-module--flush .cp-module__body {
    padding: 0;
}

/* == Legacy bridge: the pages that are not migrated yet ======================== */

/* stylesheet.css sets Verdana 10px on body and Bootstrap 14px Helvetica; inside the shell they read Inter. */
.si-cp .cp-legacy td,
.si-cp .cp-legacy th,
.si-cp .cp-legacy input,
.si-cp .cp-legacy select,
.si-cp .cp-legacy textarea,
.si-cp .cp-legacy button {
    font-family: var(--si-font-body);
}

.si-cp .cp-legacy {
    color: var(--si-color-on-surface);
    font-size: var(--si-size-body-sm);
    line-height: var(--si-lh-body-sm);
}

/* == Below the sidebar breakpoint the sidebar is a drawer ====================== */

@media (max-width: 1023px) {
    .si-cp .shell-topbar__menu-button {
        display: flex;
    }

    .si-cp .shell__sidebar {
        position: fixed;
        top: var(--si-layout-topbar-height);
        bottom: 0;
        left: 0;
        height: auto;
        transform: translateX(-100%);
        z-index: var(--si-z-overlay);
        transition: transform var(--si-dur-base) var(--si-ease);
    }

    .si-cp .shell--nav-open .shell__sidebar {
        transform: none;
        box-shadow: var(--si-elev-3);
    }

    .si-cp .shell--nav-open .shell__scrim {
        position: fixed;
        inset: var(--si-layout-topbar-height) 0 0 0;
        z-index: calc(var(--si-z-overlay) - 1);
        display: block;
        background: var(--si-color-scrim);
        border: 0;
    }
}

@media (max-width: 767px) {
    .si-cp .shell-topbar {
        gap: var(--si-space-sm);
        padding: 0 var(--si-space-sm);
    }

    .si-cp .shell-topbar__product,
    .si-cp .shell-topbar__logout .si-button__label,
    .si-cp .si-toggle__label {
        display: none;
    }

    .si-cp .shell-page {
        padding: var(--si-space-md);
    }
}

/* == Dashboard (app/cPanel/pages/dashboard.php) ================================ */

.si-cp .cp-dashboard__blurb {
    margin: 0 0 var(--si-space-md);
    color: var(--si-color-on-surface-variant);
}

.si-cp .cp-dashboard__error {
    display: flex;
    align-items: center;
    gap: var(--si-space-sm);
    margin: 0 0 var(--si-space-md);
    color: var(--si-status-due-now-fg);
}

.si-cp .cp-dashboard__hide {
    display: inline-flex;
    margin: 0;
}

/* == Legacy tables as SI data tables ===========================================
   table.hovertable / .hovertableHalf (stylesheet.css: Verdana 11px, light-blue head band, a 1px grid) take
   SiDataTable's look: a rounded card, the head band on surface-container in 11px caps, rows divided by a
   hairline, zebra on surface-bright and the hover on primary-soft. The row hover rides the cells, so the
   pages' inline onmouseover colours on <tr> stay under it. Alignment stays as each page wrote it. */

.si-cp .cp-legacy table.hovertable,
.si-cp .cp-legacy table.hovertableHalf {
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    background: var(--si-color-surface-container-lowest);
    border: 1px solid var(--si-color-outline-variant);
    border-radius: var(--si-radius-xl);
    box-shadow: var(--si-elev-1);
    color: var(--si-color-on-surface-variant);
    font-family: var(--si-font-body);
    font-size: var(--si-size-caption);
    line-height: var(--si-lh-caption);
}

.si-cp .cp-legacy table.hovertable th,
.si-cp .cp-legacy table.hovertableHalf th {
    padding: 10px var(--si-space-12) !important;
    background: var(--si-color-surface-container);
    border: 0;
    border-bottom: 1px solid var(--si-color-outline-variant);
    color: var(--si-color-on-surface-variant);
    font-size: 11px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    vertical-align: middle;
}

.si-cp .cp-legacy table.hovertable td,
.si-cp .cp-legacy table.hovertableHalf td {
    padding: 10px var(--si-space-12) !important;
    border: 0;
    border-bottom: 1px solid var(--si-color-surface-container-low);
    background: var(--si-color-surface-container-lowest);
    vertical-align: middle;
}

.si-cp .cp-legacy table.hovertableHalf th,
.si-cp .cp-legacy table.hovertableHalf td {
    padding: 6px var(--si-space-sm) !important;
}

.si-cp .cp-legacy table.hovertable tr,
.si-cp .cp-legacy table.hovertableHalf tr {
    background: transparent;
}

.si-cp .cp-legacy table.hovertable tr:nth-child(even) > td,
.si-cp .cp-legacy table.hovertableHalf tr:nth-child(even) > td {
    background: var(--si-color-surface-bright);
}

.si-cp .cp-legacy table.hovertable tr:hover > td,
.si-cp .cp-legacy table.hovertableHalf tr:hover > td {
    background: var(--si-color-primary-soft);
}

.si-cp .cp-legacy table.hovertable tr:last-child > td,
.si-cp .cp-legacy table.hovertableHalf tr:last-child > td {
    border-bottom: 0;
}

/* A row of filter fields under the head (gateway status, bootgrid-like pages) reads as part of the head band. */
.si-cp .cp-legacy table.hovertable thead tr + tr > td,
.si-cp .cp-legacy table.hovertable thead tr + tr > th {
    padding: 6px var(--si-space-sm) !important;
    background: var(--si-color-surface-container-low);
    border-bottom: 1px solid var(--si-color-outline-variant);
    text-transform: none;
    letter-spacing: 0;
}

/* == Legacy fields and buttons ================================================ */

.si-cp .cp-legacy input[type='text'],
.si-cp .cp-legacy input[type='search'],
.si-cp .cp-legacy input[type='email'],
.si-cp .cp-legacy input[type='number'],
.si-cp .cp-legacy input[type='date'],
.si-cp .cp-legacy input[type='password'],
.si-cp .cp-legacy input:not([type]),
.si-cp .cp-legacy select,
.si-cp .cp-legacy textarea {
    min-height: 32px;
    padding: 4px var(--si-space-sm);
    background: var(--si-color-surface-container-lowest);
    border: 1px solid var(--si-color-outline-variant);
    border-radius: var(--si-radius-md);
    color: var(--si-color-on-surface);
    font-family: var(--si-font-body);
    font-size: var(--si-size-body-sm);
    line-height: var(--si-lh-body-sm);
    transition: border-color var(--si-dur-fast) var(--si-ease), box-shadow var(--si-dur-fast) var(--si-ease);
}

.si-cp .cp-legacy textarea {
    min-height: 64px;
}

.si-cp .cp-legacy input:focus,
.si-cp .cp-legacy select:focus,
.si-cp .cp-legacy textarea:focus {
    outline: none;
    border-color: var(--si-color-primary-container);
    box-shadow: var(--si-focus-ring);
}

.si-cp .cp-legacy table.hovertable input[type='text'],
.si-cp .cp-legacy table.hovertable select {
    width: 100%;
    min-height: 28px;
    font-size: var(--si-size-caption);
}

/* SiButton secondary, small: the legacy submit buttons that carry no SI class. */
.si-cp .cp-legacy input[type='submit']:not([class*='glassButton']),
.si-cp .cp-legacy input[type='button']:not([class*='glassButton']),
.si-cp .cp-legacy input[type='reset']:not([class*='glassButton']),
.si-cp .cp-legacy button:not([class*='si-']):not([class*='glassButton']) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 var(--si-space-12);
    background: var(--si-color-surface-container-lowest);
    border: 1px solid var(--si-color-outline-variant);
    border-radius: var(--si-radius-lg);
    box-shadow: var(--si-elev-1);
    color: var(--si-color-on-surface);
    font-family: var(--si-font-body);
    font-size: var(--si-size-body-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--si-dur-fast) var(--si-ease);
}

.si-cp .cp-legacy input[type='submit']:not([class*='glassButton']):hover,
.si-cp .cp-legacy input[type='button']:not([class*='glassButton']):hover,
.si-cp .cp-legacy input[type='reset']:not([class*='glassButton']):hover,
.si-cp .cp-legacy button:not([class*='si-']):not([class*='glassButton']):hover {
    background: var(--si-color-surface-container-low);
}

/* stylesheet.css ends with td, th { padding: 1px !important } (a 2019 fix for Bootstrap 3), so every SI cell
   padding above carries !important too. */

/* == Legacy action buttons ====================================================
   .glassButton (blue gradient, white text !important, text-shadow) is the main action of a form (Submit, Save):
   it becomes SiButton primary. .glassButtonGreen too; .glassButtonRed takes the due-now tone. Not scoped to
   .cp-legacy: the staff-password dialog, outside the page table, uses it as well. The pages' inline
   width/height stay. */

.si-cp .glassButton,
.si-cp .glassButtonGreen,
.si-cp .glassButtonRed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 var(--si-space-md);
    background: var(--si-color-primary);
    border: 1px solid transparent;
    border-radius: var(--si-radius-lg);
    box-shadow: var(--si-elev-1);
    color: var(--si-color-on-primary) !important;
    font-family: var(--si-font-body);
    font-size: var(--si-size-body-sm);
    line-height: var(--si-lh-body-sm);
    font-weight: 600;
    text-shadow: none;
    text-decoration: none !important;
    cursor: pointer;
    transition: background-color var(--si-dur-fast) var(--si-ease), box-shadow var(--si-dur-fast) var(--si-ease);
}

.si-cp .glassButton:hover,
.si-cp .glassButtonGreen:hover {
    background: var(--si-color-on-primary-fixed-variant);
}

.si-cp .glassButtonRed {
    background: var(--si-status-due-now-solid);
}

.si-cp .glassButtonRed:hover {
    background: var(--si-status-due-now-fg);
}

.si-cp .glassButton:focus-visible,
.si-cp .glassButtonGreen:focus-visible,
.si-cp .glassButtonRed:focus-visible {
    outline: none;
    box-shadow: var(--si-focus-ring);
}

.si-cp .glassButton:active,
.si-cp .glassButtonGreen:active,
.si-cp .glassButtonRed:active {
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}
