/* =========================================
   1. GLOBAL ROOT VARIABLES 
   ========================================= */
:root, body {
    color-scheme: light dark; /* THE SILVER BULLET */
    
    /* Brand Colors */
    --cecco-red: #A21c33;
    --cecco-red-hover: #c4223d;
    --cecco-red-active: #801628;
    --cecco-grey: #888b8d;

    /* Structural Variables */
    --app-border-radius: 4px;
    --sidebar-width: 250px;
    --banner-height: 48px; 
    --footer-height: 28px; 

    /* Typography */
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    --font-family-mono: 'Cascadia Code', Consolas, 'Courier New', monospace;

    /* Fluent DataGrid Overrides */
    --datagrid-hover-color: var(--neutral-layer-3); 
}

/* =========================================
   2. THEME ADAPTATION & TYPOGRAPHY
   ========================================= */
* { box-sizing: border-box; }

/* 1. Reset standard inputs to prevent global bleed */
input, select, button, textarea {
    font-family: inherit;
}

/* 2. Isolate our specific 24px Grid Inputs */
.grid-input, .grid-dropdown { 
    width: 100%; 
    height: 24px; 
    box-sizing: border-box; 
    padding: 0 4px; 
    font-size: 0.9em; 
    outline: none; 
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0; padding: 0;
    height: 100vh; width: 100vw;
    overflow: hidden;
    background-color: var(--neutral-layer-1);
    color: var(--neutral-foreground-rest);
    font-size: var(--type-ramp-base-font-size, 12px); /* DYNAMIC USER FONT PREFERENCE */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* =========================================
   3. STRUCTURAL LAYOUT (SHELL)
   ========================================= */
.galaxy-layout {
    display: flex; flex-direction: column; height: 100vh;
    background-color: var(--neutral-layer-2); color: var(--neutral-foreground-rest); 
    overflow: hidden;
}

/* --- Header --- */
.galaxy-header {
    height: 38px; 
    background-color: var(--neutral-layer-3); 
    border-bottom: 1px solid var(--neutral-stroke-rest); 
    box-shadow: 0 2px 4px rgba(0,0,0,0.03); 
    display: flex; align-items: center; padding: 0 6px; flex-shrink: 0; gap: 0;
    z-index: 100;
}
.header-left { display: flex; align-items: center; flex: 0 0 auto; }
.header-center { flex: 1; display: flex; align-items: center; justify-content: center; gap: 0; }
.header-right { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }

.header-title {
    font-size: 12px !important; font-weight: 600 !important; 
    color: var(--neutral-foreground-rest); 
    letter-spacing: 0.8px; text-transform: uppercase;
}

.global-refresh-btn:hover svg { color: #a5d6a7; transform: rotate(180deg); }
.theme-icon-sun { color: #f5d76e; } 
.theme-icon-moon { color: var(--neutral-foreground-hint); } 
.theme-toggle, .nav-toggle-btn, .activity-btn, .header-right button, .header-center button {
    background: transparent; border: none; color: var(--neutral-foreground-hint); 
    cursor: pointer; padding: 6px; border-radius: 4px; display: flex; 
    align-items: center; justify-content: center; transition: background-color 0.1s, color 0.1s; 
    outline: none; flex-shrink: 0;
}
.theme-toggle:hover, .nav-toggle-btn:hover, .activity-btn:hover, .header-right button:hover, .header-center button:hover { 
    background-color: var(--neutral-fill-hover); color: var(--neutral-foreground-rest); 
}

/* --- Body & Main Content --- */
.galaxy-body { display: flex; flex: 1; overflow: hidden; position: relative; }

.galaxy-main {
    flex: 1; 
    background-color: var(--neutral-layer-2); 
    overflow-y: auto; 
    /* TOP: 20px | RIGHT: 2px | BOTTOM: 2px | LEFT: 2px */
    padding: 0px 0px 0px 0px; 
    display: flex; 
    flex-direction: column;
}

/* =========================================
   3.1. CENTER PANE CONTENT WRAPPER
   ========================================= */

.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    width: 100%;
    /* Remove text-align and align-items hacks here; they aren't needed if the child is sized correctly */
}

/* Standard wrapper for document, form, and settings pages */
.standard-workspace-padding {
    padding: 0px 0px 0px 24px; /* Top, Right, Bottom, Left */
    width: 100%;                 /* Forces the div to stretch across the flex container */
    max-width: 1600px;           /* Maintains your large-screen cap */
    margin: 0;                   /* KILLS the centering. Locks it to the left edge. */
    box-sizing: border-box;      /* CRITICAL for mobile/iPad: Prevents the 24px padding from causing a horizontal scrollbar */
}

/* =========================================
   4. NAVIGATION & EXPLORER SIDEBAR
   ========================================= */
.vscode-sidebar { display: flex; flex-direction: row; height: 100%; width: 100%; overflow: hidden; }

.activity-bar {
    width: 48px; min-width: 48px; background-color: var(--neutral-layer-3);
    display: flex; flex-direction: column; justify-content: space-between;
    border-right: 1px solid var(--neutral-stroke-rest); flex-shrink: 0; z-index: 90;
}
.activity-bar-top, .activity-bar-bottom { display: flex; flex-direction: column; align-items: center; padding: 4px 0; gap: 2px; }
.activity-btn { width: 48px; height: 48px; border-left: 2px solid transparent; }
.activity-btn.active { 
    color: var(--neutral-foreground-rest); border-left: 2px solid var(--cecco-red) !important; 
    background-color: var(--neutral-fill-active); 
}

.explorer-panel {
    background-color: var(--neutral-layer-2); border-right: 1px solid var(--neutral-stroke-rest);
    display: flex; flex-direction: column; height: 100%; overflow-y: auto; 
    width: max-content; min-width: 180px; padding-top: 20px; padding-left: 12px; padding-right: 16px; 
    flex-shrink: 0; z-index: 80;
}
.explorer-title {
    color: var(--neutral-foreground-hint); font-size: 10.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; padding-left: 8px; 
}
.nav-group-header { margin-top: 6px !important; padding-left: 8px !important; } /* Tighter gap above headers */

.galaxy-sidebar {
    background-color: var(--neutral-layer-2); border-right: 1px solid var(--neutral-stroke-rest); 
    box-shadow: 2px 0 4px rgba(0,0,0,0.02); flex-shrink: 0; overflow: hidden; 
    display: flex; flex-direction: column; transition: width 0.1s ease; z-index: 80;
}
.sidebar-header {
    color: var(--neutral-foreground-hint); font-size: 10.5px; font-weight: 700;
    padding: 16px 20px 8px 20px; text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid var(--neutral-stroke-divider-rest);
}

.sidebar-resizer {
    width: 8px; margin-left: -4px; cursor: col-resize; background-color: transparent;
    transition: background-color 0.2s; z-index: 100;
}
.sidebar-resizer:hover, .is-resizing .sidebar-resizer { background-color: var(--cecco-red); width: 2px; margin-left: 0; }
.is-resizing { cursor: col-resize; user-select: none; }

/* --- THE TIGHTENING SQUASH --- */
.nav-link {
    background-color: transparent !important; color: var(--neutral-foreground-rest) !important;
    height: 26px !important; min-height: 26px !important; font-size: 12.5px !important; /* Squashed from 32px */
    padding-left: 20px !important; border-radius: 4px !important; 
    margin: 0 !important; /* Nuked the 2px vertical margin */
    width: 100% !important;
    border-left: 3px solid transparent !important; transition: all 0.15s ease !important; display: flex !important; align-items: center !important;
    white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important;
}
.nav-link:hover { background-color: var(--neutral-fill-hover) !important; color: var(--neutral-foreground-rest) !important; }
/* --- BULLETPROOF ACTIVE LINK STYLING --- */
.nav-link.active, .nav-link[active], .nav-link[aria-current="page"], fluent-nav-link.nav-link[aria-current="page"] {
    background-color: var(--neutral-fill-active) !important; color: var(--neutral-foreground-rest) !important;
    font-weight: 600 !important; border-left: 3px solid var(--cecco-red) !important;
}

.sub-link { 
    padding-left: 40px !important; margin-left: 8px !important; margin-right: 10px !important; 
    color: var(--neutral-foreground-hint) !important; font-size: 12px !important; 
    height: 24px !important; min-height: 24px !important; line-height: 24px !important; /* Locked height */
    margin-top: 0 !important; margin-bottom: 0 !important; 
    white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; display: block !important;
}
.sub-link:hover { color: var(--neutral-foreground-rest) !important; background-color: var(--neutral-fill-hover) !important; }
.sub-link.active, .sub-link[active], .sub-link[aria-current="page"], fluent-nav-link.sub-link[aria-current="page"] { 
    background-color: var(--neutral-fill-active) !important; font-weight: 700; color: var(--neutral-foreground-rest) !important; border-left: 3px solid var(--cecco-red) !important; 
}

/* Nuke internal Fluent UI padding that prevents physical squashing */
.explorer-panel fluent-nav-item, 
.explorer-panel .fluent-nav-item {
    min-height: 26px !important; margin: 0 !important;
}

/* THE SHADOW DOM OVERRIDE */
.explorer-panel fluent-nav-link::part(content) {
    padding-left: 0 !important; /* Removes the dead space left by missing icons */
}

.explorer-panel fluent-nav-link.nav-link::part(control) {
    min-height: 26px !important; height: 26px !important;
    padding-top: 0 !important; padding-bottom: 0 !important;
    padding-left: 12px !important; /* Base Tier 1 Indent */
}

.explorer-panel fluent-nav-link.sub-link::part(control) {
    min-height: 24px !important; height: 24px !important;
    padding-top: 0 !important; padding-bottom: 0 !important;
    padding-left: 32px !important; /* Deep Tier 2 Indent */
}

/* Ensure the host's active background color shines through the web component's shadow DOM */
.explorer-panel fluent-nav-link.active::part(control) {
    background-color: transparent !important;
}

/* =========================================
   5. REFINED RESPONSIVE FOOTER
   ========================================= */
.galaxy-footer {
    min-height: 28px; background-color: var(--neutral-layer-3); border-top: 1px solid var(--neutral-stroke-divider-rest);
    display: flex; align-items: center; justify-content: space-between; padding: 0 12px; font-size: 11px; 
    color: var(--neutral-foreground-rest); flex-shrink: 0; white-space: nowrap; position: relative; 
}
.footer-left { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.footer-center { 
    text-align: center; color: var(--neutral-foreground-hint); font-family: var(--font-family-mono); 
    font-size: 10px; overflow: hidden; text-overflow: ellipsis; padding: 0 16px; 
    position: absolute; left: 50%; transform: translateX(-50%);
}
.footer-right { 
    display: flex; text-align: right; font-variant-numeric: tabular-nums; flex-shrink: 0; 
    color: var(--neutral-foreground-hint); font-family: var(--font-family-mono); font-size: 10px; 
}

.footer-link { color: inherit; display: flex; align-items: center; gap: 4px; transition: opacity 0.2s ease, color 0.2s ease; }
.footer-link:hover, .inline-footer-link:hover { opacity: 0.8; color: var(--accent-fill-rest); }
.inline-footer-link { color: inherit; transition: opacity 0.2s ease, color 0.2s ease; }
.footer-link-version { color: var(--neutral-foreground-hint); font-family: var(--font-family-mono); font-size: 10px; letter-spacing: 0.5px; padding: 2px 6px; border-radius: 3px; cursor: help; }
.footer-link-version:hover { color: var(--cecco-red); background-color: var(--neutral-layer-4); }

.server-selection { display: flex; align-items: center; }
.footer-dropdown {
    background: var(--neutral-layer-1); color: var(--neutral-foreground-rest);
    border: 1px solid var(--neutral-stroke-rest); border-radius: var(--app-border-radius);
    padding: 0 4px; font-size: 11px; cursor: pointer; outline: none;
}
.footer-dropdown:hover { border-color: var(--cecco-grey); }
.footer-dropdown option { background: var(--neutral-layer-1); color: var(--neutral-foreground-rest); }
.bug-btn { color: var(--cecco-red) !important; transition: transform 0.1s ease; }
.bug-btn:hover { transform: scale(1.15); }
.sep { margin: 0 8px; color: var(--neutral-stroke-strong-rest); }

/* =========================================
   6. DASHBOARD & WIDGETS
   ========================================= */
.dashboard-header-container { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; padding-bottom: 12px; border-bottom: 1px solid var(--neutral-stroke-divider-rest); }
.dashboard-title { font-weight: 600; font-size: 1.5rem; margin: 0 0 4px 0; color: var(--neutral-foreground-rest); }
.dashboard-subtitle { color: var(--neutral-foreground-hint); font-size: 14px; margin: 0; }
.dashboard-date { color: var(--cecco-grey); font-weight: bold; font-size: 1.1rem; }
/* Dashboard Scroll Wrapper */
.dashboard-scroll-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 8px; /* Room for scrollbar */
    padding-bottom: 24px;
}

/* Dashboard Grid */
.dashboard-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    grid-auto-rows: 340px; /* STRICT LOCK: Prevents massive vertical padding */
    gap: 24px; 
}

/* Gamified Edit Mode - Android Style */
@keyframes jiggle {
    0% { transform: rotate(-0.5deg); }
    50% { transform: rotate(0.5deg); }
    100% { transform: rotate(-0.5deg); }
}
.widget-jiggle {
    animation: jiggle 0.4s infinite;
    cursor: grab !important;
    border: 2px dashed var(--accent-fill-rest) !important; 
    box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
    z-index: 10;
    transition: transform 0.1s ease;
}

.widget-jiggle:active {
    cursor: grabbing !important;
    transform: scale(0.98) !important; 
    opacity: 0.9;
}

/* ARCHITECT FIX: Prevents the Windy map from stealing drag-and-drop events */
.widget-jiggle iframe {
    pointer-events: none !important;
}

.empty-card {
    background: transparent !important;
    border: 2px dashed var(--neutral-stroke-divider-rest) !important;
    box-shadow: none !important;
}

.dashboard-card { background: var(--neutral-layer-1); border-radius: var(--app-border-radius, 8px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04); padding: 20px; display: flex; flex-direction: column; border: 1px solid var(--neutral-stroke-rest); }
.card-header { font-size: 12px; font-weight: 600; color: var(--neutral-foreground-hint); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 16px; }
.health-card { border-top: 4px solid var(--cecco-red); }

.map-container { height: 140px; background: var(--neutral-layer-4); border-radius: 6px; display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 16px; }
.weather-container { display: flex; align-items: center; gap: 16px; }
.temperature { font-size: 2rem; font-weight: 300; color: var(--neutral-foreground-rest); }
.weather-condition { font-size: 0.85rem; color: var(--neutral-foreground-hint); }

.health-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; color: var(--neutral-foreground-rest); }
.health-list li { display: flex; align-items: center; gap: 8px; }

