/* ================================================
   Caster Shift Report — Precision Industrial Dashboard
   Font: Plus Jakarta Sans · Palette: Steel Slate + Blue
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ---- Design Tokens ---- */
:root {
    --sr-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --sr-primary: #1e40af;
    --sr-primary-hover: #1d4ed8;
    --sr-primary-light: #3b82f6;
    --sr-primary-bg: #eff6ff;
    --sr-surface: #ffffff;
    --sr-surface-raised: #f8fafc;
    --sr-bg: #f1f5f9;
    --sr-border: #e2e8f0;
    --sr-border-strong: #cbd5e1;
    --sr-text: #0f172a;
    --sr-text-secondary: #475569;
    --sr-text-muted: #94a3b8;
    --sr-green: #059669;
    --sr-green-bg: #ecfdf5;
    --sr-amber: #d97706;
    --sr-amber-bg: #fffbeb;
    --sr-red: #dc2626;
    --sr-red-bg: #fef2f2;
    --sr-shadow-sm: 0 1px 2px 0 rgba(0,0,0,.04);
    --sr-shadow: 0 1px 3px 0 rgba(0,0,0,.06), 0 1px 2px -1px rgba(0,0,0,.04);
    --sr-shadow-md: 0 4px 6px -1px rgba(0,0,0,.06), 0 2px 4px -2px rgba(0,0,0,.04);
    --sr-shadow-lg: 0 10px 15px -3px rgba(0,0,0,.07), 0 4px 6px -4px rgba(0,0,0,.04);
    --sr-radius: 10px;
    --sr-radius-sm: 6px;
    --sr-transition: 180ms cubic-bezier(.4,0,.2,1);
}

/* ---- Page-Level Reset ---- */
#casters-shift-report {
    font-family: var(--sr-font) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--sr-text);
}

#casters-shift-report *,
#casters-shift-report *::before,
#casters-shift-report *::after {
    font-family: var(--sr-font) !important;
}

.content-container { padding-top: 0 !important; }
#subnavbar-inner   { display: none !important; }

/* ---- Page Background ---- */
.sr-page {
    background:
        radial-gradient(ellipse at 20% 0%, rgba(59,130,246,.04) 0%, transparent 60%),
        var(--sr-bg);
    min-height: 100vh;
    padding: 0 0 32px;
}

/* ---- Page Header ---- */
.sr-page-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 20px 24px 16px;
    margin: -2px -2px 20px;
    border-radius: 0 0 var(--sr-radius) var(--sr-radius);
    position: relative;
    overflow: hidden;
}

.sr-page-header::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 300px; height: 100%;
    background: linear-gradient(135deg, transparent 40%, rgba(59,130,246,.08) 100%);
    pointer-events: none;
}

.sr-page-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--sr-primary-light), #818cf8, var(--sr-primary-light));
}

.sr-title {
    font-size: 21px;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: -0.02em;
    margin: 0 0 2px;
    padding: 0;
    border: none;
    line-height: 1.2;
    position: relative;
}

