/* ══════════════════════════════════════════════════════════════
   Change Control Module — Design System
   Mirrors the GAD Projects design language for consistency
   ══════════════════════════════════════════════════════════════ */

/* Fix: Radzen's translateZ(0) on .rz-body creates a containing block
   that breaks position:fixed overlays. Remove it so our popup overlay
   is fixed relative to the viewport, not the scroll container. */
.rz-layout .rz-body {
    transform: none !important;
}

.cc-page {
    --cc-brand-primary: #4f46e5;
    --cc-brand-primary-hover: #4338ca;
    --cc-brand-light: #eef2ff;
    --cc-surface: #f8f9fc;
    --cc-surface-card: #ffffff;
    --cc-text-primary: #1e293b;
    --cc-text-secondary: #64748b;
    --cc-border: #e2e8f0;
    --cc-radius: 0.75rem;
    --cc-shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --cc-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --cc-shadow-md: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.06);
    --cc-shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.06);
    --cc-transition: 150ms ease;
    padding: 1.5rem;
}

/* ── Page Header ── */
.cc-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.cc-page-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.cc-page-header h3 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--cc-text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.cc-page-header h3 .rzi {
    font-size: 1.5rem;
    color: var(--cc-brand-primary);
}
.cc-header-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.cc-header-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--cc-text-secondary);
}
.cc-header-stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.cc-dot-total     { background: #6366f1; }
.cc-dot-pending   { background: #f59e0b; }
.cc-dot-scheduled { background: #0ea5e9; }
.cc-dot-emergency { background: #ef4444; }

/* ── Segmented Tab Bar ── */
.cc-tab-bar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem;
    background: var(--cc-surface);
    border: 1px solid var(--cc-border);
    border-radius: 0.75rem;
    margin-bottom: 1.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.cc-tab-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--cc-text-secondary);
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--cc-transition);
}
.cc-tab-item:hover {
    color: var(--cc-text-primary);
    background: var(--cc-surface-card);
}
.cc-tab-item.active {
    color: var(--cc-brand-primary);
    background: var(--cc-surface-card);
    box-shadow: var(--cc-shadow-sm);
}
.cc-tab-item i {
    font-size: 0.85rem;
}
.cc-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 999px;
    background: var(--cc-border);
    color: var(--cc-text-secondary);
}
.cc-tab-item.active .cc-tab-count {
    background: var(--cc-brand-light);
    color: var(--cc-brand-primary);
}

