/* Block-1 Starting: Core Variables & Reset */
/* Linked File: All Files (Theme Source) */

/* 1.1: Root Variable Definitions */
/* :root defines the color palette and core variables */
:root {
    /* Confidence-inspiring professional color palette */
    --primary: #1e40af; /* Deep blue - trust, stability */
    --primary-hover: #1e3a8a;
    --primary-light: #dbeafe;
    --primary-dark: #1e40af;
    --secondary: #059669; /* Professional green - growth, success */
    --secondary-hover: #047857;
    --accent: #dc2626; /* Confident red - action, importance */
    --accent-hover: #b91c1c;
    --warning: #d97706; /* Warm orange - attention */
    --warning-hover: #b45309;
    --success: #059669; /* Success green */
    --info: #0284c7; /* Info blue */

    /* Neutral colors with high contrast */
    --white: #ffffff;
    --gray-50: #f8fafc;   /* Light background */
    --gray-100: #f1f5f9;  /* Card backgrounds */
    --gray-200: #e2e8f0;  /* Borders */
    --gray-300: #cbd5e1;  /* Disabled states */
    --gray-400: #64748b;  /* Placeholder text */
    --gray-500: #64748b;  /* Secondary text */
    --gray-600: #475569;  /* Body text */
    --gray-700: #334155;  /* Headings */
    --gray-800: #1e293b;  /* Primary text */
    --gray-900: #0f172a;  /* High emphasis text */

    /* WCAG AAA compliant text colors */
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-white: #ffffff;

    /* Background colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-muted: #f1f5f9;

    /* Interactive states with proper contrast */
    --focus-ring: 0 0 0 3px rgba(30, 64, 175, 0.3);
    --focus-ring-danger: 0 0 0 3px rgba(220, 38, 38, 0.3);
    --focus-ring-success: 0 0 0 3px rgba(5, 150, 105, 0.3);

    /* Spacing and design tokens */
    --header-height: 50px; /* Default fallback, updated by JS */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 1.2: Global Resets & Body Style */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: 60px; /* Space for fixed footer */
}
/* Block-1 Ended */

/* Block-2 Starting: Layout & Structural Components */
/* Linked File: header.php (Topbar), footer.php (Container) */

/* 2.1: Container Logic */
/* Default Container (For Login & Standalone Pages) */
.container {
    width: 100%;
    margin: 0 auto;
    padding: 10px;
}

/* Dashboard Container (ONLY applies when a .topbar exists) */
.topbar ~ main.container {
    max-width: 1800px;
    /* Smart Sticky Header Support */
    padding-top: calc(var(--header-height, 50px) + 20px); 
    min-height: 100vh;
}

main.container > *:not(:last-child) {
    margin-bottom: 16px;
}

/* 2.2: Navigation Topbar */
.topbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    
    /* Positioning for Smart Scroll (Slides up/down) */
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1100;
    transition: transform 0.3s ease-in-out;

    /* --- COMPACT MODE STYLES --- */
    padding: 0.4rem 1.5rem; /* Reduced padding */
    min-height: 48px;       /* Smaller minimum height */
    height: auto;
}

/* Hidden State for Smart Scroll */
body.nav-hidden .topbar {
    transform: translateY(-100%);
}

.topbar .left {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-white);
}

.topbar .center { display: flex; gap: 4px; align-items: center; }
.topbar .right { display: flex; align-items: center; gap: 12px; }

.topbar a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-size: 0.85rem;
    border: 1px solid transparent;
}

.topbar a:hover, .topbar a.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--text-white);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}
.topbar a:focus { outline: 2px solid rgba(255, 255, 255, 0.8); outline-offset: 2px; }

