/*
 * SIMM Visual Orchestrator
 * Progressive geometry and accessibility layer shared by every SaaS shell.
 * It deliberately avoids tenant colours and functional visibility rules.
 */
:root {
    --simm-ui-space-1: .35rem;
    --simm-ui-space-2: .6rem;
    --simm-ui-space-3: .85rem;
    --simm-ui-space-4: 1.1rem;
    --simm-ui-radius-sm: 12px;
    --simm-ui-radius-md: 18px;
    --simm-ui-radius-lg: 24px;
    --simm-ui-line: rgba(71, 94, 122, .16);
    --simm-ui-surface: rgba(255, 255, 255, .94);
    --simm-ui-shadow: 0 16px 42px rgba(24, 50, 82, .10);
    --simm-ui-focus: #1684dd;
    --simm-ui-font-caption: clamp(.76rem, .73rem + .08vw, .82rem);
    --simm-ui-font-control: clamp(.82rem, .78rem + .11vw, .92rem);
    --simm-ui-font-body: clamp(.88rem, .84rem + .12vw, .98rem);
    --simm-ui-sidebar-fluid: clamp(12.75rem, 14vw, 14.75rem);
}

body.simm-ui-polished {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body.simm-ui-polished,
body.simm-ui-polished * {
    scrollbar-width: thin;
    scrollbar-color: rgba(80, 111, 145, .42) transparent;
}

body.simm-ui-polished *::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body.simm-ui-polished *::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: rgba(80, 111, 145, .42);
    background-clip: padding-box;
}

body.simm-ui-polished *::-webkit-scrollbar-track {
    background: transparent;
}

body.simm-ui-polished :where(main, section, article, aside, header, footer, nav, form, fieldset, div, label) {
    min-width: 0;
}

body.simm-ui-polished :where(img, svg, canvas, video, iframe) {
    max-width: 100%;
}

body.simm-ui-polished :where(input, select, textarea, button) {
    max-width: 100%;
}

body.simm-ui-polished :where(h1, h2, h3, h4, h5, h6, p, small, strong, span, td, th, label) {
    overflow-wrap: anywhere;
}

body.simm-ui-polished :where(
    .sec360-app-main,
    .dece360-main,
    .dece360-content,
    .med360-main,
    .med360-content,
    .ins360-main,
    .ins360-content,
    .docente360-main,
    .fin360-main,
    .family360-stage,
    .pastoral360-main,
    .executive-academic-main,
    .console-content,
    .page-content,
    .module-stage,
    [class*="workspace"],
    [class*="workarea"],
    [class*="work-area"]
) {
    min-width: 0;
    max-width: 100%;
}

body.simm-ui-polished :where(
    [class*="grid"],
    [class*="columns"],
    [class*="layout"],
    [class*="split"]
) > * {
    min-width: 0;
}

body.simm-ui-polished :where(
    [class*="actions"],
    [class*="toolbar"],
    [class*="button-row"],
    [class*="controls"]
) {
    flex-wrap: wrap;
}

body.simm-ui-polished :where(.card, [class*="-card"], [class*="__card"], [class*="-panel"], [class*="__panel"]) {
    max-width: 100%;
}

/* The contextual assistant is anchored to its compact launcher. The generic
   panel guard above must not shrink the desktop help surface to that width. */
@media (min-width: 681px) {
    body.simm-ui-polished .saas-assistant__panel {
        width: min(452px, calc(100vw - 26px));
        max-width: min(452px, calc(100vw - 26px));
    }

    body.simm-ui-polished .saas-assistant__quick-actions {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        overflow-x: hidden;
    }
}

@media (max-width: 680px) {
    body.simm-ui-polished .saas-assistant__quick-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        overflow-x: hidden;
    }
}

/* Tables remain complete, but scroll inside their own card instead of widening the page. */
.simm-table-scroll {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: auto;
    overscroll-behavior-inline: contain;
    border: 1px solid var(--simm-ui-line);
    border-radius: var(--simm-ui-radius-md);
    background: var(--simm-ui-surface);
    box-shadow: 0 8px 24px rgba(24, 50, 82, .05);
    scrollbar-gutter: stable;
}

.simm-table-scroll:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--simm-ui-focus) 38%, transparent);
    outline-offset: 2px;
}