/* ── Grid Wrapper ── */
.cc-grid-wrapper {
    background: var(--cc-surface-card);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow-sm);
    overflow: hidden;
}
.cc-grid-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--cc-border);
    background: var(--cc-surface);
}
.cc-grid-result-count {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--cc-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.cc-grid-wrapper .rz-datatable {
    font-size: 0.8125rem;
}
.cc-grid-wrapper .rz-datatable-thead th {
    background: var(--cc-surface-card);
    color: var(--cc-text-secondary);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--cc-border);
    padding: 0.55rem 0.75rem;
}
.cc-grid-wrapper .rz-datatable-data td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.cc-grid-wrapper .rz-datatable-data tr {
    transition: background var(--cc-transition);
    cursor: pointer;
}
.cc-grid-wrapper .rz-datatable-data tr:hover {
    background: var(--cc-brand-light);
}
/* ── Description Cell ── */
.cc-desc-cell {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.cc-desc-text {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--cc-text-primary);
    line-height: 1.4;
}
.cc-desc-meta {
    font-size: 0.7rem;
    color: var(--cc-text-secondary);
}
/* ── Schedule Cell ── */
.cc-schedule-cell {
    font-size: 0.78rem;
    color: var(--cc-text-primary);
    font-weight: 500;
}
/* ── Risk Pill ── */
.cc-risk-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 700;
}
/* ── Pager ── */
.cc-grid-wrapper .rz-pager {
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--cc-border);
    background: var(--cc-surface);
    font-size: 0.8rem;
}
.cc-grid-wrapper .rz-pager .rz-pager-summary {
    font-size: 0.72rem;
    color: var(--cc-text-secondary);
    font-weight: 500;
}
.cc-grid-wrapper .rz-paginator-page,
.cc-grid-wrapper .rz-paginator-first,
.cc-grid-wrapper .rz-paginator-prev,
.cc-grid-wrapper .rz-paginator-next,
.cc-grid-wrapper .rz-paginator-last {
    border-radius: 6px;
    min-width: 30px;
    height: 30px;
    font-size: 0.72rem;
    font-weight: 600;
    transition: all var(--cc-transition);
}
.cc-grid-wrapper .rz-state-active.rz-paginator-page {
    background: var(--cc-brand-primary);
    color: #fff;
    box-shadow: 0 1px 3px rgba(79,70,229,0.25);
}
/* ── Filter inputs ── */
.cc-grid-wrapper .rz-grid-filter .rz-textbox,
.cc-grid-wrapper .rz-grid-filter .rz-dropdown {
    font-size: 0.75rem;
    border-radius: 6px;
}
.cc-grid-wrapper .rz-grid-filter-icon {
    font-size: 0.8rem;
    opacity: 0.5;
    transition: opacity var(--cc-transition), color var(--cc-transition);
}
.cc-grid-wrapper .rz-grid-filter-icon:hover {
    opacity: 1;
    color: var(--cc-brand-primary);
}
.cc-grid-wrapper .rz-grid-filter-active .rz-grid-filter-icon {
    opacity: 1;
    color: var(--cc-brand-primary);
}
/* ── Sort icons ── */
.cc-grid-wrapper .rz-sortable-column .rz-sortable-column-icon {
    font-size: 0.7rem;
    opacity: 0.5;
    transition: opacity var(--cc-transition);
}
.cc-grid-wrapper .rz-sortable-column:hover .rz-sortable-column-icon {
    opacity: 1;
}
/* ── Column resize handle ── */
.cc-grid-wrapper .rz-column-resizer {
    width: 6px;
    cursor: col-resize;
}

/* ── Calendar Wrapper ── */
.cc-calendar-wrapper {
    background: var(--cc-surface-card);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow-sm);
    overflow: hidden;
    padding: 1rem;
}
.cc-calendar-wrapper .rz-scheduler {
    border: none;
    font-size: 0.8125rem;
}
.cc-calendar-wrapper .rz-scheduler-nav {
    padding: 0.5rem 0;
    gap: 0.5rem;
}
.cc-calendar-wrapper .rz-scheduler-nav button {
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
}
.cc-calendar-wrapper .rz-scheduler-header th {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cc-text-secondary);
    padding: 0.5rem;
}

/* ── Event pills — Week/Day views ── */
.cc-calendar-wrapper .rz-event {
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 5px 10px;
    cursor: pointer;
    border: none;
    line-height: 1.5;
    min-height: 24px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cc-calendar-wrapper .rz-event:hover {
    opacity: 0.85;
    filter: brightness(1.1);
}

/* ── Week/Day view: generous slot height ── */
.cc-calendar-wrapper .rz-scheduler-week td,
.cc-calendar-wrapper .rz-scheduler-day td {
    min-height: 60px;
}

/* ── View Toggle Buttons ── */
.cc-cal-view-toggle {
    display: inline-flex;
    gap: 0;
    border: 1px solid var(--cc-border);
    border-radius: 8px;
    overflow: hidden;
}
.cc-cal-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--cc-text-secondary);
    background: var(--cc-surface-card);
    border: none;
    cursor: pointer;
    transition: all var(--cc-transition);
    white-space: nowrap;
}
.cc-cal-view-btn + .cc-cal-view-btn {
    border-left: 1px solid var(--cc-border);
}
.cc-cal-view-btn:hover {
    background: var(--cc-surface);
    color: var(--cc-text-primary);
}
.cc-cal-view-btn.active {
    background: var(--cc-brand-primary);
    color: #fff;
}

