/* ==========================================================================
   CSS GLOBAL TOKENS & DUAL THEMES
   ========================================================================== */

:root {
    /* FONTS */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* THEME LIGHT DEFAULT VARIABLE TOKENS (HOLLER FOREST & SAGE PALETTE) */
    --holler-forest: #0f372f;
    --holler-forest-deep: #071411;
    --holler-forest-mid: #164f43;
    --holler-lime: #daf478;
    --holler-lime-strong: #c5e84c;

    --bg-app: #f3f7f5;
    --bg-header: rgba(255, 255, 255, 0.9);
    --bg-card: rgba(255, 255, 255, 0.88);
    --bg-card-hover: rgba(255, 255, 255, 0.98);
    --bg-input: #ffffff;
    --bg-input-border: #c6d9d2;
    --bg-table-hdr: #eaf2ee;
    --bg-table-row-hover: #eef5f1;
    --border-glass: rgba(15, 55, 47, 0.12);
    --border-input-focus: #0f372f;

    --text-primary: #0b2923;
    --text-secondary: #2c5249;
    --text-muted: #587c72;
    --text-on-accent: #daf478;

    --accent-primary: #0f372f;
    --accent-primary-hover: #175246;
    --accent-primary-light: rgba(218, 244, 120, 0.35);
    
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.12);
    
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.12);
    
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.12);
    
    --info: #14b8a6;
    --info-light: rgba(20, 184, 166, 0.12);

    --shadow-main: 0 10px 30px -10px rgba(15, 55, 47, 0.15);
    --shadow-sm: 0 4px 6px -1px rgba(15, 55, 47, 0.06);
    --shadow-inset: inset 0 2px 4px 0 rgba(15, 55, 47, 0.05);
    
    --backdrop-blur: blur(16px);
    --transition-speed: 0.3s;
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
}

[data-theme="dark"] {
    /* THEME DARK VARIABLE TOKENS (HOLLER DEEP FOREST & ELECTRIC LIME PALETTE) */
    --bg-app: #071411;
    --bg-header: rgba(10, 29, 25, 0.88);
    --bg-card: rgba(13, 38, 32, 0.72);
    --bg-card-hover: rgba(18, 52, 44, 0.86);
    --bg-input: #0a1f1a;
    --bg-input-border: rgba(218, 244, 120, 0.15);
    --bg-table-hdr: rgba(11, 33, 28, 0.85);
    --bg-table-row-hover: rgba(218, 244, 120, 0.04);
    --border-glass: rgba(218, 244, 120, 0.1);
    --border-input-focus: #daf478;

    --text-primary: #f4f9f6;
    --text-secondary: #c4d9d1;
    --text-muted: #7fa396;
    --text-on-accent: #0f372f;

    --accent-primary: #c9ed55;
    --accent-primary-hover: #daf478;
    --accent-primary-light: rgba(218, 244, 120, 0.14);
    
    --success: #34d399;
    --success-light: rgba(52, 211, 153, 0.15);
    
    --warning: #fbbf24;
    --warning-light: rgba(251, 191, 36, 0.15);
    
    --danger: #f87171;
    --danger-light: rgba(248, 113, 113, 0.15);
    
    --info: #2dd4bf;
    --info-light: rgba(45, 212, 191, 0.15);

    --shadow-main: 0 12px 40px -15px rgba(0, 0, 0, 0.7);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.35);
    --shadow-inset: inset 0 2px 4px 0 rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   BASIC RESET & CONTAINERS
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-sans);
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

.app-container {
    max-width: 1600px;
    padding: 0 24px 48px 24px;
}

/* ==========================================================================
   TYPOGRAPHY & DECORATIONS
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
}

.font-family-mono {
    font-family: var(--font-mono) !important;
}

.font-weight-600 {
    font-weight: 600 !important;
}

.animate-pulse {
    animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.08);
    }
}

/* ==========================================================================
   APP HEADER & SIMULATOR
   ========================================================================== */

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    margin: 20px 0;
    background: var(--bg-header);
    backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    gap: 16px;
    z-index: 10;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--accent-primary);
    color: var(--text-on-accent);
    padding: 10px;
    border-radius: var(--border-radius-md);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.brand-text h1 {
    font-size: 1.3rem;
    letter-spacing: 1px;
    background: linear-gradient(90deg, var(--text-primary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-tagline {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Simulated Time Widget */
.time-simulator-panel {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--bg-input-border);
    padding: 8px 16px;
    border-radius: var(--border-radius-md);
    gap: 16px;
    box-shadow: var(--shadow-inset);
}

.simulator-clock {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-primary);
    font-weight: 600;
}

.clock-icon {
    animation: rotate-clock 15s infinite linear;
}

@keyframes rotate-clock {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.sim-time-text {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-primary);
}

.simulator-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    border-left: 1px solid var(--border-glass);
    padding-left: 14px;
}

.sim-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 4px;
}

/* Theme Switcher Button */
.theme-toggle-btn {
    background: none;
    border: 1px solid var(--bg-input-border);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed) ease;
}

.theme-toggle-btn:hover {
    background-color: var(--accent-primary-light);
    border-color: var(--accent-primary);
    transform: rotate(15deg);
}

.theme-icon {
    transition: all 0.3s ease;
}

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 10px 18px;
    border-radius: var(--border-radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    gap: 8px;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: var(--text-on-accent);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    background-color: var(--accent-primary-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--bg-input-border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--text-muted);
    color: var(--bg-app);
}

.btn-secondary-outline {
    background: transparent;
    border: 1px solid var(--bg-input-border);
    color: var(--text-secondary);
}

.btn-secondary-outline:hover {
    background-color: rgba(148, 163, 184, 0.1);
    color: var(--text-primary);
}

.btn-sim {
    padding: 4px 8px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    border-radius: var(--border-radius-sm);
    background-color: var(--accent-primary-light);
    color: var(--accent-primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.btn-sim:hover {
    background-color: var(--accent-primary);
    color: var(--text-on-accent);
}

.btn-sim-reset {
    background-color: transparent;
    color: var(--text-muted);
    border: 1px dashed var(--bg-input-border);
}

.btn-sim-reset:hover {
    background-color: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger);
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.7rem;
    border-radius: var(--border-radius-sm);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn:active {
    transform: translateY(0);
}

/* ==========================================================================
   GLASS CARDS & METRIC SECTION
   ========================================================================== */

.card-glass {
    background: var(--bg-card);
    backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-main);
    transition: box-shadow var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.card-glass:hover {
    border-color: rgba(99, 102, 241, 0.2);
}

.dashboard-controls-section {
    margin-bottom: 24px;
}

.aging-mode-toggle-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    padding: 14px 24px;
    border-radius: var(--border-radius-lg);
    gap: 16px;
}

.card-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.toggle-switch-wrapper {
    display: flex;
    background: var(--bg-app);
    padding: 4px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-glass);
}