.sr-title-sub {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* keep legacy class working */
.professional-title { display: none; }

/* ---- Navigation Bar ---- */
.sr-nav-bar {
    background: var(--sr-surface);
    border: 1px solid var(--sr-border);
    border-radius: var(--sr-radius);
    padding: 10px 16px;
    margin-bottom: 16px;
    box-shadow: var(--sr-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

/* Nav buttons (back/forward) */
.sr-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: var(--sr-radius-sm);
    border: 1px solid var(--sr-border);
    background: var(--sr-surface);
    color: var(--sr-text-secondary);
    cursor: pointer;
    transition: all var(--sr-transition);
}
.sr-nav-btn:hover:not(:disabled) {
    background: var(--sr-primary-bg);
    border-color: var(--sr-primary-light);
    color: var(--sr-primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.sr-nav-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

/* Date input group */
.sr-date-group {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--sr-border);
    border-radius: var(--sr-radius-sm);
    background: var(--sr-surface);
    overflow: hidden;
    transition: border-color var(--sr-transition), box-shadow var(--sr-transition);
}
.sr-date-group:focus-within {
    border-color: var(--sr-primary-light);
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

.date-picker {
    border: none !important;
    margin-bottom: 0 !important;
    box-shadow: none !important;
    width: 105px;
    text-align: center;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--sr-text);
    padding: 7px 8px;
    background: transparent;
    letter-spacing: -0.01em;
}

.sr-calendar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border: none;
    border-left: 1px solid var(--sr-border);
    background: var(--sr-surface-raised);
    color: var(--sr-text-secondary);
    cursor: pointer;
    transition: all var(--sr-transition);
}
.sr-calendar-btn:hover {
    background: var(--sr-primary-bg);
    color: var(--sr-primary);
}

/* Shift ID pill */
.sr-shift-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #e2e8f0;
    border: 1px solid #334155;
}

/* Shift badge (full info) */
.sr-shift-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
    background: var(--sr-primary-bg);
    color: var(--sr-primary);
    border: 1px solid rgba(59,130,246,.18);
    white-space: nowrap;
}
.sr-shift-badge::before {
    content: '';
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--sr-primary-light);
    flex-shrink: 0;
    animation: sr-pulse 2s ease-in-out infinite;
}

@keyframes sr-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .5; transform: scale(.8); }
}

/* Refresh / primary button */
.sr-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 20px;
    min-width: 130px;
    height: 36px;
    border-radius: var(--sr-radius-sm);
    border: none;
    background: linear-gradient(135deg, var(--sr-primary) 0%, var(--sr-primary-hover) 100%);
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: all var(--sr-transition);
    box-shadow: 0 1px 2px rgba(30,64,175,.25);
    position: relative;
    overflow: hidden;
}
.sr-btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,.08) 100%);
    pointer-events: none;
}
.sr-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--sr-primary-hover) 0%, #2563eb 100%);
    box-shadow: 0 4px 12px rgba(30,64,175,.3);
    transform: translateY(-1px);
}
.sr-btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(30,64,175,.25);
}

.sr-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    height: 36px;
    border-radius: var(--sr-radius-sm);
    border: 1px solid var(--sr-border-strong);
    background: var(--sr-surface);
    color: var(--sr-text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--sr-transition);
    box-shadow: var(--sr-shadow-sm);
}
.sr-btn-secondary:hover:not(:disabled) {
    background: var(--sr-surface-raised);
    border-color: var(--sr-primary-light);
    color: var(--sr-primary);
    box-shadow: var(--sr-shadow);
}
.sr-btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---- Cards (Sections) ---- */
.sr-card {
    background: var(--sr-surface);
    border: 1px solid var(--sr-border);
    border-radius: var(--sr-radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--sr-shadow);
    position: relative;
    transition: box-shadow var(--sr-transition);
}
.sr-card:hover {
    box-shadow: var(--sr-shadow-md);
}