.status-bullet, .pulse-bullet { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
@keyframes pulse { 0% { opacity: 0.6; box-shadow: 0 0 4px currentColor; } 50% { opacity: 1; box-shadow: 0 0 10px currentColor, 0 0 15px currentColor; } 100% { opacity: 0.6; box-shadow: 0 0 4px currentColor; } }
.pulse-bullet { animation: pulse 3s infinite; }
.pulse-bullet.red { background-color: var(--cecco-red); color: var(--cecco-red); animation: pulse 1.5s infinite; }
.pulse-bullet.green { background-color: #2ea043; color: #2ea043; }
.pulse-bullet.grey { background-color: var(--cecco-grey); color: var(--cecco-grey); animation: none; }

/* CARDS */
.upload-card {
    transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.upload-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    border-color: var(--accent-fill-rest); /* Subtle accent border glow */
}

/* Make your pseudo-buttons feel clickable */
.fluent-btn-mimic:active {
    transform: scale(0.97);
}

/* =========================================
   7. MODALS, NOTIFICATIONS & QUICK ACTIONS
   ========================================= */
.notification-badge { position: absolute; top: 2px; right: 2px; background-color: var(--cecco-red); color: white; font-size: 9px; font-weight: 700; width: 14px; height: 14px; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 2px solid var(--neutral-layer-1); }
.notification-dropdown { position: absolute; top: 40px; right: 0; width: 320px; background-color: var(--neutral-layer-1); border: 1px solid var(--neutral-stroke-divider-rest); border-radius: 6px; box-shadow: 0 8px 16px rgba(0,0,0,0.15); z-index: 9999; display: flex; flex-direction: column; overflow: hidden; }
.notif-header { padding: 12px 16px; background-color: var(--neutral-layer-2); border-bottom: 1px solid var(--neutral-stroke-divider-rest); display: flex; justify-content: space-between; align-items: center; }
.notif-body { max-height: 350px; overflow-y: auto; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--neutral-stroke-divider-rest); display: flex; gap: 12px; cursor: pointer; transition: background-color 0.2s; }
.notif-item:hover { background-color: var(--neutral-fill-hover); }
.notif-item.read { opacity: 0.7; }
.notif-item.unread { background-color: var(--neutral-fill-stealth-hover); }
.notif-item.unread .notif-dot { width: 8px; height: 8px; border-radius: 50%; background-color: var(--accent-fill-rest); margin-top: 4px; flex-shrink: 0; }
.notif-item.read .notif-dot { width: 8px; flex-shrink: 0; }
.notif-title { font-size: 12px; font-weight: 600; color: var(--neutral-foreground-rest); margin-bottom: 2px; }
.notif-message { font-size: 11px; color: var(--neutral-foreground-hint); line-height: 1.3; margin-bottom: 4px; }
.notif-time { font-size: 10px; color: var(--neutral-foreground-hint); opacity: 0.8; }

.bug-modal-overlay, .custom-modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: rgba(0, 0, 0, 0.6); z-index: 9999; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.bug-modal-container, .custom-modal-content { background-color: var(--neutral-layer-1); border: 1px solid var(--neutral-stroke-rest); border-radius: 8px; width: 100%; max-width: 500px; box-shadow: 0 8px 16px rgba(0,0,0,0.2); display: flex; flex-direction: column; }
.bug-modal-header { padding: 16px 20px; border-bottom: 1px solid var(--neutral-stroke-divider-rest); display: flex; align-items: center; justify-content: space-between; background-color: var(--neutral-layer-2); border-radius: 8px 8px 0 0; }
.bug-modal-body { padding: 20px; }
.bug-modal-footer { padding: 16px 20px; border-top: 1px solid var(--neutral-stroke-divider-rest); display: flex; justify-content: flex-end; gap: 8px; background-color: var(--neutral-layer-2); border-radius: 0 0 8px 8px; }

.quick-add-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; text-decoration: none; border-bottom: 1px solid var(--neutral-stroke-divider-rest); transition: background-color 0.15s ease; }
.quick-add-item:last-child { border-bottom: none; }
.quick-add-item:hover { background-color: var(--neutral-layer-3); text-decoration: none; }
.qa-icon { font-size: 16px; margin-top: 2px; }
.qa-text-container { display: flex; flex-direction: column; gap: 2px; }
.qa-title { font-size: 12px; font-weight: 600; color: var(--neutral-foreground-rest); }
.qa-desc { font-size: 11px; color: var(--neutral-foreground-hint); line-height: 1.3; }