.simm-table-scroll > table {
    width: max-content;
    min-width: 100%;
    margin: 0 !important;
}

.simm-table-scroll > table > :where(thead, tbody) > tr > :where(th, td) {
    max-width: 22rem;
    vertical-align: middle;
}

.simm-table-scroll > table > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: color-mix(in srgb, #ffffff 92%, var(--simm-ui-focus) 8%);
    box-shadow: 0 1px 0 var(--simm-ui-line);
}

body.simm-ui-polished :where(.table-responsive, [class*="table-wrap"], [class*="table-scroll"]) {
    max-width: 100%;
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
}

/* Forms and action areas: balanced density without changing validation or submit flow. */
body.simm-ui-polished :where(.form-control, .form-select, input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    min-width: 0;
}

body.simm-ui-polished :where(.nav-pills, .nav-tabs, [role="tablist"]) {
    max-width: 100%;
    flex-wrap: wrap;
    gap: .4rem;
}

body.simm-ui-polished .finance-erp-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: .35rem;
}

body.simm-ui-polished .finance-erp-tabs > * {
    flex: 0 0 auto;
}

body.simm-ui-polished :where(.docente360-guide-layout, .docente360-guide-steps) {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
}

/* Dialogs and floating work windows always retain a visible header, close control and scrollable body. */
body.simm-ui-polished :where(dialog, .modal-dialog, [role="dialog"].simm-dialog-surface) {
    max-width: min(1120px, calc(100vw - 28px));
    max-height: calc(100dvh - 28px);
}

body.simm-ui-polished dialog,
body.simm-ui-polished [role="dialog"].simm-dialog-surface {
    overscroll-behavior: contain;
}

body.simm-ui-polished :where(.modal-content, dialog > :first-child, [role="dialog"].simm-dialog-surface) {
    border-radius: var(--simm-ui-radius-lg);
}

body.simm-ui-polished :where(.modal-content, [role="dialog"].simm-dialog-surface) {
    max-height: calc(100dvh - 28px);
    overflow: hidden;
    background: var(--simm-ui-surface);
    box-shadow: 0 28px 80px rgba(16, 37, 65, .24);
}