.mode-toggle-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-toggle-btn.active {
    background: var(--bg-input);
    color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

/* Stats Counter Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-main);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    height: 180px;
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.stat-icon-wrapper {
    padding: 8px;
    border-radius: var(--border-radius-md);
}

.active-color { background-color: var(--accent-primary-light); color: var(--accent-primary); }
.success-color { background-color: var(--success-light); color: var(--success); }
.danger-color { background-color: var(--danger-light); color: var(--danger); }

.stat-value {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 800;
    margin: 10px 0;
    color: var(--text-primary);
}

.stat-description {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-alert-overdue {
    border-color: rgba(239, 68, 68, 0.2);
}
[data-theme="dark"] .stat-alert-overdue {
    background: linear-gradient(135deg, rgba(20, 30, 54, 0.65), rgba(239, 68, 68, 0.05));
}

/* Aging Bucket Widget Specifics */
.aging-buckets-card {
    height: auto;
    min-height: 180px;
    justify-content: flex-start;
    grid-column: span 1;
}

@media (min-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .aging-buckets-card {
        grid-column: span 1;
    }
}

.buckets-progress-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
    width: 100%;
}

.bucket-progress-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bucket-label-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 500;
}

.bucket-name {
    color: var(--text-secondary);
}

.bucket-count {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--text-primary);
}

.bucket-progress-bar-bg {
    width: 100%;
    height: 6px;
    background: var(--bg-app);
    border-radius: 3px;
    overflow: hidden;
}

.bucket-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease-out;
}

.new-fill { background-color: var(--success); }
.pending-fill { background-color: var(--accent-primary); }
.risk-fill { background-color: var(--warning); }
.escalated-fill { background-color: var(--danger); }

/* ==========================================================================
   QUEUE MANAGEMENT TOOLBAR
   ========================================================================== */

.queue-section {
    padding: 24px;
    margin-bottom: 24px;
}

.queue-header-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.queue-title-area h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.queue-count-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Queue Filter Panel */
.queue-filters-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
    background: var(--bg-app);
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-glass);
}

@media (min-width: 992px) {
    .queue-filters-bar {
        grid-template-columns: 280px 1fr;
        align-items: center;
    }
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input-wrapper input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--bg-input-border);
    background-color: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.search-input-wrapper input:focus {
    border-color: var(--border-input-focus);
}

.filter-dropdowns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.filter-select-wrapper {
    position: relative;
    min-width: 140px;
}

.filter-select-wrapper select {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--bg-input-border);
    background-color: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
    transition: border-color 0.2s ease;
}

.filter-select-wrapper select:focus {
    border-color: var(--border-input-focus);
}

/* ==========================================================================
   QUEUE DATA TABLE
   ========================================================================== */

.table-scroll-container {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-glass);
}

.queue-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

.queue-table th {
    background-color: var(--bg-table-hdr);
    padding: 14px 18px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-glass);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.queue-table td {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-glass);
    vertical-align: middle;
    color: var(--text-secondary);
}

.queue-table tbody tr {
    transition: background-color 0.2s ease;
}

.queue-table tbody tr:hover {
    background-color: var(--bg-table-row-hover);
}

/* Table Item Elements */
.col-sop-code {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent-primary);
}

.col-sop-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.col-sop-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

.col-assignee-name {
    font-weight: 500;
    color: var(--text-primary);
}

.col-team-label {
    font-size: 0.75rem;
    background-color: var(--accent-primary-light);
    color: var(--accent-primary);
    padding: 2px 6px;
    border-radius: var(--border-radius-sm);
    display: inline-block;
    margin-top: 4px;
    font-weight: 500;
}

/* SLA and Aging */
.aging-number {
    font-family: var(--font-mono);
    font-weight: 600;
}

.sla-progress-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.due-date-display {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Table Empty and Overdue States */
.overdue-highlight-row {
    background-color: var(--danger-light) !important;
}

.overdue-pulse-marker {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--danger);
    border-radius: 50%;
    margin-right: 6px;
    box-shadow: 0 0 8px var(--danger);
}

.empty-state-row td {
    padding: 48px 0;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
    gap: 12px;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ==========================================================================
   BADGES (Priority, Status, Aging Brackets)
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: capitalize;
}

/* Priority Badges */
.badge-priority-low { background-color: var(--bg-app); color: var(--text-muted); border: 1px solid var(--bg-input-border); }
.badge-priority-medium { background-color: var(--accent-primary-light); color: var(--accent-primary); }
.badge-priority-high { background-color: var(--warning-light); color: var(--warning); }
.badge-priority-critical { background-color: var(--danger-light); color: var(--danger); animation: border-pulse 1.5s infinite; }

@keyframes border-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* Status Badges */
.badge-status-assigned { background-color: rgba(99, 102, 241, 0.15); color: var(--accent-primary); border: 1px solid rgba(99, 102, 241, 0.3); }
.badge-status-inprogress { background-color: rgba(6, 182, 212, 0.15); color: var(--info); border: 1px solid rgba(6, 182, 212, 0.3); }
.badge-status-forreview { background-color: rgba(245, 158, 11, 0.15); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-status-completed { background-color: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-status-onhold { background-color: rgba(148, 163, 184, 0.15); color: var(--text-muted); border: 1px solid rgba(148, 163, 184, 0.3); }
.badge-status-cancelled { background-color: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); text-decoration: line-through; }
.badge-status-returned { background-color: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }

/* Aging Bracket Badges */
.badge-bracket-new { background-color: var(--success-light); color: var(--success); }
.badge-bracket-pending { background-color: var(--accent-primary-light); color: var(--accent-primary); }
.badge-bracket-risk { background-color: var(--warning-light); color: var(--warning); animation: pulse-glow 2s infinite ease-in-out; }
.badge-bracket-escalated { background-color: var(--danger-light); color: var(--danger); font-weight: 700; animation: pulse-glow 1.5s infinite ease-in-out; }

/* ==========================================================================
   INTEGRATIONS SECTION
   ========================================================================== */

.integrations-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 992px) {
    .integrations-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.integration-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.integration-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-glass);
}

.integration-icon-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.sharepoint-icon {
    color: #0078d4; /* SharePoint Blue */
}

.email-icon {
    color: var(--accent-primary);
}

.badge-bracket-info {
    background-color: var(--accent-primary-light);
    color: var(--accent-primary);
}