/* =========================================
   8. GLOBAL DATA GRID OVERRIDES & TABLE STYLING
     (APPLIES TO ALL FLUENT-DATA-GRID INSTANCES)
     ALSO APPLIES TO ANY TABLES WITH THE .EXCEL-GRID CLASS
   ========================================= */

/* The Main Wrapper Container (BLUE BOX) */
.grid-container, .eb-spreadsheet-container, .info-table-container { 
    border: 1px solid var(--neutral-stroke-rest); 
    border-radius: 4px; 
    background-color: var(--neutral-layer-1); 
    width: 100%; 
    
    /* THE FLEXBOX FIX */
    flex-grow: 1;
    min-height: 0;
    
    display: flex; 
    flex-direction: column;
    overflow: hidden; /* Stop the wrapper from scrolling. The grid inside handles it! */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04); 
}

.grid-constrained {
    max-width: 1200px !important;
    margin-left: 0 !important;       /* Locks the grid to the left */
    margin-right: auto !important;   /* Pushes all leftover screen space to the right */
}
/* Global Action Bar formatting */
.action-bar { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    padding: 12px 16px; 
    border-bottom: 1px solid var(--neutral-stroke-divider-rest);
    background-color: var(--neutral-layer-2);
    position: sticky; 
    top: 0; 
    left: 0; 
    z-index: 20;
    width: 100%; /* Make sure this is 100% */
}