/* ── Agenda View ── */
.cc-agenda-date-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.75rem 0 0.4rem;
    border-bottom: 2px solid var(--cc-brand-primary);
    margin-bottom: 0;
}
.cc-agenda-date-header:not(:first-child) {
    margin-top: 1.25rem;
}
.cc-agenda-day {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cc-brand-primary);
}
.cc-agenda-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--cc-text-primary);
}
.cc-agenda-count {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--cc-text-secondary);
    margin-left: auto;
}

.cc-agenda-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid var(--cc-border);
    cursor: pointer;
    transition: background var(--cc-transition);
}
.cc-agenda-row:hover {
    background: var(--cc-surface);
}
.cc-agenda-color-bar {
    width: 4px;
    min-height: 40px;
    border-radius: 2px;
    flex-shrink: 0;
    align-self: stretch;
}
.cc-agenda-time {
    min-width: 80px;
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--cc-text-primary);
    line-height: 1.5;
}
.cc-agenda-time-end {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--cc-text-secondary);
}
.cc-agenda-content {
    flex: 1;
    min-width: 0;
}
.cc-agenda-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--cc-text-primary);
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cc-agenda-details {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.cc-agenda-owner {
    font-size: 0.72rem;
    color: var(--cc-text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.cc-agenda-actions {
    flex-shrink: 0;
}

/* ── Facility Tag in Popup ── */
.cc-facility-tag {
    display: inline-block;
    background: var(--cc-surface);
    border: 1px solid var(--cc-border);
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--cc-text-primary);
    margin: 0.15rem 0.15rem 0.15rem 0;
}

/* ── Calendar Toolbar ── */
.cc-calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--cc-border);
    flex-wrap: wrap;
}
.cc-calendar-legend {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.cc-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--cc-text-secondary);
}
.cc-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}
.cc-calendar-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Calendar Detail Popup ── */
/* NOTE: Popup renders outside .cc-page so CSS variables aren't inherited.
   Use hardcoded values here. Dark mode overrides below. */
.cc-cal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    animation: ccFadeIn 0.15s ease;
}
.cc-cal-popup {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 480px;
    margin: 1rem;
    animation: ccSlideUp 0.2s ease;
}
@keyframes ccFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes ccSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.cc-cal-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}
.cc-cal-popup-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 150ms ease;
}
.cc-cal-popup-close:hover {
    background: #f8f9fc;
    color: #1e293b;
}
.cc-cal-popup-body {
    padding: 1rem 1.25rem;
    max-height: 60vh;
    overflow-y: auto;
}
.cc-cal-popup-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 1rem;
    line-height: 1.4;
}
.cc-cal-popup-meta {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.cc-cal-popup-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.cc-cal-popup-label {
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    min-width: 70px;
    padding-top: 2px;
}
.cc-cal-popup-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem 1rem;
    border-top: 1px solid #e2e8f0;
}

/* ── CC ID Chip ── */
.cc-id-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--cc-brand-primary);
    background: var(--cc-brand-light);
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    white-space: nowrap;
}

.cc-type-chip {
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--cc-text-secondary);
    background: var(--cc-surface-muted, rgba(0, 0, 0, 0.05));
    border: 1px solid var(--cc-border, rgba(0, 0, 0, 0.1));
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    white-space: nowrap;
}

/* ── Description Link (legacy — kept for Details page references) ── */
.cc-desc-link {
    color: var(--cc-text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--cc-transition);
}
.cc-desc-link:hover {
    color: var(--cc-brand-primary);
    text-decoration: underline;
}