.status-connected {
    background-color: var(--success-light);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* SharePoint Settings Layout */
.integration-settings-form {
    margin-bottom: 14px;
}

.form-row-compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-group-compact {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group-compact label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.input-compact {
    width: 100%;
    padding: 6px 10px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--bg-input-border);
    background-color: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.75rem;
    outline: none;
}

.sp-action-row {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sp-sync-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Sync log terminal */
.sync-terminal {
    background-color: #020617;
    border-radius: var(--border-radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 140px;
}

.terminal-header {
    background-color: #0f172a;
    padding: 6px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: #94a3b8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.terminal-dots {
    display: flex;
    gap: 4px;
}

.terminal-dots .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #475569;
}

.terminal-body {
    padding: 10px 14px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.4;
    overflow-y: auto;
    flex-grow: 1;
    max-height: 180px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.terminal-line {
    color: #38bdf8; /* light cyan */
    word-break: break-all;
}

.system-line {
    color: #64748b; /* grey */
}

.completed-line {
    color: #4ade80; /* bright green */
}

.error-line {
    color: #f87171; /* bright red */
}

/* Notification logs inbox view */
.notification-log-viewer {
    background: var(--bg-input);
    border: 1px solid var(--bg-input-border);
    border-radius: var(--border-radius-md);
    padding: 12px;
    overflow-y: auto;
    flex-grow: 1;
    max-height: 250px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 140px;
}

.empty-notif-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
    padding: 20px;
}

.notif-tab-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* Simulated Email Envelope Box */
.notif-envelope {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-sm);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-left: 3px solid var(--accent-primary);
}

.notif-envelope.envelope-reminder { border-left-color: var(--warning); }
.notif-envelope.envelope-escalation { border-left-color: var(--danger); }

.notif-env-hdr {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    font-weight: 600;
}

.notif-env-recipient { color: var(--text-primary); }
.notif-env-time { color: var(--text-muted); font-family: var(--font-mono); }

.notif-env-subj {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.notif-env-body {
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* ==========================================================================
   MODALS LAYOUT
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(9, 13, 22, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed) ease;
    z-index: 100;
    padding: 16px;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-detail-content {
    max-width: 1000px;
}

.modal-overlay.open .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.2rem;
    color: var(--text-primary);
}

.modal-sop-code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background-color: var(--accent-primary-light);
    color: var(--accent-primary);
    padding: 2px 8px;
    border-radius: var(--border-radius-sm);
    display: inline-block;
    font-weight: 700;
    margin-bottom: 4px;
}

.modal-header-title-wrapper {
    display: flex;
    flex-direction: column;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

.modal-close-btn:hover {
    color: var(--danger);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: var(--bg-table-hdr);
}

/* Modal Form Fields styling */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.required-label::after {
    content: " *";
    color: var(--danger);
}

.form-group input[type="text"],
.form-group input[type="datetime-local"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--bg-input-border);
    background-color: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    font-size: 0.85rem;
    transition: border-color var(--transition-speed) ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="datetime-local"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--border-input-focus);
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 576px) {
    .form-grid-2 {
        grid-template-columns: 1fr 1fr;
    }
}

.field-error-msg {
    font-size: 0.7rem;
    color: var(--danger);
    display: none;
    margin-top: 2px;
}

/* File drag uploader */
.file-uploader-dropzone {
    border: 2px dashed var(--bg-input-border);
    background-color: var(--bg-app);
    padding: 20px;
    border-radius: var(--border-radius-lg);
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.file-uploader-dropzone:hover {
    border-color: var(--accent-primary);
}

.file-uploader-dropzone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.uploader-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.upload-arrow {
    color: var(--accent-primary);
}

.main-prompt {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.browse-link {
    color: var(--accent-primary);
    text-decoration: underline;
}

.sub-prompt {
    font-size: 0.7rem;
}

/* Detail Split Columns */
.detail-top-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 992px) {
    .detail-top-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.detail-fields-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.detail-fields-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group-compact-static {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group-compact-static label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-static-value {
    background: var(--bg-app);
    padding: 10px 14px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-glass);
    font-size: 0.85rem;
    color: var(--text-primary);
    min-height: 40px;
    display: flex;
    align-items: center;
}

.text-scrollable {
    max-height: 100px;
    overflow-y: auto;
    align-items: flex-start;
    line-height: 1.4;
}

.aging-detail-value {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent-primary);
}

/* Detail Status dropdown inside static field */
.detail-status-select {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--bg-input-border);
    background-color: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}

/* Reassignment group container */
.reassignment-group {
    display: flex;
    gap: 6px;
    width: 100%;
}

.reassignment-group input {
    flex-grow: 1;
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--bg-input-border);
    background-color: var(--bg-input);
    color: var(--text-primary);
    outline: none;
}

.reassign-success-hint {
    font-size: 0.68rem;
    color: var(--success);
    display: none;
    margin-top: 2px;
}

/* Attached Document Row in detail pane */
.doc-attachment-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--bg-app);
    border: 1px solid var(--border-glass);
    padding: 10px 14px;
    border-radius: var(--border-radius-md);
}

.doc-file-icon {
    color: var(--accent-primary);
}

.doc-file-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-file-size {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.sp-lib-sync-status {
    font-size: 0.72rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    background-color: var(--bg-app);
    padding: 6px 10px;
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--warning);
}

.sp-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.pending-dot { background-color: var(--warning); }
.synced-dot { background-color: var(--success); }

/* Details Compact Uploader */
.file-uploader-compact-wrapper {
    margin-top: 8px;
}

.file-uploader-compact-wrapper input[type="file"] {
    display: none;
}

.file-uploader-compact-wrapper label {
    display: inline-block;
    cursor: pointer;
}

/* Audit history table inside Detail modal */
.detail-audit-trail-panel {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-glass);
    padding-left: 24px;
}

@media (max-width: 991px) {
    .detail-audit-trail-panel {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid var(--border-glass);
        padding-top: 24px;
    }
}

.audit-trail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.audit-trail-header h3 {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.audit-log-table-container {
    width: 100%;
    overflow-y: auto;
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-md);
    max-height: 420px;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    text-align: left;
}

.audit-table th {
    background-color: var(--bg-table-hdr);
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-glass);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
}

.audit-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-glass);
    vertical-align: top;
    color: var(--text-secondary);
    line-height: 1.3;
}

.audit-table tbody tr:last-child td {
    border-bottom: none;
}

.audit-timestamp {
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.audit-action-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
}

.audit-action-create { background-color: var(--success-light); color: var(--success); }
.audit-action-update { background-color: var(--accent-primary-light); color: var(--accent-primary); }
.audit-action-reassign { background-color: var(--info-light); color: var(--info); }
.audit-action-complete { background-color: rgba(16, 185, 129, 0.2); color: var(--success); }
.audit-action-warning { background-color: var(--warning-light); color: var(--warning); }
.audit-action-escalate { background-color: var(--danger-light); color: var(--danger); }