/* 0. Reset the flex property on the data grid */
.fluent-data-grid {
    flex: initial !important;
}

/* 1. Base Fluent Grid Overrides (RED BOX) */
.fluent-data-grid { 
    min-width: 100% !important; 
    width: auto !important; 
    
    /* Let the grid take up the space and generate its own scrollbars */
    height: 100% !important;
    overflow: auto !important;
    
    align-self: flex-start !important; 
    align-content: start !important; 
}

fluent-menu-item[text="Resize"] { display: none !important; }

/* 2. Flexible Strict Row Heights (FIXED FOR EDIT MODE) */
.fluent-data-grid-row, .excel-grid tr {
    height: 36px !important; 
    min-height: 36px !important; 
    /* REMOVED: max-height so edit inputs don't break the box model */
}

/* 3. Ensure the cells strictly center the inputs and strip inherent margins */
.fluent-data-grid-cell, .excel-grid td {
    padding: 0 0px !important;
    font-size: var(--type-ramp-base-font-size, 12px) !important; /* DYNAMIC USER PREFERENCE */
    white-space: nowrap !important; 
    border-right: 1px solid var(--neutral-stroke-divider-rest); 
    display: flex !important;
    align-items: center !important; 
    overflow: visible !important; 
}

/* 3.5 Nuke default margins on inputs so they don't push the row taller */
.grid-input, .grid-dropdown, .data-entry-input, .fluent-input {
    margin: 0 !important;
    vertical-align: middle;
}