/* ── Badge Overrides ── */
.cc-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.02em;
}
/* Category badges */
.cc-badge-standard  { background: #dcfce7; color: #166534; }
.cc-badge-normal    { background: #dbeafe; color: #1e40af; }
.cc-badge-emergency { background: #fee2e2; color: #991b1b; }
.cc-badge-unknown   { background: #f1f5f9; color: #475569; }
/* Status badges */
.cc-badge-pending    { background: #fef3c7; color: #92400e; }
.cc-badge-scheduled  { background: #dbeafe; color: #1e40af; }
.cc-badge-onhold     { background: #f1f5f9; color: #475569; }
.cc-badge-completed  { background: #dcfce7; color: #166534; }
.cc-badge-canceled   { background: #e2e8f0; color: #374151; }
.cc-badge-validating { background: #ede9fe; color: #5b21b6; }
/* Risk badges */
.cc-risk-low    { background: #dcfce7; color: #166534; font-weight: 700; }
.cc-risk-medium { background: #fef3c7; color: #92400e; font-weight: 700; }
.cc-risk-high   { background: #fecaca; color: #991b1b; font-weight: 700; }

/* ── PIR Indicator ── */
.cc-pir-done   { color: #059669; }
.cc-pir-needed { color: #d97706; }

/* ── Empty State ── */
.cc-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--cc-text-secondary);
}
.cc-empty-state .rzi {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 0.75rem;
}
.cc-empty-state p {
    font-size: 0.9rem;
    margin: 0;
}

/* ── Loading State ── */
.cc-loading {
    text-align: center;
    padding: 3rem 1.5rem;
}
.cc-loading p {
    color: var(--cc-text-secondary);
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

/* Inline loader shown above the Calendar tab while CC list and the
   per-CC facility map are being fetched. Sits at the top of the
   wrapper so the user sees progress even though the agenda below
   still renders any already-cached items. */
.cc-calendar-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    background: var(--cc-surface-subtle, #f9fafb);
    border: 1px solid var(--cc-border, #e5e7eb);
    border-radius: 8px;
    color: var(--cc-text-secondary, #6b7280);
    font-size: 0.85rem;
}

/* ══════════════════════════════════════════════════════════════
   CC Details Page
   ══════════════════════════════════════════════════════════════ */
.cc-details-page {
    --cc-brand-primary: #4f46e5;
    --cc-brand-light: #eef2ff;
    --cc-surface: #f8f9fc;
    --cc-surface-card: #ffffff;
    --cc-text-primary: #1e293b;
    --cc-text-secondary: #64748b;
    --cc-border: #e2e8f0;
    --cc-radius: 0.75rem;
    --cc-shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --cc-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --cc-transition: 150ms ease;
    padding: 1.5rem;
}

/* ── Detail Header ── */
.cc-detail-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--cc-border);
}
.cc-detail-header h3 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--cc-text-primary);
    margin: 0;
}

/* ── Section Cards ── */
.cc-section {
    margin-bottom: 1.25rem;
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow-sm);
    background: var(--cc-surface-card);
    overflow: hidden;
}
.cc-section-header {
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cc-text-secondary);
    background: var(--cc-surface);
    border-bottom: 1px solid var(--cc-border);
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.cc-section-header .rzi {
    font-size: 1rem;
    opacity: 0.7;
}
.cc-section-body {
    padding: 1.25rem;
}
.cc-section-body p {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* ── Accent Section (Warning / Danger borders) ── */
.cc-section-accent-warning {
    border-left: 3px solid #f59e0b;
}
.cc-section-accent-warning .cc-section-header {
    background: rgba(245, 158, 11, 0.06);
}
.cc-section-accent-danger {
    border-left: 3px solid #ef4444;
}
.cc-section-accent-danger .cc-section-header {
    background: rgba(239, 68, 68, 0.06);
}

/* ── Detail Info Items ── */
.cc-info-item {
    margin-bottom: 0.75rem;
}
.cc-info-label {
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cc-text-secondary);
    margin-bottom: 0.15rem;
}
.cc-info-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--cc-text-primary);
}

/* ── Sidebar Action Card ── */
.cc-actions-card {
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow-sm);
    background: var(--cc-surface-card);
    overflow: hidden;
    margin-bottom: 1.25rem;
    position: sticky;
    top: 1rem;
}
.cc-actions-card .cc-section-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    font-size: 0.75rem;
}
.cc-actions-card .cc-section-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ── Facility Tags ── */
.cc-facility-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    margin: 0.15rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #f1f5f9;
    color: var(--cc-text-primary);
    border: 1px solid var(--cc-border);
}

/* ── Comment / Note Timeline ── */
.cc-comment {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.cc-comment:last-child {
    border-bottom: none;
}
.cc-comment-meta {
    font-size: 0.72rem;
    color: var(--cc-text-secondary);
    font-weight: 600;
    margin-bottom: 0.3rem;
}
.cc-comment-body {
    font-size: 0.85rem;
    color: var(--cc-text-primary);
    margin: 0;
    line-height: 1.5;
}

/* ── Risk Matrix ── */
.cc-risk-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}
.cc-risk-item {
    text-align: center;
    padding: 0.75rem;
    background: var(--cc-surface);
    border-radius: 0.5rem;
    border: 1px solid var(--cc-border);
}
.cc-risk-item-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cc-text-secondary);
    margin-bottom: 0.25rem;
}
.cc-risk-item-value {
    font-size: 1.1rem;
    font-weight: 700;
}

/* ── Responsive ── */
@media (max-width: 991.98px) {
    .cc-page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .cc-tab-bar { gap: 0.15rem; }
    .cc-tab-item { padding: 0.4rem 0.65rem; font-size: 0.72rem; }
    .cc-risk-grid { grid-template-columns: 1fr; }
}
@media (max-width: 575.98px) {
    .cc-header-stats { gap: 0.5rem; }
    .cc-tab-item span { display: none; }
    .cc-tab-item i { font-size: 1rem; }
    .cc-tab-count { display: none; }
}

/* ══════════════════════════════════════════════════════════════
   CC Wizard (New / Edit Change Control)
   Matches New RFS design pattern
   ══════════════════════════════════════════════════════════════ */
.cc-wizard {
    --cc-brand-primary: #4f46e5;
    --cc-brand-primary-hover: #4338ca;
    --cc-brand-light: #eef2ff;
    --cc-surface: #f8f9fc;
    --cc-surface-card: #ffffff;
    --cc-text-primary: #1e293b;
    --cc-text-secondary: #64748b;
    --cc-text-muted: #94a3b8;
    --cc-border: #e2e8f0;
    --cc-radius: 0.75rem;
    --cc-shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --cc-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --cc-shadow-md: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.06);
    --cc-shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.06);
    --cc-transition: 200ms ease;
    --cc-step-active: #3b82f6;
    --cc-step-completed: #22c55e;
    --cc-step-pending-bg: #ffffff;
    --cc-step-pending-border: #e2e8f0;
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
}

/* ── Wizard Header ── */
.cc-wizard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.cc-wizard-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cc-text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.cc-wizard-header h2 .rzi {
    font-size: 1.6rem;
    color: var(--cc-brand-primary);
}
.cc-wizard-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cc-wizard-actions .rz-button {
    border-radius: 10px !important;
}

/* ── Two-column Layout ── */
.cc-wizard-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}
.cc-wizard-main { min-width: 0; }

/* ── Preview Panel ── */
.cc-preview {
    background: var(--cc-surface-card);
    border: 1px solid var(--cc-border);
    border-radius: 12px;
    box-shadow: var(--cc-shadow);
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}
.cc-preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--cc-text-primary);
    border-bottom: 1px solid var(--cc-border);
}
.cc-preview-header .rzi {
    color: var(--cc-brand-primary);
    font-size: 1.1rem;
}
.cc-preview-body {
    padding: 16px 20px;
}
.cc-preview-section {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cc-text-secondary);
    margin: 16px 0 8px 0;
    display: flex;
    align-items: center;
    gap: 4px;
}
.cc-preview-section .rzi {
    font-size: 0.85rem;
}
.cc-preview-row {
    padding: 10px 0;
    border-bottom: 1px solid var(--cc-border);
}
.cc-preview-row:last-child { border-bottom: none; }
.cc-preview-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cc-text-secondary);
    margin-bottom: 4px;
}
.cc-preview-value {
    font-size: 0.8rem;
    color: var(--cc-text-primary);
    font-weight: 500;
}
.cc-preview-text {
    display: block;
    white-space: pre-line;
    font-size: 0.78rem;
    line-height: 1.5;
    max-height: 80px;
    overflow: hidden;
    color: var(--cc-text-primary);
}
.cc-preview-risk-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}
.cc-preview-risk-card {
    padding: 10px;
    border: 1px solid var(--cc-border);
    border-radius: 8px;
    text-align: center;
}
.cc-preview-risk-label {
    display: block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cc-text-secondary);
    margin-bottom: 2px;
}
.cc-preview-risk-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--cc-text-primary);
}
.cc-preview-schedule {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--cc-surface);
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--cc-text-primary);
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.cc-preview-schedule-arrow {
    color: var(--cc-text-muted);
}
.cc-preview-duration {
    margin-left: auto;
    background: var(--cc-brand-light);
    color: var(--cc-brand-primary);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
}