.audit-details-text {
    font-family: var(--font-sans);
    word-break: break-word;
}

/* ==========================================================================
   MICROSOFT 365 ENTERPRISE SSO LOGIN STYLES
   ========================================================================== */

.login-overlay-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(9, 13, 22, 0.9);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999 !important;
    padding: 20px;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.login-overlay-container.logged-in {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.login-card {
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-main);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.login-card-header {
    padding: 28px 28px 20px 28px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    gap: 14px;
}

.login-card-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

/* Official Microsoft Corporate Logo in CSS */
.microsoft-logo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3px;
    width: 28px;
    height: 28px;
}

.microsoft-logo-grid-mini {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    width: 16px;
    height: 16px;
}

.ms-square {
    display: block;
    width: 100%;
    height: 100%;
}
.ms-red { background-color: #f25022; }
.ms-green { background-color: #7fba00; }
.ms-blue { background-color: #00a4ef; }
.ms-yellow { background-color: #ffb900; }

.login-card-body {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-card-body h3 {
    font-size: 1.15rem;
    color: var(--text-primary);
}

.login-intro-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.45;
}

/* Entra ID Config Box styling */
.entra-id-config-box {
    background-color: var(--bg-app);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-inset);
}

.config-box-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: block;
}

.config-box-hint {
    font-size: 0.65rem;
    color: var(--accent-primary);
    font-family: var(--font-mono);
    margin-top: 10px;
    display: block;
    text-align: center;
}

.login-sim-users {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.login-sim-users label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    background: var(--bg-input, rgba(255,255,255,0.06));
    color: var(--text-primary);
    font-size: 0.92rem;
    font-family: var(--font-primary);
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

[data-theme="light"] .form-control {
    background: rgba(0, 0, 0, 0.04);
}

.login-card-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--border-glass);
    background-color: var(--bg-table-hdr);
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    justify-content: center;
}

/* ==========================================================================
   HEADER CORPORATE PROFILE SSO WIDGET
   ========================================================================== */

.header-profile-badge {
    display: flex;
    align-items: center;
    background-color: var(--bg-input);
    border: 1px solid var(--border-glass);
    padding: 6px 12px;
    border-radius: 40px;
    gap: 10px;
    box-shadow: var(--shadow-sm);
}

.profile-avatar {
    width: 32px;
    height: 32px;
    background-color: var(--accent-primary);
    color: var(--text-on-accent);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(99, 102, 241, 0.3);
}

.profile-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.profile-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.profile-role {
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* RBAC color-coded role badges in header */
body.rbac-super-admin .profile-role {
    background: linear-gradient(90deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

body.rbac-admin .profile-role {
    color: #2dd4bf;
    font-weight: 700;
}

body.rbac-user .profile-role {
    color: var(--text-muted);
}

.btn-signout {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-signout:hover {
    color: var(--danger);
    background-color: var(--danger-light);
}

/* ==========================================================================
   COLLAPSIBLE SIDEBAR NAVIGATION
   ========================================================================== */

/* --- Sidebar Toggle Hamburger Button (in header) --- */
.sidebar-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--bg-input-border);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background-color: var(--accent-primary-light);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.sidebar-toggle-btn .hamburger-line {
    display: block;
    width: 18px;
    height: 2px;
    background-color: currentColor;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.sidebar-toggle-btn .hamburger-line::before,
.sidebar-toggle-btn .hamburger-line::after {
    content: '';
    display: block;
    width: 18px;
    height: 2px;
    background-color: currentColor;
    border-radius: 2px;
    position: absolute;
    left: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-toggle-btn .hamburger-line::before {
    top: -6px;
}

.sidebar-toggle-btn .hamburger-line::after {
    top: 6px;
}

/* When sidebar is expanded, morph hamburger into an X */
body.sidebar-expanded .sidebar-toggle-btn .hamburger-line {
    background-color: transparent;
}

body.sidebar-expanded .sidebar-toggle-btn .hamburger-line::before {
    top: 0;
    transform: rotate(45deg);
}

body.sidebar-expanded .sidebar-toggle-btn .hamburger-line::after {
    top: 0;
    transform: rotate(-45deg);
}

/* --- The Sidebar Itself --- */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    width: 68px;
    height: 100vh;
    background: #0f1629;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 4px 0 24px -6px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

body.sidebar-expanded .app-sidebar {
    width: 260px;
}

/* Sidebar Brand / Logo in top area */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    min-height: 72px;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-brand .brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f59e0b;
    color: #0f1629;
    font-weight: 900;
    font-size: 1.1rem;
    font-family: var(--font-display);
    padding: 0;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    flex-shrink: 0;
    min-width: 38px;
    min-height: 38px;
    width: 38px;
    height: 38px;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.25s ease 0.1s, transform 0.25s ease 0.1s;
    pointer-events: none;
}

body.sidebar-expanded .sidebar-brand-text {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.sidebar-brand-text h2 {
    font-size: 0.82rem;
    letter-spacing: 1px;
    color: #f1f5f9;
    font-weight: 700;
    line-height: 1.2;
}

.sidebar-brand-text span {
    font-size: 0.65rem;
    color: #64748b;
    font-weight: 500;
    letter-spacing: 0.4px;
}

/* --- Nav Items container --- */
.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 10px;
    gap: 6px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-section-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #475569;
    padding: 12px 10px 6px 10px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
}

body.sidebar-expanded .sidebar-section-label {
    opacity: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 14px;
    border-radius: var(--border-radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    color: #94a3b8;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
}

.nav-link.active {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    box-shadow: inset 3px 0 0 0 #3b82f6;
    font-weight: 600;
}

.nav-link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.nav-link-label {
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.2s ease 0.08s, transform 0.2s ease 0.08s;
    pointer-events: none;
}

body.sidebar-expanded .nav-link-label {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

/* Nav item badge (count pill) */
.nav-badge {
    margin-left: auto;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    line-height: 1.3;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s ease 0.08s;
}

body.sidebar-expanded .nav-badge {
    opacity: 1;
}

/* Tooltip on hover in collapsed state */
.nav-link::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 14px;
    border-radius: var(--border-radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: var(--shadow-main);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s ease;
    z-index: 300;
}

/* Only show tooltips when sidebar is collapsed */
body:not(.sidebar-expanded) .nav-link:hover::after {
    opacity: 1;
    visibility: visible;
}

/* --- Sidebar Footer Section --- */
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 14px 10px;
    flex-shrink: 0;
}

.sidebar-footer .nav-link {
    font-size: 0.78rem;
    color: #64748b;
}

.sidebar-footer .nav-link:hover {
    color: #ef4444;
}

/* --- Backdrop overlay for mobile / small screens --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.visible {
    display: block;
    opacity: 1;
}

/* --- Layout adjustments: push main content to the right --- */
.app-container {
    margin-left: 68px;
    transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-expanded .app-container {
    margin-left: 260px;
}

/* --- Responsive: On small screens the sidebar auto-hides completely --- */
@media (max-width: 1024px) {
    .app-sidebar {
        transform: translateX(-100%);
        width: 260px;
    }

    body.sidebar-expanded .app-sidebar {
        transform: translateX(0);
        width: 260px;
    }

    body.sidebar-expanded .sidebar-brand-text,
    body.sidebar-expanded .nav-link-label,
    body.sidebar-expanded .sidebar-section-label {
        opacity: 1;
        transform: translateX(0);
    }

    .app-container {
        margin-left: 0 !important;
    }

    body.sidebar-expanded .app-container {
        margin-left: 0 !important;
    }

    .sidebar-overlay.visible {
        display: block;
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .app-header {
        flex-wrap: wrap;
        gap: 10px;
        padding: 14px 16px;
    }

    .time-simulator-panel {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 10px;
    }

    .simulator-controls {
        border-left: none;
        padding-left: 0;
        flex-wrap: wrap;
    }
}

/* ==========================================================================
   SIMPLIFIED HEADER TITLE
   ========================================================================== */

.header-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

/* ==========================================================================
   RIGHT-SIDE DETAIL PANEL (SPLIT VIEW)
   ========================================================================== */

.detail-side-panel {
    position: fixed;
    top: 0;
    right: -480px;
    width: 460px;
    height: 100vh;
    background-color: #ffffff !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
    border-left: 1px solid var(--border-glass);
    box-shadow: -8px 0 30px -5px rgba(0, 0, 0, 0.2);
    z-index: 250;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1), width 0.35s ease;
    overflow: hidden;
}

[data-theme="dark"] .detail-side-panel {
    background-color: #0f1729 !important;
}

.detail-side-panel.open {
    right: 0;
}

.detail-side-panel.expanded {
    width: 75vw;
}

/* Panel Header */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-glass);
    flex-shrink: 0;
    gap: 12px;
}

.panel-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.panel-header-left .panel-sop-code {
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent-primary);
    letter-spacing: 0.5px;
}

.panel-header-left .panel-sop-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.panel-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.panel-header-actions .btn-icon-only {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-glass);
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.panel-header-actions .btn-icon-only:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

/* Panel Tabs */
.panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-glass);
    padding: 0 20px;
    flex-shrink: 0;
    gap: 0;
    overflow-x: auto;
}

.panel-tab {
    padding: 11px 16px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.panel-tab:hover {
    color: var(--text-primary);
}

.panel-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.panel-tab .tab-count {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-left: 4px;
}

/* Panel Body */
.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.panel-tab-content {
    display: none;
}

.panel-tab-content.active {
    display: block;
}

/* Detail Info Grid in Panel */
.panel-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 20px;
    margin-bottom: 24px;
}

.panel-info-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.panel-info-item label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
}

.panel-info-item .info-value {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
}

.panel-info-item .info-value.mono {
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

/* ==========================================================================
   STATUS FLOW TIMELINE
   ========================================================================== */

.status-flow-section {
    margin-bottom: 24px;
}

.status-flow-section h4 {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.status-flow {
    display: flex;
    align-items: center;
    gap: 0;
    position: relative;
}

.flow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    z-index: 2;
}

.flow-step .flow-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    border: 2px solid var(--border-glass);
    background: var(--bg-app);
    color: var(--text-muted);
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.flow-step.completed .flow-dot {
    background: var(--success);
    border-color: var(--success);
    color: #ffffff;
}

.flow-step.current .flow-dot {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.flow-step.pending .flow-dot {
    background: var(--bg-app);
    border-color: var(--border-glass);
    color: var(--text-muted);
}

.flow-step .flow-label {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
    line-height: 1.2;
}

.flow-step .flow-date {
    font-size: 0.58rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 2px;
    text-align: center;
}

.flow-step.completed .flow-label,
.flow-step.current .flow-label {
    color: var(--text-primary);
}

/* Connector lines between steps */
.flow-connector {
    flex: 1;
    height: 2px;
    background: var(--border-glass);
    position: relative;
    top: -16px;
    z-index: 1;
}

.flow-connector.completed {
    background: var(--success);
}

/* ==========================================================================
   SLA / TIMELINE SUMMARY
   ========================================================================== */

.sla-summary-section {
    margin-bottom: 24px;
}

.sla-summary-section h4 {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.sla-summary-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sla-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
}

.sla-item .sla-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.sla-item .sla-label {
    color: var(--text-muted);
    flex: 1;
}

.sla-item .sla-value {
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-size: 0.76rem;
}

/* ==========================================================================
   AGING BREAKDOWN STACKED BAR
   ========================================================================== */

.aging-breakdown-section {
    margin-bottom: 24px;
}

.aging-breakdown-section h4 {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.aging-bar-container {
    position: relative;
    margin-bottom: 10px;
}

.aging-bar {
    display: flex;
    height: 18px;
    border-radius: 9px;
    overflow: hidden;
    background: var(--bg-app);
}

.aging-bar-segment {
    height: 100%;
    transition: width 0.5s ease;
    position: relative;
}

.aging-bar-segment.seg-assigned { background: #22c55e; }
.aging-bar-segment.seg-inprogress { background: #f59e0b; }
.aging-bar-segment.seg-forreview { background: #3b82f6; }
.aging-bar-segment.seg-completed { background: #6366f1; }

.aging-bar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.aging-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.64rem;
    color: var(--text-muted);
}

.aging-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.aging-total-circle {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
    line-height: 1.1;
    z-index: 2;
}

.aging-total-circle .total-label {
    font-size: 0.5rem;
    font-weight: 500;
    opacity: 0.85;
}

/* ==========================================================================
   DETAIL PANEL ACTION BAR
   ========================================================================== */

.panel-action-bar {
    display: flex;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-glass);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.panel-action-bar .btn {
    flex: 1;
    min-width: 80px;
    font-size: 0.74rem;
    padding: 8px 12px;
}

.btn-requeue {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-requeue:hover {
    background: var(--warning);
    color: #ffffff;
}

.btn-cancel-sop {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-cancel-sop:hover {
    background: var(--danger);
    color: #ffffff;
}

.panel-requeue-hint {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0 20px 10px 20px;
    font-style: italic;
}

/* Panel overlay backdrop */
.detail-panel-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 249;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.detail-panel-overlay.visible {
    display: block;
    opacity: 1;
}

/* ==========================================================================
   PAGINATION BAR
   ========================================================================== */

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0 0;
    margin-top: 8px;
    border-top: 1px solid var(--border-glass);
}

.pagination-info {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-controls .page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-glass);
    background: none;
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-controls .page-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.pagination-controls .page-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #ffffff;
}

.pagination-controls .page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ==========================================================================
   EXPORT BUTTON
   ========================================================================== */

.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-export:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* ==========================================================================
   COMMENTS SECTION (Panel Tab)
   ========================================================================== */

.comment-item {
    display: flex;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-glass);
}

.comment-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-primary-light);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.comment-author {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
}

.comment-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.comment-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.comment-input-row {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.comment-input-row input {
    flex: 1;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--bg-input-border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.8rem;
}

/* ==========================================================================
   PANEL-SPECIFIC REFINEMENTS
   ========================================================================== */

#remarks-modal-overlay {
    z-index: 1000 !important;
}

.detail-side-panel .reassignment-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.detail-side-panel .reassign-success-hint {
    display: none;
    font-size: 0.7rem;
    color: var(--success);
    margin-top: 4px;
}

.detail-side-panel .detail-status-select {
    width: 100%;
    padding: 6px 10px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--bg-input-border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
}

.detail-side-panel .panel-info-grid .panel-info-item .badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
}

/* Audit timeline scrollable area */
#panel-audit-timeline {
    max-height: 600px;
    overflow-y: auto;
}

/* Smooth panel enter animation */
@keyframes panelSlideIn {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.detail-side-panel.open .panel-body {
    animation: panelSlideIn 0.3s ease;
}

/* Panel action bar responsive */
@media (max-width: 600px) {
    .detail-side-panel {
        width: 100vw !important;
        right: -100vw;
    }
    .detail-side-panel.expanded {
        width: 100vw !important;
    }
}

/* Dynamic Access Matrix locked links */
.nav-link.locked {
    opacity: 0.45 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
}
.lock-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
}
.lock-badge svg {
    opacity: 0.7;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
}

/* Access Denied overlay */
.access-denied-overlay {
    position: fixed;
    top: var(--header-height);
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.85); /* sleek dark backdrop */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

[data-theme="light"] .access-denied-overlay {
    background: rgba(241, 245, 249, 0.85);
}

.access-denied-card {
    max-width: 480px;
    width: 100%;
    padding: 40px;
    text-align: center;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-lg);
}

.access-denied-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px auto;
}

.access-denied-icon svg {
    width: 32px;
    height: 32px;
    stroke: currentColor;
    stroke-width: 2;
}

.access-denied-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.access-denied-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 30px;
}