/* Color-coded left accents */
.sr-card--blue    { border-left: 3px solid var(--sr-primary-light); }
.sr-card--amber   { border-left: 3px solid var(--sr-amber); }
.sr-card--green   { border-left: 3px solid var(--sr-green); }
.sr-card--red     { border-left: 3px solid var(--sr-red); }
.sr-card--slate   { border-left: 3px solid #64748b; }
.sr-card--purple  { border-left: 3px solid #8b5cf6; }

/* ---- Section Titles ---- */
.sr-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--sr-text);
    letter-spacing: -0.01em;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--sr-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sr-section-title .sr-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    border-radius: var(--sr-radius-sm);
    flex-shrink: 0;
}
.sr-icon--blue   { background: var(--sr-primary-bg); color: var(--sr-primary); }
.sr-icon--amber  { background: var(--sr-amber-bg); color: var(--sr-amber); }
.sr-icon--green  { background: var(--sr-green-bg); color: var(--sr-green); }
.sr-icon--red    { background: var(--sr-red-bg); color: var(--sr-red); }
.sr-icon--slate  { background: #f1f5f9; color: #475569; }
.sr-icon--purple { background: #f5f3ff; color: #7c3aed; }

/* ---- Totals & Averages Custom Table ---- */
.sr-totals-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--sr-border);
    border-radius: var(--sr-radius-sm);
    overflow: hidden;
    font-variant-numeric: tabular-nums;
}
.sr-totals-table thead th {
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sr-text-secondary);
    background: var(--sr-surface-raised);
    border-bottom: 2px solid var(--sr-border);
    text-align: center;
    white-space: nowrap;
}
.sr-totals-table thead th.sr-tt-label {
    text-align: left;
    width: 180px;
}
.sr-totals-table .sr-tt-row td {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--sr-text);
    border-bottom: 1px solid #f1f5f9;
    text-align: center;
}
.sr-totals-table .sr-tt-row td.sr-tt-label {
    text-align: left;
    font-weight: 600;
    color: var(--sr-text-secondary);
    font-size: 12.5px;
}
.sr-totals-table .sr-tt-row:hover td {
    background: rgba(59,130,246,.03);
}
.sr-totals-table .sr-tt-highlight td {
    font-weight: 700;
    color: var(--sr-primary);
    background: var(--sr-primary-bg);
    font-size: 13.5px;
}
.sr-totals-table .sr-tt-highlight td.sr-tt-label {
    color: var(--sr-primary);
}
.sr-totals-table .sr-tt-total-col {
    font-weight: 700 !important;
    background: rgba(241,245,249,.6);
}
.sr-totals-table .sr-tt-divider td {
    padding: 0;
    height: 6px;
    background: var(--sr-surface-raised);
    border-bottom: 1px solid var(--sr-border);
}
.sr-tt-std {
    font-size: 11px;
    font-weight: 500;
    color: var(--sr-text-muted);
    opacity: .8;
}

/* ---- Section Grid Layouts ---- */
.sr-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}
.sr-grid-1 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
@media (max-width: 1024px) {
    .sr-grid-2 { grid-template-columns: 1fr; }
}

/* ---- ag-Grid Theme Overrides ---- */
#casters-shift-report .ag-theme-alpine {
    --ag-border-color: var(--sr-border);
    --ag-header-background-color: #f8fafc;
    --ag-header-foreground-color: var(--sr-text);
    --ag-row-hover-color: rgba(59,130,246,.04);
    --ag-selected-row-background-color: rgba(59,130,246,.08);
    --ag-font-family: var(--sr-font);
    --ag-font-size: 12.5px;
    --ag-row-border-color: #f1f5f9;
    --ag-header-height: 38px;
    --ag-row-height: 34px;
}

/* Fixed-height grids need overflow hidden for scrolling */
.delays-grid-container.ag-theme-alpine {
    overflow: hidden;
    border-radius: var(--sr-radius-sm);
    border: 1px solid var(--sr-border);
}

/* autoHeight grids: override the 75vh default from ag-grid-module template */
.shift-resume-grid-container .ag-theme-alpine,
.warehouse-costs-grid-container .ag-theme-alpine,
.products-cast-grid-container .ag-theme-alpine,
.caster1-resume-grid-container .ag-theme-alpine,
.caster2-resume-grid-container .ag-theme-alpine,
.delays-caster1-grid-container .ag-theme-alpine,
.delays-caster2-grid-container .ag-theme-alpine,
.melt-orders-caster1-grid-container .ag-theme-alpine,
.melt-orders-caster2-grid-container .ag-theme-alpine,
.uncut-tails-caster1-grid-container .ag-theme-alpine,
.logbook-grid-container .ag-theme-alpine {
    height: auto !important;
}

/* Override ag-Grid's default 150px min-height on autoHeight viewports */
#casters-shift-report .ag-layout-auto-height .ag-center-cols-viewport,
#casters-shift-report .ag-layout-auto-height .ag-center-cols-container {
    min-height: 0 !important;
}