/* ── Step Progress Indicator ── */
.cc-steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0 16px;
    margin-bottom: 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.cc-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: opacity var(--cc-transition);
}
.cc-step:hover { opacity: 0.85; }
.cc-step-indicator {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    border: 2px solid var(--cc-step-pending-border);
    background: var(--cc-step-pending-bg);
    color: var(--cc-text-muted);
}
.cc-step.active .cc-step-indicator {
    background: var(--cc-step-active);
    border-color: var(--cc-step-active);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(59,130,246,0.2);
}
.cc-step.completed .cc-step-indicator {
    background: var(--cc-step-completed);
    border-color: var(--cc-step-completed);
    color: #fff;
}
.cc-step-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--cc-text-muted);
    text-align: center;
    max-width: 80px;
    line-height: 1.2;
    transition: color var(--cc-transition);
}
.cc-step.active .cc-step-label {
    color: var(--cc-step-active);
    font-weight: 700;
}
.cc-step.completed .cc-step-label {
    color: var(--cc-step-completed);
}
.cc-step-connector {
    flex: 1;
    min-width: 20px;
    max-width: 60px;
    height: 2px;
    background: var(--cc-border);
    margin-top: 20px;
    transition: background 0.3s ease;
}
.cc-step-connector.done {
    background: var(--cc-step-completed);
}