.access-denied-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
}

@media (max-width: 768px) {
    .access-denied-overlay {
        left: 0 !important;
    }
}

/* Dynamic Switch Toggles */
.switch-toggle {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-toggle {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 20px;
    border: 1px solid var(--border-glass);
}

.slider-toggle:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.switch-toggle input:checked + .slider-toggle {
    background-color: var(--accent-primary);
}

.switch-toggle input:focus + .slider-toggle {
    box-shadow: 0 0 1px var(--accent-primary);
}

.switch-toggle input:checked + .slider-toggle:before {
    transform: translateX(18px);
}

/* Role Card Layouts */
.role-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.role-card.role-inactive {
    opacity: 0.65;
    border-color: rgba(239, 68, 68, 0.2) !important;
}

.role-card-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

.btn-chevron.expanded svg {
    transform: rotate(180deg);
}

.permission-checkbox-label {
    border: 1px solid transparent;
    cursor: pointer;
}

.permission-checkbox-label:hover {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
}

.permission-checkbox-label input[type="checkbox"]:disabled {
    opacity: 0.5;
}

/* Light Theme overrides for role matrix */
[data-theme="light"] .slider-toggle {
    background-color: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .permission-checkbox-label:hover {
    background: rgba(0, 0, 0, 0.02) !important;
    border-color: rgba(0, 0, 0, 0.05) !important;
}
[data-theme="light"] .role-card-header:hover {
    background: rgba(0, 0, 0, 0.01);
}

/* ==========================================================================
   CUSTOM CREATE & EDIT MODALS STYLES
   ========================================================================== */

.create-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(9, 13, 22, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: none; /* Flex when active */
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

[data-theme="light"] .create-modal-overlay {
    background: rgba(241, 245, 249, 0.6);
}

.create-modal, .create-modal-card {
    width: 100%;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: var(--bg-surface);
}

.create-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-glass);
}

.create-modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-display);
}