/* 4. Bold, Slightly Darker Headers */
.fluent-data-grid-cell[cell-type="columnheader"] {
    font-weight: 700 !important;
    background-color: var(--neutral-layer-3) !important; 
    color: var(--neutral-foreground-rest) !important;
    border-bottom: 2px solid var(--neutral-stroke-strong-rest) !important;
    padding: 0 12px !important;
    font-size: var(--type-ramp-base-font-size, 12px) !important; /* DYNAMIC USER PREFERENCE */
}

/* 5. Alternating Zebra Striping */
.fluent-data-grid-row:nth-child(even) {
    background-color: var(--neutral-layer-2); 
}

/* 6. Hover Highlight Effect */
.fluent-data-grid-row:hover {
    background-color: var(--neutral-layer-4) !important; 
    cursor: pointer;
}

/* =========================================
   9. FORMS, INPUTS & EDIT STATES
   ========================================= */
fluent-text-field::part(label) { margin-bottom: 4px; }
fluent-text-area::part(label), fluent-select::part(label) {
    color: var(--neutral-foreground-hint); font-weight: 600; text-transform: uppercase;
    font-size: 0.75rem; letter-spacing: 0.5px; margin-bottom: 4px;
}

/* 1. MOCK INPUT (Read-Only) */
.mock-input::part(root) { background: transparent !important; border: none !important; box-shadow: none !important; }
.mock-input::part(control) {
    color: var(--neutral-foreground-rest) !important;
    font-size: var(--type-ramp-base-font-size, 12px) !important;
    padding: 0 8px !important; /* Mathematically aligns with edit mode */
    cursor: default;
}