/* Empty-state ("No Rows To Show") overlay
   The page uses domLayout: 'autoHeight' + min-height:0 on the viewport (above)
   which collapses the body when there are no rows — making the absolutely-
   positioned overlay invisible. Force the overlay into normal flow with
   position:relative + min-height so it actually takes up space and is readable. */
#casters-shift-report .ag-overlay-no-rows-wrapper {
    position: relative !important;
    min-height: 70px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
    padding: 16px;
}

#casters-shift-report .ag-overlay-no-rows-wrapper .ag-overlay-no-rows-center,
#casters-shift-report .ag-overlay-no-rows-wrapper .sr-no-rows {
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* Also give the wrapping ag-overlay container relative positioning so it
   contributes to layout instead of being hidden behind a 0-height body. */
#casters-shift-report .ag-layout-auto-height .ag-overlay {
    position: relative !important;
    pointer-events: auto;
}

/* Always show headers, even when no rows — the min-height:0 override above
   was collapsing the whole grid (including the header row) in some browsers. */
#casters-shift-report .ag-theme-alpine .ag-header,
#casters-shift-report .ag-theme-alpine .ag-header-row {
    min-height: 38px !important;
}

#casters-shift-report .ag-theme-alpine .ag-header-cell-label {
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--sr-text-secondary);
}

#casters-shift-report .ag-theme-alpine .ag-cell {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--sr-text);
    line-height: 34px;
}

#casters-shift-report .ag-theme-alpine .ag-row:nth-child(even) {
    background-color: rgba(241,245,249,.5);
}

/* Totals grid special styling */
.totals-grid-container .ag-theme-alpine .ag-cell {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.totals-grid-container .ag-theme-alpine .ag-row:first-child .ag-cell {
    font-weight: 700;
    color: var(--sr-primary);
}

.totals-grid-container .ag-paging-panel,
.delays-grid-container .ag-paging-panel,
.compact-grid .ag-paging-panel { display: none !important; }

.totals-grid-container .ag-header-cell-center .ag-header-cell-label {
    justify-content: center;
}

/* ---- Slag Status Cells ---- */
.slag-danger {
    background-color: #fef2f2 !important;
    color: var(--sr-red) !important;
    font-weight: 700 !important;
    border-left: 3px solid var(--sr-red) !important;
}

.slag-warning {
    background-color: #fffbeb !important;
    color: var(--sr-amber) !important;
    font-weight: 700 !important;
    border-left: 3px solid var(--sr-amber) !important;
}

.slag-normal {
    background-color: #ecfdf5 !important;
    color: var(--sr-green) !important;
    font-weight: 700 !important;
    border-left: 3px solid var(--sr-green) !important;
}

/* ---- Aims Text ---- */
.sr-aims-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--sr-surface-raised);
    border: 1px solid var(--sr-border);
    border-radius: var(--sr-radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--sr-text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ---- GANTT Legend ---- */
.sr-legend {
    background: var(--sr-surface);
    border: 1px solid var(--sr-border);
    border-radius: var(--sr-radius);
    padding: 14px 18px;
    margin-bottom: 16px;
    box-shadow: var(--sr-shadow-sm);
}

.sr-legend-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}
.sr-legend-row + .sr-legend-row {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--sr-border);
}

.sr-legend-label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--sr-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 4px;
}

.sr-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.sr-legend-swatch {
    width: 18px; height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,.12);
    flex-shrink: 0;
}
.sr-legend-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--sr-text-secondary);
}

/* Dynamic legend badges injected by JS */
#gantt-legend-categories-c1 .dynamic-badge,
#gantt-legend-categories-c2 .dynamic-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
#gantt-legend-categories-c1 .dynamic-badge .inline-block,
#gantt-legend-categories-c2 .dynamic-badge .inline-block {
    width: 18px; height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,.12) !important;
}
#gantt-legend-categories-c1 .dynamic-badge .text-sm,
#gantt-legend-categories-c2 .dynamic-badge .text-sm {
    font-size: 12px;
    font-weight: 500;
    color: var(--sr-text-secondary);
}