.create-modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.create-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.01);
}

[data-theme="light"] .create-modal-footer {
    background: rgba(0, 0, 0, 0.01);
}

/* Modal close button */
.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-close-modal:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .btn-close-modal:hover {
    background: rgba(0, 0, 0, 0.05);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleUp {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Adjust sidebar toggle button for dark sidebar */
.app-sidebar .sidebar-toggle-btn {
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.app-sidebar .sidebar-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* On mobile, ensure the button shows when sidebar is expanded */
@media (max-width: 1024px) {
    body.sidebar-expanded .app-sidebar .sidebar-toggle-btn {
        display: flex !important;
    }
}



/* Prevent FOUC of login overlay */
html.is-authenticated .login-overlay-container {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}


/* ==========================================================================
   SIDEBAR FOOTER USER PROFILE & LOGOUT DOCK
   ========================================================================== */

.sidebar-nav .nav-link,
.sidebar-nav .sidebar-section-label {
    flex-shrink: 0;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 10px 12px 10px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(15, 22, 41, 0.95);
}

.sidebar-footer .header-profile-badge,
.sidebar-footer #m365-header-profile {
    width: 100%;
    padding: 8px 6px !important;
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    justify-content: center;
    align-items: center;
    gap: 12px;
    position: relative;
    box-shadow: none;
    transition: all 0.2s ease;
}

.sidebar-footer #m365-header-profile .profile-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    flex-shrink: 0;
    margin: 0;
}

.sidebar-footer #m365-header-profile .profile-details {
    display: none;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-footer #m365-header-profile .profile-name {
    color: #f1f5f9;
    font-size: 0.8rem;
    font-weight: 700;
    text-overflow: ellipsis;
    overflow: hidden;
}

.sidebar-footer #m365-header-profile .btn-signout {
    display: none !important;
}

/* Expanded sidebar state for user profile in footer */
body.sidebar-expanded .sidebar-footer #m365-header-profile {
    justify-content: flex-start;
    padding: 10px 12px !important;
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

body.sidebar-expanded .sidebar-footer #m365-header-profile .profile-details {
    display: flex;
    flex: 1;
}

/* Tooltip for User Avatar when sidebar is collapsed */
.sidebar-footer #m365-header-profile::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 14px;
    border-radius: var(--border-radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: var(--shadow-main);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s ease;
    z-index: 300;
}