/* Synchronize plain spans in read-only cells to match edit mode padding */
.read-only-cell {
    padding: 0 8px; 
    font-size: var(--type-ramp-base-font-size, 12px);
    display: flex;
    align-items: center;
    height: 100%;
}

/* 2. EDIT MODE INPUT (STABILIZED BOX MODEL) */
.edit-mode-input::part(root),
.data-entry-input, 
.grid-input,
.grid-dropdown {
    height: 32px !important; /* Increased to allow bottom border to render without clipping */
    box-sizing: border-box !important;
    margin: 0 !important;
    
    /* Pre-allocate the 2px bottom border so the physical size NEVER changes on focus */
    border-width: 1px 1px 2px 1px !important;
    border-style: solid !important;
    border-color: var(--neutral-stroke-rest) var(--neutral-stroke-rest) transparent;
    
    /* Nuke internal padding that causes vertical drift */
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    background-color: var(--neutral-fill-input-rest) !important;
    border-radius: 4px 4px 0 0;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;

    /* THE FIX: Force the standard Windows arrow pointer to stay visible */
    cursor: default !important; 

    /* THE FIX: Ensure the blinking typing line remains dark/visible against the yellow background */
    color: var(--neutral-foreground-rest) !important;
}

.edit-mode-input::part(control) {
    color: var(--neutral-foreground-rest) !important;
    padding: 0 8px !important; /* Explicitly matches read-only padding */
    font-size: var(--type-ramp-base-font-size, 12px) !important; /* Prevents font shrinking/growing */
    cursor: text !important; /* Changed from default to text so the user knows they can type */
}

/* On Focus: ONLY change the color, never the thickness or physical size */
.edit-mode-input::part(root):focus-within,
.data-entry-input:focus,
.grid-input:focus,
.grid-dropdown:focus {
    background-color: var(--neutral-fill-input-rest) !important;
    color: var(--neutral-foreground-rest) !important;
    border-bottom-color: var(--accent-fill-active) !important;
    outline: none !important;
    box-shadow: none !important; /* Neutralizes the aggressive drop shadow causing layout bleed */
}

/* Penetrate Shadow DOM to ensure actual input text flips color */
.edit-mode-input::part(control):focus {
    color: var(--neutral-foreground-rest) !important;
}

/* Specific Form Layouts */
.enterprise-form-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; row-gap: 16px; }
.form-row { display: flex; align-items: center; }
.form-label { width: 120px; flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--neutral-foreground-rest); }
.req-star { color: var(--cecco-red); margin-left: 2px; }
.data-entry-input option { background-color: var(--neutral-layer-1) !important; color: var(--neutral-foreground-rest) !important; }

/* =========================================
   10. TIERED RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================= */