/* Remove old legend row styles that conflict */
.sr-legend-row + .sr-legend-row {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* ---- D3 Chart Styles ---- */
.domain {
    stroke: var(--sr-border-strong) !important;
}
.tick > line {
    stroke: var(--sr-border);
}
.dashed {
    stroke-dasharray: 3,3;
}
.wdashed {
    stroke-dasharray: none !important;
}
.top_text {
    font-weight: 700;
    font-size: 11px;
}
g > text {
    font-size: 11.5px;
    font-weight: 600;
    font-family: var(--sr-font) !important;
    fill: var(--sr-text-secondary);
}

/* ---- GANTT Chart Containers ---- */
.sr-gantt-wrap {
    display: flex;
    justify-content: center;
    overflow-x: auto;
    padding: 8px 0;
    background: var(--sr-surface-raised);
    border: 1px solid var(--sr-border);
    border-radius: var(--sr-radius-sm);
}

/* ---- Modern GANTT Timeline ---- */
.sr-gantt {
    width: 100%;
    overflow: hidden;
}

.sr-gantt-timeline {
    position: relative;
    width: 99%;
    padding: 0 0 0 60px;
    box-sizing: border-box;
}

/* Time axis */
.sr-gantt-axis {
    position: relative;
    height: 28px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--sr-border);
}

.sr-gantt-tick {
    position: absolute;
    transform: translateX(-50%);
    font-size: 10.5px;
    font-weight: 600;
    color: var(--sr-text-muted);
    letter-spacing: 0.02em;
    top: 6px;
    white-space: nowrap;
    user-select: none;
}

/* Swim lanes */
.sr-gantt-lane {
    display: flex;
    align-items: stretch;
    margin-bottom: 6px;
}

.sr-gantt-lane-label {
    position: absolute;
    left: 0;
    width: 54px;
    font-size: 10px;
    font-weight: 700;
    color: var(--sr-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    height: 42px;
}

.sr-gantt-lane-track {
    position: relative;
    flex: 1;
    height: 42px;
    background: var(--sr-surface-raised);
    border: 1px solid var(--sr-border);
    border-radius: var(--sr-radius-sm);
    overflow: hidden;
}

/* Grid lines inside lanes */
.sr-gantt-gridline {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--sr-border);
    opacity: 0.5;
    pointer-events: none;
}

/* Bars */
.sr-gantt-bar {
    position: absolute;
    top: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    transition: filter 180ms ease, box-shadow 180ms ease;
    border: 1px solid rgba(0,0,0,.12);
    z-index: 1;
    overflow: hidden;
}

.sr-gantt-bar--heat {
    height: 36px;
    top: 3px;
}

.sr-gantt-bar--delay {
    height: 28px;
    top: 7px;
}

.sr-gantt-bar:hover {
    filter: brightness(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    z-index: 2;
}

.sr-gantt-bar-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(0,0,0,.65);
    text-shadow: 0 0 2px rgba(255,255,255,.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
    pointer-events: none;
}

/* ---- Chart Card Containers ---- */
.sr-chart-area {
    text-align: center;
    padding: 4px;
    background: var(--sr-surface-raised);
    border: 1px solid var(--sr-border);
    border-radius: var(--sr-radius-sm);
    min-height: 60px;
    overflow-x: auto;
}
.sr-chart-area svg {
    display: block;
    margin: 0 auto;
}


/* ---- Legend Inline: Heat Duration | Delay Categories side by side ---- */
.sr-legend-inline {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}
.sr-legend-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.sr-legend-divider {
    width: 1px;
    align-self: stretch;
    background: var(--sr-border);
    min-height: 20px;
}
@media (max-width: 768px) {
    .sr-legend-divider { display: none; }
}

/* ---- Grid Empty Message ---- */
.sr-grid-empty-msg {
    text-align: center;
    padding: 20px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--sr-text-muted);
    background: var(--sr-surface-raised);
    border: 1px dashed var(--sr-border);
    border-radius: var(--sr-radius-sm);
}