body:not(.sidebar-expanded) .sidebar-footer #m365-header-profile:hover::after {
    opacity: 1;
    visibility: visible;
}


/* Chromeless Embed Mode (?embed=true) */
body.embed-mode .app-sidebar,
body.embed-mode .app-header,
body.embed-mode .sidebar-overlay {
    display: none !important;
}

body.embed-mode .app-container {
    margin-left: 0 !important;
    padding-top: 12px !important;
}


/* ==========================================================================
   HOLLER ENTERPRISE LOGIN REDESIGN
   ========================================================================== */

#m365-login-overlay.login-overlay-container {
    background: radial-gradient(circle at 15% 20%, rgba(59, 130, 246, 0.14), transparent 45%),
                radial-gradient(circle at 85% 80%, rgba(99, 102, 241, 0.14), transparent 45%),
                #060b16;
    padding: 24px;
    overflow-y: auto;
}

.holler-login-bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
    z-index: 0;
}

.holler-login-bg-glow.glow-1 {
    width: 420px;
    height: 420px;
    background: rgba(59, 130, 246, 0.18);
    top: -100px;
    left: -80px;
}

.holler-login-bg-glow.glow-2 {
    width: 380px;
    height: 380px;
    background: rgba(139, 92, 246, 0.15);
    bottom: -90px;
    right: -60px;
}

.holler-login-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 980px;
    min-height: 580px;
    display: grid;
    grid-template-columns: 1.08fr 1fr;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 24px;
    box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.7),
                0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    overflow: hidden;
}

/* Left Brand Panel */
.holler-brand-panel {
    position: relative;
    padding: 44px 42px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(155deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    overflow: hidden;
}

.holler-brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
    pointer-events: none;
}

.holler-brand-top {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
}

.holler-logo-mark {
    position: relative;
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.45rem;
    letter-spacing: -0.5px;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.holler-brand-wordmark h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: 2.5px;
    color: #f8fafc;
    line-height: 1.1;
}

.holler-brand-wordmark span {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1.6px;
    color: #60a5fa;
    margin-top: 3px;
}

.holler-brand-hero {
    position: relative;
    margin: 28px 0;
}

.holler-brand-hero h2 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1.25;
    margin: 0 0 12px 0;
    letter-spacing: -0.3px;
}

.holler-brand-hero p {
    font-size: 0.86rem;
    color: #94a3b8;
    line-height: 1.6;
    margin: 0 0 28px 0;
}

.holler-feature-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.holler-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.holler-feature-item:hover {
    transform: translateX(3px);
    border-color: rgba(96, 165, 250, 0.25);
}

.holler-feature-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.14);
    color: #60a5fa;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.holler-feature-item strong {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 2px;
}

.holler-feature-item span {
    display: block;
    font-size: 0.74rem;
    color: #94a3b8;
    line-height: 1.4;
}