/* ── Step Content Card ── */
.cc-step-card {
    background: var(--cc-surface-card);
    border: 1px solid var(--cc-border);
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--cc-shadow);
    animation: ccFadeIn 0.3s ease;
}
@keyframes ccFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.cc-step-card-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cc-text-secondary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--cc-border);
    text-align: center;
}
.cc-step-card-header .step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--cc-brand-primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
}

/* ── Form Fields ── */
.cc-wizard .cc-field {
    margin-bottom: 20px;
}
.cc-wizard .cc-field-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--cc-text-primary);
    margin-bottom: 6px;
}
.cc-wizard .cc-field-hint {
    font-size: 0.75rem;
    color: var(--cc-text-secondary);
    margin-bottom: 8px;
}
.cc-wizard .rz-textarea,
.cc-wizard .rz-dropdown,
.cc-wizard .rz-datepicker {
    border-radius: 10px !important;
}
.cc-wizard .rz-textarea:focus-within,
.cc-wizard .rz-dropdown:focus-within {
    border-color: var(--cc-brand-primary) !important;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.12) !important;
}

/* ── Category Cards ── */
.cc-category-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cc-category-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 2px solid var(--cc-border);
    border-radius: 10px;
    background: var(--cc-surface-card);
    cursor: pointer;
    transition: all var(--cc-transition);
}
.cc-category-option:hover {
    border-color: var(--cc-brand-primary);
    background: var(--cc-brand-light);
}
.cc-category-option.selected {
    border-color: var(--cc-brand-primary);
    background: var(--cc-brand-light);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
.cc-category-radio {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--cc-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--cc-transition);
}
.cc-category-option.selected .cc-category-radio {
    border-color: var(--cc-brand-primary);
}
.cc-category-option.selected .cc-category-radio::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--cc-brand-primary);
}
.cc-category-info h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--cc-text-primary);
    margin: 0 0 2px 0;
}
.cc-category-info p {
    font-size: 0.75rem;
    color: var(--cc-text-secondary);
    margin: 0;
}

/* ── Risk Score Display ── */
.cc-risk-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    background: var(--cc-surface);
    border-radius: 10px;
    margin-top: 12px;
}
.cc-risk-display .cc-risk-score {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}
.cc-risk-display .cc-risk-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cc-text-secondary);
}