.nav-link-icon {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
/* Block-2 Ended */

/* Block-3 Starting: UI Components */
/* Linked File: dashboard.php (Cards), tasks.php (Lists) */

/* 3.1: Card Component */
.card {
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    position: relative;
    transition: var(--transition);
}
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.card h2, .card h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--text-primary);
    font-weight: 600;
    border-bottom: 2px solid var(--gray-100);
    padding-bottom: 8px;
}
.card h4 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 3.2: Dashboard Widgets */
.summary-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
.summary-box {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--gray-50) 100%);
    border-radius: var(--radius-xl);
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-100);
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.summary-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}
.summary-box:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}
.big {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.small {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 3.3: List Items */
.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 4px;
    border-bottom: 1px solid var(--gray-200);
    transition: var(--transition);
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover {
    background-color: var(--gray-50);
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    border-radius: var(--radius-md);
}

/* 3.4: Buttons & Interactions */
.btn, button, input[type="submit"], input[type="button"] {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background-color: var(--primary); color: var(--text-white);
    padding: 10px 18px; border: 1px solid var(--primary);
    border-radius: var(--radius-md); font-size: 14px; font-weight: 600;
    cursor: pointer; transition: var(--transition); text-decoration: none;
    font-family: inherit; -webkit-appearance: none;
    position: relative; overflow: hidden;
}
.btn::before, button::before, input[type="submit"]::before, input[type="button"]::before {
    content: ''; position: absolute; top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}
.btn:hover::before, button:hover::before, input[type="submit"]:hover::before, input[type="button"]:hover::before {
    left: 100%;
}
.btn:hover, button:hover, input[type="submit"]:hover, input[type="button"]:hover {
    background-color: var(--primary-hover); border-color: var(--primary-hover);
    transform: translateY(-2px); box-shadow: 0 6px 20px rgba(30, 64, 175, 0.3);
}
.btn:focus, button:focus, input[type="submit"]:focus, input[type="button"]:focus { outline: none; box-shadow: var(--focus-ring); }
.btn-small { padding: 6px 12px; font-size: 12px; font-weight: 500; }
.btn.ghost { background-color: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn.ghost:hover { background-color: var(--primary); color: var(--text-white); }
.btn-danger { background-color: var(--accent); border-color: var(--accent); }
.btn-danger:hover { background-color: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 6px 20px rgba(220, 38, 38, 0.3); }
.btn-danger:focus { box-shadow: var(--focus-ring-danger); }
.btn-danger.ghost { background-color: transparent; border-color: var(--accent); color: var(--accent); }
.btn-danger.ghost:hover { background-color: var(--accent); color: var(--text-white); }

/* 3.5: Form Elements */
input, textarea, select {
    width: 100%; padding: 12px 16px; border: 1px solid var(--gray-300);
    border-radius: var(--radius-md); font-size: 14px; transition: var(--transition);
    outline: none; background-color: var(--bg-primary); color: var(--text-primary); font-family: inherit;
}
input[type="checkbox"], input[type="radio"] { width: auto; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: var(--focus-ring); }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; color: var(--text-primary); }
.form-row { margin-bottom: 16px; }
.date-wrapper { position: relative; display: flex; align-items: center; }
.date-wrapper input { width: 100%; padding-right: 32px !important; }
.date-wrapper .calendar-icon { position: absolute; right: 10px; cursor: pointer; font-style: normal; font-size: 1.2em; z-index: 5; }
.form-grid-2 { display:grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* Block-3 Ended */

/* Block-4 Starting: Data Tables & Grids */
/* Linked File: documents.php, departments.php */

/* 4.1: General Table Wrapper */
.table-wrapper {
    overflow-x: auto;
    box-sizing: border-box; 
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
table {
    min-width: 100%; width: auto; border-collapse: collapse;
}
th, td { 
    padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--gray-200); 
    font-size: 12px; vertical-align: middle; 
}
th {
    background: var(--gray-50); font-weight: 700; color: var(--text-primary);
    font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; white-space: normal;
}
tbody tr { transition: background-color 0.15s ease-out; }
tbody tr:hover { background-color: var(--primary-light); }

/* 4.2: Animations & Highlights */
@keyframes highlight-fade { from { background-color: #fef9c3; } to { background-color: transparent; } }
.highlight-row { animation: highlight-fade 60s ease-out forwards; }
tbody tr.highlight-row:hover { animation: none; background-color: var(--primary-light); }

#documents-table th, #documents-table td { border-right: 1px solid var(--gray-200); }
#documents-table th:last-child, #documents-table td:last-child { border-right: none; }

/* 4.3: Drag & Drop (Sortable) */
#documents-table tbody tr .handle { cursor: grab; }
#documents-table tbody tr.sortable-chosen { background-color: var(--primary-light); box-shadow: var(--shadow-lg); cursor: grabbing; }
#documents-table tbody tr.sortable-ghost { background-color: var(--primary-light); opacity: 0.5; border: 2px dashed var(--primary); }

/* 4.4: Sticky Columns */
.sticky-col { position: -webkit-sticky; position: sticky; background-color: inherit; z-index: 1; }
#documents-table thead .sticky-col { z-index: 2; background-color: var(--gray-50); }
#documents-table tbody tr .sticky-col { background-color: var(--bg-primary); }
#documents-table tbody tr:hover .sticky-col { background-color: var(--primary-light); }

/* 4.5: History Expanded View */
.history-toggle-btn {
    font-family: monospace; font-size: 16px; font-weight: bold; width: 24px; height: 24px;
    padding: 0; line-height: 22px; border-radius: 50%; border: 1px solid var(--gray-400);
    background-color: var(--gray-100); color: var(--gray-600); cursor: pointer;
}
.history-toggle-btn:hover { background-color: var(--primary); color: white; }
.history-row td { background-color: #f8fafc; padding: 0; }
.history-container { padding: 8px 16px; }
.history-container .hint { margin: 0; padding: 8px; background-color: var(--gray-100); }
.history-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.history-table th, .history-table td { padding: 4px 8px; border: 1px solid var(--gray-200); text-align: left; white-space: normal; vertical-align: top; }
.history-table th { background-color: var(--gray-200); font-weight: 600; }
.history-table td:nth-child(1) { width: 15%; } /* Timestamp */
.history-table td:nth-child(2) { width: 10%; } /* User */
.history-table td:nth-child(3) { width: 10%; } /* Action */
.history-table td:nth-child(4) { width: 65%; } /* Details */

/* 4.6: Status Badges */
.status-cell span { padding: 4px 10px; border-radius: 999px; font-weight: 600; font-size: 0.8rem; display: inline-block; }
.status-expired, .status-overdue { background-color: #fee2e2; color: #b91c1c; }
.status-due, .status-due-soon, .status-due-today { background-color: #ffedd5; color: #c2410c; }
.status-active { background-color: #dcfce7; color: #166534; }

/* 4.7: Department Grid */
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.item-box {
    border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-md);
    transition: var(--transition); border: 1px solid transparent; position: relative;
    color: var(--text-primary); cursor: pointer;
}
.item-box:hover { transform: translateY(-4px) scale(1.02); box-shadow: var(--shadow-lg); border-color: rgba(0,0,0,0.1); }
.item-name { font-weight: 600; color: inherit; font-size: 18px; }
.item-box:nth-child(8n + 1) { background: linear-gradient(135deg, #e0f2fe, #bae6fd); }
.item-box:nth-child(8n + 2) { background: linear-gradient(135deg, #d1fae5, #a7f3d0); }
.item-box:nth-child(8n + 3) { background: linear-gradient(135deg, #ede9fe, #ddd6fe); }
.item-box:nth-child(8n + 4) { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.item-box:nth-child(8n + 5) { background: linear-gradient(135deg, #fee2e2, #fecaca); }
.item-box:nth-child(8n + 6) { background: linear-gradient(135deg, #ccfbf1, #99f6e4); }
.item-box:nth-child(8n + 7) { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); }
.item-box:nth-child(8n + 8) { background: linear-gradient(135deg, #fae8ff, #f5d0fe); }

/* 4.8: Context Menus */
.ellipsis-menu { position: absolute; top: 8px; right: 8px; cursor: pointer; font-size: 24px; color: var(--text-secondary); padding: 4px; line-height: 1; border-radius: 50%; z-index: 5; transition: var(--transition); }
.ellipsis-menu:hover { background-color: rgba(0,0,0,0.1); }
.dropdown-menu { display: none; position: absolute; top: 36px; right: 8px; background: white; border: 1px solid var(--gray-200); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 10; padding: 6px 0; min-width: 140px; }
.dropdown-menu button { display: block; width: 100%; padding: 8px 16px; background: none; border: none; text-align: left; cursor: pointer; font-size: 14px; color: var(--text-secondary); }
.dropdown-menu button:hover { background: var(--gray-100); }
.edit-form { display: none; margin-top: 12px; }

/* 4.9: Calendar Styles */
#calendar-controls { display: flex; gap: 12px; align-items: center; justify-content: flex-start; margin-bottom: 20px; padding: 0; }
#currentMonthLabel { font-weight: 700; font-size: 18px; min-width: 180px; text-align: center; color: var(--text-primary); }
.calendar-grid { display: flex; flex-direction: column; gap: 2px; background: var(--bg-primary); padding: 16px; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); border: 1px solid var(--gray-200); }
.cal-row { display: flex; gap: 2px; }
.cal-header div { flex: 1; text-align: center; font-weight: 700; padding: 10px; background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-50) 100%); border-radius: var(--radius-md); font-size: 12px; text-transform: uppercase; color: var(--text-primary); letter-spacing: 0.5px; }
.cal-cell { flex: 1; min-height: 60px; padding: 8px; cursor: pointer; border: 2px solid var(--gray-200); border-radius: var(--radius-md); transition: var(--transition); background-color: var(--bg-primary); font-size: 14px; font-weight: 600; display: flex; flex-direction: column; justify-content: space-between; text-align: center; color: var(--text-primary); }
.cal-cell:hover { border-color: var(--primary); transform: scale(1.03); z-index: 10; box-shadow: var(--shadow-md); }
.cal-cell:focus { outline: none; box-shadow: var(--focus-ring); }
.cal-cell.today { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: var(--text-white); font-weight: 700; border-color: var(--primary-dark); }
.cal-day { font-size: 14px; font-weight: 700; }
.cal-badges { display: flex; justify-content: center; gap: 2px; }
.badge-doc, .badge-note { display: inline-block; color: var(--text-white); border-radius: var(--radius-xl); padding: 2px 6px; font-size: 10px; font-weight: 600; }
.badge-doc { background-color: var(--primary); }
.badge-note { background-color: var(--warning); }
/* Block-4 Ended */

/* Block-5 Starting: Global Overlays & Modals */
/* Linked File: scripts.js (Unified Modal System) */

/* Block-5 Starting: Global Overlays & Modals */
/* 5.1: Modals */
.modal-overlay { 
    position: fixed; 
    inset: 0; 
    background-color: rgba(15, 23, 42, 0.7); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    /* FIX: Increased to 10000 to sit above everything */
    z-index: 10000; 
    backdrop-filter: blur(8px); 
    animation: modal-fade-in 0.3s ease-out; 
}

.modal-window { 
    background-color: var(--bg-primary); 
    border-radius: var(--radius-xl); 
    padding: 24px; 
    max-width: 90%; 
    width: 700px; 
    box-shadow: var(--shadow-lg), 0 25px 50px -12px rgba(0, 0, 0, 0.25); 
    max-height: 90vh; 
    overflow-y: auto; 
    animation: modal-slide-up 0.3s ease-out; 
    position: relative; 
    /* FIX: Increased to 10001 to satisfy Audit Check */
    z-index: 10001; 
}

@keyframes modal-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-slide-up { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }

.modal-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--gray-200); margin-bottom: 16px; }
.modal-header h3 { margin: 0; font-size: 18px; border: none; padding: 0; }
.modal-close-icon { font-size: 32px; color: var(--gray-500); cursor: pointer; transition: transform 0.2s; }
.modal-close-icon:hover { color: var(--accent); transform: rotate(90deg); }
.modal-footer { text-align: right; margin-top: 20px; border-top: 1px solid var(--gray-200); padding-top: 16px; }

/* 5.2: Helper Classes */
.hint, .message-box { color: var(--text-muted); font-style: italic; text-align: center; padding: 16px; font-size: 14px; background: var(--gray-50); border-radius: var(--radius-md); border: 1px solid var(--gray-200); }
.hint.error { color: var(--accent); background-color: #fee2e2; border-color: #fecaca; }

/* 5.3: Dropzone & Upload UI */
@keyframes dropdown-fade-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.azkml-dropzone-wrapper{margin-bottom:16px}
.azkml-dropzone{border:2px dashed #cfcfcf;border-radius:8px;padding:28px;text-align:center;cursor:pointer}
.azkml-upload-preview{margin-bottom:16px}
.azkml-file-list-container{border-top:1px solid #eee;padding-top:16px}
.azkml-file-list-header{margin:0 0 12px 0;font-size:16px;color:#333}
.azkml-table-responsive-wrapper { overflow-x: auto; }
.azkml-dms-file-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.azkml-dms-file-table th, .azkml-dms-file-table td { padding: 12px 15px; border-bottom: 1px solid #e2e8f0; vertical-align: middle; }
.azkml-dms-file-table th { background-color: #f8fafc; font-weight: 600; color: #475569; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.azkml-dms-file-table .s-no-col, .azkml-dms-file-table .uploaded-col, .azkml-dms-file-table .actions-col { text-align: center; width: 1%; white-space: nowrap; }
.azkml-dms-file-table .file-name-col { width: 100%; text-align: left; word-break: break-word; font-weight: 500; color: #1e293b; }
.azkml-file-list-empty { text-align: center; color: #64748b; padding: 24px; font-style: italic; }

/* 5.4: Action Dropdown (Vertical Dots) */
.action-dropdown-container {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}
.action-dropdown-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 20px;        /* Large enough to be clickable */
    font-weight: bold;
    line-height: 1;
    color: var(--gray-500, #64748b);
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    width: 32px;
}
.action-dropdown-toggle:hover,
.action-dropdown-toggle:focus {
    background-color: var(--gray-100, #f1f5f9);
    color: var(--primary, #3b82f6);
    outline: none;
}
.action-dropdown-menu {
    display: none;          /* Hidden */
    position: absolute;
    right: 0;               /* Align to right edge of button */
    top: 100%;              /* Appear below button */
    background-color: #ffffff;
    min-width: 160px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); /* Strong shadow for depth */
    border: 1px solid var(--gray-200, #e2e8f0);
    border-radius: 6px;
    padding: 6px 0;
    z-index: 1050;          /* CRITICAL: Must be higher than modal table rows */
    text-align: left;
    margin-top: 4px;        /* Slight spacing from button */
}
.action-dropdown-menu.show {
    display: block;
    animation: fadeInMenu 0.1s ease-out;
}
.action-dropdown-menu a,
.action-dropdown-menu button {
    display: block;
    width: 100%;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-secondary, #334155);
    text-decoration: none;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;    /* Prevent text wrapping */
    transition: background 0.15s;
}
.action-dropdown-menu a:hover,
.action-dropdown-menu button:hover {
    background-color: var(--gray-50, #f8fafc);
    color: var(--primary, #3b82f6);
}
@keyframes fadeInMenu {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 5.5: Overflow Handling */
.azkml-table-responsive-wrapper {
    overflow: visible !important; 
}
.azkml-upload-item { display:flex; justify-content:space-between; align-items:center; padding:8px 0; gap:12px; border-bottom:1px dashed #eee; }
.azkml-upload-item > div { flex-grow: 1; min-width: 0; }
.azkml-progress { width:100%; background:#f1f5f9; border-radius:6px; overflow:hidden; height:8px; margin-top:6px; }
.azkml-progress-bar { width:0%; height:100%; background:#34d399; transition:width 0.2s ease; }

/* Fix: Flip Dropdown Upwards for Last 4 Files in Upload Modal */
.azkml-dms-file-table tbody tr:nth-last-child(-n+4) .action-dropdown-menu {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 4px;
    transform-origin: bottom right;
}
/* Block-5 Ended */

/* Block-6 Starting: Feature Specific Styles */
/* Linked File: header.php (Search), footer.php */

/* 6.1: Search Interface */
.search-container { position: relative; width: 240px; }
#globalSearchInput { 
    width: 100%; padding: 0.35rem 0.75rem; padding-right: 32px; 
    font-size: 0.85rem; height: 32px; background-color: rgba(255, 255, 255, 0.15); 
    border: 1px solid rgba(255, 255, 255, 0.3); border-radius: var(--radius-md); 
    color: var(--text-white); transition: var(--transition); 
}
#globalSearchInput::placeholder { color: rgba(255, 255, 255, 0.7); }
#globalSearchInput:focus { background-color: var(--white); color: var(--text-primary); border-color: var(--primary); box-shadow: var(--focus-ring); width: 240px; }

.search-results-overlay {
    position: absolute; top: 110%; left: 0; right: 0; width: 450px; max-height: 60vh;
    background-color: var(--bg-primary); border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 101;
    overflow-y: auto; padding: 8px;
}
.search-result-dates { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
.search-result-category { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); padding: 8px 12px; border-bottom: 1px solid var(--gray-200); }
.search-result-item a { display: block; padding: 10px 12px; text-decoration: none; color: var(--text-secondary); border-radius: var(--radius-md); transition: var(--transition); }
.search-result-item a:hover { background-color: var(--gray-100); color: var(--text-primary); }
.search-result-title { font-weight: 600; color: var(--text-primary); }
.search-result-context { font-size: 12px; color: var(--text-muted); display: block; margin-top: 2px; }
.search-results-empty { padding: 16px; text-align: center; color: var(--text-muted); }

#search-filter-toggle {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    background: transparent; border: none; color: rgba(255, 255, 255, 0.7);
    cursor: pointer; height: 32px; width: 32px; padding: 0;
    border-radius: var(--radius-sm); display: flex; align-items: center;
    justify-content: center; transition: var(--transition);
}
#globalSearchInput:focus + #search-filter-toggle { color: var(--text-secondary); }
#search-filter-toggle:hover { background-color: rgba(0, 0, 0, 0.1); color: var(--text-white); }
#search-filter-toggle.active, #search-filter-toggle:focus { background-color: var(--primary); color: var(--white); outline: none; }

#search-filters-container {
    position: absolute; top: 110%; right: 0; width: 380px;
    background-color: var(--bg-primary); border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 102;
    padding: 16px; animation: dropdown-fade-in 0.2s ease-out;
}
.filter-header { display: flex; justify-content: space-between; align-items: center; margin: 0 0 12px 0; padding: 0 0 8px 0; border-bottom: 1px solid var(--gray-200); }
#close-filters-btn { background: none; border: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--text-muted); padding: 0 4px; }
#close-filters-btn:hover { color: var(--accent); }
#search-filters-container h4 { margin: 0; padding: 0; border: none; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.filter-group { margin-bottom: 16px; }
.filter-group:last-of-type { margin-bottom: 0; }
.filter-group label { font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text-secondary); }
.filter-group .date-inputs { display: flex; gap: 8px; }
.filter-group input, .filter-group select { padding: 8px 10px; font-size: 13px; background-color: var(--gray-50); }
.filter-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--gray-200); }
.search-results-close-icon { position: absolute; top: 8px; right: 8px; background: none; border: none; font-size: 28px; line-height: 1; cursor: pointer; color: var(--text-muted); padding: 4px 8px; z-index: 10; }
.search-results-close-icon:hover { color: var(--accent); }

/* 6.2: Live Clock & Header Extras */
/* 6.2: Live Clock & Header Extras (Fixed Layout) */
.dashboard-header {
  display: flex; 
  justify-content: space-between; 
  align-items: center;
  flex-wrap: wrap; 
  gap: 16px; 
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--gray-200);
}

.dashboard-header h2 { 
    margin: 0; 
    font-size: 24px;
    color: var(--text-primary);
    line-height: 1.2;
}

.live-clock-container {
    display: inline-flex; 
    align-items: center; 
    gap: 12px; 
    margin: 0;
    padding: 6px 16px; 
    background-color: #ffffff; /* Explicit white background */
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md); 
    box-shadow: var(--shadow-sm);
    height: 42px; /* Fixed container height */
    box-sizing: border-box;
}

/* FIX: Department Filter Dropdown Sizing */
/* Using !important to override global form styles & inline HTML styles */
#dashboard-dept-filter {
    width: auto !important; 
    max-width: 220px;
    min-width: 140px;
    height: 30px !important; 
    padding: 0 8px !important; 
    font-size: 13px !important;
    line-height: 28px !important;
    margin: 0 !important;
    border: 1px solid var(--gray-300) !important;
    border-radius: 4px !important;
    background-color: var(--bg-off-white) !important;
    color: var(--text-primary) !important;
    cursor: pointer;
}

#dashboard-dept-filter:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2) !important;
}

/* FIX: Clock Typography & Separator */
#live-clock {
    font-family: "SF Mono", "Consolas", "Menlo", monospace;
    font-weight: 600; 
    color: var(--text-primary); 
    font-size: 14px;
    letter-spacing: 0.5px; 
    white-space: nowrap; 
    min-width: 80px; 
    text-align: center;
    
    /* Clean Vertical Separator */
    border-left: 1px solid var(--gray-300);
    padding-left: 12px;
    height: 20px;
    line-height: 20px;
    display: flex;
    align-items: center;
}
#live-clock::before { content: none; } /* Remove old pipe char */

/* FIX: Format Toggle Button */
#time-format-toggle {
    background: none; 
    border: none; 
    cursor: pointer; 
    font-size: 16px;
    color: var(--text-muted); 
    padding: 4px; 
    margin-left: 2px;
    line-height: 1; 
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    border-radius: 4px;
}
#time-format-toggle:hover { 
    color: var(--primary); 
    background-color: var(--gray-100);
}
#time-format-toggle::before { content: none; }

/* 6.3: Task Table Specifics */
#task-table { table-layout: fixed; width: 100%; border-collapse: collapse; }
#task-table th, #task-table td {
    text-align: center; vertical-align: middle; padding: 8px;
    word-wrap: break-word; border: 1px solid var(--gray-400);
}
#task-table td { font-size: 13px; }
#task-table td[contenteditable="true"], #task-table th.task-col, #task-table th.remarks-col { text-align: left; }
#task-table select { font-size: 13px; border-radius: var(--radius-sm); border: 1px solid var(--gray-300); width: 100%; padding: 6px; }
#task-table thead th { background-color: var(--gray-100); color: var(--text-primary); font-weight: 700; }
.date-time-col div { display: block; line-height: 1.3; }
.date-time-col .task-time { font-size: 0.9em; color: var(--text-muted); }

.priority-urgent-important { background-color: #ef4444; color: white; }
.priority-urgent-not-important { background-color: #f97316; color: white; }
.priority-not-urgent-important { background-color: #3b82f6; color: white; }
.priority-not-urgent-not-important { background-color: #e5e7eb; color: var(--text-secondary); }
.priority-cell select { background-color: transparent; color: inherit; border: 1px solid rgba(255, 255, 255, 0.5); font-weight: 600; }
.priority-cell option { background-color: var(--bg-primary); color: var(--text-primary); }
.status-cell { font-weight: 600; background-color: var(--bg-primary); color: var(--text-primary); }
.status-cell.status-complete { background-color: #dcfce7; color: #166534; }
.status-cell.status-pending { background-color: #fee2e2; color: #b91c1c; }
.status-cell select { background-color: transparent; color: inherit; border: 1px solid rgba(0, 0, 0, 0.2); }
.status-cell option { background-color: var(--bg-primary); color: var(--text-primary); }
.color-meaning-list { list-style-type: none; padding-left: 0; margin-top: 10px; }
.color-meaning-list li { margin-bottom: 5px; }
.color-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 8px; vertical-align: middle; }
.task-toggle-container { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--gray-300); transition: .4s; border-radius: 28px; }
.toggle-slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .toggle-slider { background-color: var(--primary); }
input:checked + .toggle-slider:before { transform: translateX(22px); }
.toggle-label { font-weight: 600; color: var(--text-secondary); }
.toggle-label.active { color: var(--primary); }

/* 6.4: Export Modal */
#export-choice-modal .modal-footer { justify-content: center; gap: 16px; }
#export-dept-list { list-style-type: none; padding: 0; max-height: 40vh; overflow-y: auto; border: 1px solid var(--gray-200); padding: 10px; border-radius: var(--radius-md); }
#export-dept-list ul { padding-left: 0; list-style: none;}
#export-dept-list li { margin-bottom: 10px; }
#export-dept-list .dept-name { font-weight: bold; margin-bottom: 5px; }
#export-dept-list .cat-list { padding-left: 20px; }
#export-dept-list .cat-list label { display: flex; align-items: center; gap: 8px; font-weight: normal; margin-bottom: 2px; padding: 2px 0; }
#custom-calculation-list label { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: normal;}
#custom-calculation-list input[type="number"] { width: 80px; padding: 4px 8px; font-size: 13px; margin-left: 4px; }

/* 6.5: Footer */
.page-footer {
  position: fixed; bottom: 0; left: 0; width: 100%;
  background-color: #212529; color: #f8f9fa;
  padding: 15px 30px; box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px; z-index: 1000;
}
.footer-copyright {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  opacity: 0.5; white-space: nowrap;
}
.footer-credit {
  position: absolute; right: 30px; top: 50%; transform: translateY(-50%);
  opacity: 0.5; transition: opacity 0.3s ease; white-space: nowrap;
}
.credit-link:hover { opacity: 1; }
.credit-link { position: relative; color: #58a6ff; font-weight: 600; text-decoration: none; transition: color 0.3s ease; }
.credit-link:hover { color: #9ecbff; }
/* FIX: Tooltip anchored to right to prevent overflow */
.credit-link::after {
  content: attr(data-tooltip); position: absolute; right: 0; bottom: 150%;
  /* Removed left:50% centering, now anchors to right edge */
  background-color: #f8f9fa; color: #212529; padding: 8px 12px; border-radius: 6px; font-size: 13px;
  white-space: normal; width: 120px; text-align: center; box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  opacity: 0; visibility: hidden; transition: opacity 0.3s ease, transform 0.3s ease; pointer-events: none;
}
.credit-link::before {
  content: ''; position: absolute; left: 50%; bottom: 150%; margin-bottom: -10px;
  /* Arrow stays centered on the text */
  transform: translateX(-50%); border: 5px solid transparent; border-top-color: #f8f9fa;
  opacity: 0; visibility: hidden; transition: opacity 0.3s ease, transform 0.3s ease; pointer-events: none;
}
/* Split hover effects to handle different transforms */
.credit-link:hover::after { opacity: 1; visibility: visible; transform: translateY(-5px); }
.credit-link:hover::before { opacity: 1; visibility: visible; transform: translate(-50%, -5px); }

.footer-ping {
  position: absolute; left: 30px; top: 50%; transform: translateY(-50%); font-size: 13px; color: #adb5bd;
}
/* Network Ping Indicator - Footer High Contrast */
#ping-indicator {
    font-weight: 700;
    font-size: 12px;
    min-width: 45px;
    display: inline-block;
    text-align: right;
    transition: color 0.3s ease;
    
    /* Force Transparent Background */
    background-color: transparent !important;
    border: none !important;
    
    /* Monospace for stable number width */
    font-family: 'Consolas', 'Monaco', monospace; 
    cursor: help;
}

/* Neon Colors for High Contrast on Footer */
.ping-good { color: #22c55e !important; text-shadow: 0 0 1px rgba(0,0,0,0.5); }   /* Bright Green */
.ping-medium { color: #facc15 !important; text-shadow: 0 0 1px rgba(0,0,0,0.5); } /* Bright Yellow */
.ping-bad { color: #f87171 !important; text-shadow: 0 0 1px rgba(0,0,0,0.5); }    /* Bright Red */

/* 6.6: Special Buttons */
#documents-table td[data-col="Action"] { position: relative; }
#documents-table .ellipsis-menu { position: static; display: inline-flex; padding: 0; align-items: center; justify-content: center; width: 30px; height: 30px; }
#documents-table .dropdown-menu { top: calc(100% + 2px); right: 5px; min-width: 100px; z-index: 20; }
#documents-table .dropdown-menu button { padding: 8px 12px; font-size: 13px; }
#documents-table .dropdown-menu button.delete-doc:hover { background-color: var(--accent); color: var(--white); }

/* AKKI's Modern 3D Button */
.akki-3d-word-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: inherit; text-decoration: none; cursor: pointer; font-weight: 600;
    padding: 8px 16px; font-size: 13px; border-radius: 8px;
    background-color: #e2e8f0; border: 1px solid rgba(255, 255, 255, 0.7); color: #334155;
    box-shadow: -4px -4px 8px rgba(255, 255, 255, 0.8), 4px 4px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.15s ease-out;
}
.akki-3d-word-btn:hover {
    transform: translateY(-2px);
    box-shadow: -6px -6px 12px rgba(255, 255, 255, 0.9), 6px 6px 12px rgba(0, 0, 0, 0.2);
    color: #1e40af;
}
.akki-3d-word-btn:active {
    transform: translateY(1px); background-color: #dbeafe;
    box-shadow: inset 4px 4px 8px rgba(0, 0, 0, 0.15), inset -4px -4px 8px rgba(255, 255, 255, 0.8);
    transition: all 0.05s ease-in;
}
.akki-3d-word-btn:focus-visible {
    outline: none;
    box-shadow: -4px -4px 8px rgba(255, 255, 255, 0.8), 4px 4px 8px rgba(0, 0, 0, 0.15), 0 0 0 3px rgba(59, 130, 246, 0.5);
}
.akki-3d-word-btn svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; }

/* Multi-Drag Selection */
tr.sortable-selected { background-color: var(--primary-light) !important; color: var(--primary-hover) !important; }
tr.history-row.sortable-selected { background-color: var(--gray-50) !important; }
#documents-table tbody tr.sortable-selected .sticky-col { background-color: var(--primary-light) !important; }
tr.sortable-ghost { opacity: 0.4; background-color: #cceeff; }

/* 6.7: Accessibility & Responsive */
@media (prefers-contrast: high) { :root { --primary: #000080; --text-primary: #000000; --text-secondary: #000000; --bg-primary: #ffffff; --gray-200: #000000; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; } }
@media (max-width: 768px) {
    .topbar { flex-direction: column; gap: 12px; padding: 12px 16px; }
    .topbar .center, .topbar .right { flex-wrap: wrap; justify-content: center; }
    .search-container { width: 100%; order: -1; }
    .search-results-overlay { width: 100%; }
    #search-filters-container { left: 50%; transform: translateX(-50%); width: 95%; max-width: 380px; }
    .live-clock-container { display: none; }
    .container { padding: 8px; }
    .card { padding: 12px; }
    .modal-window { width: 95%; }
    .footer-content { flex-direction: column; }
    .page-footer { text-align: center; }
    .footer-ping, .footer-copyright, .footer-credit { position: static; transform: none; margin-bottom: 5px; opacity: 1; }
    .footer-credit { margin-bottom: 0; }
}


/* --- Diagnostics Report Styles --- */
.diag-container { font-family: 'Segoe UI', sans-serif; padding: 10px; }
.diag-section { margin-bottom: 25px; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; background: #fff; }
.diag-header { background: #f8fafc; padding: 10px 15px; border-bottom: 1px solid #e2e8f0; font-weight: 700; color: #334155; display: flex; justify-content: space-between; align-items: center; }
.diag-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.diag-table td { padding: 8px 15px; border-bottom: 1px solid #f1f5f9; color: #475569; }
.diag-table tr:last-child td { border-bottom: none; }
.diag-label { font-weight: 500; width: 40%; color: #1e293b; }
.diag-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-err { background: #fee2e2; color: #991b1b; }
.diag-summary { display: flex; gap: 10px; margin-bottom: 20px; }
.diag-card { flex: 1; padding: 15px; border-radius: 8px; color: white; text-align: center; }
.card-green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.card-red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.card-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.diag-card h3 { margin: 0; font-size: 2em; }
.diag-card span { font-size: 0.9em; opacity: 0.9; }

/* Professional Cleanup Report Styling */
.message-box {
    white-space: pre-wrap;       /* Respects newlines (\n) */
    font-family: 'Consolas', 'Monaco', monospace; /* Tech look */
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 15px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.6;
    color: #334155;
}

/* Block-6 Ended */


/* =========================================
   LOGIN PAGE STYLES (Exact Port from index.php)
   ========================================= */

/* 1. Scoped Body Background & Variables */
body.login-page {
    /* Define original variables locally to prevent conflicts */
    --login-primary: #3b82f6; 
    --login-error: #ef4444; 
    --login-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); 
    --login-radius: 8px; 
    --login-transition: all 0.2s ease-in-out; 
    --grad-1: #a5b4fc; 
    --grad-2: #6366f1; 
    --grad-3: #4f46e5;

    font-family: 'Inter', system-ui, sans-serif;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(-45deg, var(--grad-1), var(--grad-2), var(--grad-3), var(--grad-1));
    background-size: 400% 400%;
    animation: gradientAnimation 15s ease infinite;
}

@keyframes gradientAnimation { 
    0% { background-position: 0% 50%; } 
    50% { background-position: 100% 50%; } 
    100% { background-position: 0% 50%; } 
}

/* 2. Login Layout */
body.login-page .container { 
    width: 100%; 
    max-width: 420px; 
    padding: 1rem; 
}

.login-card { 
    background: #ffffff; 
    border-radius: var(--login-radius); 
    box-shadow: var(--login-shadow); 
    padding: 2rem; 
}

.login-card .center { 
    text-align: center; 
    margin-bottom: 1.5rem; 
    color: #1f2937; 
    font-size: 1.5rem; 
    font-weight: 600; 
}

.login-card .error-message { 
    background: rgba(239, 68, 68, 0.1); 
    border: 1px solid var(--login-error); 
    border-radius: var(--login-radius); 
    color: var(--login-error); 
    padding: 0.75rem; 
    margin-bottom: 1rem; 
    font-size: 0.875rem; 
    font-weight: 500; 
    text-align: center; 
}

/* 3. Form Elements (Scoped) */
.login-card form label { 
    display: block; 
    margin-bottom: 0.5rem; 
    color: #4b5563; 
    font-size: 0.875rem; 
    font-weight: 500; 
}

.login-card form input { 
    width: 100%; 
    padding: 0.75rem 1rem; 
    margin-bottom: 1rem; 
    border: 1px solid #d1d5db; 
    border-radius: var(--login-radius); 
    font-size: 1rem; 
    transition: var(--login-transition); 
    box-sizing: border-box; 
}

.login-card form input:focus { 
    outline: none; 
    border-color: var(--login-primary); 
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); 
}

.login-card form button { 
    width: 100%; 
    padding: 0.75rem; 
    background: var(--login-primary); 
    color: #ffffff; 
    border: none; 
    border-radius: var(--login-radius); 
    font-size: 1rem; 
    font-weight: 600; 
    cursor: pointer; 
    transition: var(--login-transition); 
}


/* =========================================
   TASK MANAGER STYLES (Final Professional Version - Rounded)
   ========================================= */

/* 1. Main Table Layout & Borders */
#task-table {
    table-layout: fixed;
    width: 100%;
    /* switch to separate to allow border-radius to work */
    border-collapse: separate; 
    border-spacing: 0;
    border: 1px solid #cbd5e1; /* Crisp Slate Border */
    background-color: #ffffff;
    /* ROUNDED CORNERS HERE */
    border-radius: 12px;
    overflow: hidden; /* Clips the corners */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); /* Soft Shadow */
}

#task-table th, 
#task-table td {
    vertical-align: middle;
    padding: 10px 8px; /* More breathing room */
    word-wrap: break-word;
    /* Only borders on bottom and right to prevent double borders with border-spacing:0 */
    border-bottom: 1px solid #cbd5e1;
    border-right: 1px solid #cbd5e1;
    font-size: 13px;
    text-align: center; /* Default center alignment */
}

/* Remove right border from last column so it fits the rounded container */
#task-table th:last-child,
#task-table td:last-child {
    border-right: none;
}
/* Remove bottom border from last row */
#task-table tbody tr:last-child td {
    border-bottom: none;
}

/* 2. Professional Table Header (Soft Navy Theme) */
#task-table thead th {
    background-color: #7c8188; /* Slate 700 - Professional & Calm */
    color: #ffffff;            /* White Text */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;     /* Slightly wider for readability */
    
    /* FIX: Solid borders to prevent conflict */
    border-right: 1px solid #475569; /* Slightly lighter line for separation */
    border-bottom: 1px solid #cbd5e1; /* Matches the table grid */
    border-top: none;
    border-left: none;
}

/* Remove the right border from the last column */
#task-table thead th:last-child { 
    border-right: none; 
}

/* 3. Department Section Header (The "Distinguishable" Row) */
tr.dept-section-header td {
    /* Eye-Catching Gradient */
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 100%) !important;
    color: #0f172a !important;
    font-weight: 800 !important;
    font-size: 14px !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 20px !important;
    text-align: left !important; /* Always left-align the dept name */
    border-left: 6px solid #2563eb !important; /* Bold Blue Accent */
    border-top: 1px solid #94a3b8 !important;
    border-bottom: 1px solid #94a3b8 !important;
    /* Override standard cell borders */
    border-right: none !important;
}

/* 4. Column Alignment Fixes */

/* HEADERS: Keep Titles Centered */
#task-table th.task-col,
#task-table th.remarks-col {
    text-align: center !important;
}

/* CONTENT: Keep Text Left Aligned (Better Readability) */
#task-table td[data-field="task_list"],
#task-table td[data-field="remarks"] {
    text-align: left !important;
    padding-left: 15px !important; /* Adds nice spacing from the edge */
}

/* Ensure editable cells look like text, not inputs */
#task-table td[contenteditable="true"]:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
    background-color: #f0f9ff;
}

/* 5. Priority Colors & Transparent Dropdowns */
.priority-urgent-important { background-color: #ef4444; color: white; }
.priority-urgent-not-important { background-color: #f97316; color: white; }
.priority-not-urgent-important { background-color: #3b82f6; color: white; }
.priority-not-urgent-not-important { background-color: #f1f5f9; color: #475569; }

.priority-cell select {
    background-color: transparent;
    color: inherit;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.4); /* Subtle white border for visibility */
    border-radius: 4px;
    width: 100%;
    padding: 6px;
    cursor: pointer;
}
/* Fix border visibility for light backgrounds */
.priority-not-urgent-not-important select { border-color: rgba(0,0,0,0.1); }

.priority-cell option { background-color: #fff; color: #334155; }

/* 6. Status Colors & Transparent Dropdowns */
.status-cell { font-weight: 700; background-color: #fff; }
.status-cell.status-complete { background-color: #dcfce7; color: #166534; }
.status-cell.status-pending { background-color: #fee2e2; color: #b91c1c; }
.status-cell.status-in-process { background-color: #fef9c3; color: #854d0e; }

.status-cell select {
    background-color: transparent;
    color: inherit;
    font-weight: 700;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 4px;
    width: 100%;
    padding: 6px;
    cursor: pointer;
}
.status-cell option { background-color: #fff; color: #334155; }

/* 7. Date & Time Styling */
.date-time-col { line-height: 1.4; font-weight: 500; color: #334155; }
.date-time-col .task-time { font-size: 0.85em; color: #64748b; font-weight: 400; }

/* 8. Toggle Switch & Back Button */
.toggle-container { display: flex; align-items: center; gap: 4px; }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #3b82f6; }
input:checked + .slider:before { transform: translateX(16px); }
.toggle-label.active { color: #3b82f6; font-weight: 800; }

.back-btn { 
    display: inline-flex; align-items: center; gap: 8px; 
    padding: 8px 16px; background-color: #fff; color: #334155; 
    border: 1px solid #cbd5e1; border-radius: 6px; 
    text-decoration: none; font-size: 14px; font-weight: 600; 
    transition: all 0.2s ease; cursor: pointer; white-space: nowrap; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.back-btn:hover { 
    border-color: #3b82f6; color: #3b82f6; background-color: #f8fafc; 
}



/* =========================================
   LOGIN PAGE STYLES (Covers Index & Step 2)
   ========================================= */

/* 1. Scoped Body & Variables */
body.login-page {
    --primary-color: #3b82f6;
    --error-color: #ef4444;
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.2s ease-in-out;
    --gradient-color-1: #a5b4fc;
    --gradient-color-2: #6366f1;
    --gradient-color-3: #4f46e5;

    font-family: 'Inter', system-ui, sans-serif;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    /* Animated Gradient Background */
    background: linear-gradient(-45deg, var(--gradient-color-1), var(--gradient-color-2), var(--gradient-color-3), var(--gradient-color-1));
    background-size: 400% 400%;
    animation: gradientAnimation 15s ease infinite;
}

/* 2. Animation Keyframes */
@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 3. Layout Container */
body.login-page .container {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

/* 4. Login Card */
.login-card {
    background: #ffffff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 2rem;
}

.login-card .center {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #1f2937;
    font-size: 1.5rem;
    font-weight: 600;
}

/* 5. Alerts & Errors */
.login-card .error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    border-radius: var(--border-radius);
    color: var(--error-color);
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}

/* 6. Form Elements */
.login-card form label {
    display: block;
    margin-bottom: 0.5rem;
    color: #4b5563;
    font-size: 0.875rem;
    font-weight: 500;
}

.login-card form input {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid #d1d5db;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    box-sizing: border-box;
}

.login-card form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.login-card form button {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

/* 7. Step 2 Specific: Read-only Username Display */
.login-card .username-display {
    padding: 0.75rem 1rem;
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    color: #374151;
    font-weight: 500;
    width: 100%;
    box-sizing: border-box;
}




/* =========================================
   RECYCLE BIN STYLES
   ========================================= */

/* 1. Header & Layout */
.recycle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e2e8f0;
}

.recycle-header h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    color: #1e293b;
}

/* 2. Table Styles */
.recycle-table {
    width: 100%;
    border-collapse: collapse;
}

.recycle-table th, 
.recycle-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    vertical-align: middle;
}

.recycle-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #475569;
}

/* [FIXED] Detectable Hover Effect */
/* We use 'tbody tr' to ensure the Header row doesn't light up */
.recycle-table tbody tr {
    transition: background-color 0.15s ease-in-out;
}

.recycle-table tbody tr:hover {
    background-color: #eff6ff; /* Clearly visible Light Blue */
    cursor: default;
}

/* 3. Badges & Meta */
.path-badge {
    display: inline-block;
    background: #f1f5f9;
    color: #64748b;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-right: 4px;
    border: 1px solid #e2e8f0;
}

.deleted-meta {
    font-size: 12px;
    color: #94a3b8;
}

.empty-state {
    padding: 40px;
    text-align: center;
    color: #94a3b8;
    font-style: italic;
    display: none; /* Toggled by JS */
}

/* 4. Batch Actions Toolbar */
#batch-actions-toolbar {
    background: #f1f5f9;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    display: flex; /* Hidden by default via inline style, but ready */
    align-items: center;
    justify-content: space-between;
}

/* 5. Tab Navigation Buttons */
.recycle-tab-nav {
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 20px;
}
.recycle-tab-nav button.active-tab {
    border-bottom: 2px solid #3b82f6;
    color: #3b82f6;
    font-weight: 600;
}



/* =========================================
   SCROLL TO TOP BUTTON (GeneratePress Style)
   ========================================= */
#dms-scroll-top {
    display: flex;
    position: fixed;
    /* [FIX] Positioned higher (15% from bottom) like the old version */
    bottom: 15%;       
    right: 20px;
    z-index: 2147483647; /* Maximum Z-Index */
    
    /* [CRITICAL] Allows the tooltip to float outside the button */
    overflow: visible !important; 
    
    /* Dimensions */
    width: 44px;
    height: 44px;
    border-radius: 4px; /* Slight radius */
    border: none;
    
    /* [FIX] Dark Semi-Transparent Glass (GeneratePress Standard) */
    background-color: rgba(0, 0, 0, 0.4); 
    color: #ffffff;
    
    /* Animations */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: none; /* Clean flat look initially */
}

/* Visible State */
#dms-scroll-top.show {
    opacity: 1;
    visibility: visible;
}

/* Hover State */
#dms-scroll-top:hover {
    /* [FIX] Darkens on hover */
    background-color: rgba(0, 0, 0, 0.7); 
    transform: translateY(-2px);
}

/* Icon Styling */
#dms-scroll-top svg {
    width: 20px;
    height: 20px;
    stroke-width: 3;
}

/* =========================================
   TOOLTIP STYLES ("Scroll back to top")
   ========================================= */
.gp-tooltip {
    position: absolute;
    /* Positioned to the left of the button */
    right: 120%; 
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    
    background-color: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    font-family: system-ui, -apple-system, sans-serif;
    white-space: nowrap; /* Prevents text wrapping */
    
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-in-out;
    pointer-events: none;
}

/* Little triangle pointer for the tooltip */
.gp-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -4px;
    margin-top: -4px;
    border-width: 4px;
    border-style: solid;
    border-color: transparent transparent transparent rgba(0, 0, 0, 0.85);
}

/* Show Tooltip on Hover */
#dms-scroll-top:hover .gp-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}