body.simm-ui-polished :where(
    .modal-body,
    .sec360-operational-body,
    .sri-window__body,
    [data-simm-dialog-body]
) {
    min-height: 0;
    max-height: calc(100dvh - 170px);
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

body.simm-ui-polished :where(
    .modal-header,
    .sec360-operational-head,
    .sri-window__head,
    [data-simm-dialog-header]
) {
    position: sticky;
    top: 0;
    z-index: 8;
    background: color-mix(in srgb, var(--simm-ui-surface) 95%, transparent);
    backdrop-filter: blur(16px);
}

body.simm-ui-polished :where(
    .modal-footer,
    .sec360-operational-actions,
    .sri-window__footer,
    [data-simm-dialog-footer]
) {
    position: sticky;
    bottom: 0;
    z-index: 7;
    background: color-mix(in srgb, var(--simm-ui-surface) 96%, transparent);
    backdrop-filter: blur(16px);
}

body.simm-ui-polished .sec360-operational-panel.simm-dialog-surface {
    inset: clamp(.5rem, 2vw, 1.5rem);
    width: auto;
    height: auto;
    margin: 0;
}

body.simm-ui-polished :where(.sec360-floating-close, [data-sri-window-close], .btn-close, [aria-label*="Cerrar" i]) {
    flex: 0 0 auto;
}

/* Compact cards on constrained desktops without making touch targets too small. */
@media (max-width: 1280px) {
    body.simm-ui-polished :where(
        .sec360-topbar,
        .dece360-command,
        .med360-command,
        .ins360-command,
        .docente360-topbar,
        .fin360-topbar,
        .family360-topbar,
        .pastoral360-topbar,
        .executive-academic-appbar,
        .console-header
    ) {
        gap: .7rem;
    }

    body.simm-ui-polished :where(.page-content, [class*="module-stage"], [class*="workarea"]) {
        padding-inline: clamp(.55rem, 1.2vw, 1rem);
    }
}

@media (max-width: 1100px) {
    body.simm-ui-polished .docente360-guide-layout {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

/*
 * Global readable workspace contract.
 *
 * A SaaS page must grow with its content at 100% browser zoom. The document is
 * the only vertical scroller for the working area; navigation, wide tables and
 * dialogs keep their own bounded scrolling. This prevents fixed 100dvh shells
 * from trapping forms below the fold without changing tenant branding.
 */
body.simm-ui-polished.simm-natural-page-flow:is(
    .secretaria360-workspace-shell,
    .dece360-workspace-shell,
    .ins360-workspace-shell,
    .med360-workspace-shell,
    .docente360-workspace-shell,
    .fin360-body,
    .family360-shell,
    .executive-academic-shell,
    .pastoral360-body,
    .evaluation360-body
) {
    width: 100% !important;
    height: auto !important;
    min-height: 100dvh !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

body.simm-ui-polished.simm-natural-page-flow :where(
    .sec360-shell-wrap,
    #secretaria360App.sec360-workspace-v2,
    .dece360-root,
    .dece360-workspace-v2,
    .ins360-root,
    .ins360-workspace-v2,
    .med360-root,
    .med360-workspace-v2,
    .docente360-workspace-v2,
    .fin360-app,
    .family360-frame,
    .family360-app,
    .executive-academic-frame,
    .executive-workspace-v2,
    .pastoral360-app,
    .evaluation360-app
) {
    width: 100% !important;
    height: auto !important;
    min-height: 100dvh !important;
    max-height: none !important;
    overflow: visible !important;
}

body.simm-ui-polished.simm-natural-page-flow :where(
    .sec360-app-main,
    .dece360-main,
    .dece360-content,
    .ins360-main,
    .ins360-content,
    .med360-main,
    .med360-content,
    .docente360-main,
    .fin360-main,
    .fin360-workarea,
    .family360-stage,
    .executive-academic-main,
    .executive-stage,
    .pastoral360-main,
    .evaluation360-main
) {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
}

body.simm-ui-polished.simm-natural-page-flow :where(
    .sec360-stage,
    .sec360-hub,
    .dece360-module-stage,
    .ins360-module-stage,
    .med360-module-stage,
    .docente360-content,
    .fin360-content-scroll,
    .family360-content,
    .executive-stage-scroll,
    .pastoral360-workarea,
    .evaluation360-workarea
) {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    overscroll-behavior: auto !important;
    scrollbar-gutter: auto !important;
}

body.simm-ui-polished.simm-natural-page-flow :where(
    .sec360-side-scroll,
    .dece360-side-nav,
    .ins360-side-nav,
    .med360-side-nav,
    .docente360-nav,
    .fin360-nav,
    .family360-nav,
    .executive-navigation,
    .pastoral360-nav,
    .evaluation360-nav
) {
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

@media (min-width: 961px) {
    body.simm-ui-polished.simm-natural-page-flow :where(
        .sec360-sidebar,
        .dece360-sidebar,
        .ins360-sidebar,
        .med360-sidebar,
        .docente360-sidebar,
        .fin360-sidebar,
        .family360-sidebar,
        .executive-sidebar,
        .pastoral360-sidebar,
        .evaluation360-sidebar
    ) {
        position: sticky !important;
        inset: auto !important;
        top: 8px !important;
        align-self: start !important;
        height: calc(100dvh - 16px) !important;
        min-height: 0 !important;
        max-height: calc(100dvh - 16px) !important;
        overflow: hidden !important;
    }
}

@media (max-width: 960px) {
    body.simm-ui-polished.simm-natural-page-flow :where(
        .sec360-sidebar,
        .dece360-sidebar,
        .ins360-sidebar,
        .med360-sidebar,
        .docente360-sidebar,
        .fin360-sidebar,
        .family360-sidebar,
        .executive-sidebar,
        .pastoral360-sidebar,
        .evaluation360-sidebar
    ) {
        max-height: calc(100dvh - 16px);
    }
}

@media (max-width: 900px) {
    body.simm-ui-polished #secretaria360App.sec360-workspace-v2 #secretaria360Sidebar {
        height: auto !important;
        max-height: min(44dvh, 420px) !important;
        min-height: 0 !important;
    }

    body.simm-ui-polished :where(
        .sec360-topbar,
        .dece360-command-topline,
        .med360-command-topline,
        .ins360-command-topline,
        .docente360-topbar,
        .fin360-topbar,
        .family360-topbar,
        .pastoral360-topbar,
        .executive-academic-appbar,
        .console-header
    ) {
        align-items: stretch;
    }

    body.simm-ui-polished :where(
        .sec360-topbar-actions,
        .dece360-command-actions,
        .med360-command-actions,
        .ins360-command-actions,
        .docente360-topbar-actions,
        .fin360-actions,
        .pastoral360-context-badges,
        .executive-academic-appbar-actions
    ) {
        width: 100%;
        justify-content: flex-start;
    }

    body.simm-ui-polished :where(dialog, .modal-dialog, [role="dialog"].simm-dialog-surface) {
        max-width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
    }

    body.simm-ui-polished :where(.modal-content, [role="dialog"].simm-dialog-surface) {
        max-height: calc(100dvh - 16px);
        border-radius: 18px;
    }
}

@media (max-width: 640px) {
    body.simm-ui-polished :where(.btn, button, a[role="button"]) {
        min-height: 40px;
    }

    body.simm-ui-polished :where([class*="actions"], [class*="toolbar"], [class*="button-row"]) > :where(a, button, .btn) {
        flex: 1 1 auto;
    }

    body.simm-ui-polished .simm-table-scroll {
        border-radius: 14px;
    }

    body.simm-ui-polished .simm-table-scroll > table > :where(thead, tbody) > tr > :where(th, td) {
        max-width: 16rem;
        padding: .62rem .7rem;
    }
}

/*
 * Adaptive workspace contract for browser zoom at 100%.
 * Macro layout uses viewport queries; modules adapt to their real content width.
 */
body.simm-ui-polished :where(
    .sec360-stage,
    .dece360-module-stage,
    .ins360-module-stage,
    .med360-module-stage,
    .docente360-content,
    .fin360-workarea,
    .family360-stage,
    .executive-stage-scroll,
    .pastoral360-workarea,
    .evaluation360-workarea,
    .page-content
) {
    container-name: simm-workspace-stage;
    container-type: inline-size;
}

body.simm-ui-polished :where(
    .sec360-hub,
    .dece360-module-stage,
    .ins360-module-stage,
    .med360-module-stage,
    .docente360-content,
    .fin360-content-scroll,
    .family360-content,
    .executive-stage-scroll,
    .pastoral360-workarea,
    .evaluation360-workarea,
    .page-content
) {
    min-height: 0;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

/* Tiny captions from the dense legacy layer remain readable without scaling the app. */
body.simm-ui-polished :where(
    .sec360-stage,
    .dece360-module-stage,
    .ins360-module-stage,
    .med360-module-stage,
    .docente360-content,
    .fin360-workarea,
    .family360-content,
    .executive-stage-scroll,
    .pastoral360-workarea,
    .evaluation360-workarea,
    .page-content
) :where(p, small, label, th, td) {
    font-size: var(--simm-ui-font-caption) !important;
    line-height: 1.45;
}

body.simm-ui-polished :where(
    .sec360-stage,
    .dece360-module-stage,
    .ins360-module-stage,
    .med360-module-stage,
    .docente360-content,
    .fin360-workarea,
    .family360-content,
    .executive-stage-scroll,
    .pastoral360-workarea,
    .evaluation360-workarea,
    .page-content
) :where(.btn, button, input, select, textarea) {
    font-size: var(--simm-ui-font-control) !important;
}

body.simm-ui-polished :where(
    .sec360-side-link strong,
    .dece360-side-link strong,
    .ins360-side-link strong,
    .med360-side-link strong,
    .docente360-nav-link strong,
    .fin360-nav-link span,
    .family360-nav-link strong,
    .executive-nav-item strong,
    .pastoral360-nav a,
    .evaluation360-nav b,
    .console-nav-link
) {
    font-size: var(--simm-ui-font-control) !important;
    line-height: 1.25;
}

body.simm-ui-polished :where(
    .sec360-nav-group-label,
    .dece360-nav-group-label,
    .ins360-nav-group-label,
    .med360-nav-group-label,
    .docente360-nav-group,
    .fin360-nav-label,
    .family360-nav-title,
    .executive-nav-group-label,
    .pastoral360-nav > span,
    .evaluation360-nav-group,
    .console-nav-group
) {
    font-size: var(--simm-ui-font-caption) !important;
    line-height: 1.25;
}

body.simm-ui-polished :where(
    .sec360-side-link,
    .dece360-side-link,
    .ins360-side-link,
    .med360-side-link,
    .docente360-nav-link,
    .fin360-nav-link,
    .family360-nav-link,
    .executive-nav-item,
    .pastoral360-nav a,
    .evaluation360-nav a,
    .console-nav-link
) {
    min-height: 42px;
}

/* KPI rows wrap from the space available after the sidebar, not from screen width. */
body.simm-ui-polished :where(
    .sec360-metric-strip,
    .dece360-metrics,
    .ins360-metrics,
    .med360-metrics,
    .docente360-kpi-grid,
    .finance-metrics-strip,
    .family360-kpi-grid,
    .executive-metrics,
    .executive-mini-metrics,
    .pastoral360-kpis,
    .evaluation360-kpis,
    .sri-operation-kpis,
    .fin-obligations__kpis
) {
    grid-template-columns: repeat(auto-fit, minmax(min(9.75rem, 100%), 1fr)) !important;
    max-height: none !important;
    overflow: visible !important;
}

@media (min-width: 961px) and (max-width: 1600px) {
    body.simm-ui-polished :where(
        #secretaria360App.sec360-workspace-v2,
        .dece360-workspace-v2,
        .ins360-workspace-v2,
        .med360-workspace-v2,
        .docente360-workspace-v2,
        .fin360-app,
        .pastoral360-app
    ) {
        grid-template-columns: var(--simm-ui-sidebar-fluid) minmax(0, 1fr) !important;
    }

    body.simm-ui-polished .executive-workspace-v2 {
        grid-template-columns: clamp(14rem, 18vw, 16.5rem) minmax(0, 1fr);
    }

    body.simm-ui-polished .evaluation360-app {
        grid-template-columns: clamp(14rem, 18vw, 16.5rem) minmax(0, 1fr);
    }
}

@media (min-width: 961px) and (max-width: 1380px) {
    body.simm-ui-polished :where(
        .sec360-topbar,
        .dece360-command,
        .ins360-command,
        .med360-command,
        .docente360-topbar,
        .fin360-topbar
    ) {
        grid-template-columns: minmax(11rem, .7fr) minmax(15rem, 1fr) auto;
    }

    body.simm-ui-polished :where(
        .sec360-status,
        .sec360-user-label,
        .dece360-command-subtitle,
        .ins360-command-subtitle,
        .med360-command-subtitle,
        .fin360-context-pills
    ) {
        white-space: normal;
    }
}

@container simm-workspace-stage (max-width: 1120px) {
    body.simm-ui-polished :where(
        .sec360-workspace-dashboard,
        .dece360-dashboard-grid,
        .ins360-dashboard-grid,
        .med360-dashboard-grid,
        .family360-dashboard-grid,
        .executive-dashboard-grid,
        .pastoral360-dashboard-grid,
        .evaluation360-grid-dashboard
    ) {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    body.simm-ui-polished .sec360-priority-rail {
        display: grid !important;
        grid-template-columns: minmax(10rem, .72fr) minmax(18rem, 1.35fr) minmax(12rem, .8fr) !important;
        align-items: center;
        gap: .75rem;
    }

    body.simm-ui-polished .sec360-priority-rail > header p {
        margin-bottom: 0;
    }

    body.simm-ui-polished .sec360-priority-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.simm-ui-polished .sec360-tenant-assurance {
        margin-top: 0;
    }
}

@container simm-workspace-stage (max-width: 860px) {
    body.simm-ui-polished :where(
        .sec360-workflow-grid,
        .dece360-dashboard-grid,
        .ins360-dashboard-grid,
        .med360-dashboard-grid,
        .family360-action-grid,
        .pastoral360-report-grid,
        .evaluation360-grid-dashboard
    ) {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    body.simm-ui-polished .sec360-priority-rail {
        display: block !important;
    }

    body.simm-ui-polished .sec360-priority-list {
        grid-template-columns: minmax(0, 1fr);
    }
}

@supports not (container-type: inline-size) {
    @media (max-width: 1280px) {
        body.simm-ui-polished :where(
            .sec360-workspace-dashboard,
            .dece360-dashboard-grid,
            .ins360-dashboard-grid,
            .med360-dashboard-grid,
            .family360-dashboard-grid,
            .executive-dashboard-grid,
            .pastoral360-dashboard-grid,
            .evaluation360-grid-dashboard
        ) {
            grid-template-columns: minmax(0, 1fr) !important;
        }
    }
}

/* VU1: table geometry is independent from page navigation and browser zoom. */
body.simm-ui-polished .simm-table-stage {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    margin-block: .5rem;
    color: var(--bs-body-color, #18334b);
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #d7e2ec);
    border-radius: 12px;
    overflow: hidden;
}
body.simm-ui-polished .simm-table-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 6px 10px;
    font-size: 13px;
    border-bottom: 1px solid var(--bs-border-color, #d7e2ec);
}
body.simm-ui-polished :is(.simm-table-expand, .simm-table-column-step, .simm-help-docked-button) {
    min-height: 40px;
    padding: 6px 12px;
    border: 1px solid var(--theme-primary, #126cc0);
    border-radius: 8px;
    color: var(--theme-primary, #126cc0);
    background: var(--bs-body-bg, #fff);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
body.simm-ui-polished .simm-table-control-buttons { display: flex; gap: 6px; align-items: center; }
body.simm-ui-polished .simm-table-column-step { min-width: 36px; padding-inline: 8px; font-weight: 700; }
body.simm-ui-polished .simm-table-column-step:disabled { opacity: .4; cursor: default; }
body.simm-ui-polished .simm-table-column-step[hidden] { display: none; }
body.simm-ui-polished .simm-table-xbar {
    height: 20px;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: auto;
    scroll-behavior: auto !important;
}
body.simm-ui-polished .simm-table-xbar[hidden] { display: none !important; }
body.simm-ui-polished .simm-table-xbar > div { height: 1px; }
body.simm-ui-polished .simm-table-xbar::-webkit-scrollbar { height: 14px; }
body.simm-ui-polished .simm-table-xbar::-webkit-scrollbar-track { background: #e5edf5; }
body.simm-ui-polished .simm-table-xbar::-webkit-scrollbar-thumb { background: #69839c; border: 3px solid #e5edf5; border-radius: 8px; }
body.simm-ui-polished .simm-readable-scroll,
body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-scroll {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    max-height: min(62dvh, 640px) !important;
    padding: 0 !important;
    overflow: auto !important;
    overscroll-behavior: auto;
    scrollbar-gutter: stable;
    border-radius: 0 !important;
    scroll-behavior: auto !important;
}
body.simm-ui-polished .simm-readable-table,
body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-table {
    width: max-content !important;
    min-width: 100% !important;
    max-width: none !important;
    table-layout: auto !important;
    border-collapse: separate !important;
    border-spacing: 0;
    font-size: 13px !important;
}
body.simm-ui-polished .simm-readable-table :is(th, td),
body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-table :is(th, td) {
    min-width: 88px;
    width: auto !important;
    max-width: 300px;
    height: auto !important;
    padding: 8px 10px !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    vertical-align: top;
    line-height: 1.45 !important;
    font-variant-numeric: tabular-nums;
}
body.simm-ui-polished .simm-readable-table th,
body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-table th {
    position: static !important;
    top: auto !important;
    min-width: 110px;
    max-width: 240px;
    white-space: normal !important;
    background: var(--simm-ui-table-header, #edf7ff) !important;
}
body.simm-ui-polished .simm-readable-table thead,
body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-table thead {
    position: sticky !important;
    top: 0 !important;
    z-index: 20 !important;
    background: var(--simm-ui-table-header, #edf7ff);
}
body.simm-ui-polished .simm-readable-table :is(strong, span, a, button) {
    overflow-wrap: normal;
    word-break: normal;
}
body.simm-ui-polished .simm-readable-table :is(.student, .subject-group),
body.simm-ui-polished .simm-readable-table td:has(> strong, > div, > .sec360-status-chip) {
    min-width: 160px;
    max-width: 300px;
    white-space: normal !important;
}
body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-table .sticky-left.student {
    left: var(--simm-code-width, 110px);
    min-width: 220px;
    max-width: 260px;
    white-space: normal !important;
}
body.simm-ui-polished .simm-readable-table :is(.sticky-left, .sticky-right),
body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-table :is(.sticky-left, .sticky-right) {
    position: sticky !important;
    top: auto !important;
    z-index: 2 !important;
    background: var(--bs-body-bg, #fff);
}
body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-table .sticky-right {
    right: var(--simm-action-width, 88px);
}
body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-table .sticky-right.action { right: 0; }
body.simm-ui-polished .simm-table-stage:fullscreen {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
    padding: 12px;
}
body.simm-ui-polished .simm-table-stage:fullscreen .simm-readable-scroll,
body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-table-stage:fullscreen .simm-readable-scroll {
    flex: 1;
    min-height: 0;
    max-height: none !important;
}
body.simm-ui-polished .simm-table-expanded-inline .simm-readable-scroll,
body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-table-expanded-inline .simm-readable-scroll {
    max-height: 82dvh !important;
}
body.simm-ui-polished :is(.simm-table-expand, .simm-table-column-step, .simm-table-xbar, .simm-readable-scroll, .simm-help-docked-button):focus-visible {
    outline: 3px solid var(--theme-secondary, #169bc2);
    outline-offset: -3px;
}
body.simm-ui-polished[data-secretaria-workspace="v2"] #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody {
    max-height: none !important;
    overflow: visible !important;
    scrollbar-gutter: auto !important;
}
body.simm-ui-polished[data-secretaria-workspace="v2"] #sec360OperationalPanel::after {
    display: none;
}
body.simm-ui-polished[data-secretaria-workspace="v2"] #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody :is(.sec360-console-shell, .sec360-context-bar, .sec360-action-bar, .sec360-module-tabs, .sec360-context-summary, .sec360-table-tools) {
    position: static !important;
    top: auto !important;
}
body.simm-ui-polished [data-sec360-student-detail] { scroll-margin-top: 16px; }
body.simm-ui-polished[data-secretaria-workspace="v2"] #secretaria360App #secretariaFloatingPanelBody .sec360-action-bar {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)) !important;
}
body.simm-ui-polished[data-secretaria-workspace="v2"] #secretaria360App #secretariaFloatingPanelBody .sec360-action-bar > * {
    min-width: 0 !important;
    max-width: 100% !important;
    grid-column: auto !important;
}
body.simm-ui-polished[data-secretaria-workspace="v2"] #secretaria360App #secretariaFloatingPanelBody .sec360-action-bar > .sec360-filter-title {
    grid-column: 1 / -1 !important;
}
body.simm-ui-polished .sec360-detail-navigation { margin-bottom: 12px; }
@media (max-width: 980px) {
    body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-table { display: table !important; }
    body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-table thead { display: table-header-group !important; }
    body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-table tbody { display: table-row-group !important; }
    body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-table tr { display: table-row !important; }
    body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-table :is(th, td) { display: table-cell !important; }
    body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-table td::before { display: none !important; }
    body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-table :is(tbody, tr) {
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
    }
}
@media (max-width: 700px) {
    body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .sec360-gradebook > .sec360-panel-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-table :is(.sticky-left, .sticky-right),
    body.simm-ui-polished .simm-readable-table.tutor-board-table tr > :first-child {
        position: static !important;
    }
    body.simm-ui-polished .simm-table-controls { gap: 6px; }
}
@media print {
    body.simm-ui-polished :is(.simm-table-controls, .simm-table-xbar) { display: none !important; }
    body.simm-ui-polished .simm-readable-scroll,
    body.simm-ui-polished #secretaria360App.sec360-readable-layout #secretariaFloatingPanelBody .simm-readable-scroll { max-height: none !important; overflow: visible !important; }
    body.simm-ui-polished .simm-readable-table thead { position: static !important; }
}

@media (prefers-reduced-motion: reduce) {
    body.simm-ui-polished *,
    body.simm-ui-polished *::before,
    body.simm-ui-polished *::after {
        scroll-behavior: auto !important;
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}