.holler-brand-footer {
    position: relative;
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* Right Authentication Card */
.login-card.holler-auth-card {
    max-width: none;
    width: 100%;
    background: rgba(15, 23, 42, 0.55);
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.holler-auth-header {
    padding: 40px 40px 8px 40px;
}

.holler-mobile-badge {
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.holler-logo-mark-sm {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.holler-mobile-badge span {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 2px;
    color: #f8fafc;
}

.holler-auth-header h3 {
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 0 0 6px 0;
}

.holler-auth-header .login-intro-text {
    font-size: 0.83rem;
    color: #94a3b8;
    margin: 0;
}

.login-card-body.holler-auth-body {
    padding: 22px 40px 28px 40px;
    gap: 18px;
}

.login-sso-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.holler-sso-btn {
    width: 100%;
    padding: 12px 16px;
    border-radius: 11px;
    background: rgba(30, 41, 59, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
    font-size: 0.88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.holler-sso-btn:hover {
    background: rgba(51, 65, 85, 0.85);
    border-color: rgba(96, 165, 250, 0.45);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.45);
}

.holler-sso-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.holler-sso-text {
    flex: 1;
    text-align: left;
}

.holler-sso-arrow {
    color: #64748b;
    font-size: 0.95rem;
    transition: transform 0.2s ease, color 0.2s ease;
}

.holler-sso-btn:hover .holler-sso-arrow {
    transform: translateX(3px);
    color: #60a5fa;
}

.holler-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1.1px;
    margin: 2px 0;
}

.holler-divider::before,
.holler-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

.holler-credentials-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.holler-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.holler-input-group label {
    font-size: 0.76rem;
    font-weight: 600;
    color: #cbd5e1;
}

.holler-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.holler-field-icon {
    position: absolute;
    left: 13px;
    color: #64748b;
    pointer-events: none;
}

.form-control.holler-input {
    width: 100%;
    padding: 11px 14px 11px 38px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    font-size: 0.86rem;
    text-align: left !important;
}

.form-control.holler-input:focus {
    border-color: #3b82f6;
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.holler-submit-btn {
    width: 100%;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 4px;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    box-shadow: 0 8px 20px -4px rgba(59, 130, 246, 0.45);
}

.holler-submit-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
}

.login-card-footer.holler-auth-footer {
    padding: 16px 40px;
    background: rgba(2, 6, 23, 0.35);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    color: #64748b;
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

@media (max-width: 860px) {
    .holler-login-shell {
        grid-template-columns: 1fr;
        max-width: 460px;
        min-height: auto;
    }

    .holler-brand-panel {
        display: none;
    }

    .holler-mobile-badge {
        display: flex;
    }

    .holler-auth-header {
        padding: 32px 28px 8px 28px;
    }

    .login-card-body.holler-auth-body {
        padding: 20px 28px 24px 28px;
    }

    .login-card-footer.holler-auth-footer {
        padding: 14px 24px;
    }
}


/* ==========================================================================
   OFFICIAL HOLLER LOGO IMAGE & THEME-AWARE DISPLAY RULES
   ========================================================================== */

.holler-login-logo {
    height: 60px;
    width: auto;
    max-width: 240px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.25));
}

.holler-mobile-logo {
    height: 40px;
    width: auto;
    max-width: 175px;
    object-fit: contain;
}

.sidebar-brand .sidebar-brand-text {
    display: flex;
    align-items: center;
}

.sidebar-holler-logo {
    height: 36px;
    width: auto;
    max-width: 155px;
    object-fit: contain;
    display: block;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.app-sidebar.collapsed .sidebar-holler-logo {
    display: none !important;
}

/* Automatic Dark / Light Theme Logo Switching */
html[data-theme="dark"] .logo-for-light,
html:not([data-theme="light"]) .logo-for-light {
    display: none !important;
}

html[data-theme="dark"] .logo-for-dark,
html:not([data-theme="light"]) .logo-for-dark {
    display: block;
}

html[data-theme="light"] .logo-for-dark {
    display: none !important;
}

html[data-theme="light"] .logo-for-light {
    display: block;
}


/* ==========================================================================
   HOLLER BRAND PALETTE HARMONIZATION (DEEP FOREST #0F372F & LIME #DAF478)
   ========================================================================== */

/* 1. Sidebar & Navigation in Holler Palette */
[data-theme="dark"] .app-sidebar {
    background: linear-gradient(180deg, rgba(10, 31, 26, 0.96) 0%, rgba(7, 20, 17, 0.98) 100%);
    border-right: 1px solid rgba(218, 244, 120, 0.1);
}

[data-theme="light"] .app-sidebar {
    background: rgba(255, 255, 255, 0.95);
    border-right: 1px solid rgba(15, 55, 47, 0.12);
}

[data-theme="dark"] .nav-link.active {
    background: rgba(218, 244, 120, 0.14);
    color: #daf478;
    border-left: 3px solid #daf478;
    font-weight: 600;
}

[data-theme="dark"] .nav-link.active .nav-link-icon {
    color: #daf478;
}

[data-theme="light"] .nav-link.active {
    background: rgba(15, 55, 47, 0.09);
    color: #0f372f;
    border-left: 3px solid #0f372f;
    font-weight: 600;
}

[data-theme="light"] .nav-link.active .nav-link-icon {
    color: #0f372f;
}

.nav-badge {
    background: #daf478 !important;
    color: #0f372f !important;
    font-weight: 700 !important;
    border: 1px solid rgba(15, 55, 47, 0.2);
}

/* 2. Primary Buttons & Active Tab Pills */
[data-theme="dark"] .btn-primary {
    background: linear-gradient(135deg, #daf478 0%, #bfe642 100%);
    color: #0f372f !important;
    font-weight: 700;
    border: 1px solid rgba(218, 244, 120, 0.5);
    box-shadow: 0 6px 18px -4px rgba(218, 244, 120, 0.3);
}

[data-theme="dark"] .btn-primary:hover {
    background: linear-gradient(135deg, #e5f993 0%, #daf478 100%);
    color: #071411 !important;
    box-shadow: 0 8px 22px -4px rgba(218, 244, 120, 0.45);
}

[data-theme="light"] .btn-primary {
    background: linear-gradient(135deg, #0f372f 0%, #175246 100%);
    color: #daf478 !important;
    font-weight: 700;
    border: 1px solid #0f372f;
    box-shadow: 0 6px 18px -4px rgba(15, 55, 47, 0.28);
}

[data-theme="light"] .btn-primary:hover {
    background: linear-gradient(135deg, #14463c 0%, #1d6658 100%);
    color: #ffffff !important;
}

[data-theme="dark"] .btn-sim.active,
[data-theme="dark"] .queues-tab-btn.active,
[data-theme="dark"] .st-main-tab-btn.active,
[data-theme="dark"] .tp-tab-btn.active,
[data-theme="dark"] .mt-bucket-tab.active,
[data-theme="dark"] .st-type-pill.active {
    background: rgba(218, 244, 120, 0.16) !important;
    color: #daf478 !important;
    border-color: rgba(218, 244, 120, 0.45) !important;
}

[data-theme="light"] .btn-sim.active,
[data-theme="light"] .queues-tab-btn.active,
[data-theme="light"] .st-main-tab-btn.active,
[data-theme="light"] .tp-tab-btn.active,
[data-theme="light"] .mt-bucket-tab.active,
[data-theme="light"] .st-type-pill.active {
    background: #0f372f !important;
    color: #daf478 !important;
    border-color: #0f372f !important;
}

/* 3. User Profile Avatar in Sidebar Footer */
.profile-avatar {
    background: linear-gradient(135deg, #daf478 0%, #b8e13a 100%) !important;
    color: #0f372f !important;
    font-weight: 800 !important;
    border: 1px solid rgba(15, 55, 47, 0.25);
}

/* 4. Holler Login Overlay & Split Showcase Card in Brand Palette */
.login-overlay-container {
    background: radial-gradient(circle at 18% 20%, rgba(218, 244, 120, 0.14), transparent 45%),
                radial-gradient(circle at 82% 80%, rgba(22, 79, 67, 0.35), transparent 50%),
                linear-gradient(135deg, #040d0b 0%, #0a211c 50%, #071411 100%) !important;
}

.holler-login-bg-glow.glow-1 {
    background: rgba(218, 244, 120, 0.18) !important;
}

.holler-login-bg-glow.glow-2 {
    background: rgba(23, 86, 73, 0.28) !important;
}

.holler-login-shell {
    background: rgba(9, 27, 23, 0.84) !important;
    border: 1px solid rgba(218, 244, 120, 0.14) !important;
}

.holler-brand-panel {
    background: linear-gradient(155deg, rgba(15, 55, 47, 0.92) 0%, rgba(7, 22, 19, 0.97) 100%) !important;
    border-right: 1px solid rgba(218, 244, 120, 0.1) !important;
}

.holler-feature-icon {
    background: rgba(218, 244, 120, 0.15) !important;
    color: #daf478 !important;
    border: 1px solid rgba(218, 244, 120, 0.25);
}

.holler-feature-item:hover {
    border-color: rgba(218, 244, 120, 0.35) !important;
}

.login-card.holler-auth-card {
    background: rgba(7, 20, 17, 0.65) !important;
}

.holler-sso-btn {
    background: rgba(15, 44, 37, 0.75) !important;
    border: 1px solid rgba(218, 244, 120, 0.12) !important;
}

.holler-sso-btn:hover {
    background: rgba(20, 58, 49, 0.9) !important;
    border-color: rgba(218, 244, 120, 0.45) !important;
}

.holler-sso-btn:hover .holler-sso-arrow {
    color: #daf478 !important;
}

.form-control.holler-input {
    background: rgba(7, 20, 17, 0.82) !important;
    border: 1px solid rgba(218, 244, 120, 0.14) !important;
}

.form-control.holler-input:focus {
    border-color: #daf478 !important;
    box-shadow: 0 0 0 3px rgba(218, 244, 120, 0.18) !important;
}

.holler-submit-btn {
    background: linear-gradient(135deg, #daf478 0%, #c2e847 100%) !important;
    color: #0f372f !important;
    font-weight: 700 !important;
    box-shadow: 0 8px 22px -4px rgba(218, 244, 120, 0.35) !important;
}

.holler-submit-btn:hover {
    background: linear-gradient(135deg, #e5f993 0%, #daf478 100%) !important;
    color: #071411 !important;
}