@media (max-width: 1024px) { 
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); } 
    .desktop-only { display: none; } 
    .footer-center { padding: 0 8px; }
}
@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-header-container { flex-direction: column; align-items: flex-start; gap: 12px; }
    .header-center { display: none; } 
    .header-title { font-size: 11px !important; letter-spacing: 0px; }
    .galaxy-footer { padding: 0 4px; font-size: 10px; }
    .server-selection { display: none; } 
    .sep { margin: 0 4px; }
    .bug-modal-container, .custom-modal-content { width: 95%; max-width: none; margin: 0 10px; }
    .notification-dropdown { width: calc(100vw - 20px); right: -40px; }
    .sidebar-header { font-size: 9.5px; padding: 12px 16px 6px 16px; }
    .nav-link { font-size: 11.5px !important; padding-left: 16px !important; margin: 1px 0 !important; height: 28px !important; min-height: 28px !important; }
    .sub-link { padding-left: 32px !important; margin-left: 6px !important; }
}

/* =========================================
   11. GLOBAL BADGES & CHIPS
   ========================================= */
.custom-badge {
    padding: 0 12px; border-radius: 2px; font-size: 11px; font-family: var(--font-family-base);
    font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
    min-width: 60px; height: 24px; box-sizing: border-box;
}
.active-theme { color: #4CAF50 !important; border-color: #4CAF50 !important; }
span.active-theme { background-color: rgba(76, 175, 80, 0.1); border: 1px solid #4CAF50; }
.inactive-theme { color: var(--neutral-foreground-hint) !important; border-color: var(--neutral-stroke-rest) !important; }
span.inactive-theme { background-color: rgba(136, 136, 136, 0.1); border: 1px solid var(--neutral-stroke-rest); }

/* Hazard Safety Cone Theme (Broke) */
.broke-theme { 
    color: #d83b01 !important; 
    border-color: #d83b01 !important; 
}
span.broke-theme { 
    background-color: #ffebd6; 
    border: 1px solid #d83b01; 
}

.time-badge {
    background-color: #e8f5e9; /* Pastel green */
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
    border: 1px solid #c8e6c9;
    font-family: var(--font-family-mono); /* Monospace keeps date digits aligned */
}

/* 1. Fix Host Element Height Drift */
.btn-status-submit,
.btn-status-approve,
.btn-status-reject {
    height: 26px !important;
    min-height: 26px !important;
    margin: 0 !important;
}

/* 2. Stabilize the Status Badge Box Model */
.ch-badge { 
    padding: 0 12px !important; /* Strip top/bottom padding to let flexbox center */
    height: 26px !important; 
    font-weight: bold; 
    border-radius: 4px; 
    text-transform: uppercase; 
    font-size: 0.85em; 
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

/* =========================================
   12. GLOBAL WIZARD STEPPER (NAV BAR)
   ========================================= */
.wizard-stepper {
    display: inline-flex; /* Changed to inline-flex to match breadcrumbs */
    align-items: center;
    background: var(--neutral-layer-1); 
    border: 1px solid var(--neutral-stroke-rest); /* Matched breadcrumb border color */
    border-radius: 4px; /* Matched breadcrumb 4px radius (was 8px) */
    padding: 0; /* CRITICAL FIX: Removed container padding */
    margin-bottom: 24px;
    width: max-content;
    overflow: hidden; /* Ensures active background stays inside rounded corners */
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px; /* This 6px now perfectly matches the breadcrumb height */
    border-radius: 0; /* Removed so active background touches top and bottom borders */
    font-size: 12px;
    font-weight: 600;
    color: var(--neutral-foreground-hint);
    text-decoration: none;
    transition: all 0.2s;
}

/* The sleek, greytone emoji magic */
.wizard-icon {
    font-size: 14px;
    filter: grayscale(100%) contrast(1.2) opacity(0.6);
    transition: filter 0.2s;
}

.wizard-step.active {
    background: var(--neutral-layer-3); /* Consider matching breadcrumb's --neutral-fill-stealth-selected */
    color: var(--neutral-foreground-rest);
}

.wizard-step.active .wizard-icon {
    opacity: 1; 
}

/* Optional: Make locked steps unclickable */
.wizard-step.locked {
    cursor: not-allowed;
    opacity: 0.7;
}

.wizard-divider {
    color: var(--neutral-stroke-strong-rest);
    font-size: 10px;
    padding: 0 4px; /* Added slight padding to separators since container padding is gone */
}


/* ==========================================================================
   GLOBAL OVERRIDE: FluentDataGrid Alignment & Density
   ========================================================================== */

/* 1. Data Cells: Left align with a slight 8px horizontal buffer. 
      (Keeps top/bottom padding at 0px for maximum row density) */
.fluent-data-grid-row td {
    text-align: left !important;
    padding: 0px 8px !important; 
}

/* 2. Header Cells: Center align globally */
.fluent-data-grid-row th {
    text-align: center !important;
}

/* 2b. Fluent UI wraps header text in a flexbox div to accommodate sort icons. 
       This forces that inner flex container to center as well. */
.fluent-data-grid-row th > div {
    justify-content: center !important;
}

/* Global Grid Header Fix */
.fluent-data-grid-column-header {
    white-space: nowrap !important;
    padding-right: 36px !important; 
}

.number-align {
        display: block;
        width: 100%;
        text-align: right;
        padding-right: 24px;
        font-family: var(--font-family-mono);
    }

/* Force all Fluent Data Grid headers to center align */
.fluent-data-grid-row th {
    text-align: center !important;
}

/* Align the inner content wrapper of the header */
.fluent-data-grid-row th > div {
    justify-content: center !important;
}

/* ==========================================================================
   TRAINING & ONBOARDING OVERRIDE: Fluent UI Button Density
   ========================================================================== */
    /* Strips default padding so the progress bar can hit the edges */
    .training-card {
        padding: 0 !important; 
        border: 1px solid var(--neutral-stroke-divider-rest);
    }

    /* Massive click targets for the lazy */
    .training-row {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        border-radius: 6px;
        background-color: transparent;
        border: 1px solid transparent;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .training-row:hover {
        background-color: var(--neutral-layer-3);
        border-color: var(--neutral-stroke-rest);
    }

    .task-info {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .task-title {
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--neutral-foreground-rest);
        transition: color 0.3s ease;
    }

    .task-desc {
        font-size: 0.8rem;
        color: var(--neutral-foreground-hint);
    }

    /* The visual reward for completing a task */
    .task-completed {
        opacity: 0.5;
        background-color: transparent !important;
        border-color: transparent !important;
    }

    .task-completed .task-title {
        text-decoration: line-through;
    }
    
    /* Disables pointer events after completion to feel 'locked in' (Optional) */
    .task-completed:hover {
        cursor: default;
    }


/* ==========================================================================
   GLOBAL OVERRIDE: Footer Link Styling
   ========================================================================== */
.galaxy-footer a {
    text-decoration: none !important; /* Strips the default underline */
    transition: opacity 0.2s ease;    /* Smooth transition for the hover state */
}

/* Architect's Touch: Add a subtle hover effect so users still know they are clickable */
.galaxy-footer a:hover {
    opacity: 0.7; 
    /* Alternatively, you can use: text-decoration: underline !important; if you only want underlines on hover */
}

/* ==========================================================================
   GLOBAL SCROLLBAR OVERRIDES (DARK MODE)
   ========================================================================== */

/* 1. Firefox Support */
* {
    scrollbar-width: middle; /* Makes the scrollbar thinner than the default */
    scrollbar-color: var(--neutral-stroke-rest) var(--neutral-layer-1);
}

/* 2. WebKit Support (Chrome, Edge, Safari) */
::-webkit-scrollbar {
    width: 12px;  /* Vertical scrollbar width */
    height: 12px; /* Horizontal scrollbar height */
}

/* The track (background) of the scrollbar */
::-webkit-scrollbar-track {
    background-color: var(--neutral-layer-1); 
}

/* The draggable thumb */
::-webkit-scrollbar-thumb {
    background-color: var(--neutral-stroke-rest); 
    border-radius: 6px;
    
    /* This border creates a transparent "padding" effect around the thumb */
    border: 3px solid var(--neutral-layer-1); 
}

/* Hover state for the thumb */
::-webkit-scrollbar-thumb:hover {
    background-color: var(--neutral-foreground-hint); 
}

/* The intersection where vertical and horizontal scrollbars meet */
::-webkit-scrollbar-corner {
    background-color: var(--neutral-layer-1);
}

/* ==========================================================================
   AI Chat & Login Animated Border 
   ========================================================================== */

.ai-glow-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: var(--app-border-radius, 8px);
    /* The padding dictates the thickness of the glowing border */
    padding: 2px; 
    z-index: 1;
}

/* The spinning gradient engine */
.ai-glow-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    /* Creates a hard line that fades out. Change #0078d4 to var(--cecco-red) if desired */
    background: conic-gradient(from 0deg, transparent 75%, #0078d4 80%,  var(--cecco-red) 100%);
    animation: spin-glow 15s linear infinite; /* Slower, ambient pace */
    z-index: -1;
}

/* The mask that hides the center of the gradient, leaving only the border */
.ai-glow-inner {
    background-color: var(--neutral-layer-2); /* Locks to Fluent UI dark/light mode */
    border-radius: calc(var(--app-border-radius, 8px) - 2px);
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
}

@keyframes spin-glow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}