/* ---- Loading State ---- */
@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.sr-spin {
    animation: spin 1s linear infinite;
}
.spinner {
    animation: spin 1s linear infinite;
    transform-origin: center;
}

.sr-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 16px;
}

.sr-loading-spinner {
    width: 48px; height: 48px;
    border-radius: 50%;
    border: 3px solid var(--sr-border);
    border-top-color: var(--sr-primary-light);
    animation: spin .8s linear infinite;
}

.sr-loading-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--sr-text-muted);
    letter-spacing: 0.01em;
}

/* ---- Empty / No-Data State ---- */
.sr-empty-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 12px;
}

.sr-empty-icon {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: var(--sr-surface-raised);
    border: 2px dashed var(--sr-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sr-text-muted);
}

.sr-empty-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--sr-text-muted);
}

.sr-empty-hint {
    font-size: 12.5px;
    color: var(--sr-text-muted);
    opacity: .7;
}

/* ---- Skeleton Loading ---- */
.sr-skeleton {
    background: var(--sr-surface);
    border: 1px solid var(--sr-border);
    border-radius: var(--sr-radius);
    padding: 20px;
}

.skeleton-input,
.skeleton-select,
.skeleton-button,
.skeleton-grid {
    border-radius: var(--sr-radius-sm);
    background: linear-gradient(
        100deg,
        #f1f5f9 30%,
        #e2e8f0 50%,
        #f1f5f9 70%
    );
    background-size: 300% 100%;
    animation: sr-shimmer 1.8s ease-in-out infinite;
}

@keyframes sr-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---- Recipes Average Table ---- */
.sr-recipes-avg-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--sr-border);
    border-radius: var(--sr-radius-sm);
    overflow: hidden;
    font-variant-numeric: tabular-nums;
}
.sr-recipes-avg-table thead th {
    padding: 10px 14px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sr-text-secondary);
    background: var(--sr-surface-raised);
    border-bottom: 2px solid var(--sr-border);
    text-align: center;
}
.sr-recipes-avg-table thead th:first-child {
    text-align: left;
    width: 160px;
}
.sr-recipes-avg-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
}
.sr-recipes-avg-table tbody tr:last-child {
    border-bottom: none;
}
.sr-recipes-avg-table tbody tr:hover td {
    background: rgba(59,130,246,.03);
}
.sr-ravg-label {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    color: var(--sr-text-secondary);
    background: var(--sr-surface-raised);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid var(--sr-border);
}
.sr-ravg-value {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--sr-text);
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
}

/* ---- Card entrance animation ---- */
@keyframes sr-fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.sr-card {
    animation: sr-fadeUp .4s ease-out both;
}

/* Staggered entrance for cards in grids */
.sr-grid-2 > .sr-card:nth-child(1) { animation-delay: 0s; }
.sr-grid-2 > .sr-card:nth-child(2) { animation-delay: .06s; }
.sr-grid-1 > .sr-card:nth-child(1) { animation-delay: 0s; }
.sr-grid-1 > .sr-card:nth-child(2) { animation-delay: .06s; }

/* ---- Scrollbar Styling ---- */
#casters-shift-report ::-webkit-scrollbar {
    width: 6px; height: 6px;
}
#casters-shift-report ::-webkit-scrollbar-track {
    background: transparent;
}
#casters-shift-report ::-webkit-scrollbar-thumb {
    background: var(--sr-border-strong);
    border-radius: 3px;
}
#casters-shift-report ::-webkit-scrollbar-thumb:hover {
    background: var(--sr-text-muted);
}

/* ---- Print Styles ---- */
@media print {
    .sr-page-header { background: #fff !important; color: #000 !important; }
    .sr-page-header::before, .sr-page-header::after { display: none; }
    .sr-title { color: #000 !important; }
    .sr-card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
    .sr-btn-primary, .sr-nav-btn, .sr-calendar-btn { display: none !important; }
}