/* ── Navigation Bar ── */
.cc-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--cc-surface-card);
    border: 1px solid var(--cc-border);
    border-radius: 12px;
    box-shadow: var(--cc-shadow-sm);
}
.cc-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--cc-transition);
}
.cc-nav-btn .rzi { font-size: 16px; }
.cc-nav-prev {
    background: var(--cc-surface);
    color: var(--cc-text-secondary);
    border: 1px solid var(--cc-border);
}
.cc-nav-prev:hover:not(:disabled) {
    background: var(--cc-border);
    color: var(--cc-text-primary);
}
.cc-nav-next {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    box-shadow: var(--cc-shadow-md);
}
.cc-nav-next:hover:not(:disabled) {
    opacity: 0.9;
    box-shadow: var(--cc-shadow-lg);
    transform: translateY(-1px);
}
.cc-nav-submit {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    box-shadow: var(--cc-shadow-md);
    min-width: 180px;
}
.cc-nav-submit:hover:not(:disabled) {
    opacity: 0.9;
    box-shadow: var(--cc-shadow-lg);
    transform: translateY(-1px);
}
.cc-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}
.cc-nav-btn:active:not(:disabled) {
    transform: translateY(0);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .cc-wizard-layout {
        grid-template-columns: 1fr;
    }
    .cc-preview {
        position: static;
        max-height: none;
    }
}
@media (max-width: 768px) {
    .cc-wizard { padding: 16px; }
    .cc-step-card { padding: 20px; }
    .cc-steps { padding: 0; gap: 0; }
    .cc-step-label { font-size: 0.55rem; max-width: 60px; }
    .cc-step-indicator { width: 32px; height: 32px; font-size: 0.7rem; }
    .cc-step-connector { min-width: 12px; }
    .cc-nav-bar { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
    .cc-nav-btn { flex: 1; min-width: auto; padding: 10px 16px; }
    .cc-wizard-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ══════════════════════════════════════════════════════════════
   DARK MODE
   ══════════════════════════════════════════════════════════════ */
body[data-theme="dark"] .cc-page,
body[data-theme="dark"] .cc-details-page,
body[data-theme="dark"] .cc-wizard {
    --cc-surface: #1e293b;
    --cc-surface-card: #0f172a;
    --cc-text-primary: #e2e8f0;
    --cc-text-secondary: #94a3b8;
    --cc-border: #334155;
    --cc-brand-light: rgba(79, 70, 229, 0.15);
}
body[data-theme="dark"] .cc-grid-wrapper .rz-datatable-thead th {
    background: #1e293b;
    color: #94a3b8;
    border-bottom-color: #475569;
}
body[data-theme="dark"] .cc-grid-wrapper .rz-datatable-data td {
    border-bottom-color: #334155;
}
body[data-theme="dark"] .cc-grid-wrapper .rz-pager {
    background: #1e293b;
    border-top-color: #334155;
}
body[data-theme="dark"] .cc-grid-wrapper .rz-state-active.rz-paginator-page {
    background: #6366f1;
}
body[data-theme="dark"] .cc-grid-wrapper .rz-datatable-data tr:hover {
    background: rgba(79, 70, 229, 0.1);
}
body[data-theme="dark"] .cc-grid-toolbar {
    background: #1e293b;
    border-bottom-color: #334155;
}
body[data-theme="dark"] .cc-tab-bar {
    background: #1e293b;
    border-color: #334155;
}
body[data-theme="dark"] .cc-tab-item {
    color: #94a3b8;
}
body[data-theme="dark"] .cc-tab-item:hover {
    color: #e2e8f0;
    background: #0f172a;
}
body[data-theme="dark"] .cc-tab-item.active {
    color: #a5b4fc;
    background: #0f172a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
body[data-theme="dark"] .cc-tab-count {
    background: #334155;
    color: #94a3b8;
}
body[data-theme="dark"] .cc-tab-item.active .cc-tab-count {
    background: rgba(99,102,241,0.2);
    color: #a5b4fc;
}
body[data-theme="dark"] .cc-desc-text {
    color: #e2e8f0;
}
body[data-theme="dark"] .cc-desc-meta {
    color: #64748b;
}
body[data-theme="dark"] .cc-calendar-wrapper {
    background: #0f172a;
    border-color: #334155;
}
body[data-theme="dark"] .cc-calendar-wrapper .rz-scheduler-header th {
    color: #94a3b8;
}
body[data-theme="dark"] .cc-calendar-toolbar {
    border-bottom-color: #334155;
}
body[data-theme="dark"] .cc-cal-popup {
    background: #1e293b;
    border-color: #475569;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 4px 16px rgba(0,0,0,0.4);
}
body[data-theme="dark"] .cc-cal-popup-header,
body[data-theme="dark"] .cc-cal-popup-actions {
    border-color: #334155;
}
body[data-theme="dark"] .cc-cal-popup-close {
    color: #94a3b8;
}
body[data-theme="dark"] .cc-cal-popup-close:hover {
    background: #334155;
    color: #e2e8f0;
}
body[data-theme="dark"] .cc-cal-popup-title {
    color: #f1f5f9;
}
body[data-theme="dark"] .cc-cal-popup-label {
    color: #94a3b8;
}
body[data-theme="dark"] .cc-cal-overlay {
    background: rgba(0,0,0,0.65);
}
/* ── Dark mode: Agenda view ── */
body[data-theme="dark"] .cc-agenda-date-header {
    border-bottom-color: #6366f1;
}
body[data-theme="dark"] .cc-agenda-day {
    color: #a5b4fc;
}
body[data-theme="dark"] .cc-agenda-date {
    color: #e2e8f0;
}
body[data-theme="dark"] .cc-agenda-count {
    color: #94a3b8;
}
body[data-theme="dark"] .cc-agenda-row {
    border-bottom-color: #334155;
}
body[data-theme="dark"] .cc-agenda-row:hover {
    background: #1e293b;
}
body[data-theme="dark"] .cc-agenda-time {
    color: #e2e8f0;
}
body[data-theme="dark"] .cc-agenda-time-end {
    color: #94a3b8;
}
body[data-theme="dark"] .cc-agenda-title {
    color: #f1f5f9;
}
body[data-theme="dark"] .cc-agenda-owner {
    color: #94a3b8;
}
body[data-theme="dark"] .cc-cal-view-toggle {
    border-color: #475569;
}
body[data-theme="dark"] .cc-cal-view-btn {
    background: #0f172a;
    color: #94a3b8;
    border-color: #475569;
}
body[data-theme="dark"] .cc-cal-view-btn:hover {
    background: #1e293b;
    color: #e2e8f0;
}
body[data-theme="dark"] .cc-cal-view-btn.active {
    background: #6366f1;
    color: #fff;
}
body[data-theme="dark"] .cc-id-chip {
    background: rgba(79, 70, 229, 0.2);
    color: #a5b4fc;
}
body[data-theme="dark"] .cc-facility-tag {
    background: #1e293b;
    color: #cbd5e1;
    border-color: #475569;
}
body[data-theme="dark"] .cc-step-indicator {
    background: #1e293b;
    border-color: #475569;
    color: #94a3b8;
}
body[data-theme="dark"] .cc-step-connector {
    background: #334155;
}
body[data-theme="dark"] .cc-category-option {
    background: #1e293b;
    border-color: #334155;
}
body[data-theme="dark"] .cc-category-option:hover {
    border-color: #6366f1;
    background: rgba(79, 70, 229, 0.1);
}
body[data-theme="dark"] .cc-category-option.selected {
    border-color: #6366f1;
    background: rgba(79, 70, 229, 0.15);
}
body[data-theme="dark"] .cc-nav-prev {
    background: #1e293b;
    border-color: #475569;
    color: #94a3b8;
}
body[data-theme="dark"] .cc-nav-prev:hover:not(:disabled) {
    background: #334155;
    color: #e2e8f0;
}
body[data-theme="dark"] .cc-risk-display {
    background: #1e293b;
}
