/* ==========================================================================
   Right-Click Context Menu Styles
   ========================================================================== */
.doc-context-menu {
    position: fixed;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    min-width: 200px;
    padding: 0.5rem 0;
    animation: contextMenuIn 0.1s ease-out;
}

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

.doc-context-menu-content {
    display: flex;
    flex-direction: column;
}

.doc-context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #000000;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
    white-space: nowrap;
}

.doc-context-menu-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #000000;
}

.doc-context-menu-item:active {
    background-color: var(--primary-light);
    color: #000000;
}

.doc-context-menu-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.doc-context-menu-item:disabled:hover {
    background-color: transparent;
    color: #000000;
}

.doc-context-menu-item--danger {
    color: #000000;
}

.doc-context-menu-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: #000000;
}

.doc-context-menu-separator {
    height: 1px;
    background-color: var(--border);
    margin: 0.25rem 0;
}

/* ==========================================================================
   Hide Actions Column in Document Table (use right-click context menu)
   ========================================================================== */
.doc-row td:last-child,
table thead tr th:last-child {
    display: none;
}

/* ==========================================================================
   Design Tokens - Centralized Design System
   ========================================================================== */

:root {
  /* COLOR TOKENS - Semantic Color Palette */
  
  /* Brand Colors - Primary interaction and branding */
  --color-primary:           #1565c0;
  --color-primary-dark:      #0d47a1;
  --color-primary-light:     #e3f2fd;
  --color-primary-50:        #e3f2fd;
  --color-primary-100:       #bbdefb;
  --color-primary-200:       #90caf9;
  --color-primary-300:       #64b5f6;
  --color-primary-400:       #42a5f5;
  --color-primary-500:       #1565c0;
  --color-primary-600:       #1e88e5;
  --color-primary-700:       #1976d2;
  --color-primary-800:       #1565c0;
  --color-primary-900:       #0d47a1;

  /* Secondary Color - Secondary interactions */
  --color-secondary:         #1976d2;
  --color-secondary-light:   #e1f5fe;
  --color-secondary-dark:    #0d47a1;

  /* Accent Color - Call-to-action elements */
  --color-accent:            #1976d2;
  
  /* Status Colors */
  --color-success:           #1b5e20;
  --color-success-light:     #dcfce7;
  --color-success-50:        #f0fdf4;
  --color-success-100:       #dcfce7;
  --color-success-200:       #bbf7d0;
  --color-success-300:       #86efac;
  --color-success-400:       #4ade80;
  --color-success-500:       #22c55e;
  --color-success-600:       #16a34a;
  --color-success-700:       #15803d;
  --color-success-800:       #166534;
  --color-success-900:       #1b5e20;

  --color-warning:           #b45309;
  --color-warning-light:     #fef3c7;
  --color-warning-50:        #fffbeb;
  --color-warning-100:       #fef3c7;
  --color-warning-200:       #fde68a;
  --color-warning-300:       #fcd34d;
  --color-warning-400:       #fbbf24;
  --color-warning-500:       #f59e0b;
  --color-warning-600:       #d97706;
  --color-warning-700:       #b45309;
  --color-warning-800:       #92400e;
  --color-warning-900:       #78350f;

  --color-danger:            #b71c1c;
  --color-danger-light:      #fee2e2;
  --color-danger-50:         #fef2f2;
  --color-danger-100:        #fee2e2;
  --color-danger-200:        #fecaca;
  --color-danger-300:        #fca5a5;
  --color-danger-400:        #f87171;
  --color-danger-500:        #ef4444;
  --color-danger-600:        #dc2626;
  --color-danger-700:        #b91c1c;
  --color-danger-800:        #991b1b;
  --color-danger-900:        #7f1d1d;

  --color-info:              #0e7490;
  --color-info-light:        #e0f2fe;
  --color-info-50:           #f0f9fe;
  --color-info-100:          #e0f2fe;
  --color-info-200:          #bae6fd;
  --color-info-300:          #7dd3fc;
  --color-info-400:          #38bdf8;
  --color-info-500:          #0ea5e9;
  --color-info-600:          #0284c7;
  --color-info-700:          #0369a1;
  --color-info-800:          #075985;
  --color-info-900:          #0e7490;

  /* Neutral Colors - Grayscale palette for text, borders, backgrounds */
  --color-gray-50:           #f9fafb;
  --color-gray-100:          #f3f4f6;
  --color-gray-200:          #e5e7eb;
  --color-gray-300:          #d1d5db;
  --color-gray-400:          #9ca3af;
  --color-gray-500:          #6b7280;
  --color-gray-600:          #4b5563;
  --color-gray-700:          #374151;
  --color-gray-800:          #1f2937;
  --color-gray-900:          #111827;

  /* Semantic Text Colors */
  --color-text-heading:      #0f172a;
  --color-text-body:         #334155;
  --color-text-secondary:    #000000;
  --color-text-muted:        #000000;
  --color-text-inverse:      #ffffff;

  /* Component Colors */
  --color-background:        #ffffff;
  --color-card-bg:           #ffffff;
  --color-border:            #e2e8f0;
  --color-border-light:      #f1f5f9;
  --color-border-dark:       #cbd5e1;
  --color-divider:           #e2e8f0;

  /* TYPOGRAPHY TOKENS - Font hierarchy and scales */
  
  /* Font Family Stack */
  --font-family:             'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-family-mono:        'Menlo', 'Monaco', 'Courier New', monospace;

  /* Font Sizes - 8-step scale (xs through 2xl) */
  --fs-xs:                   0.75rem;   /* 12px - Small labels, captions */
  --fs-sm:                   0.875rem;  /* 14px - Small text, helpers */
  --fs-base:                 1rem;      /* 16px - Body text, base */
  --fs-md:                   1.125rem;  /* 18px - Medium text */
  --fs-lg:                   1.25rem;   /* 20px - Large text */
  --fs-xl:                   1.5rem;    /* 24px - Extra large */
  --fs-2xl:                  1.875rem;  /* 30px - Heading 2 */
  --fs-3xl:                  2.25rem;   /* 36px - Heading 1 */

  /* Font Weights */
  --fw-light:                300;
  --fw-normal:               400;
  --fw-medium:               500;
  --fw-semibold:             600;
  --fw-bold:                 700;
  --fw-extrabold:            800;

  /* Line Heights */
  --lh-tight:                1.2;
  --lh-normal:               1.5;
  --lh-relaxed:              1.6;
  --lh-loose:                1.8;

  /* Letter Spacing */
  --ls-tight:                -0.02em;
  --ls-normal:               0;
  --ls-wide:                 0.02em;

  /* SPACING TOKENS - Consistent rem-based spacing */
  --sp-xs:                   0.25rem;  /* 4px - Tight spacing, icon gaps */
  --sp-sm:                   0.5rem;   /* 8px - Small component spacing */
  --sp-md:                   0.75rem;  /* 12px - Default component padding */
  --sp-lg:                   1rem;     /* 16px - Standard spacing */
  --sp-xl:                   1.25rem;  /* 20px - Large component spacing */
  --sp-2xl:                  1.5rem;   /* 24px - Section spacing */
  --sp-3xl:                  2rem;     /* 32px - Major layout spacing */

  /* BORDER TOKENS */
  --border-radius-none:      0;
  --border-radius-xs:        0.125rem; /* 2px - Minimal rounding */
  --border-radius-sm:        0.375rem; /* 6px - Small buttons */
  --border-radius:           0.75rem;  /* 12px - Default rounding */
  --border-radius-md:        0.875rem; /* 14px - Medium rounding */
  --border-radius-lg:        1rem;     /* 16px - Large rounding */
  --border-radius-xl:        1.5rem;   /* 24px - Extra large rounding */
  --border-radius-full:      9999px;   /* Fully rounded (pills) */

  --border-width-thin:       1px;
  --border-width-base:       1px;
  --border-width-thick:      2px;

  /* SHADOW TOKENS - Depth and elevation */
  --shadow-xs:               0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:               0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow:                  0 4px 6px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
  --shadow-md:               0 10px 15px rgba(0,0,0,.07), 0 4px 6px rgba(0,0,0,.05);
  --shadow-lg:               0 20px 25px rgba(0,0,0,.08), 0 10px 10px rgba(0,0,0,.04);
  --shadow-xl:               0 25px 50px rgba(0,0,0,.1);

  /* TRANSITION & ANIMATION TOKENS */
  --duration-fast:           0.1s;
  --duration-base:           0.18s;
  --duration-slow:           0.28s;
  --duration-slower:         0.4s;

  --timing-linear:           linear;
  --timing-ease:             ease;
  --timing-ease-in:          ease-in;
  --timing-ease-out:         ease-out;
  --timing-ease-in-out:      ease-in-out;

  --transition-fast:         all 0.1s ease;
  --transition:              all 0.18s ease;
  --transition-slow:         all 0.28s ease;

  /* OPACITY TOKENS */
  --opacity-0:               0;
  --opacity-5:               0.05;
  --opacity-10:              0.1;
  --opacity-25:              0.25;
  --opacity-50:              0.5;
  --opacity-75:              0.75;
  --opacity-90:              0.9;
  --opacity-100:             1;

  /* COMPONENT-SPECIFIC TOKENS */
  
  /* Sidebar */
  --sidebar-width:           260px;
  --sidebar-collapsed-width: 68px;
  --sidebar-bg:              #0d2744;
  --sidebar-border:          rgba(255,255,255,.06);
  --sidebar-text:            #ffffff;
  --sidebar-text-hover:      #ffffff;
  --sidebar-active-bg:       rgba(21,101,192,.35);
  --sidebar-active:          #60a5fa;
  --sidebar-icon:            #e0f2fe;

  /* Topbar */
  --topbar-height:           64px;
  --topbar-bg:               #ffffff;
  --topbar-border:           #e2e8f0;

  /* Z-Index Hierarchy - Clear layering system with gaps for future components */
  /* 0-10:    Background layers, negative z-index elements */
  /* 100-199: Base layout (topbar, sidebar) */
  /* 200-299: Sidebar, main navigation */
  /* 300-399: Dropdowns, menus, popovers */
  /* 400-499: Tooltips, help text */
  /* 500-599: Sticky/floating content */
  /* 600-699: Backdrops, overlays, modals */
  /* 700-799: Modal content, modal headers, floating panels */
  /* 800-899: Modal floating (dropdowns within modals) */
  /* 900-999: Alerts, notifications, toasts */
  /* 1000+:   Critical overlays, full-screen dialogs */

  --z-negative:              -1;       /* Below main content */
  --z-base:                  10;       /* Base/default layer */
  --z-topbar:                100;      /* Topbar/header */
  --z-sidebar:               200;      /* Sidebar navigation */
  --z-dropdown:              300;      /* Dropdown menus, popovers */
  --z-tooltip:               400;      /* Tooltips, help text */
  --z-sticky:                500;      /* Sticky/floating content */
  --z-backdrop:              600;      /* Modal backdrops, overlays */
  --z-modal:                 700;      /* Modal dialogs */
  --z-modal-floating:        800;      /* Floating content within modals */
  --z-alert:                 900;      /* Alerts, notifications */
  --z-critical:              1000;     /* Critical overlays, full-screen */
  --z-emergency:             9999;     /* Emergency override (deprecated) */

  /* BACKWARD COMPATIBILITY - Legacy variable names */
  --primary:                 var(--color-primary);
  --primary-dark:            var(--color-primary-dark);
  --primary-light:           var(--color-primary-light);
  --accent:                  var(--color-accent);
  --success:                 var(--color-success);
  --success-light:           var(--color-success-light);
  --warning:                 var(--color-warning);
  --warning-light:           var(--color-warning-light);
  --danger:                  var(--color-danger);
  --danger-light:            var(--color-danger-light);
  --info:                    var(--color-info);
  --info-light:              var(--color-info-light);
  --content-bg:              var(--color-background);
  --card-bg:                 var(--color-card-bg);
  --border:                  var(--color-border);
  --radius:                  var(--border-radius);
  --radius-sm:               var(--border-radius-sm);
  --text-heading:            var(--color-text-heading);
  --text-body:               var(--color-text-body);
  --text-secondary:          var(--color-text-secondary);
  --text-muted:              var(--color-text-muted);
  --transition:              var(--duration-base);
  --transition-slow:         var(--duration-slow);
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  height: 100%;
  z-index: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-body);
  background: var(--content-bg);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  z-index: var(--z-base);
}

a { text-decoration: none; color: inherit; }
img, svg { display: block; }
ul { list-style: none; }
button { border: none; cursor: pointer; background: transparent; font-family: inherit; }
input, select, textarea { font-family: inherit; }
script, style { display: none !important; }

/* Global SVG/Icon Styling - consistent stroke-based icons with specific color overrides */
svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* Button and action icons - ensure stroke style with black color */
button svg,
.btn svg,
.btn-icon svg,
.doc-action-btn svg,
.icon-btn svg,
[role="button"] svg {
  stroke: #000000 !important;
  fill: none !important;
  stroke-width: 1.5 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}

/* Exceptions for icons that should be filled */
.stat-icon svg,
.avatar svg,
.logo svg,
.brand-icon svg,
.filled-icon svg {
  fill: currentColor;
  stroke: none;
}

/* ==========================================================================
   Global Text & Semantic Element Styling (Design Tokens)
   ========================================================================== */

/* Ensure all paragraph text uses design token colors */
p, li, span, div, label, td, th { color: var(--color-text-body); }

/* Form elements */
input, select, textarea {
  color: var(--color-text-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
}

input::placeholder, textarea::placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}

/* Table styling with design tokens */
table {
  color: var(--color-text-body);
  font-size: var(--fs-base);
}

thead {
  background: var(--color-gray-50);
  font-weight: 600;
  color: var(--color-text-body);
}

tbody tr:hover {
  background: var(--color-gray-50);
}

/* List items */
li {
  color: var(--color-text-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-primary-600);
}

/* Code blocks and inline code */
code, pre {
  font-family: 'Menlo', 'Monaco', monospace;
  background: var(--color-gray-50);
  color: var(--color-text-body);
  border-radius: var(--border-radius-xs);
}

code {
  padding: 0.125rem 0.375rem;
  font-size: 0.9em;
}

pre {
  padding: var(--sp-md);
  overflow-x: auto;
  line-height: var(--lh-normal);
}

/* Alerts and messages */
.alert {
  color: var(--color-text-body);
  background: var(--color-gray-50);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: var(--sp-md);
  font-size: var(--fs-base);
}

.alert-danger, .alert-error {
  background: var(--color-danger-50);
  color: var(--color-danger-700);
  border-color: var(--color-danger-200);
}

.alert-success {
  background: var(--color-success-50);
  color: var(--color-success-700);
  border-color: var(--color-success-200);
}

.alert-warning {
  background: var(--color-warning-50);
  color: var(--color-warning-700);
  border-color: var(--color-warning-200);
}

.alert-info {
  background: var(--color-info-50);
  color: var(--color-info-700);
  border-color: var(--color-info-200);
}

/* Stat cards and metric displays */
.stat-card,
.stat-display,
.metric-card {
  color: var(--color-text-body);
  font-size: var(--fs-base);
}

.stat-label,
.metric-label {
  color: var(--color-text-secondary);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.stat-value,
.metric-value {
  color: var(--color-text-heading);
  font-weight: 700;
  font-size: var(--fs-2xl);
}

/* Filter and search elements */
.filter-bar input,
.filter-bar select,
.search-wrap input {
  color: var(--color-text-body);
  font-size: var(--fs-base);
  border: 1px solid var(--color-border);
  background: white;
}

.filter-bar input:focus,
.filter-bar select:focus,
.search-wrap input:focus {
  border-color: var(--color-primary);
  outline: none;
}

.filter-bar input::placeholder,
.search-wrap input::placeholder {
  color: var(--color-text-muted);
}

/* Page headers and titles */
.page-header {
  color: var(--color-text-body);
}

.page-title,
.page-subtitle,
.card-title,
.card-subtitle {
  color: var(--color-text-heading);
}

.page-subtitle,
.card-subtitle {
  color: var(--color-text-secondary);
  font-size: var(--fs-sm);
}

/* ==========================================================================
   Font Size: Apply 12.8px (0.8rem) to Page Content
   ========================================================================== */
/* Apply 0.8rem to all page content areas (dashboard and default layouts) */
.dashboard-main,
.site-main {
  font-size: 0.8rem;
}

/* Apply 0.8rem to common text elements within page content */
.dashboard-main p,
.dashboard-main li,
.dashboard-main span:not([class*="stat"]):not([class*="topbar"]):not([class*="sidebar"]),
.dashboard-main div:not([class*="stat"]):not([class*="topbar"]):not([class*="sidebar"]):not([class*="footer"]),
.dashboard-main td,
.dashboard-main th,
.dashboard-main label,
.dashboard-main button,
.site-main p,
.site-main li,
.site-main span,
.site-main div:not([class*="stat"]):not([class*="footer"]),
.site-main td,
.site-main th,
.site-main label,
.site-main button {
  font-size: 0.8rem;
}

/* Apply 0.8rem to form elements (inputs, selects, textareas) */
input:not([type="hidden"]):not([type="file"]),
select,
textarea,
.input,
.select,
.textarea {
  font-size: 0.8rem;
}

/* Apply 0.8rem to filter select elements */
.filter-bar select,
.filter select,
#filterBar select,
#rrsFilterBar select,
[class*="filter"] select {
  font-size: 0.8rem;
}

/* Apply 0.8rem to table text spans */
table span.text,
table span.text * {
  font-size: 0.8rem;
}

/* Apply 0.8rem to modals and modal content */
.modal,
.modal-overlay,
.modal-dialog,
[role="dialog"],
[role="alertdialog"],
.drawer,
.drawer-overlay,
.modal-box {
  font-size: 0.8rem;
}

/* Apply 0.8rem to modal content elements */
.modal-header,
.modal-body,
.modal-footer,
.modal-title {
  font-size: 0.8rem;
}

/* Apply 0.8rem to dropdown menus */
.dropdown,
.dropdown-content,
.dropdown-menu,
[role="menu"],
[role="menuitem"],
.menu,
.menu-item {
  font-size: 0.8rem;
}

/* Preserve original sizes for excluded elements */
.sidebar,
.sidebar *,
.topbar,
.topbar *,
.stat-card,
.stat-card *,
.stat-card-solid,
.stat-card-solid *,
.docs-stats-card,
.docs-stats-card *,
.dept-stat-card,
.dept-stat-card *,
.dash-footer,
.dash-footer *,
.site-footer,
.site-footer *,
.page-header,
.topbar-title,
.topbar-subtitle {
  font-size: inherit;
}

/* Ensure text-level elements inherit the 0.8rem properly */
.dashboard-main a,
.site-main a {
  font-size: 0.8rem;
}



/* ==========================================================================
   Default (non-dashboard) Layout
   ========================================================================== */
.layout-default {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }

.site-main { flex: 1; padding: 2rem 0; }

.site-header {
  background: var(--primary);
  color: #fff;
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .5px;
}

.main-nav ul { display: flex; gap: 1.5rem; }

.main-nav a {
  color: rgba(255,255,255,.8);
  font-size: .95rem;
  transition: color var(--transition);
}

.main-nav a:hover,
.main-nav a.active { color: #fff; }

.site-footer {
  background: #1e293b;
  color: var(--text-muted);
  text-align: center;
  padding: 1rem 0;
  font-size: .875rem;
}

/* Dashboard footer */
.dash-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  margin-left: var(--sidebar-width);
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: margin-left var(--transition-slow);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.footer-divider {
  color: var(--text-muted);
  margin: 0 0.5rem;
}

.footer-link {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
  cursor: pointer;
}

.footer-link:hover {
  color: var(--primary-dark);
}

.footer-right {
  white-space: nowrap;
}

body.sidebar-collapsed .dash-footer { margin-left: var(--sidebar-collapsed-width); }

/* Default layout card (about/contact pages) */
.layout-default .card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

/* ==========================================================================
   Dashboard Layout — Sidebar
   ========================================================================== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  transition: transform var(--transition-slow), width var(--transition-slow);
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 0 1rem;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-brand-logo {
  height: 55px;
  width: auto;
  flex-shrink: 0;
}

.sidebar-brand-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
  flex: 1;
}

.sidebar-brand-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: .3px;
  white-space: nowrap;
  overflow: hidden;
  max-width: 160px;
  opacity: 1;
  transition: max-width var(--transition-slow), opacity var(--transition-slow);
  line-height: 1;
}

.sidebar-brand-tagline {
  font-size: 0.7rem;
  font-weight: 400;
  color: #ffffff;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  max-width: 160px;
  opacity: 0.75;
  line-height: 1;
}

.sidebar-brand-text em {
  color: #90caf9;
  font-style: normal;
  font-weight: 700;
}



.sidebar-toggle {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: .5rem;
  color: rgba(255,255,255,.7);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.sidebar-toggle svg { width: 20px; height: 20px; }

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar-nav .nav-section:last-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.nav-section { margin-bottom: .5rem; }

.nav-section-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: #cbd5e1 !important;
  padding: .75rem 1.25rem .3rem;
  white-space: nowrap;
  display: block;
}

.nav-item { margin: 0 .625rem .125rem; }

.nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .575rem .75rem;
  border-radius: .5rem;
  color: var(--sidebar-text) !important;
  font-size: 0.8rem;
  font-weight: 400;
  transition: color var(--transition);
  white-space: nowrap;
  text-decoration: none !important;
}

.nav-link:hover {
  color: var(--sidebar-text-hover) !important;
  text-decoration: none !important;
  border-bottom: none !important;
}

.nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active) !important;
}

.nav-link .nav-label {
  color: var(--sidebar-text) !important;
}

.nav-link:hover .nav-label {
  color: var(--sidebar-text-hover) !important;
}

.nav-link.active .nav-label {
  color: var(--sidebar-active) !important;
}

.nav-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }
.nav-link.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: rgba(26,58,110,.4);
  color: #93c5fd;
  font-size: .63rem;
  font-weight: 700;
  padding: .1rem .45rem;
  border-radius: 999px;
  line-height: 1.5;
}

.nav-link.active .nav-badge { background: var(--sidebar-active); color: var(--sidebar-bg); }

/* Nav parent button (same look as nav-link) */
.nav-link-parent {
  width: 100%;
  text-align: left;
  background: transparent;
  font-family: inherit;
}

/* Chevron icon */
.nav-chevron {
  width: 14px !important;
  height: 14px !important;
  margin-left: auto;
  flex-shrink: 0;
  opacity: .6;
  transition: transform var(--transition);
}

.nav-link-parent[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
}

/* Submenu */
.nav-submenu {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--transition-slow);
}

.nav-submenu.open {
  max-height: 200px;
}

.nav-sublink {
  padding-left: 2.5rem !important;
  font-size: .9rem !important;
  color: #ffffff !important;
  font-weight: 500;
}

.nav-sublink:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

.nav-sublink.active {
  background: rgba(59, 130, 246, 0.2) !important;
  color: #60a5fa !important;
}

.nav-sublink svg {
  width: 15px !important;
  height: 15px !important;
  opacity: .65;
}

/* Hide submenu in collapsed mode */
body.sidebar-collapsed .nav-submenu { max-height: 0 !important; }
body.sidebar-collapsed .nav-chevron { display: none; }

.sidebar-footer {
  padding: .75rem 1rem;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.sidebar-copyright {
  font-size: .67rem;
  color: var(--sidebar-icon);
  text-align: center;
  line-height: 1.4;
  overflow: hidden;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  border-radius: .5rem;
  cursor: pointer;
  transition: background var(--transition);
  width: 100%;
  text-align: left;
  background: transparent;
  font-family: inherit;
}

.sidebar-user-content {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: 1;
  min-width: 0;
}

.sidebar-user-caret {
  width: 14px !important;
  height: 14px !important;
  flex-shrink: 0;
  opacity: .6;
  transition: transform var(--transition);
}

.sidebar-user[aria-expanded="true"] .sidebar-user-caret {
  transform: rotate(180deg);
}

.sidebar-user-content > div {
  min-width: 0;
  flex: 1;
}

.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1565c0, #1a3a6e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: .815rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.sidebar-user-role {
  font-size: .7rem;
  color: var(--sidebar-icon);
}

/* Sidebar User Menu */
.sidebar-user-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--sidebar-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: .5rem;
  margin-bottom: .5rem;
  box-shadow: 0 -4px 6px rgba(0,0,0,.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar-user-menu[hidden] { display: none; }

.sidebar-user-menu-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .575rem .75rem;
  color: var(--sidebar-text);
  font-size: .855rem;
  font-weight: 500;
  transition: color var(--transition), background var(--transition);
  text-align: left;
  background: transparent;
  font-family: inherit;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.sidebar-user-menu-item:hover {
  background: rgba(255,255,255,.05);
  color: var(--sidebar-text-hover);
}

.sidebar-user-menu-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: .8;
}

/* ==========================================================================
   Dashboard Layout — Top Bar
   ========================================================================== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem 0 calc(var(--sidebar-width) + 1.5rem);
  gap: 1rem;
  z-index: var(--z-topbar);
  box-shadow: var(--shadow-xs);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: 1;
}

.topbar-brand-icon {
  width: 36px; height: 36px;
  background: #f1f5f9;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar-brand-icon svg { width: 20px; height: 20px; color: var(--primary); }

.topbar-brand-text {
  display: flex;
  align-items: center;
  line-height: 1.2;
}

.topbar-brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: .2px;
  white-space: nowrap;
}

.topbar-brand-name em {
  font-style: normal;
  color: var(--text-secondary);
}

.topbar-brand-sub {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-heading);
  white-space: nowrap;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .375rem;
}

.topbar-btn {
  width: 38px; height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: .5rem;
  color: var(--text-secondary);
  position: relative;
  transition: background var(--transition), color var(--transition);
}

.topbar-btn:hover { background: #f1f5f9; color: var(--text-heading); }
.topbar-btn svg { width: 19px; height: 19px; }

.topbar-notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: #f87171;
  border-radius: 50%;
  border: 2px solid #ffffff;
  display: none; /* hidden until JS sets unread count */
}
.topbar-notif-dot.has-unread { display: block; }

/* ── Notification Panel ──────────────────────────────────────────────────── */
.notif-panel {
  position: absolute;
  top: calc(100% + .5rem);
  right: 0;
  width: 340px;
  max-height: 480px;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: .75rem;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  z-index: var(--z-backdrop);
  overflow: hidden;
}
.notif-panel:not([hidden]) {
  display: flex;
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1rem .7rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.notif-panel-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-heading);
}

.notif-panel-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.notif-mark-all-btn,
.notif-clear-all-btn {
  font-size: .75rem;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.notif-mark-all-btn:hover,
.notif-clear-all-btn:hover { }

.notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .75rem 1rem;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--hover-bg, rgba(0,0,0,.04)); }
.notif-item.unread { background: rgba(59,130,246,.06); }
.notif-item.unread:hover { background: rgba(59,130,246,.1); }

.notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: .35rem;
}
.notif-item:not(.unread) .notif-dot { background: transparent; }

.notif-body { flex: 1; min-width: 0; }
.notif-title {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-heading);
}
.notif-msg {
  font-size: .78rem;
  color: var(--text-secondary);
  margin-top: .15rem;
}
.notif-time {
  font-size: .72rem;
  color: var(--text-muted, #000000);
  margin-top: .2rem;
  white-space: nowrap;
}

.notif-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: .85rem;
}

/* Notification type icon badge */
.notif-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: .1rem;
}
.notif-icon svg { width: 15px; height: 15px; }

.notif-icon--upload  { background: #dbeafe; color: #1d4ed8; }
.notif-icon--approve { background: #dcfce7; color: #15803d; }
.notif-icon--reject  { background: #fee2e2; color: #b91c1c; }
.notif-icon--archive { background: #fef3c7; color: #b45309; }
.notif-icon--share   { background: #f3e8ff; color: #7c3aed; }
.notif-icon--disposal          { background: #fff7ed; color: #c2410c; }
.notif-icon--deadline          { background: #eff6ff; color: #1d4ed8; }
.notif-icon--deadline-warning  { background: #fef3c7; color: #b45309; }
.notif-icon--deadline-urgent   { background: #fff7ed; color: #c2410c; }
.notif-icon--deadline-overdue  { background: #fee2e2; color: #b91c1c; }
.notif-icon--default { background: #f1f5f9; color: #000000; }

body.dark-mode .notif-icon--upload  { background: rgba(29,78,216,.2);  color: #93c5fd; }
body.dark-mode .notif-icon--approve { background: rgba(21,128,61,.2);  color: #86efac; }
body.dark-mode .notif-icon--reject  { background: rgba(185,28,28,.2);  color: #fca5a5; }
body.dark-mode .notif-icon--archive { background: rgba(180,83,9,.2);   color: #fcd34d; }
body.dark-mode .notif-icon--share   { background: rgba(124,58,237,.2); color: #c4b5fd; }
body.dark-mode .notif-icon--disposal         { background: rgba(194,65,12,.2);  color: #fdba74; }
body.dark-mode .notif-icon--deadline         { background: rgba(29,78,216,.2);  color: #93c5fd; }
body.dark-mode .notif-icon--deadline-warning { background: rgba(180,83,9,.2);   color: #fcd34d; }
body.dark-mode .notif-icon--deadline-urgent  { background: rgba(194,65,12,.2);  color: #fdba74; }
body.dark-mode .notif-icon--deadline-overdue { background: rgba(185,28,28,.2);  color: #fca5a5; }
body.dark-mode .notif-icon--default { background: rgba(100,116,139,.15); color: #e2e8f0; }

/* Actor name (who triggered the event) */
.notif-actor {
  font-size: .74rem;
  font-weight: 500;
  color: var(--accent);
  margin-top: .1rem;
}

/* Clickable indicator arrow */
.notif-arrow {
  width: 14px; height: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--transition), transform var(--transition);
  align-self: center;
  margin-left: .25rem;
}
.notif-item--linked:hover .notif-arrow {
  opacity: 1;
  transform: translateX(2px);
}
.notif-item--linked { cursor: pointer; }
.notif-item--linked:hover { background: var(--hover-bg, rgba(0,0,0,.04)); }
.notif-item--linked.unread:hover { background: rgba(59,130,246,.1); }

/* The topbar-actions must be position:relative for the panel to anchor */
.topbar-actions { position: relative; }

.topbar-divider { width: 1px; height: 22px; background: rgba(255,255,255,.2); margin: 0 .25rem; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .375rem .625rem;
  border-radius: .5rem;
  cursor: pointer;
  transition: background var(--transition);
}

.topbar-user:hover { background: rgba(255,255,255,.1); }

/* Theme toggle icons */
.theme-icon { width: 19px; height: 19px; }
.theme-icon-sun  { display: none; }
.theme-icon-moon { display: block; }
body.dark-mode .theme-icon-sun  { display: block; }
body.dark-mode .theme-icon-moon { display: none; }

/* ==========================================================================
   Dark Mode
   ========================================================================== */
body.dark-mode {
  --content-bg:   #0f172a;
  --card-bg:      #1e293b;
  --border:       #334155;
  --text-heading: #f1f5f9;
  --text-body:    #cbd5e1;
  --text-secondary:#000000;
  --text-muted:   #000000;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow:    0 4px 6px rgba(0,0,0,.4), 0 2px 4px rgba(0,0,0,.3);
  --shadow-md: 0 10px 15px rgba(0,0,0,.4), 0 4px 6px rgba(0,0,0,.3);
}

body.dark-mode .card,
body.dark-mode .stat-card,
body.dark-mode .doc-table-wrap,
body.dark-mode .folder-card { background: var(--card-bg); border-color: var(--border); }

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  background: #1e293b;
  color: var(--text-body);
  border-color: var(--border);
}

body.dark-mode input::placeholder { color: var(--text-muted); }

.topbar-logout {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .75rem;
  border-radius: .5rem;
  color: var(--text-secondary);
  font-size: .8rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.topbar-logout:hover {
  background: #f1f5f9;
  color: var(--text-heading);
}

.topbar-logout svg { width: 16px; height: 16px; flex-shrink: 0; }

.topbar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1565c0, #1a3a6e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  border: 2px solid #e2e8f0;
  overflow: hidden;
}

.topbar-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.topbar-user-name { font-size: .8rem; font-weight: 600; color: var(--text-heading); line-height: 1.2; }
.topbar-user-role { font-size: .7rem; color: var(--text-secondary); }

/* Topbar user as a button */
button.topbar-user {
  appearance: none;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
}

/* Dropdown caret */
.topbar-user-caret {
  width: 14px; height: 14px;
  flex-shrink: 0;
  opacity: .65;
  transition: transform var(--transition);
}
button.topbar-user[aria-expanded="true"] .topbar-user-caret { transform: rotate(180deg); }

/* User dropdown wrapper */
.topbar-user-wrap { position: relative; }

/* Dropdown menu */
.topbar-dropdown-menu {
  position: absolute;
  top: calc(100% + .4rem);
  right: 0;
  background: var(--topbar-bg);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 0;
  min-width: 200px;
  box-shadow: 0 10px 25px rgba(0,0,0,.15), 0 4px 8px rgba(0,0,0,.1);
  z-index: var(--z-dropdown);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.topbar-dropdown-menu:not([hidden]) {
  display: block;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.topbar-dd-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 100%;
  padding: .45rem .75rem;
  background: none;
  border: none;
  color: var(--text-heading);
  font-size: .84rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}
.topbar-dd-item:hover { background: rgba(0,0,0,.08); color: var(--text-heading); }
.topbar-dd-item svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--text-heading); }

/* Avatar upload modal preview */
.avatar-preview-wrap {
  display: inline-block;
  position: relative;
  margin-bottom: .75rem;
}

.avatar-preview-circle {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1565c0, #1a3a6e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  border: 3px solid var(--border);
  position: relative;
}

.avatar-preview-circle img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.avatar-preview-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
}
.avatar-preview-wrap:hover .avatar-preview-overlay { opacity: 1; }
.avatar-preview-overlay svg { width: 22px; height: 22px; stroke: #fff; }

#avatarFileInput { display: none; }

.avatar-file-hint {
  font-size: .78rem;
  color: var(--text-secondary);
  margin: 0 0 .25rem;
}

.avatar-selected-name {
  font-size: .8rem;
  color: var(--text-body);
  margin-top: .4rem;
  word-break: break-all;
}

/* Avatar modal — compact size */
#avatarModal .meta-modal {
  max-width: 420px;
}

#avatarModal .meta-modal-body {
  padding: 1.5rem 1.25rem;
}

/* ==========================================================================
   Dashboard Layout — Wrapper & Main
   ========================================================================== */
.dashboard-wrapper {
  margin-left: var(--sidebar-width);
  transition: margin-left var(--transition-slow);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.dashboard-main {
  padding-top: var(--topbar-height);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.dashboard-content {
  padding: 1.75rem 3rem 3rem;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* ==========================================================================
   Page Header
   ========================================================================== */
.page-header { margin-bottom: 1.625rem; }

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.25;
  letter-spacing: -.02em;
}

.page-subtitle {
  font-size: .875rem;
  color: var(--text-secondary);
  margin-top: .2rem;
}

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .775rem;
  color: var(--text-muted);
  margin-bottom: .375rem;
}

.breadcrumb svg { width: 13px; height: 13px; }
.breadcrumb a { color: var(--text-secondary); transition: color var(--transition); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { opacity: .35; }
.breadcrumb-current { color: var(--text-body); font-weight: 500; }

/* ==========================================================================
   Cards (Dashboard)
   ========================================================================== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 1.125rem 1.375rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 61px;
}

.card-title {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text-heading);
}

.card-subtitle {
  font-size: .775rem;
  color: var(--text-muted);
  margin-top: .15rem;
}

.card-body { padding: 0.875rem; }

/* Header Actions & Filters */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.filter-dropdown {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: white;
  color: var(--text-heading);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color var(--transition);
  height: auto;
  max-height: 32px;
}

.filter-dropdown:hover {
  border-color: var(--primary);
}

.filter-dropdown:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
}

/* Documents Overview Body */
.docs-overview-body {
  display: flex;
  gap: 1.5rem;
  align-items: stretch;
}

.docs-overview-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 0 0 45%;
  min-width: 180px;
  align-items: center;
  text-align: center;
  justify-content: center;
}

/* Documents Legend */
.docs-legend {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-width: 180px;
}

.docs-legend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.docs-legend-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.docs-legend-label {
  flex: 1;
  color: var(--text-heading);
  font-weight: 500;
}

.docs-legend-count {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

/* View Report Button */
.view-report-btn {
  display: inline-block;
  color: #3b82f6;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color var(--transition);
  margin-top: 0.5rem;
}

.view-report-btn:hover {
  color: #2563eb;
}

.view-report-btn svg {
  width: 16px;
  height: 16px;
}

.card-footer {
  padding: .875rem 1.375rem;
  border-top: 1px solid var(--border);
  background: #fafbfc;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ==========================================================================
   Stat Cards
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.125rem;
  margin-bottom: 1.375rem;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.375rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-label {
  font-size: .73rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .35rem;
}

.stat-value {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.1;
  letter-spacing: -.03em;
  margin-bottom: .45rem;
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .78rem;
  font-weight: 500;
}

.stat-trend svg { width: 14px; height: 14px; flex-shrink: 0; }
.stat-trend.up   { color: var(--success); }
.stat-trend.down { color: var(--danger); }
.stat-trend.neutral { color: var(--text-muted); }
.stat-trend-label { color: var(--text-secondary); font-weight: 400; }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 26px; height: 26px; }
.stat-icon-blue   { background: #dbeafe; color: #1565c0; }
.stat-icon-violet { background: #dbeafe; color: #1976d2; }
.stat-icon-green  { background: #dcfce7; color: #1b5e20; }
.stat-icon-amber  { background: #fef3c7; color: #b45309; }
.stat-icon-cyan   { background: #e0f2fe; color: #0e7490; }
.stat-icon-rose   { background: #fee2e2; color: #b71c1c; }

/* Solid-background stat cards (matches reference dashboard style) */
.stat-card-solid {
  border: none;
}
.stat-card-solid .stat-label {
  color: rgba(255,255,255,.85);
  text-transform: uppercase;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
}
.stat-card-solid .stat-value  { color: #fff; }
.stat-card-solid .stat-trend  { color: rgba(255,255,255,.9); }
.stat-card-solid .stat-trend-label { color: rgba(255,255,255,.72); }
.stat-card-solid .stat-icon   { background: rgba(255,255,255,.18); color: #fff; }
.stat-card-solid:hover        { box-shadow: var(--shadow-lg); }

.stat-solid-blue  { background: #1565c0; }
.stat-solid-green { background: #1b5e20; }
.stat-solid-amber { background: #c79100; }
.stat-solid-red   { background: #b71c1c; }

/* ==========================================================================
   Dashboard Grid
   ========================================================================== */
.dash-grid { display: grid; grid-template-columns: 1fr 340px; gap: 1.25rem; margin-bottom: 1.25rem; align-items: stretch; }
.dash-grid-3 { display: grid; grid-template-columns: 1fr 1fr 340px; gap: 1.25rem; margin-bottom: 1.25rem; }
.dash-col { display: flex; flex-direction: column; gap: 1.25rem; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: .5rem;
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
  line-height: 1.4;
  white-space: nowrap;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--card-bg); color: var(--text-body); border-color: var(--border); }
.btn-secondary:hover { background: var(--content-bg); color: var(--text-heading); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--content-bg); color: var(--text-heading); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #1b5e20; color: #fff; }
.btn-sm  { padding: .35rem .75rem; font-size: .8rem; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn-xs  { padding: .2rem .55rem; font-size: .73rem; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: .4rem; }
.btn-icon svg { width: 15px; height: 15px; }

/* ==========================================================================
   Badges
   ========================================================================== */
/* Badge base styling */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 10.88px;
  font-weight: 700;
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
  white-space: nowrap;
  margin: 0;
}

.badge-blue   { background: #dbeafe; color: #1a3a6e; }
.badge-violet { background: #dbeafe; color: #1565c0; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-gray   { background: #f8fafc; color: #475569; border: 1px solid #e2e8f0; }
.badge-cyan   { background: #e0f2fe; color: #0e7490; }
.badge-pink   { background: #fdf2f8; color: #9d174d; }
.badge-orange { background: #fff7ed; color: #9a3412; }
.badge-archived { background: #fee2e2; color: #991b1b; font-weight: 700; }

.badge-pdf  { background: #fee2e2; color: #991b1b; }
.badge-docx { background: #dbeafe; color: #1a3a6e; }
.badge-xlsx { background: #dcfce7; color: #166534; }
.badge-pptx { background: #fff7ed; color: #9a3412; }
.badge-img  { background: #dbeafe; color: #1565c0; }
.badge-zip  { background: #f8fafc; color: #334155; border: 1px solid #e2e8f0; }

/* ==========================================================================
   Table
   ========================================================================== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}

.table th {
  padding: .7rem .75rem;
  text-align: left;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #000000 !important;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: relative;
}

.table th:hover {
  background: #f1f5f9;
  cursor: pointer;
  transition: background var(--transition);
}

/* Sort indicator in column headers */
.table th .sort-indicator {
  display: inline-block;
  margin-left: 0.3rem;
  font-size: 0.65rem;
  opacity: 0.5;
  transition: opacity var(--transition);
}

.table th.sorted .sort-indicator {
  opacity: 1;
  color: #1565c0;
}

/* Search term highlighting */
.search-highlight {
  background: #fef3c7;
  color: #92400e;
  padding: 0.1rem 0.2rem;
  border-radius: 2px;
  font-weight: 500;
}

.table td {
  padding: .875rem .75rem;
  border-bottom: 1px solid #f1f5f9;
  color: #000000 !important;
  vertical-align: top;
}

/* Table text styling - keep text black but exclude buttons/icons */
.table td {
  color: #000000 !important;
}

/* Action buttons in tables - force black color and stroke */
.table .doc-action-btn,
.table .doc-action-btn svg {
  color: #000000 !important;
  fill: none !important;
  stroke: #000000 !important;
}

.table .doc-action-btn:hover,
.table .doc-action-btn:hover svg {
  color: #000000 !important;
  stroke: #000000 !important;
  opacity: 1;
}

/* Other table buttons */
.table .btn,
.table .btn svg,
.table .btn-link,
.table button svg,
.table [role="button"] svg {
  color: inherit;
  fill: inherit;
}

/* Exclude folder icon from black - use stroke style with black color */
.table .folder-cell svg {
  color: #000000;
  stroke: #000000 !important;
  fill: none !important;
}

/* Exclude badges and stat cards from table text color */
.table .badge,
.table .badge *,
.table .stat-card,
.table .stat-card * {
  color: inherit !important;
  fill: inherit !important;
}

/* Table links in black */
.table a,
.table a:visited {
  color: #000000 !important;
}

/* Badges should not be black */
.table .badge {
  color: inherit !important;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover td { background: #f8faff; }

/* Improved table row selection styling */
.table tbody tr.selected td {
  background: #eff6ff;
  border-color: #1565c0;
}

.table tbody tr.selected:hover td {
  background: #e0edff;
}

/* Bulk Action Toolbar */
.bulk-action-toolbar {
  background: #eff6ff;
  border: 1px solid #1565c0;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bulk-action-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
}

.bulk-action-info {
  font-size: 0.875rem;
  color: #1565c0;
  font-weight: 500;
  white-space: nowrap;
  min-width: 150px;
}

.bulk-action-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.bulk-action-buttons .btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
  color: #1565c0;
  transition: all var(--transition);
  border-radius: var(--radius-sm);
}

.bulk-action-buttons .btn:hover {
  background: rgba(21, 101, 192, 0.1);
  color: #0d47a1;
}

.bulk-action-buttons .btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Responsive bulk action toolbar */
@media (max-width: 1024px) {
  .bulk-action-content {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .bulk-action-info {
    min-width: auto;
  }
  
  .bulk-action-buttons {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .bulk-action-toolbar {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
  }
  
  .bulk-action-buttons .btn {
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    gap: 0.3rem;
  }
  
  .bulk-action-buttons .btn svg {
    width: 12px;
    height: 12px;
  }
}

/* Standard table cell utility classes - work with .table, .data-table, and other table types */
td.text-secondary, td.text-muted, td.text-heading { font-size: .8rem; }
td.text-secondary { color: var(--text-secondary); }
td.text-muted { color: var(--text-muted); }
td.text-heading { color: var(--text-heading); font-weight: 500; }

/* Table cell alignment and spacing utilities */
td.text-center { text-align: center; }
td.text-center-compact { padding: .6rem .5rem; text-align: center; }

/* Text size and color utilities for table cells */
.text-xs { font-size: 0.8rem; }
.text-xs-secondary { font-size: 0.8rem; color: #000000 !important; }
.text-xs-muted { font-size: 0.8rem; color: #000000 !important; }
.text-xs-truncate { font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Ensure span.text-xs-secondary remains at 12.8px (0.8rem) */
span.text-xs-secondary {
  font-size: 0.8rem !important;
}

/* Folder cell with flex layout */
.folder-cell { display: flex; align-items: center; gap: .3rem; font-size: 0.8rem; color: #000000 !important; }

/* Override text size in table context to match table font size */
.table .text-xs,
.table .text-xs-secondary,
.table .text-xs-muted,
.table .text-xs-truncate {
  font-size: 0.8rem !important;
}

.data-table .text-xs,
.data-table .text-xs-secondary,
.data-table .text-xs-muted,
.data-table .text-xs-truncate {
  font-size: 0.8rem !important;
}

/* Apply consistent font sizing to all data tables */
.data-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.data-table th {
  padding: .7rem .75rem;
  text-align: left;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #000000 !important;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: .875rem .75rem;
  border-bottom: 1px solid #f1f5f9;
  color: #000000 !important;
  vertical-align: top;
}

/* Action buttons in data tables - force black color and stroke */
.data-table .doc-action-btn,
.data-table .doc-action-btn svg {
  color: #000000 !important;
  fill: none !important;
  stroke: #000000 !important;
}

.data-table .doc-action-btn:hover,
.data-table .doc-action-btn:hover svg {
  color: #000000 !important;
  stroke: #000000 !important;
  opacity: 1;
}

/* Other data table buttons */
.data-table .btn,
.data-table .btn svg,
.data-table .btn-link,
.data-table button svg,
.data-table [role="button"] svg {
  color: inherit;
  fill: inherit;
}

/* Exclude folder icon from black - use stroke style with black color */
.data-table .folder-cell svg {
  color: #000000;
  stroke: #000000 !important;
  fill: none !important;
}

/* Exclude badges and stat cards from data table text color */
.data-table .badge,
.data-table .badge *,
.data-table .stat-card,
.data-table .stat-card * {
  color: inherit !important;
  fill: inherit !important;
}

/* Data table links in black */
.data-table a,
.data-table a:visited {
  color: #000000 !important;
}

/* Badges should not be black */
.data-table .badge {
  color: inherit !important;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover td { background: #f8faff; }

/* Knowledge Base Table Styles */
.kb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.kb-table th {
  padding: .7rem .75rem;
  text-align: left;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.kb-table td {
  padding: .875rem .75rem;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-body);
  vertical-align: top;
  font-size: .875rem;
}
.kb-table tbody tr:last-child td { border-bottom: none; }
.kb-table tbody tr { transition: background var(--transition); }
.kb-table tbody tr:hover td { background: #f8faff; }

/* Compliance Table Styles */
.compliance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.compliance-table thead {
  background: var(--content-bg);
  border-bottom: 1px solid var(--border);
}
.compliance-table th {
  padding: .75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.compliance-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition);
}
.compliance-table tbody tr:last-child td { border-bottom: none; }
.compliance-table tbody tr:hover {
  background: var(--bg-hover, #f9f9f9);
}
.compliance-table td {
  padding: .75rem 1rem;
  vertical-align: top;
  color: var(--text-body);
  font-size: 0.8rem;
}

/* Compliance Table Related Utility Classes */
.rrs-code {
  font-weight: 600;
  color: var(--primary);
}

.record-title {
  font-weight: 500;
  color: var(--text-heading);
}

.dept-badge {
  display: inline-flex;
  align-items: center;
  padding: .25rem .6rem;
  border-radius: 999px;
  font-size: 10.88px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 10.88px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pending-upload {
  background: #fef3c7;
  color: #92400e;
}

.status-pending-review {
  background: #bfdbfe;
  color: #1e40af;
}

.status-approved {
  background: #d1fae5;
  color: #065f46;
}

.status-overdue {
  background: #fee2e2;
  color: #991b1b;
}

.days-left {
  font-weight: 600;
  color: var(--primary);
}

.days-overdue {
  font-weight: 600;
  color: var(--danger);
}

.compliance-actions-cell {
  text-align: center;
  white-space: nowrap;
}

.file-cell { display: flex; align-items: center; gap: .75rem; }

.file-thumb {
  width: 36px; height: 36px;
  border-radius: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-thumb svg { width: 19px; height: 19px; }
.file-thumb-pdf   { background: #fee2e2; color: #991b1b; }
.file-thumb-docx  { background: #dbeafe; color: #1a3a6e; }
.file-thumb-xlsx  { background: #dcfce7; color: #166534; }
.file-thumb-pptx  { background: #fff7ed; color: #ea580c; }
.file-thumb-img   { background: #dbeafe; color: #1565c0; }
.file-thumb-other { background: #f1f5f9; color: #000000; }

.file-name { font-weight: 500; color: #000000 !important; font-size: .8rem; line-height: 1.3; }
.file-meta { font-size: .73rem; color: #000000 !important; margin-top: .1rem; }

/* Disposal alert inline badge (shown under document title) */
.disposal-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .03em;
    border-radius: 999px;
    padding: .25rem .6rem;
    white-space: nowrap;
    cursor: default;
}

/* Disposal alert icon button in action column */
.disposal-alert-btn {
    border-radius: .375rem !important;
}

.table-actions { display: flex; align-items: center; gap: 0; }

/* ==========================================================================
   Document Action Inline Buttons
   ========================================================================== */
.doc-action-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  flex-wrap: wrap;
  white-space: nowrap;
}

.doc-visible-buttons {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.doc-menu-btn {
  display: none !important;
}

.doc-action-menu {
  display: none !important;
}

.doc-action-btn {
  padding: 0.35rem !important;
  min-width: auto;
  color: #000000 !important;
  background: transparent;
  border: none;
  transition: all var(--transition);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}

.doc-action-btn:hover {
  color: #000000 !important;
  background: transparent;
  opacity: 1;
}

.doc-action-btn:active {
  background: rgba(21, 101, 192, 0.15);
  color: #0d47a1;
  opacity: 1;
}

.doc-action-btn[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.doc-action-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: #000000 !important;
  fill: none !important;
  stroke-width: 2 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}

.doc-action-btn--danger {
  color: var(--danger);
}

.doc-action-btn--danger:hover {
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
}

/* Override .btn-ghost color for action buttons */
.btn-ghost.doc-action-btn {
  color: #000000 !important;
}

.btn-ghost.doc-action-btn:hover {
  color: #000000 !important;
}

.doc-action-item {
  display: none !important;
}

.doc-action-sep {
  display: none !important;
}

/* Compact upload zone variant — horizontal row */
.upload-zone--compact {
  padding: .55rem .875rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .625rem;
  text-align: left;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}
.upload-zone--compact .upload-zone-icon { width: 26px; height: 26px; margin: 0; flex-shrink: 0; }
.upload-zone--compact .upload-zone-icon svg { width: 15px; height: 15px; }
.upload-zone--compact h4 { font-size: .8125rem; margin-bottom: 0; white-space: nowrap; font-weight: 600; flex-shrink: 0; }
.upload-zone--compact p { font-size: .8125rem; margin: 0; white-space: nowrap; color: var(--text-secondary); font-weight: 600; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; }
.upload-zone--compact .upload-note { display: none; }

/* Modal layout grids */
.upload-modal-cols { display: grid; grid-template-columns: 3fr 1.2fr; gap: 1.25rem; }
.upload-modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: .75rem; }

/* Section divider styling */
.upload-section-divider {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: .75rem 0 .5rem 0;
    margin-top: .75rem;
    margin-bottom: .5rem;
    border-bottom: 1px solid var(--border);
}

.upload-section-divider:first-child {
    margin-top: 0;
}

/* Upload column styling for modal */
.upload-col {
    display: flex;
    flex-direction: column;
    gap: 0;
}

@media (max-width: 768px) {
  .upload-modal-cols { grid-template-columns: 1fr; }
  .upload-modal-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Filter Bar
   ========================================================================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .875rem 1.125rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.search-wrap { 
  position: relative; 
  flex: 1; 
  min-width: 180px; 
  max-width: 500px;
}

.search-wrap svg {
  position: absolute;
  left: .75rem; 
  top: 50%;
  transform: translateY(-50%);
  width: 18px; 
  height: 18px;
  color: var(--text-secondary);
  pointer-events: none;
  opacity: 0.6;
}

.search-wrap input {
  width: 100%;
  padding: .625rem .75rem .625rem 2.5rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .9rem;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s ease;
}

.search-wrap input::placeholder {
  color: var(--text-secondary);
}

.search-wrap input:hover {
  border-color: #c0c0c0;
}

.search-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 58, 110, 0.1);
  background: #fff;
}

.search-wrap button[type="button"] {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: .25rem;
  display: none;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.search-wrap button[type="button"]:hover {
  color: var(--text-primary);
  opacity: 0.8;
}

.filter-select {
  padding: .45rem .75rem;
  background: var(--content-bg);
  border: 1px solid var(--border);
  border-radius: .45rem;
  font-size: .855rem;
  color: #000000 !important;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

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


/* ==========================================================================
   Advanced Filter Panel
   ========================================================================== */
.adv-filter-panel {
  display: none;
  padding: .875rem 1.125rem 1rem;
  background: var(--content-bg);
  border-top: 1px solid var(--border);
}
.adv-filter-panel.open { display: block; }

.adv-filter-header {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .055em;
  margin-bottom: .75rem;
}

.adv-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .875rem;
  align-items: flex-end;
}

.adv-filter-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.adv-filter-group > label {
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.adv-filter-group input[type="date"],
.adv-filter-group input[type="text"] {
  padding: .45rem .75rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: .45rem;
  font-size: .85rem;
  color: var(--text-body);
  outline: none;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.adv-filter-group input[type="date"]:focus,
.adv-filter-group input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21,101,192,.09);
  background: #fff;
}
/* The uploader field reuses .search-wrap which already has padding-left for icon */
.adv-filter-group .search-wrap input {
  background: var(--card-bg);
}
.adv-filter-group .search-wrap input:focus { background: #fff; }

@media (max-width: 640px) {
  .adv-filter-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Tabs
   ========================================================================== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 1.375rem;
}

.tab-btn {
  padding: .65rem .875rem;
  font-size: .845rem;
  font-weight: 500;
  color: #000000 !important;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn:hover { color: #000000 !important; }
.tab-btn.active { color: #1565c0 !important; border-color: #1565c0 !important; }

/* ==========================================================================
   Activity Feed
   ========================================================================== */
.activity-list { padding: 0; }

.activity-item {
  display: flex;
  gap: .8rem;
  padding: .875rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.activity-item:last-child { border-bottom: none; padding-bottom: 0; }
.activity-item:first-child { padding-top: 0; }

.activity-icon {
  width: 32px; height: 32px;
  border-radius: .45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: .1rem;
}

.activity-icon svg { width: 15px; height: 15px; }
.act-upload  { background: #dcfce7; color: #166534; }
.act-view    { background: #dbeafe; color: #1a3a6e; }
.act-edit    { background: #fef3c7; color: #b45309; }
.act-delete  { background: #fee2e2; color: #991b1b; }
.act-share   { background: #dbeafe; color: #1565c0; }
.act-comment { background: #e0f2fe; color: #0e7490; }

.activity-text {
  font-size: .825rem;
  color: var(--text-body);
  line-height: 1.45;
}

.activity-text strong { color: var(--text-heading); font-weight: 600; }
.activity-text a { color: var(--primary); font-weight: 500; }
.activity-text a:hover { }

.activity-time {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: .2rem;
}

/* ==========================================================================
   Category Bars
   ========================================================================== */
.cat-list { display: flex; flex-direction: column; gap: .875rem; }

.cat-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .375rem;
}

.cat-name {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .845rem;
  font-weight: 500;
  color: var(--text-heading);
}

.cat-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.cat-count { font-size: .78rem; color: var(--text-secondary); font-weight: 500; }

.progress {
  height: 7px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 1.2s cubic-bezier(.4,0,.2,1);
}

/* ==========================================================================
   Upload Zone
   ========================================================================== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  transition: border-color var(--transition), background var(--transition);
  cursor: pointer;
  min-height: auto;
  max-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Compact upload zone when file is selected */
.upload-zone.has-file {
  padding: 1rem 1.5rem;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-zone-icon {
  width: 52px; height: 52px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto .875rem;
  color: var(--primary);
}

.upload-zone-icon svg { width: 26px; height: 26px; }
.upload-zone h4 { font-size: .9375rem; font-weight: 600; color: var(--text-heading); margin-bottom: .35rem; }
.upload-zone p { font-size: .8rem; color: var(--text-secondary); }
.upload-note { font-size: .72rem !important; color: var(--text-muted) !important; margin-top: .625rem !important; }



/* ==========================================================================
   Storage Bar
   ========================================================================== */
.storage-bar-wrap {
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: .875rem;
}

.storage-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 1.2s cubic-bezier(.4,0,.2,1);
}

.storage-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}

.storage-legend-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .75rem;
  color: var(--text-secondary);
}

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

/* ==========================================================================
   Mini Stats Row
   ========================================================================== */
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: 1rem; }

.mini-stat {
  background: var(--content-bg);
  border-radius: .625rem;
  padding: .875rem 1rem;
  border: 1px solid var(--border);
}

.mini-stat-value { font-size: 1.25rem; font-weight: 700; color: var(--text-heading); line-height: 1.2; }
.mini-stat-label { font-size: .72rem; color: var(--text-muted); font-weight: 500; margin-top: .1rem; }

/* ==========================================================================
   Chart Container
   ========================================================================== */
.chart-wrap { position: relative; height: 180px; }



/* ==========================================================================
   Alerts
   ========================================================================== */
.alert {
  padding: .75rem 1rem;
  border-radius: .5rem;
  font-size: .875rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.alert-success { background: var(--success-light); color: #065f46; border-color: #a7f3d0; }
.alert-error   { background: var(--danger-light);  color: #991b1b; border-color: #fecaca; }
.alert-info    { background: var(--info-light);    color: #155e75; border-color: #a5f3fc; }

/* ==========================================================================
   Tooltip
   ========================================================================== */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  font-size: .72rem;
  padding: .3rem .6rem;
  border-radius: .35rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: var(--z-tooltip);
}
[data-tooltip]:hover::after { opacity: 1; }

/* ==========================================================================
   DaisyUI Modal Support (HTML5 <dialog>)
   ========================================================================== */
dialog {
  all: revert;
  position: fixed;
  margin: auto;
  z-index: var(--z-critical);
  padding: 0;
  border: none;
}

dialog[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
  animation: fadeIn 0.2s ease;
}

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

.modal {
  width: 100%;
  max-width: 30rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

.modal.modal-lg {
  max-width: 42.5rem;
}

.modal.modal-xl {
  max-width: 56rem;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-box {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-box > :first-child {
  flex-shrink: 0;
}

.modal-box > :last-child {
  flex-shrink: 0;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Ensure form elements in modal-body have consistent styling */
.modal-body .form-group input:not([type="checkbox"]):not([type="radio"]),
.modal-body .form-group select,
.modal-body .form-group textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-body);
    background: var(--card-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.modal-body .form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.modal-body .form-group select:focus,
.modal-body .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.15);
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  cursor: pointer;
}

.modal-backdrop button {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* DaisyUI-style button utilities */
.btn-square {
  padding: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-ghost {
  background: transparent;
  border: none;
  color: inherit;
}

.btn-ghost:hover {
  background: var(--content-bg);
  color: var(--text-heading);
}

/* Flex utilities */
.w-full { width: 100%; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }
.pb-4 { padding-bottom: 1rem; }
.pt-4 { padding-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.border-b { border-bottom: 1px solid; }
.border-t { border-top: 1px solid; }
.border-base-300 { border-color: var(--border); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }

/* ==========================================================================
   Scrollbar
   ========================================================================== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ==========================================================================
   Spacing Scale Utilities
   ========================================================================== */
/* Uses CSS variables: --sp-xs (0.25rem), --sp-sm (0.5rem), --sp-md (0.75rem),
   --sp-lg (1rem), --sp-xl (1.25rem), --sp-2xl (1.5rem), --sp-3xl (2rem) */

/* Padding */
.p-xs  { padding: var(--sp-xs); }
.p-sm  { padding: var(--sp-sm); }
.p-md  { padding: var(--sp-md); }
.p-lg  { padding: var(--sp-lg); }
.p-xl  { padding: var(--sp-xl); }
.p-2xl { padding: var(--sp-2xl); }
.p-3xl { padding: var(--sp-3xl); }

.px-xs  { padding-left: var(--sp-xs); padding-right: var(--sp-xs); }
.px-sm  { padding-left: var(--sp-sm); padding-right: var(--sp-sm); }
.px-md  { padding-left: var(--sp-md); padding-right: var(--sp-md); }
.px-lg  { padding-left: var(--sp-lg); padding-right: var(--sp-lg); }
.px-xl  { padding-left: var(--sp-xl); padding-right: var(--sp-xl); }
.px-2xl { padding-left: var(--sp-2xl); padding-right: var(--sp-2xl); }

.py-xs  { padding-top: var(--sp-xs); padding-bottom: var(--sp-xs); }
.py-sm  { padding-top: var(--sp-sm); padding-bottom: var(--sp-sm); }
.py-md  { padding-top: var(--sp-md); padding-bottom: var(--sp-md); }
.py-lg  { padding-top: var(--sp-lg); padding-bottom: var(--sp-lg); }
.py-xl  { padding-top: var(--sp-xl); padding-bottom: var(--sp-xl); }
.py-2xl { padding-top: var(--sp-2xl); padding-bottom: var(--sp-2xl); }

.pt-xs  { padding-top: var(--sp-xs); }
.pt-sm  { padding-top: var(--sp-sm); }
.pt-md  { padding-top: var(--sp-md); }
.pt-lg  { padding-top: var(--sp-lg); }
.pt-xl  { padding-top: var(--sp-xl); }
.pt-2xl { padding-top: var(--sp-2xl); }

.pb-xs  { padding-bottom: var(--sp-xs); }
.pb-sm  { padding-bottom: var(--sp-sm); }
.pb-md  { padding-bottom: var(--sp-md); }
.pb-lg  { padding-bottom: var(--sp-lg); }
.pb-xl  { padding-bottom: var(--sp-xl); }
.pb-2xl { padding-bottom: var(--sp-2xl); }

/* Margin */
.m-xs  { margin: var(--sp-xs); }
.m-sm  { margin: var(--sp-sm); }
.m-md  { margin: var(--sp-md); }
.m-lg  { margin: var(--sp-lg); }
.m-xl  { margin: var(--sp-xl); }
.m-2xl { margin: var(--sp-2xl); }

.mx-xs  { margin-left: var(--sp-xs); margin-right: var(--sp-xs); }
.mx-sm  { margin-left: var(--sp-sm); margin-right: var(--sp-sm); }
.mx-md  { margin-left: var(--sp-md); margin-right: var(--sp-md); }
.mx-lg  { margin-left: var(--sp-lg); margin-right: var(--sp-lg); }
.mx-xl  { margin-left: var(--sp-xl); margin-right: var(--sp-xl); }
.mx-2xl { margin-left: var(--sp-2xl); margin-right: var(--sp-2xl); }

.my-xs  { margin-top: var(--sp-xs); margin-bottom: var(--sp-xs); }
.my-sm  { margin-top: var(--sp-sm); margin-bottom: var(--sp-sm); }
.my-md  { margin-top: var(--sp-md); margin-bottom: var(--sp-md); }
.my-lg  { margin-top: var(--sp-lg); margin-bottom: var(--sp-lg); }
.my-xl  { margin-top: var(--sp-xl); margin-bottom: var(--sp-xl); }
.my-2xl { margin-top: var(--sp-2xl); margin-bottom: var(--sp-2xl); }

.mt-xs  { margin-top: var(--sp-xs); }
.mt-sm  { margin-top: var(--sp-sm); }
.mt-md  { margin-top: var(--sp-md); }
.mt-lg  { margin-top: var(--sp-lg); }
.mt-xl  { margin-top: var(--sp-xl); }
.mt-2xl { margin-top: var(--sp-2xl); }

.mb-xs  { margin-bottom: var(--sp-xs); }
.mb-sm  { margin-bottom: var(--sp-sm); }
.mb-md  { margin-bottom: var(--sp-md); }
.mb-lg  { margin-bottom: var(--sp-lg); }
.mb-xl  { margin-bottom: var(--sp-xl); }
.mb-2xl { margin-bottom: var(--sp-2xl); }

.mr-xs  { margin-right: var(--sp-xs); }
.mr-sm  { margin-right: var(--sp-sm); }
.mr-md  { margin-right: var(--sp-md); }
.mr-lg  { margin-right: var(--sp-lg); }
.mr-xl  { margin-right: var(--sp-xl); }

.ml-xs  { margin-left: var(--sp-xs); }
.ml-sm  { margin-left: var(--sp-sm); }
.ml-md  { margin-left: var(--sp-md); }
.ml-lg  { margin-left: var(--sp-lg); }
.ml-xl  { margin-left: var(--sp-xl); }

/* Gap (for flex/grid) */
.gap-xs  { gap: var(--sp-xs); }
.gap-sm  { gap: var(--sp-sm); }
.gap-md  { gap: var(--sp-md); }
.gap-lg  { gap: var(--sp-lg); }
.gap-xl  { gap: var(--sp-xl); }
.gap-2xl { gap: var(--sp-2xl); }

/* Common spacing combinations */
.space-y-xs > * + * { margin-top: var(--sp-xs); }
.space-y-sm > * + * { margin-top: var(--sp-sm); }
.space-y-md > * + * { margin-top: var(--sp-md); }
.space-y-lg > * + * { margin-top: var(--sp-lg); }
.space-y-xl > * + * { margin-top: var(--sp-xl); }
.space-y-2xl > * + * { margin-top: var(--sp-2xl); }

.space-x-xs > * + * { margin-left: var(--sp-xs); }
.space-x-sm > * + * { margin-left: var(--sp-sm); }
.space-x-md > * + * { margin-left: var(--sp-md); }
.space-x-lg > * + * { margin-left: var(--sp-lg); }
.space-x-xl > * + * { margin-left: var(--sp-xl); }

/* ==========================================================================
   Typography Utilities
   ========================================================================== */
/* Font Sizes - 8-step scale (xs through 3xl) */
.text-xs   { font-size: var(--fs-xs);   }  /* 12px */
.text-sm   { font-size: var(--fs-sm);   }  /* 14px */
.text-base { font-size: var(--fs-base); }  /* 16px */
.text-md   { font-size: var(--fs-md);   }  /* 18px */
.text-lg   { font-size: var(--fs-lg);   }  /* 20px */
.text-xl   { font-size: var(--fs-xl);   }  /* 24px */
.text-2xl  { font-size: var(--fs-2xl);  }  /* 30px */
.text-3xl  { font-size: var(--fs-3xl);  }  /* 36px */

/* Font Weights */
.font-light      { font-weight: var(--fw-light);      }  /* 300 */
.font-normal     { font-weight: var(--fw-normal);     }  /* 400 */
.font-medium     { font-weight: var(--fw-medium);     }  /* 500 */
.font-semibold   { font-weight: var(--fw-semibold);   }  /* 600 */
.font-bold       { font-weight: var(--fw-bold);       }  /* 700 */
.font-extrabold  { font-weight: var(--fw-extrabold);  }  /* 800 */

/* Line Heights */
.leading-tight   { line-height: var(--lh-tight);   }  /* 1.2 */
.leading-normal  { line-height: var(--lh-normal);  }  /* 1.5 */
.leading-relaxed { line-height: var(--lh-relaxed); }  /* 1.6 */
.leading-loose   { line-height: var(--lh-loose);   }  /* 1.8 */

/* Letter Spacing */
.tracking-tight  { letter-spacing: var(--ls-tight);  }  /* -0.02em */
.tracking-normal { letter-spacing: var(--ls-normal); }  /* 0 */
.tracking-wide   { letter-spacing: var(--ls-wide);   }  /* 0.02em */

/* Text Color Semantic Utilities */
.text-heading     { color: var(--color-text-heading);   }
.text-body        { color: var(--color-text-body);      }
.text-secondary   { color: var(--color-text-secondary); }
.text-muted       { color: var(--color-text-muted);     }
.text-inverse     { color: var(--color-text-inverse);   }

/* Status Text Colors */
.text-success     { color: var(--color-success);   }
.text-warning     { color: var(--color-warning);   }
.text-danger      { color: var(--color-danger);    }
.text-info        { color: var(--color-info);      }
.text-primary     { color: var(--color-primary);   }

/* Text Alignment */
.text-left        { text-align: left;     }
.text-center      { text-align: center;   }
.text-right       { text-align: right;    }
.text-justify     { text-align: justify;  }

/* Text Decoration */
.underline        { text-decoration: underline;     }
.no-underline     { text-decoration: none;          }
.line-through     { text-decoration: line-through;  }

/* Text Transform */
.uppercase        { text-transform: uppercase;   }
.lowercase        { text-transform: lowercase;   }
.capitalize       { text-transform: capitalize;  }
.normal-case      { text-transform: none;        }

/* Text Truncation */
.truncate         { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-1     { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2     { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3     { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Heading Typography Presets */
.h1 {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  color: var(--color-text-heading);
}

.h2 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  color: var(--color-text-heading);
}

.h3 {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--color-text-heading);
}

.h4 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-normal);
  color: var(--color-text-heading);
}

.h5 {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-normal);
  color: var(--color-text-heading);
}

.h6 {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-normal);
  color: var(--color-text-heading);
}

/* Body Text Preset */
.body-lg {
  font-size: var(--fs-lg);
  font-weight: var(--fw-normal);
  line-height: var(--lh-relaxed);
  color: var(--color-text-body);
}

.body-base {
  font-size: var(--fs-base);
  font-weight: var(--fw-normal);
  line-height: var(--lh-relaxed);
  color: var(--color-text-body);
}

.body-sm {
  font-size: var(--fs-sm);
  font-weight: var(--fw-normal);
  line-height: var(--lh-relaxed);
  color: var(--color-text-body);
}

/* Label/Caption Presets */
.label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: var(--lh-normal);
  color: var(--color-text-heading);
}

.caption {
  font-size: var(--fs-xs);
  font-weight: var(--fw-normal);
  line-height: var(--lh-normal);
  color: var(--color-text-muted);
}

/* ==========================================================================
   Legacy Utilities (keep for backward compatibility during migration)
   ========================================================================== */
.d-flex    { display: flex; }
.align-center   { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.text-muted   { color: var(--text-muted)    !important; }
.text-success { color: var(--success)       !important; }
.text-danger  { color: var(--danger)        !important; }
.text-primary { color: var(--primary)       !important; }
.text-heading { color: var(--text-heading)  !important; }
.text-sm  { font-size: .875rem; }
.text-xs  { font-size: .8rem; }
.fw-500   { font-weight: 500; }
.fw-600   { font-weight: 600; }
.fw-700   { font-weight: 700; }

/* Additional Flex & Layout Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-evenly { justify-content: space-evenly; }

/* Display Utilities */
.hidden { display: none !important; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.inline-flex { display: inline-flex; }

/* Size Utilities */
.w-full { width: 100%; }
.w-1\/2 { width: 50%; }
.w-1\/3 { width: 33.333%; }
.w-2\/3 { width: 66.667%; }
.h-full { height: 100%; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }

/* ==========================================================================
   Border Radius Utilities
   ========================================================================== */
.rounded-none    { border-radius: var(--border-radius-none);   }  /* 0 */
.rounded-xs      { border-radius: var(--border-radius-xs);     }  /* 2px */
.rounded-sm      { border-radius: var(--border-radius-sm);     }  /* 6px */
.rounded         { border-radius: var(--border-radius);        }  /* 12px */
.rounded-md      { border-radius: var(--border-radius-md);     }  /* 14px */
.rounded-lg      { border-radius: var(--border-radius-lg);     }  /* 16px */
.rounded-xl      { border-radius: var(--border-radius-xl);     }  /* 24px */
.rounded-full    { border-radius: var(--border-radius-full);   }  /* 9999px */

/* Individual corner border radius */
.rounded-t       { border-top-left-radius: var(--border-radius); border-top-right-radius: var(--border-radius); }
.rounded-b       { border-bottom-left-radius: var(--border-radius); border-bottom-right-radius: var(--border-radius); }
.rounded-l       { border-top-left-radius: var(--border-radius); border-bottom-left-radius: var(--border-radius); }
.rounded-r       { border-top-right-radius: var(--border-radius); border-bottom-right-radius: var(--border-radius); }

/* ==========================================================================
   Border Utilities
   ========================================================================== */
.border           { border: var(--border-width-base) solid var(--color-border); }
.border-thin      { border: var(--border-width-thin) solid var(--color-border); }
.border-thick     { border: var(--border-width-thick) solid var(--color-border); }

.border-t         { border-top: var(--border-width-base) solid var(--color-border); }
.border-b         { border-bottom: var(--border-width-base) solid var(--color-border); }
.border-l         { border-left: var(--border-width-base) solid var(--color-border); }
.border-r         { border-right: var(--border-width-base) solid var(--color-border); }

/* Border Colors */
.border-primary   { border-color: var(--color-primary);   }
.border-success   { border-color: var(--color-success);   }
.border-warning   { border-color: var(--color-warning);   }
.border-danger    { border-color: var(--color-danger);    }
.border-info      { border-color: var(--color-info);      }
.border-gray      { border-color: var(--color-gray-300);  }

/* ==========================================================================
   Background Color Utilities
   ========================================================================== */
/* Primary backgrounds */
.bg-primary       { background-color: var(--color-primary);     }
.bg-primary-light { background-color: var(--color-primary-light); }
.bg-primary-50    { background-color: var(--color-primary-50);  }
.bg-primary-100   { background-color: var(--color-primary-100); }
.bg-primary-200   { background-color: var(--color-primary-200); }

/* Status backgrounds */
.bg-success       { background-color: var(--color-success);       }
.bg-success-light { background-color: var(--color-success-light); }
.bg-success-50    { background-color: var(--color-success-50);    }
.bg-success-100   { background-color: var(--color-success-100);   }

.bg-warning       { background-color: var(--color-warning);       }
.bg-warning-light { background-color: var(--color-warning-light); }
.bg-warning-50    { background-color: var(--color-warning-50);    }
.bg-warning-100   { background-color: var(--color-warning-100);   }

.bg-danger        { background-color: var(--color-danger);        }
.bg-danger-light  { background-color: var(--color-danger-light);  }
.bg-danger-50     { background-color: var(--color-danger-50);     }
.bg-danger-100    { background-color: var(--color-danger-100);    }

.bg-info          { background-color: var(--color-info);         }
.bg-info-light    { background-color: var(--color-info-light);   }
.bg-info-50       { background-color: var(--color-info-50);      }
.bg-info-100      { background-color: var(--color-info-100);     }

/* Neutral backgrounds */
.bg-white         { background-color: #ffffff;            }
.bg-gray-50       { background-color: var(--color-gray-50);   }
.bg-gray-100      { background-color: var(--color-gray-100);  }
.bg-gray-200      { background-color: var(--color-gray-200);  }
.bg-gray-300      { background-color: var(--color-gray-300);  }

/* ==========================================================================
   Opacity Utilities
   ========================================================================== */
.opacity-0        { opacity: var(--opacity-0);   }
.opacity-5        { opacity: var(--opacity-5);   }
.opacity-10       { opacity: var(--opacity-10);  }
.opacity-25       { opacity: var(--opacity-25);  }
.opacity-50       { opacity: var(--opacity-50);  }
.opacity-75       { opacity: var(--opacity-75);  }
.opacity-90       { opacity: var(--opacity-90);  }
.opacity-100      { opacity: var(--opacity-100); }

/* ==========================================================================
   Shadow Utilities
   ========================================================================== */
.shadow-xs        { box-shadow: var(--shadow-xs); }
.shadow-sm        { box-shadow: var(--shadow-sm); }
.shadow           { box-shadow: var(--shadow);    }
.shadow-md        { box-shadow: var(--shadow-md); }
.shadow-lg        { box-shadow: var(--shadow-lg); }
.shadow-xl        { box-shadow: var(--shadow-xl); }
.shadow-none      { box-shadow: none;             }

/* ==========================================================================
   Transition Utilities
   ========================================================================== */
.transition-fast  { transition: var(--transition-fast);  }
.transition       { transition: var(--transition);       }
.transition-slow  { transition: var(--transition-slow);  }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1280px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-grid-3 { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .dash-grid-3 { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Nav label — base (always present, transitions on collapse)
   ========================================================================== */
.nav-label {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  max-width: 200px;
  opacity: 1;
  transition: max-width var(--transition-slow), opacity var(--transition-slow);
}

.sidebar-brand-text,
.nav-section-label,
.nav-badge,
.sidebar-user-name,
.sidebar-user-role {
  transition: max-width var(--transition-slow), opacity var(--transition-slow), padding var(--transition-slow);
}

/* ==========================================================================
   Sidebar — Collapsed (desktop icon-only mode)
   ========================================================================== */
body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
}
/* .dashboard-wrapper and .topbar intentionally NOT changed — content stays fixed */

/* Hide text elements */
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .sidebar-brand-text {
  max-width: 0;
  opacity: 0;
}
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .nav-badge,
body.sidebar-collapsed .sidebar-user-name,
body.sidebar-collapsed .sidebar-user-role {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

/* .sidebar-brand is already centered (justify-content: center) — no override needed */

/* Icon-only nav items */
body.sidebar-collapsed .nav-item {
  margin: 0 .375rem .125rem;
}
body.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: .6rem;
  gap: 0;
  position: relative;
}
body.sidebar-collapsed .nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: .85;
}
body.sidebar-collapsed .nav-link.active svg { opacity: 1; }

/* Center avatar in footer */
body.sidebar-collapsed .sidebar-user {
  justify-content: center;
  padding: .6rem;
}
body.sidebar-collapsed .sidebar-footer {
  padding: 1rem .375rem;
}

/* Tooltip on hover */
body.sidebar-collapsed .nav-link[title] {
  overflow: visible;
}
body.sidebar-collapsed .nav-link[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: calc(var(--sidebar-collapsed-width) + .5rem);
  top: 50%;
  transform: translateY(-50%);
  background: #1e293b;
  color: #f1f5f9;
  font-size: .75rem;
  font-weight: 500;
  padding: .35rem .65rem;
  border-radius: .375rem;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  z-index: var(--z-sticky);
}

/* ==========================================================================
   Topbar hamburger button (mobile sidebar open)
   ========================================================================== */
.topbar-menu-btn {
  display: none;
  width: 38px; height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: .5rem;
  color: #000;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.topbar-menu-btn:hover { background: rgba(0,0,0,.1); color: #000; }
.topbar-menu-btn svg { width: 20px; height: 20px; }

/* ==========================================================================
   Default layout — mobile nav toggle
   ========================================================================== */
.nav-mobile-toggle {
  display: none;
  width: 38px; height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: .4rem;
  color: rgba(255,255,255,.85);
  transition: background var(--transition);
  flex-shrink: 0;
}
.nav-mobile-toggle:hover { background: rgba(255,255,255,.1); }
.nav-mobile-toggle svg { width: 20px; height: 20px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition), width var(--transition);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
  }
  
  .topbar { padding-left: 1rem; gap: .5rem; }
  .topbar-menu-btn { display: flex; }
  .dashboard-wrapper { margin-left: 0 !important; }
  .dashboard-content { padding: 1.25rem 1.75rem 1.5rem; }
  .smart-dashboard { padding: 0 0 1.5rem 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .875rem; }
  .stat-value { font-size: 1.5rem; }
  .topbar-user-name, .topbar-user-role { display: none; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 0; }
  .tab-btn { white-space: nowrap; }
  .page-header-row { flex-direction: column; gap: .75rem; }
  .page-header-row .btn { align-self: flex-start; }

  /* Reset all collapsed overrides on mobile */
  body.sidebar-collapsed .sidebar { width: var(--sidebar-width); }
}

/* ==========================================================================
   Sidebar Overlay (mobile)
   ========================================================================== */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--z-sidebar) - 1);
  animation: fadeIn var(--transition) ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .sidebar-brand-text { max-width: 200px; opacity: 1; }
  body.sidebar-collapsed .nav-section-label,
  body.sidebar-collapsed .nav-badge,
  body.sidebar-collapsed .sidebar-user-name,
  body.sidebar-collapsed .sidebar-user-role { max-width: none; opacity: 1; overflow: visible; padding: revert; margin: revert; }
  body.sidebar-collapsed .nav-item { margin: 0 .625rem .125rem; }
  body.sidebar-collapsed .nav-link { justify-content: flex-start; padding: .575rem .75rem; gap: .75rem; }
  body.sidebar-collapsed .nav-link svg { width: 17px; height: 17px; }
  body.sidebar-collapsed .sidebar-user { justify-content: flex-start; padding: .6rem .75rem; }
  body.sidebar-collapsed .sidebar-footer { padding: 1rem .625rem; }
}

@media (max-width: 640px) {
  /* Default layout: mobile nav dropdown */
  .site-header { position: relative; }
  .nav-mobile-toggle { display: flex; }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--primary-dark);
    padding: .375rem 0 .625rem;
    z-index: var(--z-sidebar);
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; gap: 0; }
  .main-nav a {
    display: block;
    padding: .625rem 1.25rem;
    border-radius: 0;
    color: rgba(255,255,255,.85);
  }
  .main-nav a:hover,
  .main-nav a.active { background: rgba(255,255,255,.08); color: #fff; }
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-wrap { max-width: none; }
  .topbar-brand-sub { font-size: .8rem; }
  .topbar-logout span { display: none; }
  .card-header { flex-wrap: wrap; gap: .625rem; }
}

@media print {
  .sidebar, .topbar, .topbar-actions { display: none !important; }
  .dashboard-wrapper { margin-left: 0 !important; }
  .dashboard-main { padding-top: 0 !important; }
}

.btn-danger { background: #991b1b; color: #fff; border-color: #991b1b; }
.btn-danger:hover { background: #7f1d1d; }

/* ==========================================================================
   Quick Actions
   ========================================================================== */
.quick-action-list {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .75rem;
  border-radius: .5rem;
  color: var(--text-body);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}

.quick-action-btn:hover {
  background: var(--content-bg);
  color: var(--text-heading);
}

.quick-action-icon {
  width: 36px;
  height: 36px;
  border-radius: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quick-action-icon svg { width: 17px; height: 17px; }

.quick-action-label { flex: 1; }

.quick-action-arrow {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: .5;
}

.quick-action-btn:hover .quick-action-arrow { opacity: 1; }

/* ==========================================================================
   Pending Approvals List
   ========================================================================== */
.pending-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.pending-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}

.pending-list li:last-child .pending-item,
.pending-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.pending-item-icon {
  width: 32px;
  height: 32px;
  border-radius: .45rem;
  background: #fee2e2;
  color: #991b1b;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: .1rem;
}

.pending-item-icon svg { width: 15px; height: 15px; }

.pending-item-body { flex: 1; min-width: 0; }

.pending-item-title {
  font-weight: 600;
  font-size: .82rem;
  color: var(--text-heading);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-decoration: none;
  transition: color var(--transition);
}

.pending-item-title:hover { color: var(--primary); }

.pending-item-meta {
  font-size: .73rem;
  color: var(--text-secondary);
  margin-top: .1rem;
}

.pending-item-date {
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: .05rem;
}

/* ==========================================================================
   Categories List
   ========================================================================== */
.categories-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.category-item:hover {
  background: #f1f5f9;
  transform: translateX(4px);
}

.category-name {
  font-weight: 500;
  font-size: .875rem;
  color: var(--text-heading);
}

.category-count {
  font-size: .813rem;
  font-weight: 500;
  white-space: nowrap;
  margin-left: 1rem;
}

/* ==========================================================================
   Storage Donut Chart
   ========================================================================== */
.storage-donut-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto .5rem;
}

.storage-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.storage-donut-pct {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1;
  letter-spacing: -.04em;
}

.storage-donut-label {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: .2rem;
}

.storage-overview-legend {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.storage-overview-legend .storage-legend-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  color: var(--text-body);
}

.storage-legend-val {
  margin-left: auto;
  font-weight: 600;
  color: var(--text-heading);
  font-size: .8rem;
}

/* ==========================================================================
   My Folders Grid
   ========================================================================== */
.folder-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.folder-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  text-decoration: none;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  cursor: pointer;
}

.folder-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: #bfdbfe;
}

.folder-card-icon {
  width: 44px;
  height: 44px;
  margin-bottom: .625rem;
}

.folder-card-icon svg {
  width: 44px;
  height: 44px;
  display: block;
}

.folder-card-name {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-heading);
  line-height: 1.3;
  margin-bottom: .2rem;
}

.folder-card-meta {
  font-size: .78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.folder-card-updated {
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: .2rem;
}

/* Enhanced Folder Card - for improved folder display */
.enhanced-folder-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  overflow: visible;
  min-height: 200px;
}

.enhanced-folder-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
  border-color: #bfdbfe;
  background: var(--card-bg);
}

.enhanced-folder-card-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.enhanced-folder-card-icon svg {
  width: 48px;
  height: 48px;
  display: block;
}

.enhanced-folder-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.3;
  margin-bottom: 0.35rem;
}

.enhanced-folder-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.enhanced-folder-updated {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
  .folder-card-grid { grid-template-columns: repeat(2, 1fr); }
  .enhanced-folder-card { min-height: 180px; }
}

/* Form */
.form-group { margin-bottom: .625rem; }
.form-group label { 
  display: block; 
  margin-bottom: .2rem; 
  font-weight: 500; 
  font-size: var(--fs-sm);
  color: var(--color-text-body);
}
.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group textarea,
.form-group select {
    width: 100%;
    height: auto;
    min-height: 2.5rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text-body);
    background: var(--card-bg);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}
.form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.15);
}

/* ==========================================================================
   Upload Page — Tag Input
   ========================================================================== */
.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  align-items: center;
  padding: .325rem .6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-xs);
  background: white;
  min-height: auto;
  cursor: text;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.tag-input-wrap:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgb(21 101 192 / .15);
}

.tag-pills {
  display: contents; /* pills flow inline with the text input */
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: .275rem;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(26,58,110,.2);
  border-radius: 999px;
  padding: .175rem .55rem;
  font-size: .75rem;
  font-weight: 500;
  white-space: nowrap;
}

.tag-pill-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  transition: background var(--transition);
}

.tag-pill-remove:hover {
  background: rgba(26,58,110,.15);
}

.tag-pill-remove svg { width: 8px; height: 8px; }

.tag-text-input {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  width: auto;
  min-width: 140px;
  flex: 1;
  font-size: .875rem;
  background: transparent;
  color: var(--text-body);
}

/* ==========================================================================
   Documents Page — Unified Container Styling
   ========================================================================== */
/* Main wrapper for the documents page */
.docs-main-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-height: 0;
}

#docsTableSection {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin-bottom: 0 !important;
}

#docsTableSection .table-wrap {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

#docsTableSection .table {
  height: 100%;
}

#docsTableSection tbody {
  display: table-row-group;
}

.docs-container {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.docs-container-section {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.docs-container-section:last-child {
  border-bottom: none;
}

/* Filter Bar - consistent with other sections */
.docs-filter-bar {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-xs);
}

/* Action Bar - consistent with other sections */
.docs-action-bar {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-xs);
}

/* Table Section - consistent with other sections */
.docs-table-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  margin-bottom: 1.5rem;
}

/* Showing info row */
.docs-showing-row {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #f8fafc;
}

/* Pagination section */
.docs-pagination {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: #f8fafc;
}

.docs-pagination-left,
.docs-pagination-right {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.docs-pagination-center {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex: 1;
  justify-content: center;
}

/* Per page selector */
.docs-per-page-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}

.docs-per-page-sel {
  padding: .55rem .8rem;
  border: 1px solid var(--border);
  border-radius: .375rem;
  font-size: .9rem;
  background: var(--card-bg);
  cursor: pointer;
  transition: all var(--transition);
}

.docs-per-page-sel:hover {
  border-color: var(--primary);
}

/* Dark mode support for document containers */
body.dark-mode .docs-filter-bar,
body.dark-mode .docs-action-bar,
body.dark-mode .docs-table-section,
body.dark-mode .docs-showing-row,
body.dark-mode .docs-pagination {
  background: var(--card-bg);
  border-color: var(--border);
}

body.dark-mode .docs-showing-row,
body.dark-mode .docs-pagination {
  background: #1a222f;
  color: #000000;
}

/* Filter Form Elements */
.dfb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.dfb-search-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .85rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: .5rem;
  background: #f8fafc;
  transition: all var(--transition);
  flex: 1;
  min-width: 220px;
}

.dfb-search-wrap:hover {
  border-color: var(--primary);
  background: #fff;
}

.dfb-search-wrap:focus-within {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-light);
}

.dfb-search-wrap svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.dfb-search-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: .95rem;
  color: var(--text-body);
}

.dfb-search-wrap input::placeholder {
  color: var(--text-muted);
}

/* Dropdown Selects */
.dfb-select {
  padding: .85rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: .5rem;
  font-size: .95rem;
  background: var(--card-bg);
  cursor: pointer;
  transition: all var(--transition);
  min-width: 170px;
  flex-shrink: 0;
}

.dfb-select:hover {
  border-color: var(--primary);
  background: var(--card-bg);
}

.dfb-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Chip Select - for multi-select dropdowns */
.dfb-chip-select {
  min-width: 160px;
}

/* Secondary row adjustments */
.dfb-row--secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* Search wrap small variation */
.dfb-search-wrap--sm {
  min-width: 180px;
}

/* Date inputs */
.dfb-date {
  padding: .85rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: .5rem;
  font-size: .95rem;
  background: var(--card-bg);
  cursor: pointer;
  transition: all var(--transition);
  min-width: 160px;
  color: var(--text-body);
}

.dfb-date:hover {
  border-color: var(--primary);
}

.dfb-date:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Toggle checkboxes */
.dfb-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-body);
  user-select: none;
  padding: .35rem .5rem;
  border-radius: .375rem;
  transition: background var(--transition);
}

.dfb-toggle:hover {
  background: rgba(0, 0, 0, .03);
}

.dfb-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* Filter Chips */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .85rem;
  background: #e3f2fd;
  border: 1px solid #90caf9;
  border-radius: .5rem;
  font-size: .8rem;
}

.filter-chip-prefix {
  font-weight: 600;
  color: #1d4ed8;
}

.filter-chip-label {
  color: #1d4ed8;
}

.filter-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 3px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #1d4ed8;
  transition: all var(--transition);
  flex-shrink: 0;
}

.filter-chip-remove:hover {
  background: rgba(29, 78, 216, 0.15);
}

/* ==========================================================================
   Unified Filter System
   ========================================================================== */

.filter-panel {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--content-bg);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-chips-area {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 300px;
  flex-wrap: wrap;
}

.filter-chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-help-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

.filter-help-btn svg {
  width: 16px;
  height: 16px;
}

/* Filter Help Modal */
.filter-help-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-sticky);
  padding: 1rem;
}

.filter-help-content {
  background: var(--card-bg);
  border-radius: var(--radius);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.filter-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--card-bg);
}

.filter-help-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-heading);
}

.filter-help-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.filter-help-close:hover {
  color: var(--text-heading);
  background: var(--content-bg);
  border-radius: var(--radius-sm);
}

.filter-help-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.filter-help-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filter-help-section h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-heading);
}

.filter-help-section ul {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding-left: 1.5rem;
  list-style: disc;
}

.filter-help-section li {
  color: var(--text-body);
  font-size: 0.9rem;
  line-height: 1.5;
}

.filter-help-section code {
  background: var(--content-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.2rem 0.5rem;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  color: var(--primary);
}

/* Filter Sidebar (optional for advanced filters) */
.filter-sidebar {
  width: 280px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  height: fit-content;
  position: sticky;
  top: 100px;
}

.filter-sidebar-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-heading);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-sidebar-group {
  margin-bottom: 1.25rem;
}

.filter-sidebar-group:last-child {
  margin-bottom: 0;
}

.filter-sidebar-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  display: block;
}

.filter-sidebar-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-sidebar-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-sidebar-option:hover {
  background: var(--content-bg);
}

.filter-sidebar-option input[type="checkbox"],
.filter-sidebar-option input[type="radio"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

.filter-sidebar-option label {
  flex: 1;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-body);
  margin: 0;
}

/* Filter Presets */
.filter-presets-dropdown {
  position: relative;
  display: inline-block;
}

.filter-preset-save-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
}

.filter-presets-list {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-width: 280px;
  max-height: 300px;
  overflow-y: auto;
  z-index: var(--z-dropdown);
  margin-top: 0.5rem;
}

.filter-presets-list-empty {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.filter-preset-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-preset-item:last-child {
  border-bottom: none;
}

.filter-preset-item:hover {
  background: var(--content-bg);
}

.filter-preset-item-name {
  font-weight: 500;
  color: var(--text-body);
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

.filter-preset-item-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Dark mode adjustments */
body.dark-mode .filter-panel {
  background: var(--card-bg);
  border-color: var(--border);
}

body.dark-mode .filter-help-modal {
  background: rgba(0, 0, 0, 0.7);
}

body.dark-mode .filter-help-content {
  background: var(--card-bg);
}

body.dark-mode .filter-help-header {
  border-color: var(--border);
}

body.dark-mode .filter-help-body code {
  background: #1e1e2e;
  border-color: var(--border);
}

body.dark-mode .filter-sidebar {
  background: var(--card-bg);
  border-color: var(--border);
}

body.dark-mode .filter-sidebar-option:hover {
  background: #2a2a3e;
}

body.dark-mode .filter-presets-list {
  background: var(--card-bg);
  border-color: var(--border);
}

body.dark-mode .filter-preset-item:hover {
  background: #2a2a3e;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .filter-sidebar {
    width: 240px;
  }
}

@media (max-width: 768px) {
  .filter-panel {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .filter-chips-area {
    min-width: auto;
    flex-basis: 100%;
  }

  .filter-help-btn {
    margin-left: 0;
  }

  .filter-help-content {
    max-width: 95%;
  }

  .filter-sidebar {
    display: none;
  }
}

/* ==========================================================================
   View Toggle & Mode Styles
   ========================================================================== */

/* View toggle button group */
.view-toggle-group {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: .5rem;
  overflow: hidden;
  background: var(--card-bg);
}

.view-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .5rem .65rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 500;
  font-size: .9rem;
  min-width: 36px;
  height: 36px;
  position: relative;
}

.view-toggle-btn:hover {
  color: var(--primary);
  background: rgba(0, 0, 0, .03);
}

.view-toggle-btn.active {
  color: var(--primary);
  background: var(--primary-light);
}

.view-toggle-btn svg {
  width: 16px;
  height: 16px;
}

/* List View (default) */
.docs-table-section.view-list {
  display: block;
}

.docs-table-section.view-list .table {
  width: 100%;
  display: table;
  border-collapse: collapse;
}

.docs-table-section.view-list .table-wrap {
  display: block;
  overflow-x: auto;
}

.docs-table-section.view-list tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  display: table-row;
}

.docs-table-section.view-list tbody td {
  display: table-cell;
}

.docs-table-section.view-list tbody tr:hover {
  background: #f8fafc;
}

body.dark-mode .docs-table-section.view-list tbody tr:hover {
  background: rgba(255, 255, 255, .03);
}

/* Grid View */
.docs-table-section.view-grid {
  display: block;
  padding: 1.5rem;
}

.docs-table-section.view-grid .table-wrap {
  overflow: visible;
}

.docs-table-section.view-grid .table {
  display: none;
}

.docs-grid-container {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  width: 100%;
  padding: 1.5rem;
}

.docs-grid-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: var(--card-bg);
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.docs-grid-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(21, 101, 192, .1);
  transform: translateY(-2px);
}

.docs-grid-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}

.docs-grid-card-file {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: 1;
  min-width: 0;
}

.docs-grid-card-thumb {
  width: 48px;
  height: 48px;
  border-radius: .5rem;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--primary);
}

.docs-grid-card-thumb svg {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

.docs-grid-card-title {
  font-weight: 600;
  color: var(--text-heading);
  font-size: .9375rem;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.docs-grid-card-star {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: .375rem;
  transition: all var(--transition);
  flex-shrink: 0;
  padding: 0;
}

.docs-grid-card-star:hover {
  color: #f59e0b;
  background: rgba(245, 158, 11, .1);
}

.docs-grid-card-star.starred {
  color: #f59e0b;
}

.docs-grid-card-star svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.docs-grid-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  flex: 1;
}

.docs-grid-card-meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docs-grid-card-meta-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.docs-grid-card-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  margin-top: 0.25rem;
}

.docs-grid-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.docs-grid-card-action-btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: .375rem;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: .75rem;
  font-weight: 500;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
}

.docs-grid-card-action-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
}

/* Compact View */
.docs-table-section.view-compact {
  display: block;
  padding: 0;
}

.docs-table-section.view-compact .table {
  min-width: auto;
  table-layout: fixed;
  display: table;
  width: 100%;
  border-collapse: collapse;
}

.docs-table-section.view-compact .table-wrap {
  display: block;
  overflow-x: visible;
}

.docs-table-section.view-compact thead {
  display: none;
}

.docs-table-section.view-compact tbody tr {
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: background var(--transition);
}

.docs-table-section.view-compact tbody td {
  padding: 0 !important;
  border: none;
  display: inline-block;
}

.docs-table-section.view-compact tbody tr:hover {
  background: #f8fafc;
}

body.dark-mode .docs-table-section.view-compact tbody tr:hover {
  background: rgba(255, 255, 255, .03);
}

.docs-table-section.view-compact tbody td:first-child {
  width: 32px;
  flex-shrink: 0;
}

.docs-table-section.view-compact tbody td:nth-child(2) {
  width: 32px;
  flex-shrink: 0;
}

.docs-table-section.view-compact tbody td:nth-child(3) {
  flex: 1;
  min-width: 0;
}

.docs-table-section.view-compact tbody td:nth-child(n+4) {
  display: none;
}
  min-width: 0;
}

.docs-table-section.view-compact tbody td:nth-child(n+4) {
  display: none;
}

/* Info View */
.docs-table-section.view-info {
  display: block;
  padding: 1.5rem;
}

.docs-table-section.view-info .table-wrap {
  overflow: visible;
}

.docs-table-section.view-info .table {
  display: none;
}

.docs-info-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  width: 100%;
}

.docs-info-card {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: var(--card-bg);
  transition: all var(--transition);
  align-items: flex-start;
  cursor: pointer;
}

.docs-info-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(21, 101, 192, .1);
  transform: translateY(-2px);
}

.docs-info-card-icon {
  width: 60px;
  height: 60px;
  border-radius: .5rem;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--primary);
}

.docs-info-card-icon svg {
  width: 32px;
  height: 32px;
  color: var(--primary);
}

.docs-info-card-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.docs-info-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.docs-info-card-title {
  font-weight: 600;
  color: var(--text-heading);
  font-size: 1rem;
  line-height: 1.4;
}

.docs-info-card-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: .875rem;
  color: var(--text-secondary);
}

.docs-info-card-meta-item {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.docs-info-card-description {
  font-size: .875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-height: 2.8em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.docs-info-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  margin-top: 0.75rem;
}

.docs-info-card-star {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: .375rem;
  transition: all var(--transition);
  flex-shrink: 0;
  padding: 0;
}

.docs-info-card-star:hover {
  color: #f59e0b;
  background: rgba(245, 158, 11, .1);
}

.docs-info-card-star.starred {
  color: #f59e0b;
}

.docs-info-card-star svg {
  width: 16px;
  height: 16px;
}

/* Hide elements based on view mode */
.docs-table-section.view-grid .docs-showing-row,
.docs-table-section.view-grid .docs-pagination,
.docs-table-section.view-info .docs-showing-row,
.docs-table-section.view-info .docs-pagination {
  display: none;
}

.docs-table-section.view-grid .docs-showing-row,
.docs-table-section.view-grid .docs-pagination {
  display: none;
}

.docs-table-section.view-info .docs-showing-row,
.docs-table-section.view-info .docs-pagination {
  display: none;
}

/* Responsive adjustments for grid view */
@media (max-width: 768px) {
  .docs-grid-container {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }
  
  .docs-table-section.view-grid {
    padding: 1rem;
  }

  .docs-grid-card {
    padding: 1rem;
  }

  .docs-info-card {
    grid-template-columns: 50px 1fr;
    gap: 0.75rem;
    padding: 1rem;
  }

  .docs-info-card-icon {
    width: 50px;
    height: 50px;
  }

  .docs-info-card-icon svg {
    width: 28px;
    height: 28px;
  }
}

.filter-chip-remove:hover {
  background: rgba(29, 78, 216, .15);
  color: #1d4ed8;
}

/* Dark mode support for filter elements */
body.dark-mode .dfb-search-wrap {
  background: #1a222f;
  border-color: var(--border);
}

body.dark-mode .dfb-search-wrap:hover,
body.dark-mode .dfb-search-wrap:focus-within {
  background: #233142;
  border-color: var(--primary);
}

body.dark-mode .dfb-select,
body.dark-mode .dfb-date {
  background: var(--card-bg);
  color: var(--text-body);
  border-color: var(--border);
}

body.dark-mode .dfb-select:hover,
body.dark-mode .dfb-date:hover {
  border-color: var(--primary);
}

body.dark-mode .dfb-toggle {
  color: var(--text-body);
}

body.dark-mode .dfb-toggle:hover {
  background: rgba(255, 255, 255, .05);
}

body.dark-mode .filter-chip {
  background: rgba(29, 78, 216, .2);
  border-color: rgba(29, 78, 216, .4);
}

body.dark-mode .filter-chip-prefix,
body.dark-mode .filter-chip-label {
  color: #93c5fd;
}

body.dark-mode .filter-chip-remove:hover {
  background: rgba(29, 78, 216, .35);
}

/* ==========================================================================
   Upload Page — File Preview Strip
   ========================================================================== */
.file-preview-strip {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: .875rem;
  padding: .75rem 1rem;
  background: var(--content-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.file-preview-icon {
  width: 36px; height: 36px;
  border-radius: .375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .5px;
  flex-shrink: 0;
}

.file-preview-icon.ext-pdf  { background:#fee2e2; color:#b91c1c; }
.file-preview-icon.ext-docx,
.file-preview-icon.ext-doc  { background:#dbeafe; color:#1a3a6e; }
.file-preview-icon.ext-xlsx,
.file-preview-icon.ext-xls  { background:#dcfce7; color:#166534; }
.file-preview-icon.ext-pptx,
.file-preview-icon.ext-ppt  { background:#fff7ed; color:#c2410c; }
.file-preview-icon.ext-txt  { background:#f8fafc; color:#475569; }
.file-preview-icon.ext-img  { background:#fdf4ff; color:#7e22ce; }

.file-preview-info { flex: 1; min-width: 0; max-width: 100%; }
.file-preview-name { display: block; font-size: .8rem; font-weight: 600; color: var(--text-heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.file-preview-size { display: block; font-size: .72rem; color: var(--text-muted); }

.file-preview-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: .375rem;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}

.file-preview-remove:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }

/* ==========================================================================
   Upload Page — Department badge preview
   ========================================================================== */
.dept-badge-preview {
  display: inline-block;
  padding: .3rem .75rem;
  border-radius: 999px;
  font-size: 10.88px;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(26,58,110,.2);
}

/* ==========================================================================
   Upload Page — Required star
   ========================================================================== */
.required-star { color: var(--danger); margin-left: .1rem; }

/* ==========================================================================
   Upload Page — Field hint
   ========================================================================== */
.field-hint { display: block; margin-top: .25rem; font-size: .72rem; color: var(--text-muted); }

/* ==========================================================================
   Upload Page — Browse button inside drop zone
   ========================================================================== */
.upload-browse-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  font-size: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ==========================================================================
   Upload Progress Overlay
   ========================================================================== */
.upload-progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  z-index: var(--z-emergency);
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-progress-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 2rem 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  min-width: 300px;
}

.upload-progress-icon {
  width: 56px; height: 56px;
  margin: 0 auto 1rem;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  animation: uploadBounce 1.2s ease infinite;
}

.upload-progress-icon svg { width: 24px; height: 24px; }

@keyframes uploadBounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.upload-progress-label {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 1rem;
}

.upload-progress-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  width: 0;
  transition: width .3s ease;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
#toastContainer {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: var(--z-emergency);
  display: flex;
  flex-direction: column;
  gap: .625rem;
  pointer-events: none;
  max-width: min(24rem, calc(100vw - 2rem));
  width: 24rem;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: .875rem;
  padding: 1rem 1.125rem;
  border-radius: .75rem;
  color: #fff;
  font-size: .9rem;
  font-weight: 500;
  line-height: 1.5;
  box-shadow: 0 8px 24px rgba(0,0,0,.2), 0 2px 6px rgba(0,0,0,.1);
  pointer-events: all;
  animation: toastIn .3s cubic-bezier(.25, .46, .45, .94) forwards;
  position: relative;
  border: 1px solid rgba(255,255,255,.15);
  backdrop-filter: blur(8px);
}
.toast.toast-out {
  animation: toastOut .25s cubic-bezier(.4, 0, .2, 1) forwards;
}
.toast-success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.toast-error   { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.toast-warning { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.toast-info    { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }

.toast-icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: .125rem;
  color: rgba(255,255,255,1);
  display: flex;
  align-items: center;
  justify-content: center;
}
.toast-body {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  color: #fff;
  letter-spacing: 0.3px;
}
.toast-close {
  flex-shrink: 0;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.9);
  cursor: pointer;
  padding: .375rem .5rem;
  line-height: 1;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: .375rem;
  transition: all .2s cubic-bezier(.4, 0, .2, 1);
  margin: -.25rem -.375rem -.25rem 0;
}
.toast-close:hover {
  background: rgba(255,255,255,.25);
  color: #fff;
  transform: scale(1.05);
}

@keyframes toastIn {
  0% {
    opacity: 0;
    transform: translateX(calc(100% + 1rem)) scale(.92);
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}
@keyframes toastOut {
  0% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(calc(100% + 1rem)) scale(.92);
  }
}

/* ==========================================================================
   Toast Confirm Dialog
   ========================================================================== */
#toastConfirmOverlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-emergency);
  background: rgba(15,23,42,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
  animation: fadeInOverlay .15s ease;
}
#toastConfirmOverlay.hidden { display: none; }

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

.toast-confirm-box {
  background: var(--card-bg, #fff);
  border-radius: .875rem;
  box-shadow: 0 12px 40px rgba(0,0,0,.2), 0 2px 8px rgba(0,0,0,.1);
  padding: 1.75rem 1.5rem 1.5rem;
  max-width: 22rem;
  width: calc(100% - 2rem);
  animation: confirmIn .2s cubic-bezier(.2,.8,.4,1);
}
@keyframes confirmIn {
  from { opacity: 0; transform: scale(.94) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.toast-confirm-icon {
  width: 2.75rem; height: 2.75rem;
  border-radius: 50%;
  background: #fee2e2;
  color: #991b1b;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
}
.toast-confirm-icon.warn { background: #fef3c7; color: #92400e; }
.toast-confirm-icon.info { background: #e0f2fe; color: #075985; }
.toast-confirm-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-heading, #1e293b);
  margin-bottom: .35rem;
}
.toast-confirm-msg {
  font-size: .875rem;
  color: var(--text-secondary, #000000);
  margin-bottom: 1.375rem;
  line-height: 1.55;
}
.toast-confirm-actions {
  display: flex; gap: .625rem; justify-content: flex-end;
}
.toast-confirm-actions .btn { min-width: 5.5rem; }

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--content-bg);
  flex-wrap: wrap;
  font-size: 0.875rem;
}

#rrsPageSize,
#docsPageSize {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  font-size: 0.875rem;
  cursor: pointer;
  background: white;
  color: var(--text-body);
  transition: border-color var(--transition), box-shadow var(--transition);
}

#rrsPageSize:hover,
#docsPageSize:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
}

#rrsPageSize:focus,
#docsPageSize:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
}

#rrsPaginationInfo {
  color: var(--text-muted);
  white-space: nowrap;
  font-size: 0.875rem;
  min-width: 4.5rem;
  text-align: center;
}

.pagination-btn {
  background: white;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-body);
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: rgba(21, 101, 192, 0.05);
  color: var(--primary);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Active pagination number styling */
#docsPaginationNumbers .pagination-btn:disabled {
  background: #0066ff !important;
  color: white !important;
  border-color: #0066ff !important;
  opacity: 1 !important;
  cursor: default;
  pointer-events: none;
}

.pagination-number {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-body);
  background: white;
}

.pagination-number:hover {
  border-color: var(--primary);
  background: rgba(21, 101, 192, 0.05);
  color: var(--primary);
}

.pagination-number.active {
  background: #0066ff !important;
  border-color: #0066ff !important;
  color: white !important;
  font-weight: 600;
}

#rrsPrevBtn, #rrsNextBtn {
  transition: opacity var(--transition), background-color var(--transition);
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

#rrsPrevBtn:disabled, #rrsNextBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

#rrsPrevBtn:hover:not(:disabled), #rrsNextBtn:hover:not(:disabled) {
  background-color: var(--content-bg);
  color: var(--primary);
}



/* Readonly field styling - locked RRS-populated fields */.readonly-field {
  background-color: #f0f0f0 !important;
  color: #666 !important;
  cursor: not-allowed !important;
  opacity: 0.7 !important;
}

body.dark-mode .readonly-field {
  background-color: #2a2a2a !important;
  color: #999 !important;
}

/* ==========================================================================
   Smart Dashboard Styles
   ========================================================================== */

/* Topbar Title Section */
.topbar-title-section {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-width: 0;
}

.topbar-title-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.topbar-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-heading);
  white-space: nowrap;
  letter-spacing: -0.01em;
  line-height: 1;
}

.topbar-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 400;
  white-space: nowrap;
  letter-spacing: 0.5px;
  line-height: 1;
}

/* Search in topbar-actions */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Topbar Notification Badge */
.topbar-notif-btn {
  position: relative;
}

.topbar-notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444;
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--card-bg);
}

/* Topbar Divider */
.topbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

/* Smart Dashboard Container */
.smart-dashboard {
  padding: 0 0 3rem 0;
  position: relative;
}

/* Dashboard Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.dashboard-header-left {
  flex: 1;
}

.dashboard-stats-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0;
  letter-spacing: -0.02em;
}

.dashboard-header-right {
  display: flex;
  align-items: center;
}

/* Date Range Picker */
.date-range-picker {
  display: flex;
  align-items: center;
}

.date-range-btn {
  display: flex;
  align-items: center;
}

/* ==========================================================================
   Login Page — Refactored Styles
   ========================================================================== */

/* ── Modern Blue Login Page ───────────────────────────────────────── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 50%, #1e40af 100%);
    padding: 2rem 1rem;
    position: relative;
    overflow: hidden;
}

/* Animated background elements */
.login-page::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: -250px;
    right: -150px;
    animation: float 20s ease-in-out infinite;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    bottom: -200px;
    left: -100px;
    animation: float 15s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(-30px) translateX(30px); }
}

.login-card {
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25),
                0 10px 25px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 460px;
    padding: 3.5rem 3rem;
    animation: slideUp 0.6s ease;
    position: relative;
    z-index: var(--z-base);
    backdrop-filter: blur(10px);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    background: transparent;
    border-radius: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: none;
}

.login-brand svg {
    width: 36px;
    height: 36px;
    stroke: white;
    stroke-width: 2.5;
    display: none;
}

.logo-img {
    width: 138px;
    height: 138px;
    object-fit: contain;
    display: block;
    border-radius: 0.875rem;
}

.login-brand-logo {
    font-size: 2rem;
    font-weight: 700;
    color: #1e40af;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
}

.login-brand-logo em { 
    font-style: normal;
    font-weight: 700;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-brand-version {
    font-size: 0.625rem;
    color: #000000;
    font-weight: 500;
    letter-spacing: 0.5px;
    margin-left: 0.5rem;
    vertical-align: super;
}

.login-brand-subtitle {
    font-size: 0.8125rem;
    color: #000000;
    margin-bottom: 0.75rem;
    display: block;
    font-weight: 600;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.login-subtitle {
    font-size: 0.9375rem;
    color: #000000;
    margin-bottom: 2rem;
    font-weight: 400;
}

.login-alert {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-left: 4px solid #dc2626;
    color: #991b1b;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.1);
}

.login-alert svg {
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.625rem;
    letter-spacing: -0.2px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #000000;
    pointer-events: none;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.form-group input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 7rem;
    font-size: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #f8fafc;
    color: #0f172a;
    transition: all 0.3s ease;
    font-weight: 500;
    text-indent: 1.2rem;
}

.form-group input:focus {
    outline: none;
    border-color: #2563eb;
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1),
                0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-2px);
}

.form-group input:focus + .input-icon {
    color: #2563eb;
}

.form-group input::placeholder {
    color: #000000;
    font-weight: 400;
    font-size: 0.9rem;
}

.login-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    margin-top: 2rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.login-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.login-btn:hover::before {
    opacity: 1;
}

.login-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.5);
}

.login-btn:active {
    transform: translateY(-1px);
}

.login-btn svg,
.login-btn span {
    position: relative;
    z-index: var(--z-base);
    color: white;
}

.login-btn svg {
    width: 20px;
    height: 20px;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
}

.login-footer-text {
    font-size: 0.875rem;
    color: #000000;
}

.login-footer-link {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.login-footer-link:hover {
    color: #1e40af;
}

/* Dark Mode Support */
body.dark-mode .login-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #e2e8f0;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.5),
                0 10px 25px rgba(0, 0, 0, 0.3);
}

body.dark-mode .login-brand-logo {
    color: #f1f5f9;
}

body.dark-mode .login-brand-version {
    color: #000000;
}

body.dark-mode .login-title {
    color: #f1f5f9;
}

body.dark-mode .form-group label {
    color: #e2e8f0;
}

body.dark-mode .form-group input {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .form-group input:focus {
    border-color: #3b82f6;
    background: #1e293b;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2),
                0 4px 12px rgba(59, 130, 246, 0.25);
}

body.dark-mode .input-icon {
    color: #000000;
}

body.dark-mode .form-group input:focus + .input-icon {
    color: #3b82f6;
}

body.dark-mode .login-alert {
    background: linear-gradient(135deg, #3b0f0f 0%, #2d0a0a 100%);
    border-left-color: #ef4444;
    color: #fca5a5;
}

body.dark-mode .login-footer {
    border-top-color: #334155;
}

body.dark-mode .login-footer-text {
    color: #000000;
}

body.dark-mode .login-footer-link {
    color: #60a5fa;
}

body.dark-mode .login-footer-link:hover {
    color: #93c5fd;
}

/* Responsive Design */
@media (max-width: 640px) {
    .login-card {
        padding: 2.5rem 2rem;
        border-radius: 1.25rem;
    }
    
    .login-title {
        font-size: 1.5rem;
    }
    
    .login-brand-logo {
        font-size: 1.75rem;
    }
    
    .login-brand {
        width: 60px;
        height: 60px;
    }
    
    .login-brand svg {
        width: 30px;
        height: 30px;
    }
}
  gap: 0.625rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.625rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-body);
  transition: all var(--transition);
  white-space: nowrap;
}

.date-range-btn:hover {
  background: #f8fafb;
  border-color: var(--primary);
  color: var(--primary);
}

.date-range-btn svg {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.date-range-btn .dropdown-arrow {
  width: 16px;
  height: 16px;
  transition: transform var(--transition);
}

.date-range-btn:hover .dropdown-arrow {
  color: var(--primary);
}

#dateRangeLabel {
  font-weight: 600;
  color: var(--text-heading);
}

/* Date Picker Modal */
.date-picker-modal {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  z-index: var(--z-critical);
  min-width: 320px;
}

.date-picker-content {
  display: flex;
  flex-direction: column;
}

.date-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.date-picker-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
}

.date-picker-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}

.date-picker-close:hover {
  color: var(--text-heading);
}

.date-picker-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.date-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.date-input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-heading);
}

.date-input {
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  background: var(--card-bg);
  color: var(--text-body);
  font-family: inherit;
  transition: border-color var(--transition);
}

.date-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
}

.date-picker-footer {
  display: flex;
  gap: 0;
  padding: 1rem;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

.date-picker-footer .btn {
  font-size: 0.9rem;
  padding: 0.6rem 1.2rem;
}

/* Dark Mode */
body.dark-mode .date-picker-modal {
  background: #1e293b;
}

body.dark-mode .date-input {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

body.dark-mode .date-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.2);
}

/* Dashboard Container */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
  margin-top: 3.5rem;
}

/* DaisyUI Stats with Gradient Cards */
.metrics-grid .stat {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  gap: 0.5rem;
  align-items: start;
  padding: 0.875rem;
  border-radius: 0.75rem;
  color: white;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  z-index: var(--z-base);
}

.metrics-grid .stat::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.05);
  pointer-events: none;
  z-index: var(--z-negative);
}

.metrics-grid .stat:hover {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
  transform: translateY(-6px);
}

/* Gradient backgrounds for each metric card */
.metrics-grid .stat-blue {
  background: linear-gradient(135deg, #2563eb 0%, #4fa3ff 100%);
}

.metrics-grid .stat-green {
  background: linear-gradient(135deg, #059669 0%, #36d399 100%);
}

.metrics-grid .stat-amber {
  background: linear-gradient(135deg, #d97706 0%, #fbbf24 100%);
}

.metrics-grid .stat-teal {
  background: linear-gradient(135deg, #0891b2 0%, #22d3ee 100%);
}

.metrics-grid .stat-red {
  background: linear-gradient(135deg, #dc2626 0%, #ff6b6b 100%);
}

.metrics-grid .stat-figure {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 0.375rem;
  background: rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
  color: white;
  opacity: 0.9;
  grid-row: 2;
  grid-column: 1;
  margin-right: 0.5rem;
}

.metrics-grid .stat-figure svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
}

.metrics-grid .stat-title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.9);
  grid-column: 2;
  grid-row: 1;
  align-self: center;
}

.metrics-grid .stat-value {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: white;
  grid-column: 2;
  grid-row: 2;
}

.metrics-grid .stat-desc {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  grid-column: 2;
  grid-row: 3;
}

.metrics-grid .stat-desc span:first-child {
  font-weight: 700;
  font-size: 0.9rem;
}

.metrics-grid .stat-trend.stat-up span:first-child {
  color: #86efac;
}

.metrics-grid .stat-trend.stat-down span:first-child {
  color: #fca5a5;
}

.metrics-grid .stat-trend.stat-neutral span:first-child {
  color: rgba(255, 255, 255, 0.7);
}

/* Dashboard Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Dashboard Row Layout (New Structure) */
.dashboard-row-1,
.dashboard-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Card spanning for tall cards in row-1 */
.dashboard-row-1 .card-tall {
  grid-row: span 1;
}

/* Dashboard Row 2 alignment */
.dashboard-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
}

/* Chart Row - Equal width 3 columns */
.chart-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  grid-column: 1 / -1;
  margin-bottom: 1rem;
  align-items: stretch;
}

.chart-row-two {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  grid-column: 1 / -1;
  margin-bottom: 1rem;
  align-items: stretch;
}

.chart-card {
  display: flex;
  flex-direction: column;
  min-height: 360px;
  height: 100%;
}

.chart-card .card {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.chart-card .card-body {
  display: flex;
  flex: 1;
}

.card-full {
  display: flex;
  flex-direction: column;
  height: auto;
}

.card-full .card-body {
  flex: 1;
}

.card-footer {
  padding: 1rem 1.375rem;
  border-top: 1px solid var(--border);
  background: var(--content-bg);
}

/* Chart Container */
.chart-container {
  position: relative;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.chart-container.chart-tall {
  height: 180px;
}

/* Workflow Status Styles */
.workflow-status-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
  padding: 0;
}

.workflow-chart-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: center;
  width: 100%;
}

.workflow-legend {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  width: 100%;
  min-width: auto;
  justify-content: center;
  flex-wrap: wrap;
}

.workflow-legend-center {
  text-align: center;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

.workflow-center-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1;
}

.workflow-center-label {
  font-size: .85rem;
  color: var(--text-secondary);
  margin-top: .35rem;
}

.workflow-legend-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.workflow-legend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: .85rem;
}

.workflow-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

.workflow-legend-text {
  flex: 1;
  min-width: 0;
}

.workflow-legend-label {
  font-size: .8rem;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
}

.workflow-legend-count {
  font-size: .75rem;
  color: var(--text-muted);
}

.workflow-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--primary);
  color: white;
  border-radius: .375rem;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
}

.workflow-btn:hover {
  background: var(--primary-dark);
}

/* Retention Footer */
.retention-footer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.retention-schedule {
  display: flex;
  align-items: center;
  font-size: .85rem;
  color: var(--text-secondary);
}

.retention-plan-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--primary);
  color: white;
  border-radius: .375rem;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
}

.retention-plan-btn:hover {
  background: var(--primary-dark);
}

/* Knowledge Connections Graph */
/* Knowledge Connections - SVG Graph */
.knowledge-body {
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.knowledge-graph {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.knowledge-graph-svg {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.05));
}

.knowledge-central-label {
  font-size: 13px;
  font-weight: 600;
  fill: #0284c7;
}

.knowledge-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--primary);
  color: white;
  border-radius: .375rem;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
  border: none;
  margin-top: 0.5rem;
}

.knowledge-btn:hover {
  background: var(--primary-dark);
}

/* Retention & Disposal Cards - Horizontal Row */
.retention-body {
  flex-direction: column;
  padding: 0;
}

.retention-cards-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding: 0.5rem;
  flex: 1;
}

.retention-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.4rem;
  background: var(--card-bg);
  border-radius: .625rem;
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.retention-item:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.retention-item-icon {
  width: 36px;
  height: 36px;
  border-radius: .625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.retention-item-icon svg {
  width: 18px;
  height: 18px;
}

.retention-item-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1;
}

.retention-item-label {
  font-size: .7rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.retention-item-text {
  font-size: .75rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.retention-item-btn {
  font-size: .7rem;
  color: var(--primary);
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  background: transparent;
  border: none;
  transition: color var(--transition);
  white-space: nowrap;
}

.retention-item-btn:hover {
  color: var(--primary-dark);
}

.retention-footer-section {
  padding: 1rem 1.375rem;
  border-top: 1px solid var(--border);
}

/* Recently Uploaded List */
.recent-list {
  padding: 0;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.recent-item:last-child {
  border-bottom: none;
}

.recent-item:hover {
  background: var(--content-bg);
}

.recent-icon {
  width: 36px;
  height: 36px;
  border-radius: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-weight: 600;
  font-size: .75rem;
}

.recent-pdf    { background: #fee2e2; color: #991b1b; }
.recent-docx   { background: #dbeafe; color: #1a3a6e; }
.recent-xlsx   { background: #dcfce7; color: #166534; }
.recent-pptx   { background: #fff7ed; color: #9a3412; }
.recent-img    { background: #dbeafe; color: #1565c0; }

.recent-icon svg {
  width: 18px;
  height: 18px;
}

.recent-content {
  flex: 1;
  min-width: 0;
}

.recent-title {
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-heading);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recent-meta {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .15rem;
}

.recent-time {
  font-size: .75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

/* Knowledge Connections */
.knowledge-connections {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  padding: 0;
}

.connection-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: .75rem;
  background: var(--content-bg);
  border: 1px solid var(--border);
  border-radius: .625rem;
  flex: 0 1 calc(50% - .375rem);
  transition: all var(--transition);
}

.connection-node:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
}

.node-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-weight: 700;
  font-size: .85rem;
}

.node-name {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-heading);
  text-align: center;
  line-height: 1.3;
}

/* Pending List */
.pending-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.pending-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.pending-item:last-child {
  border-bottom: none;
}

.pending-item:hover {
  background: var(--content-bg);
}

.pending-icon {
  width: 36px;
  height: 36px;
  border-radius: .5rem;
  background: #fee2e2;
  color: #991b1b;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pending-icon svg {
  width: 18px;
  height: 18px;
}

.pending-content {
  flex: 1;
  min-width: 0;
}

.pending-title {
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-heading);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pending-meta {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .15rem;
}

.pending-time {
  font-size: .75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

/* Alerts List */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 0;
}

.alert-item {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: 1rem;
  border-radius: .625rem;
  border-left: 4px solid;
  transition: all var(--transition);
}

.alert-item.alert-success {
  background: #dcfce7;
  border-color: #10b981;
  color: #166534;
}

.alert-item.alert-info {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1a3a6e;
}

.alert-item.alert-warning {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.alert-item.alert-danger {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.alert-header {
  font-size: .85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.alert-message {
  font-size: .8rem;
  line-height: 1.4;
}

.alert-progress {
  height: 6px;
  background: rgba(0, 0, 0, .1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: currentColor;
  opacity: .6;
  border-radius: 3px;
}

/* Bottom Dashboard Grid */
.dashboard-bottom {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: .85rem;
}

/* Loading Animation */
.loading {
  opacity: .6;
  pointer-events: none;
}

#refreshDashboard.loading svg {
  animation: spin 1s linear infinite;
}

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

/* Link Style */
.link-small {
  font-size: .8rem;
  color: var(--primary);
  font-weight: 500;
  transition: color var(--transition);
  text-decoration: none;
}

.link-small:hover {
  color: var(--primary-dark);
}

/* Responsive Design */
@media (max-width: 1536px) {
  .metrics-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }

  .chart-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1280px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .dashboard-header-right {
    width: 100%;
    justify-content: flex-end;
  }

  .topbar-title-section {
    gap: 1rem;
  }

  .topbar-title {
    font-size: 1.1rem;
  }

  .topbar-subtitle {
    font-size: 0.7rem;
  }

  .topbar-search-wrapper {
    min-width: 250px;
  }

  .topbar-search-input {
    font-size: 0.8rem;
  }
}

@media (max-width: 1024px) {
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .chart-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .docs-overview-body {
    flex-direction: column;
  }

  .docs-overview-content {
    flex: 1;
  }

  .dashboard-bottom {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
  }

  .dashboard-stats-title {
    font-size: 1.25rem;
  }

  .date-range-btn {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
  }

  .topbar-title {
    font-size: 1rem;
  }

  .topbar-subtitle {
    font-size: 0.65rem;
  }

  .topbar-actions {
    gap: 0.5rem;
  }

  .topbar-search-wrapper {
    min-width: 200px;
  }

  .smart-dashboard {
    padding: 0 0 1.5rem 0;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .metrics-grid .stat {
    padding: 0.875rem;
  }

  .metrics-grid .stat-figure {
    width: 40px;
    height: 40px;
  }

  .metrics-grid .stat-figure svg {
    width: 20px;
    height: 20px;
  }

  .metrics-grid .stat-value {
    font-size: 1.875rem;
  }

  .metrics-grid .stat-title {
    font-size: 0.65rem;
  }

  .metrics-grid .stat-desc {
    font-size: 0.75rem;
  }

  .dashboard-grid,
  .dashboard-bottom {
    grid-template-columns: 1fr;
  }

  .chart-row {
    grid-template-columns: 1fr;
  }

  .chart-container {
    height: 240px;
  }

  .chart-container.chart-tall {
    height: 240px;
  }

  .connection-node {
    flex: 0 1 calc(33% - 0.5rem);
  }

  .docs-legend {
    gap: 0.6rem;
  }

  .docs-legend-item {
    font-size: 0.8rem;
  }

  .docs-legend-count {
    font-size: 0.75rem;
  }
}

@media (max-width: 640px) {
  .dashboard-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }

  .dashboard-stats-title {
    font-size: 1.1rem;
  }

  .date-range-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.625rem;
    gap: 0.5rem;
  }

  .date-range-btn svg {
    width: 16px;
    height: 16px;
  }

  .topbar-title {
    font-size: 0.9rem;
  }

  .topbar-subtitle {
    font-size: 0.6rem;
    white-space: normal;
  }

  .topbar-actions {
    gap: 0.4rem;
  }

  .topbar-search-wrapper {
    min-width: 180px;
    padding: 0 0.5rem;
  }

  .topbar-search-input {
    font-size: 0.75rem;
    padding: 0.5rem 0.4rem;
  }

  .topbar-search-shortcut {
    display: none;
  }

  .topbar-search-wrapper svg {
    width: 14px;
    height: 14px;
  }

  .smart-dashboard {
    padding: 0 0 1rem 0;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .metrics-grid .stat {
    padding: 0.875rem;
  }

  .metrics-grid .stat-figure {
    width: 38px;
    height: 38px;
  }

  .metrics-grid .stat-figure svg {
    width: 19px;
    height: 19px;
  }

  .metrics-grid .stat-value {
    font-size: 1.625rem;
  }

  .metrics-grid .stat-title {
    font-size: 0.625rem;
  }

  .metrics-grid .stat-desc {
    font-size: 0.75rem;
  }

  .connection-node {
    flex: 0 1 calc(50% - 0.375rem);
  }
}

/* Dark mode support */
body.dark-mode .topbar-title {
  color: #f1f5f9;
}

body.dark-mode .topbar-subtitle {
  color: #000000;
}

body.dark-mode .topbar-search-wrapper {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .topbar-search-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.2);
}

body.dark-mode .topbar-search-input {
  color: #f1f5f9;
}

body.dark-mode .topbar-search-input::placeholder {
  color: #000000;
}

body.dark-mode .topbar-search-wrapper svg,
body.dark-mode .topbar-search-shortcut {
  color: #000000;
}

body.dark-mode .topbar-divider {
  background: #334155;
}

body.dark-mode .dashboard-header {
  border-color: #334155;
}

body.dark-mode .dashboard-stats-title {
  color: #f1f5f9;
}

body.dark-mode .date-range-btn {
  background: #1e293b;
  border-color: #334155;
  color: #000000;
}

body.dark-mode .date-range-btn:hover {
  background: #293548;
  border-color: var(--primary);
  color: var(--primary);
}

body.dark-mode .date-range-btn svg {
  color: #000000;
}

body.dark-mode .date-range-btn:hover svg {
  color: var(--primary);
}

body.dark-mode #dateRangeLabel {
  color: #f1f5f9;
}

body.dark-mode .date-selector-btn:hover {
  background: #1e293b;
}

body.dark-mode .recent-item:hover,
body.dark-mode .pending-item:hover,
body.dark-mode .retention-card:hover {
  background: #293548;
}

body.dark-mode .alert-item {
  filter: brightness(1.1);
}

/* ==========================================================================
   Documents Page - Stats Card
   ========================================================================== */
.docs-stats-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-xs);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.25rem;
}

.docs-stats-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.docs-stats-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.docs-stats-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.docs-stats-description {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Responsive adjustments */
@media (max-width: 1280px) {
  .docs-stats-card {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    padding: 1.25rem;
  }

  .docs-stats-value {
    font-size: 1.75rem;
  }
}

@media (max-width: 768px) {
  .docs-stats-card {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .docs-stats-value {
    font-size: 1.5rem;
  }

  .docs-stats-label {
    font-size: 0.7rem;
  }

  .docs-stats-description {
    font-size: 0.7rem;
  }
}

@media (max-width: 640px) {
  .docs-stats-card {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0.875rem;
    margin-bottom: 0.75rem;
  }

  .docs-stats-value {
    font-size: 1.25rem;
  }

  .docs-stats-label {
    font-size: 0.65rem;
  }
}
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--content-bg);
  flex-wrap: wrap;
}

.doc-viewer-modal-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.doc-viewer-modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.doc-viewer-modal-row:last-child {
  border-bottom: none;
}

.doc-viewer-modal-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  flex: 1;
}

.doc-viewer-modal-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  flex: 1;
  justify-content: center;
  min-width: 120px;
}

.doc-viewer-modal-action-btn:hover {
  transform: translateY(-1px);
}

.doc-viewer-modal-action-btn:active {
  transform: translateY(0);
}

/* Responsive adjustments */
/* ==========================================================================
   AI Assistant Styles
   ========================================================================== */

/* Override dashboard content padding for AI assistant ONLY */
.dashboard-content:has(> .ai-assistant-container) {
  padding: 0;
  display: flex;
}

.ai-assistant-container {
  display: flex;
  flex: 1;
  width: 100%;
  background: #fff;
  overflow: hidden;
}

.ai-sidebar {
  width: 260px;
  background: #f8f9fa;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1rem;
  overflow-y: auto;
}

.ai-new-chat-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #e9ecef;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  color: var(--text-body);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ai-new-chat-btn:hover {
  background: #dee2e6;
}

.ai-history-section {
  flex: 1;
}

.ai-history-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.ai-history-item {
  padding: 0.75rem;
  border-radius: 0.5rem;
  color: var(--text-body);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.ai-history-item:hover {
  background: #e9ecef;
}

.ai-history-item.active {
  background: #dfe4ff;
  color: var(--primary);
  font-weight: 500;
}

.ai-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ai-messages-empty {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  height: 100%;
}

.ai-messages-empty-icon {
  width: 60px;
  height: 60px;
  margin-bottom: 1rem;
  color: #cbd5e1;
}

.ai-messages-empty-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 0.5rem;
}

.ai-messages-empty-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.ai-examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.ai-example-btn {
  padding: 1rem;
  background: var(--content-bg);
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-body);
}

.ai-example-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(21, 101, 192, 0.1);
  transform: translateY(-2px);
}

.ai-example-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.ai-example-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ai-message {
  display: flex;
  gap: 1rem;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-message.user {
  justify-content: flex-end;
}

.ai-message.user .ai-message-content {
  max-width: 70%;
}

.ai-message.assistant .ai-message-content {
  max-width: 70%;
}

.ai-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 600;
  font-size: 0.875rem;
}

.ai-avatar.user {
  background: var(--primary);
  color: #fff;
}

.ai-avatar.assistant {
  background: #f0f4f8;
  color: var(--primary);
}

.ai-message-content {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  line-height: 1.6;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.ai-message.user .ai-message-content {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}

.ai-message.assistant .ai-message-content {
  background: #f0f4f8;
  color: var(--text-body);
  border-bottom-left-radius: 0.25rem;
}

.ai-typing-indicator {
  display: flex;
  gap: 0.4rem;
  padding: 0.75rem 1rem;
  background: #f0f4f8;
  border-radius: 0.75rem;
  border-bottom-left-radius: 0.25rem;
  width: fit-content;
}

.ai-typing-dot {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: bounce 1.4s infinite;
}

.ai-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.ai-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-10px);
  }
}

.ai-input-area {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  background: #fff;
}

.ai-input-wrapper {
  max-width: 100%;
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
}

#aiAssistantInput {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.95rem;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  background: var(--content-bg);
  color: var(--text-body);
  transition: border-color 0.15s;
}

#aiAssistantInput:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
}

.ai-send-btn {
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: #fff;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  border: none;
  flex-shrink: 0;
}

.ai-send-btn:hover:not(:disabled) {
  background: var(--primary-dark);
}

.ai-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-send-icon {
  width: 16px;
  height: 16px;
  margin-left: 0.5rem;
}

@media (max-width: 768px) {
  .ai-assistant-container {
    flex-direction: column;
  }

  .ai-sidebar {
    width: 100%;
    height: auto;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: wrap;
  }

  .ai-messages-area {
    padding: 1rem;
  }

  .ai-input-area {
    padding: 1rem;
  }

  .ai-message.user .ai-message-content,
  .ai-message.assistant .ai-message-content {
    max-width: 90%;
  }

  .ai-examples-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Documents Page Styles
   ========================================================================== */

.docs-filter-chips-area {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--content-bg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.docs-active-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 1;
}

/* Column Customizer Styles */
#columnChooserMenu {
  font-family: inherit;
}

.column-chooser-item:hover {
  background-color: rgba(0, 0, 0, 0.04) !important;
}

.column-chooser-item input[type="checkbox"] {
  margin: 0;
  width: 16px;
  height: 16px;
}

.column-chooser-item label {
  margin: 0;
}

#columnChooserMenu::-webkit-scrollbar {
  width: 6px;
}

#columnChooserMenu::-webkit-scrollbar-track {
  background: transparent;
}

#columnChooserMenu::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

#columnChooserMenu::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Academic Term Bar */
.acad-term-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1.25rem;
  background: var(--content-bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.acad-term-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-body);
  white-space: nowrap;
}

.acad-term-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(34,197,94,.25);
}

.acad-term-selectors {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1;
  flex-wrap: wrap;
}

.acad-term-sel-label {
  font-size: .8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.acad-term-sel-val {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-body);
  white-space: nowrap;
}

.acad-term-chevron {
  width: 13px; height: 13px;
  color: var(--text-muted);
}

.acad-term-divider {
  color: var(--border);
  margin: 0 .25rem;
  font-size: .85rem;
}

/* Action Bar */
.docs-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: .75rem;
  flex-wrap: wrap;
}

.docs-actions-left {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.docs-actions-right {
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* View Toggle */
.view-toggle-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  padding: 0.4rem 0.5rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  cursor: pointer;
  color: var(--text-body);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.view-toggle-btn:hover {
  background: var(--content-bg);
  color: var(--text-body);
}

.view-toggle-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.view-toggle-btn svg {
  width: 16px;
  height: 16px;
}

/* More Actions */
.more-actions-wrap {
  position: relative;
}

/* Horizontal Filter Bar */
.docs-filter-bar {
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--content-bg);
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.dfb-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.dfb-row--secondary {
  padding-top: .25rem;
}

.dfb-search-wrap {
  display: flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .6rem .9rem;
  background: var(--card-bg);
  min-width: 200px;
  flex: 1;
  max-width: 320px;
}

.dfb-search-wrap svg {
  width: 13px;
  height: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.dfb-search-wrap input {
  border: none;
  background: transparent;
  font-size: .95rem;
  width: 100%;
  min-width: 0;
  color: var(--text-body);
  outline: none;
}

.dfb-search-wrap--sm {
  min-width: 140px;
  max-width: 180px;
  flex: none;
}

.dfb-select {
  padding: .6rem .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  background: var(--card-bg);
  color: var(--text-body);
  cursor: pointer;
  height: 40px;
}

.dfb-select:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}

.dfb-date {
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  background: var(--card-bg);
  color: var(--text-body);
  height: 40px;
}

.dfb-date:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}

.dfb-toggle {
  display: flex;
  align-items: center;
  gap: .4rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.dfb-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.dfb-toggle-thumb {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  background: var(--border);
  border-radius: 18px;
  transition: background .2s;
  flex-shrink: 0;
}

.dfb-toggle-thumb::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}

.dfb-toggle input:checked ~ .dfb-toggle-thumb {
  background: var(--primary);
}

.dfb-toggle input:checked ~ .dfb-toggle-thumb::after {
  transform: translateX(14px);
}

.dfb-toggle-text {
  font-size: .78rem;
  color: var(--text-secondary);
}

/* Filter Chips */
.dfb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
  padding: .5rem 0 .25rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: 999px;
  padding: .2rem .5rem .2rem .6rem;
  font-size: .75rem;
  line-height: 1;
  color: var(--primary-dark);
  white-space: nowrap;
  animation: chipIn .15s ease;
}

@keyframes chipIn {
  from { opacity: 0; transform: scale(.88); }
  to { opacity: 1; transform: scale(1); }
}

.filter-chip-prefix {
  font-weight: 700;
  opacity: .75;
  margin-right: .05rem;
}

.filter-chip-label {
  font-weight: 500;
}

.filter-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background .15s, transform .15s;
  margin-left: .1rem;
}

.filter-chip-remove svg {
  width: 8px;
  height: 8px;
}

.filter-chip-remove:hover {
  background: var(--primary-dark);
  transform: scale(1.1);
}

.filter-chip-remove:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Table Section */
.docs-table-section {
  display: flex;
  flex-direction: column;
}

/* Showing Row */
.docs-showing-row {
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--content-bg);
}

/* Star button */
.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: .2rem;
  color: var(--text-muted);
  transition: color var(--transition), transform .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.star-btn svg {
  width: 16px;
  height: 16px;
}

.star-btn:hover {
  color: #f59e0b;
  transform: scale(1.15);
}

.star-btn.starred {
  color: #f59e0b;
}

.star-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ==========================================================================
   Workflow Metrics Dashboard Styles
   ========================================================================== */

.workflow-metrics-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.875rem;
    padding: 0;
    margin-bottom: 1.5rem;
}

.workflow-metric-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    background: white;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.workflow-metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.5), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.workflow-metric-card:hover {
    box-shadow: var(--shadow-sm);
    transform: none;
    border-color: var(--border);
}

.workflow-metric-card:hover::before {
    opacity: 0;
}

.workflow-metric-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 0;
    flex-shrink: 0;
}

.workflow-metric-icon--active {
    background: transparent;
}

.workflow-metric-icon--pending {
    background: transparent;
}

.workflow-metric-icon--overdue {
    background: transparent;
}

.workflow-metric-icon--completed {
    background: transparent;
}

.workflow-metric-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.workflow-metric-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.workflow-metric-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1;
}

.workflow-metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ==========================================================================
   Workflow Page Styles
   ========================================================================== */

.workflow-main-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
    min-height: 0;
}

.workflow-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
    align-items: start;
}

.workflow-table-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    margin: 0;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow-y: auto;
    background: var(--card-bg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.workflow-filter-bar {
    padding: 1.25rem 1.25rem 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--content-bg);
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    min-height: 60px;
}

.workflow-filter-bar form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
}

.workflow-search-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    background: var(--card-bg);
    min-width: 200px;
    flex: 1;
    max-width: 280px;
    transition: all var(--transition);
}

.workflow-search-input:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.workflow-search-input input {
    border: none;
    background: transparent;
    font-size: 0.85rem;
    width: 100%;
    min-width: 0;
    color: var(--text-body);
    outline: none;
}

.workflow-search-input input::placeholder {
    color: var(--text-muted);
}

.workflow-filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    background: var(--card-bg);
    color: var(--text-body);
    cursor: pointer;
    height: auto;
    min-height: 32px;
    transition: all var(--transition);
}

.workflow-filter-select:hover {
    border-color: var(--primary-light);
}

.workflow-filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.workflow-filter-button {
    padding: 0.5rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all var(--transition);
    white-space: nowrap;
}

.workflow-filter-button:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.workflow-filter-button:active {
    transform: scale(0.98);
}

.workflow-active-filters {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    background: rgba(59, 130, 246, 0.03);
    width: 100%;
}

.workflow-filter-chips {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
}

.workflow-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 9999px;
    font-size: 0.8rem;
    color: var(--text-body);
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.workflow-filter-chip-prefix {
    font-weight: 700;
    color: var(--primary);
}

.workflow-filter-chip-remove {
    background: none;
    border: none;
    padding: 0;
    margin: 0 -0.25rem 0 0.25rem;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: color var(--transition);
}

.workflow-filter-chip-remove:hover {
    color: var(--danger);
}

.workflow-filter-chip-remove svg {
    width: 14px;
    height: 14px;
}

.workflow-clear-all-btn {
    padding: 0.5rem 0.9rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all var(--transition);
    border-radius: var(--radius-sm);
}

.workflow-clear-all-btn:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(220, 38, 38, 0.05);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.9rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    text-transform: capitalize;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.status-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.status-draft {
    background: linear-gradient(135deg, #f5f5f5 0%, #e5e5e5 100%);
    color: #555;
}

.status-review {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.status-approved {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.status-archived {
    background: linear-gradient(135deg, #e9d5ff 0%, #d8b4fe 100%);
    color: #5b21b6;
}

/* Workflow Progress Indicator */
.workflow-progress-indicator {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0;
}

.workflow-stage-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    border: 2px solid #ddd;
    flex-shrink: 0;
    transition: all 0.25s ease;
    background: #f9f9f9;
}

.workflow-stage-circle.completed {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #10b981;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.workflow-stage-circle.current {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    transform: scale(1.05);
}

.workflow-stage-circle.pending {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #e5e7eb;
}

.workflow-stage-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
}

.workflow-stage-line {
    width: 16px;
    height: 2px;
    background: #e5e7eb;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

/* Priority Badge */
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.8rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    text-transform: capitalize;
    transition: all 0.2s ease;
}

.priority-low {
    background: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
    color: white;
}

.priority-medium {
    background: linear-gradient(135deg, #fef08a 0%, #fcd34d 100%);
    color: #78350f;
}

.priority-high {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    color: #7c2d12;
}

/* Workflow Table */
.workflow-table {
    width: 100%;
    border-collapse: collapse;
}

.workflow-table th {
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #000000 !important;
    border-bottom: 1px solid var(--border);
    padding: 0.7rem 0.75rem;
    background: #fafbfc;
}

#deletionRequestsTable thead tr th:last-child {
    display: table-cell !important;
    visibility: visible !important;
    min-width: 80px;
}

.workflow-table td {
    vertical-align: top;
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
}

.workflow-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.workflow-row:hover {
    background-color: rgba(59, 130, 246, 0.04);
}

.workflow-row.active {
    background-color: rgba(59, 130, 246, 0.08);
    border-left: 3px solid var(--primary);
}

.workflow-row:active {
    background-color: rgba(59, 130, 246, 0.08);
}



.context-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}

.workflow-action-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.workflow-action-btn {
    padding: 0.5rem !important;
    min-width: auto;
    color: var(--text-secondary);
    transition: all var(--transition);
    border-radius: var(--radius-sm);
}

.workflow-action-btn:hover {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

.workflow-action-btn:active {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary);
}

.workflow-action-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 2;
}

.workflow-action-btn--danger {
    color: var(--danger);
}

.workflow-action-btn--danger:hover {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
}

.workflow-action-btn--danger:active {
    background: rgba(220, 38, 38, 0.2);
}

/* ==========================================================================
   Workflow Details Panel
   ========================================================================== */

.workflow-details-panel {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card-bg);
    height: fit-content;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 100px;
}

.workflow-details-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 60px;
}

.workflow-details-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0;
}

.workflow-details-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.workflow-details-close:hover {
    background: var(--content-bg);
    color: var(--text-heading);
}

.workflow-details-close svg {
    width: 20px;
    height: 20px;
}

.workflow-details-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.workflow-details-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.workflow-details-empty svg {
    opacity: 0.3;
}

.workflow-details-empty p {
    margin: 0;
    font-size: 0.9rem;
}

/* Workflow details sections */
.workflow-details-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.workflow-details-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.workflow-details-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.workflow-details-value {
    font-size: 0.9rem;
    color: var(--text-body);
    font-weight: 500;
}

.workflow-details-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.workflow-details-row-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.workflow-details-doc-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

.workflow-details-doc-id {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: monospace;
}

.workflow-details-status-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Workflow Progress */
.workflow-details-progress {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.workflow-details-progress-stages {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.workflow-details-progress-stage {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    border: 2px solid #ddd;
    flex-shrink: 0;
    transition: all 0.25s ease;
    background: #f9f9f9;
    color: #666;
}

.workflow-details-progress-stage.completed {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #10b981;
}

.workflow-details-progress-stage.current {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    transform: scale(1.05);
}

.workflow-details-progress-bar {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.workflow-details-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* Workflow Timeline */
.workflow-details-timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.workflow-details-timeline-item {
    display: flex;
    gap: 1rem;
}

.workflow-details-timeline-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.workflow-details-timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--card-bg);
}

.workflow-details-timeline-line {
    width: 2px;
    flex: 1;
    background: var(--border);
}

.workflow-details-timeline-line.last {
    display: none;
}

.workflow-details-timeline-content {
    flex: 1;
    padding-top: 0.25rem;
}

.workflow-details-timeline-action {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-heading);
}

.workflow-details-timeline-user {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.workflow-details-timeline-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Workflow Comments */
.workflow-details-comments {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.workflow-details-comment {
    padding: 0.75rem;
    background: var(--content-bg);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.workflow-details-comment-author {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-heading);
}

.workflow-details-comment-text {
    font-size: 0.85rem;
    color: var(--text-body);
    margin-top: 0.5rem;
    line-height: 1.4;
}

.workflow-details-comment-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Workflow Actions */
.workflow-details-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.workflow-details-action-btn {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-body);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.workflow-details-action-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.workflow-details-action-btn svg {
    width: 16px;
    height: 16px;
}

.workflow-details-action-btn--danger {
    color: var(--danger);
}

.workflow-details-action-btn--danger:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* ======================================================================
   Upload Page Styles
   ====================================================================== */

/* Upload form layout — full container width */
#uploadForm > div {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* Responsive: Adjust for tablets */
@media (max-width: 1024px) {
    #uploadForm > div {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .upload-form-grid-2col {
        grid-template-columns: 1fr !important;
    }
}

/* Further responsive adjustment for smaller screens */
@media (max-width: 768px) {
    #uploadForm > div {
        gap: 1rem;
        max-width: 100%;
        padding: 0 1rem;
    }
    
    .upload-section {
        gap: 0.6rem;
    }
    
    .upload-section-label {
        font-size: 0.8rem;
    }
}

/* Upload form disabled state (window closed) */
#uploadForm.disabled {
    pointer-events: none;
    opacity: 0.55;
}

/* Alert messages */
#uploadAlert {
    display: none;
}

#uploadAlert.show {
    display: block;
}

/* Left column — Use grid to arrange cards */
.upload-form-left {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
}

/* Department Mapping card — first column, first row */
.upload-form-left .card:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
}

/* Document Information card — second column, first row */
.upload-form-left .card:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
}

/* Tags & Keywords card — first column, second row */
.upload-form-left .card:nth-child(3) {
    grid-column: 1;
    grid-row: 2;
    margin-top: -37.5rem;
}

/* File Upload card — first column, third row, below Tags & Keywords */
.upload-form-left .card:nth-child(4) {
    grid-column: 1;
    grid-row: 3;
    margin-top: -23.5rem;
}

/* Submit card — second column, second row (under Document Information) */
.upload-form-left .card:nth-child(5) {
    grid-column: 2;
    grid-row: 2;
}

/* Responsive: Stack on tablets and mobile */
@media (max-width: 1024px) {
    .upload-form-left {
        grid-template-columns: 1fr;
    }
    
    .upload-form-left .card:nth-child(1),
    .upload-form-left .card:nth-child(2),
    .upload-form-left .card:nth-child(3),
    .upload-form-left .card:nth-child(n+4) {
        grid-column: 1;
        grid-row: auto;
    }
}

/* Right column — Department & Tags */
.upload-form-right {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Card body sections */
.upload-card-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem;
}

/* Add padding to file upload card body */
.upload-form-left .card-body {
    padding: 1.25rem;
}

/* Add padding to right column cards */
.upload-form-right .upload-card-body {
    padding: 1.25rem;
}

.upload-card-body-tags {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.5rem;
    min-height: 280px;
}

.upload-card-body-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Form groups — remove default margin */
.upload-form-group {
    margin-bottom: 0;
}

/* Form group labels */
.upload-form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-heading);
    margin-bottom: 0.375rem;
}

/* Checkbox label should stay inline */
.upload-form-group .upload-checkbox-label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    font-size: inherit;
    color: inherit;
}

/* Required star styling */
.required-star {
    color: var(--danger);
    margin-left: 0.2rem;
}

/* Comprehensive styling for all form controls */
.upload-form-group input:not([type="hidden"]):not([type="checkbox"]),
.upload-form-group select,
.upload-form-group textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-body);
    background-color: var(--card-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

/* Focus state with primary color glow */
.upload-form-group input:not([type="hidden"]):focus,
.upload-form-group select:focus,
.upload-form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.15);
}

/* Read-only inputs */
.upload-form-group input[readonly] {
    background-color: var(--content-bg);
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* Disabled inputs and selects */
.upload-form-group input[disabled],
.upload-form-group select[disabled],
.upload-form-group textarea[disabled] {
    background-color: var(--content-bg);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.65;
}

/* Textarea specific styling */
.upload-form-group textarea {
    resize: vertical;
    line-height: 1.5;
    min-height: 100px;
}

/* Highlight class for required fields that need to be filled */
.upload-form-group input.field-highlight:not([type="hidden"]):not([type="checkbox"]),
.upload-form-group select.field-highlight,
.upload-form-group textarea.field-highlight {
    border-color: #f59e0b;
    background-color: rgba(245, 158, 11, 0.02);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

/* Highlight focus state */
.upload-form-group input.field-highlight:not([type="hidden"]):focus,
.upload-form-group select.field-highlight:focus,
.upload-form-group textarea.field-highlight:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
}

/* Field hints and help text */
.field-hint {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.375rem;
    line-height: 1.4;
}

.field-hint strong {
    color: #d97706;
    font-weight: 600;
}

/* Two-column grid for form fields */
.upload-form-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Read-only input styling */
#docCode {
    background-color: #f3f4f6;
    cursor: not-allowed;
}

/* Custom form field styling for upload form */
.input-readonly {
    background-color: #f3f4f6 !important;
    cursor: not-allowed !important;
}

/* Hidden text inputs (shown/hidden dynamically) */
.upload-form-hidden-input {
    display: none;
    margin-top: 0.625rem;
}

.upload-form-hidden-input.show {
    display: block;
}

/* Checkbox styling */
.upload-checkbox {
    display: inline;
    width: auto;
    height: auto;
    accent-color: var(--primary);
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

.upload-checkbox:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    accent-color: var(--text-muted);
}

.upload-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.upload-checkbox-label:has(.upload-checkbox:disabled) {
    cursor: not-allowed;
    opacity: 0.6;
}

.upload-checkbox-label span {
    display: inline;
}

/* Form group description text */
.upload-form-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.upload-form-hint-small {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Warning text in form hints */
.upload-form-hint strong {
    color: var(--warning);
}

/* Department units display */
#deptUnitsDisplay {
    display: none;
    padding: 0.75rem;
    background: #f3f4f6;
    border-radius: 0.375rem;
    border-left: 4px solid #3b82f6;
}

#deptUnitsDisplay.show {
    display: block;
}

#deptUnitsDisplay p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0 0 0.5rem 0;
    font-weight: 500;
}

#deptUnitsList {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Department badge preview */
#deptBadgeWrap {
    display: none;
}

#deptBadgeWrap.show {
    display: block;
}

.dept-badge-preview {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: #f0f4f8;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    font-size: 10.88px;
    font-weight: 700;
    color: #334155;
}

/* AI Suggest button and chips */
.upload-ai-btn {
    font-size: 0.75rem;
    padding: 0.3rem 0.7rem;
    gap: 0.35rem;
    display: flex;
    align-items: center;
}

.upload-ai-btn svg {
    width: 13px;
    height: 13px;
}

#aiSuggestWrap {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
}

#aiSuggestWrap.show {
    display: flex;
}

#aiSuggestWrap p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

#aiSuggestChips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

/* Tag input styling */
.upload-tag-input-wrap {
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.5rem;
    background: #ffffff;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.upload-tag-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.upload-tag-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.upload-tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    background: var(--primary);
    color: white;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 500;
}

.upload-tag-pill-remove {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.upload-tag-pill-remove:hover {
    opacity: 0.8;
}

.upload-tag-text-input {
    flex: 1;
    min-width: 120px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.9rem;
    color: var(--text-body);
}

.upload-tag-text-input::placeholder {
    color: var(--text-muted);
}

/* File preview strip */
.upload-file-preview-strip {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f0fdf4;
    border: 1px solid #dcfce7;
    border-radius: 0.375rem;
    margin-top: 1rem;
}

.upload-file-preview-strip.show {
    display: flex;
}

.upload-file-preview-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: white;
    border-radius: 0.375rem;
    border: 1px solid #dcfce7;
}

.upload-file-preview-info {
    flex: 1;
    min-width: 0;
}

.upload-file-preview-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-body);
    word-break: break-word;
}

.upload-file-preview-size {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.upload-file-preview-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.upload-file-preview-remove:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-body);
}

/* Submit button styling */
.upload-submit-btn {
    width: 100%;
    justify-content: center;
    gap: 0.5rem;
}

.upload-submit-btn svg {
    width: 16px;
    height: 16px;
}

.upload-cancel-btn {
    width: 100%;
    text-align: center;
}

/* Upload progress overlay */
.upload-progress-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: var(--z-emergency);
    align-items: center;
    justify-content: center;
}

.upload-progress-overlay.show {
    display: flex;
}

.upload-progress-card {
    background: white;
    border-radius: 0.5rem;
    padding: 2rem;
    max-width: 300px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.upload-progress-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
    animation: spin 1s linear infinite;
}

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

.upload-progress-icon svg {
    width: 48px;
    height: 48px;
    display: inline-block;
}

.upload-progress-label {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-body);
    margin-bottom: 1rem;
}

.upload-progress-bar-wrap {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 9999px;
    width: 0%;
    transition: width 0.3s ease;
}

/* SVG icon sizing in upload form */
.upload-form-icon {
    width: 14px;
    height: 14px;
}

.upload-form-icon-lg {
    width: 16px;
    height: 16px;
}

.workflow-action-btn--danger:hover {
    background: rgba(220, 38, 38, 0.08);
    color: var(--danger);
}

.workflow-pagination {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1.5rem;
    align-items: center;
    border-top: 1px solid var(--border);
    background: var(--content-bg);
    flex-wrap: wrap;
}

.workflow-pagination-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-right: auto;
    font-weight: 500;
}

.workflow-pagination-link {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-body);
    transition: all var(--transition);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    min-width: 32px;
    text-align: center;
}

.workflow-pagination-link:hover {
    background: var(--content-bg);
    border-color: var(--primary);
    color: var(--primary);
}

.workflow-pagination-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 700;
}

@media (max-width: 1280px) {
    .workflow-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .workflow-filter-bar form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .workflow-metrics-container {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.875rem;
        padding: 0;
        margin-bottom: 1.5rem;
    }
    
    .workflow-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .workflow-details-panel {
        position: static;
        max-height: none;
        top: auto;
    }
}

@media (max-width: 768px) {
    .workflow-metrics-container {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.875rem;
        padding: 0;
        margin-bottom: 1.5rem;
    }
    
    .workflow-metric-card {
        padding: 1rem;
        gap: 0.5rem;
    }
    
    .workflow-metric-icon {
        width: 48px;
        height: 48px;
    }
    
    .workflow-metric-value {
        font-size: 2.25rem;
    }
    
    .workflow-metric-label {
        font-size: 0.75rem;
    }
    
    .workflow-filter-bar {
        padding: 1rem;
        gap: 0.5rem;
    }
    
    .workflow-filter-bar form {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .workflow-search-input {
        max-width: 100%;
    }
    
    .workflow-filter-select {
        width: 100%;
    }
    
    .workflow-filter-button {
        width: 100%;
    }
    
    .workflow-active-filters {
        padding: 0.75rem 1rem;
    }
    
    .workflow-table th {
        font-size: 0.7rem;
        padding: 0.75rem 0.5rem;
    }
    
    .workflow-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
    
    .workflow-pagination {
        padding: 1rem;
        gap: 0.5rem;
    }
    
    .workflow-pagination-info {
        margin-right: auto;
        font-size: 0.8rem;
    }
}

/* Doc row hover */
.doc-row {
  transition: all var(--transition);
  cursor: pointer;
}

.doc-row:hover {
  background: var(--content-bg);
  box-shadow: 0 2px 8px rgba(21, 101, 192, .08);
}

/* Pagination */
.docs-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  gap: .75rem;
  flex-wrap: wrap;
}

.docs-pagination-left,
.docs-pagination-center,
.docs-pagination-right {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.docs-per-page-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.docs-per-page-sel {
  padding: .2rem .4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .8rem;
  background: var(--card-bg);
  cursor: pointer;
}

/* View Mode Styles */
#docsTableSection .docs-grid-container,
#docsTableSection .docs-info-container {
  display: none !important;
}

#docsTableSection .table-wrap {
  display: block !important;
}

#docsTableSection.view-grid .table-wrap,
#docsTableSection.view-compact .table-wrap,
#docsTableSection.view-info .table-wrap {
  display: none !important;
}

#docsTableSection.view-list .table-wrap {
  display: block !important;
}

#docsTableSection.view-grid .docs-grid-container {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  padding: 1rem;
}

#docsTableSection.view-info .docs-info-container {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  padding: 1.25rem;
}

.docs-grid-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: var(--card-bg);
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.docs-grid-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  transform: translateY(-2px);
}

.docs-grid-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
}

.docs-grid-card-title {
  font-weight: 600;
  color: var(--text-body);
  word-break: break-word;
  flex: 1;
}

.docs-grid-card-star {
  cursor: pointer;
  flex-shrink: 0;
}

.docs-grid-card-meta {
  font-size: .8rem;
  color: var(--text-muted);
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.docs-grid-card-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: .2rem .5rem;
  border-radius: .3rem;
  font-size: .75rem;
  font-weight: 600;
}

/* Compact View */
.view-compact table {
  width: 100%;
}

.view-compact tbody tr {
  display: flex;
  align-items: center;
  padding: .5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: .5rem;
}

.view-compact tbody tr td {
  padding: 0 !important;
}

.view-compact tbody tr td:nth-child(1),
.view-compact tbody tr td:nth-child(2) {
  flex-shrink: 0;
}

.view-compact tbody tr td:nth-child(3) {
  flex: 1;
  min-width: 0;
}

.view-compact tbody tr td:nth-child(n+4):not(:last-child) {
  display: none;
}

.view-compact tbody tr td:last-child {
  flex-shrink: 0;
}

/* Info View */
.view-info .docs-info-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  padding: 1.25rem;
}

.docs-info-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--card-bg);
  transition: box-shadow .2s;
}

.docs-info-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

.docs-info-card-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-body);
  margin-bottom: .5rem;
  word-break: break-word;
}

.docs-info-card-meta {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: .75rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.docs-info-card-actions {
  display: flex;
  gap: .5rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
}

.docs-info-card-actions button,
.docs-info-card-actions a {
  flex: 1;
  padding: .4rem .5rem;
  font-size: .75rem;
}

/* Document Action Buttons */
.doc-action-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.doc-visible-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.doc-visible-buttons .doc-action-btn:nth-child(n+5) {
  display: flex !important;
}

.doc-action-menu-container {
  position: relative;
  display: none;
  align-items: center;
}

.doc-menu-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 0.4rem !important;
  min-width: auto;
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}

.doc-menu-btn:hover {
  color: var(--text-heading);
  background: var(--content-bg);
}

.doc-menu-btn:active {
  background: var(--primary-light);
  color: var(--primary);
}

.doc-menu-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.doc-action-menu {
  position: absolute;
  right: 0;
  top: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
  z-index: var(--z-critical);
  min-width: 180px;
  margin-top: 4px;
  display: none;
  flex-direction: column;
}

.doc-action-item {
  display: flex !important;
  align-items: center;
  padding: 0.5rem 1rem;
  gap: 0.5rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.doc-action-item:hover {
  background: var(--content-bg);
  color: var(--text-heading);
}

.doc-action-item.doc-action-item--danger {
  color: var(--danger);
}

.doc-action-item.doc-action-item--danger:hover {
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
}

.doc-action-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 2;
}



/* ==========================================================================
   View Document Page Styles
   ========================================================================== */
.document-detail-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--page-bg);
}

.document-header {
    padding: 1.25rem;
    background: var(--card-bg);
}

.document-header-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.document-title-section {
    flex: 1;
}

.document-title-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.document-title-main h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #000000 !important;
}

.document-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 10.88px;
    font-weight: 700;
}

/* Status Badge Colors */
.document-status-badge.badge-approved {
    background: #ecfdf5;
    color: #10b981;
}

.document-status-badge.badge-draft {
    background: #f3f4f6;
    color: #6b7280;
}

.document-status-badge.badge-review {
    background: #fffbeb;
    color: #f59e0b;
}

.document-status-badge.badge-archived {
    background: #faf5ff;
    color: #8b5cf6;
}

.document-meta-info {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: #000000 !important;
}

.document-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.document-meta-item strong {
    color: #000000 !important;
    font-weight: 600;
}

.document-actions {
    display: flex;
    gap: 0.5rem;
}

/* Document Actions Menu - Three-Dot Dropdown */
.page-actions {
    overflow: visible;
    position: relative;
}

.document-actions-menu {
    position: relative;
    overflow: visible;
}

.document-actions-dropdown {
    min-width: 13rem;
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    z-index: 300;
    display: none;
    flex-direction: column;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius-sm, 0.375rem);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    max-height: 80vh;
}

.document-actions-dropdown.show {
    display: flex;
    animation: slideIn 0.15s ease-out;
}

.document-action-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border: none;
    background: none;
    color: inherit;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.document-action-item:hover {
    background-color: rgba(0, 0, 0, 0.06);
}

.document-action-item:active {
    background-color: rgba(0, 0, 0, 0.1);
}

.document-actions-dropdown .document-action-item:first-child {
    border-radius: var(--radius-sm, 0.375rem) var(--radius-sm, 0.375rem) 0 0;
}

.document-actions-dropdown .document-action-item:last-child {
    border-radius: 0 0 var(--radius-sm, 0.375rem) var(--radius-sm, 0.375rem);
}

.document-tabs-content-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.document-viewer-column {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.document-viewer-container {
    flex: 1 1 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    min-height: 600px;
}

.document-tabs {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    background: white;
    padding: 0 1.25rem;
    overflow-x: auto;
    flex-shrink: 0;
}

.document-tab {
    padding: 1rem 0;
    border: none;
    background: none;
    color: #000000 !important;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.document-tab:hover {
    color: #000000 !important;
}

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

.document-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    gap: 1.25rem;
    padding: 0.25rem 1.25rem 1.25rem 1.25rem;
    align-items: stretch;
    min-height: 600px;
}

.document-viewer-section {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
}

.document-viewer-canvas {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    padding: 1rem;
}

.document-viewer-placeholder {
    text-align: center;
    padding: 3rem 1rem;
    color: #000000 !important;
}

.document-thumbnails {
    width: 100px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--content-bg);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.document-thumbnail {
    width: 80px;
    height: 110px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.document-thumbnail:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.document-thumbnail.active {
    border-color: var(--primary);
    background: #eff6ff;
}

/* ══════════════════════════════════════════════════════════════
   Reports Page Styles
   ══════════════════════════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    padding: 1.25rem;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0.25rem 0;
}

.stats-empty-card {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.stats-empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    display: block;
    opacity: 0.4;
}

.stats-empty-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stats-empty-subtitle {
    font-size: 0.875rem;
}

.document-info-panel {
    width: 320px;
    flex: 0 0 320px;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow: hidden;
    align-items: stretch;
}

.document-info-section {
    margin-bottom: 0;
    padding: 0.65rem;
    background: var(--content-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    flex: 0 0 auto;
}

.document-info-section:last-child {
    margin-bottom: 0;
}

.document-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #000000 !important;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.related-doc-item {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.75rem;
}

.related-doc-item:last-child {
    margin-bottom: 0;
}

.related-doc-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.related-doc-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: #000000 !important;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.related-doc-meta {
    font-size: 0.75rem;
    color: #000000 !important;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.workflow-status-item {
    padding: 0.75rem;
    border-left: 3px solid var(--primary);
    background: white;
    margin-bottom: 0.75rem;
}

.workflow-status-item:last-child {
    margin-bottom: 0;
}

.workflow-status-date {
    font-size: 0.75rem;
    color: #000000 !important;
    margin-bottom: 0.25rem;
}

.workflow-status-action {
    font-weight: 600;
    font-size: 0.85rem;
    color: #000000 !important;
    margin-bottom: 0.25rem;
}

.workflow-status-by {
    font-size: 0.75rem;
    color: #000000 !important;
}

.document-info-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #000000 !important;
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.document-info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
}

.document-info-label {
    color: #000000 !important;
    font-weight: 500;
}

.document-info-value {
    color: #000000 !important;
    font-weight: 600;
    text-align: right;
}

.document-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.document-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--primary-light);
    border: 1px solid rgba(21, 101, 192, 0.2);
    color: var(--primary);
}

.document-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.document-quick-action {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    background: var(--content-bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    color: #000000 !important;
    transition: all 0.2s;
}

.document-quick-action:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.document-qr-code {
    text-align: center;
    padding: 0.5rem 0;
}

.document-qr-code-image {
    width: 85px;
    height: 85px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin: 0 auto 0.35rem;
}

.document-qr-text {
    font-size: 0.75rem;
    color: #000000 !important;
}

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

.document-tab-content.active {
    display: flex;
    flex: 1;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.document-tab-content[data-tab-content="viewer"] {
    flex-direction: column;
    align-items: stretch;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.details-group {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.details-group:last-child {
    border-bottom: none;
}

.details-label {
    font-size: 0.85rem;
    color: #000000 !important;
    font-weight: 600;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.details-value {
    font-size: 0.95rem;
    color: #000000 !important;
}

.related-documents {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.related-doc-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--content-bg);
    cursor: pointer;
    transition: all 0.2s;
}

.related-doc-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.related-doc-title {
    font-weight: 600;
    color: #000000 !important;
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.related-doc-meta {
    font-size: 0.8rem;
    color: #000000 !important;
}

.workflow-timeline {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.workflow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.workflow-step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--content-bg);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.workflow-step-circle.completed {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.workflow-step-label {
    font-size: 0.8rem;
    text-align: center;
    color: #000000 !important;
}

.workflow-step-date {
    font-size: 0.75rem;
    color: #000000 !important;
    margin-top: 0.25rem;
}

@media (max-width: 1536px) {
    .document-info-panel {
        width: 280px;
        flex: 0 0 280px;
    }
}

@media (max-width: 1024px) {
    .document-content {
        flex-direction: column;
    }

    .document-info-panel {
        width: 100%;
        flex: 0 0 auto;
        gap: 1rem;
    }

    .document-viewer-section {
        height: 400px;
    }
}

@media (max-width: 768px) {
    .document-header-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .document-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }

    .related-documents {
        grid-template-columns: 1fr;
    }
}

/* Edit Document Modal Styles */
.edit-doc-modal {
    display: none;
    position: fixed;
    z-index: var(--z-critical);
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease-in;
}

.edit-doc-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-doc-modal-content {
    background-color: white;
    border-radius: var(--radius);
    max-width: 1100px;
    width: 95%;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease-out;
}

.edit-doc-modal-header {
    padding: 0.75rem !important;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.edit-doc-modal-header h2 {
    margin: 0;
    font-size: 0.95rem !important;
    color: #000000 !important;
}

.edit-doc-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.edit-doc-modal-close:hover {
    color: var(--text-body);
}

.edit-doc-modal-body {
    padding: 0.75rem !important;
    overflow-y: auto !important;
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f5f5f5;
    font-size: 12.8px !important;
}

/* WebKit scrollbar styling for Chrome/Safari */
.edit-doc-modal-body::-webkit-scrollbar {
    width: 8px;
}

.edit-doc-modal-body::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.edit-doc-modal-body::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
    border: 2px solid #f5f5f5;
}

.edit-doc-modal-body::-webkit-scrollbar-thumb:hover {
    background-color: #999;
}

.edit-doc-form-group {
    margin-bottom: 0.5rem !important;
}

.edit-doc-form-group:last-child {
    margin-bottom: 0 !important;
}

/* Form displays contents so children become direct grid children */
#editDocForm {
    display: block !important;
}

/* Keep form groups at normal block display */


.edit-doc-form-label {
    display: block;
    font-size: 12.8px !important;
    font-weight: 600;
    color: var(--text-heading) !important;
    margin-bottom: 0.375rem !important;
}

.edit-doc-form-input,
.edit-doc-form-textarea,
.edit-doc-form-select {
    width: 100% !important;
    padding: 0.625rem 0.75rem !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    font-size: 12.8px !important;
    color: var(--text-body) !important;
    background: var(--card-bg) !important;
    font-family: inherit !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
    line-height: 1.5 !important;
    box-sizing: border-box !important;
}

#editDocForm input,
#editDocForm select,
#editDocForm textarea {
    width: 100% !important;
    padding: 0.625rem 0.75rem !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    font-size: 12.8px !important;
    color: var(--text-body) !important;
    background: var(--card-bg) !important;
    font-family: inherit !important;
    line-height: 1.5 !important;
    box-sizing: border-box !important;
}

.edit-doc-form-input:focus,
.edit-doc-form-textarea:focus,
.edit-doc-form-select:focus,
#editDocForm input:focus,
#editDocForm select:focus,
#editDocForm textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.15);
}

#editDocForm textarea,
.edit-doc-form-textarea {
    resize: vertical !important;
    min-height: 100px !important;
    height: auto !important;
    max-height: none !important;
}

.edit-doc-modal-footer {
    padding: 0.75rem !important;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

.edit-doc-modal-footer button {
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
}

.edit-doc-modal-footer .btn-cancel {
    background: white;
    color: #000000 !important;
}

.edit-doc-modal-footer .btn-cancel:hover {
    background: var(--content-bg);
}

.edit-doc-modal-footer .btn-save {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.edit-doc-modal-footer .btn-save:hover:not(:disabled) {
    background: #2563eb;
    border-color: #2563eb;
}

.edit-doc-modal-footer .btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.edit-doc-success-message {
    display: none;
    padding: 1rem;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #d1fae5;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.75rem;
    animation: slideIn 0.3s ease-out;
}

.edit-doc-success-message.show {
    display: block;
}

.edit-doc-error-message {
    display: none;
    padding: 1rem;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fee2e2;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.75rem;
    animation: slideIn 0.3s ease-out;
}

.edit-doc-error-message.show {
    display: block;
}

.edit-doc-loading {
    display: none;
    text-align: center;
    padding: 1rem;
    font-size: 0.75rem;
}

.edit-doc-loading.show {
    display: block;
}

.permission-radio-label {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    cursor: pointer !important;
    padding: 0.5rem !important;
    border-radius: 0.375rem !important;
    transition: all 0.2s ease !important;
    border: 1px solid transparent !important;
}

.permission-radio-label:hover {
    background: #f3f4f6 !important;
    border-color: #e5e7eb !important;
}

.permission-radio-label input[type="radio"]:checked + span {
    color: var(--primary) !important;
}
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(59, 130, 246, 0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

}

/* End of CSS Styles */

.document-action-item:last-child {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

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

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ======================================================================
   Users Management Page Styles
   ====================================================================== */

/* ---- Role badges ---- */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    white-space: nowrap;
}

.role-admin {
    background: #fef3c7;
    color: #92400e;
}

.role-unit_admin {
    background: #fecaca;
    color: #7f1d1d;
}

.role-faculty {
    background: #dbeafe;
    color: #1e40af;
}

.role-staff {
    background: #d1fae5;
    color: #065f46;
}

.role-student {
    background: #ede9fe;
    color: #5b21b6;
}

.role-department_head {
    background: #fce7f3;
    color: #831843;
}

/* ---- Status pills ---- */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-pill::before {
    content: '';
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-active::before {
    background: #22c55e;
}

.status-inactive::before {
    background: #94a3b8;
}

/* ---- Avatar initials ---- */
.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    user-select: none;
}

/* ---- Modal ---- */
.um-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: var(--z-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.um-modal-overlay[hidden] {
    display: none;
}

.um-modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 2rem);
    overflow: hidden;
}

.um-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.375rem;
    border-bottom: 1px solid var(--border);
}

.um-modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-heading);
}

.um-modal-close {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    color: var(--text-secondary);
    transition: background var(--transition);
    cursor: pointer;
}

.um-modal-close:hover {
    background: var(--content-bg);
    color: var(--text-heading);
}

.um-modal-body {
    padding: 1.375rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.um-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.375rem;
    border-top: 1px solid var(--border);
}

.um-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

@media (max-width: 640px) {
    .um-form-row {
        grid-template-columns: 1fr;
    }
}

/* Page Access Grid ---- */
.perm-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem 0.75rem;
    padding: 0.6rem 0;
}

@media (max-width: 640px) {
    .perm-grid {
        grid-template-columns: 1fr;
    }
}

.perm-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400;
    font-size: 0.875rem;
    color: var(--text-body);
    padding: 0.25rem;
}

.perm-item input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--color-primary);
}

.perm-item:hover {
    color: var(--color-primary);
}

/* Password toggle ---- */
.um-pass-toggle-wrap {
    position: relative;
}

.um-pass-toggle-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

.um-pass-toggle-btn:hover {
    color: var(--text-heading);
}

/* ---- Confirm delete overlay ---- */
.um-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.um-confirm-overlay[hidden] {
    display: none;
}

.um-confirm-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 380px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.um-confirm-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-heading);
}

.um-confirm-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.um-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ---- Permissions modal ---- */
.um-perm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

@media (max-width: 640px) {
    .um-perm-grid {
        grid-template-columns: 1fr;
    }
}

.um-perm-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background var(--transition);
}

.um-perm-item:hover {
    background: var(--content-bg);
}

.um-perm-item input {
    accent-color: var(--primary);
    flex-shrink: 0;
}

.um-perm-item span {
    font-size: 0.83rem;
    color: var(--text-heading);
    line-height: 1.3;
}

/* ======================================================================
   Settings Page Styles
====================================================================== */

/* Tabs */
.settings-tabs        { display: flex; gap: 0; border-bottom: 2px solid var(--border);
                        margin-bottom: 0; flex-wrap: wrap; }
.settings-tab         { display: inline-flex; align-items: center; gap: .4rem;
                        padding: .7rem 1.2rem; font-size: .855rem; font-weight: 500; color: var(--text-muted);
                        border: none; background: transparent; border-bottom: 2px solid transparent;
                        margin-bottom: -2px; cursor: pointer; transition: color .15s, border-color .15s; }
.settings-tab:hover   { color: var(--primary); background: rgba(21,101,192,.04); }
.settings-tab.active  { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.settings-tab svg     { flex-shrink: 0; }

/* Panel */
.settings-panel       { display: none; }
.settings-panel.active{ display: block; }

/* Section block */
.settings-section     { border-bottom: 1px solid var(--border); padding: 1.6rem 1.75rem; }
.settings-section:last-of-type { border-bottom: none; }

.section-header       { margin-bottom: 1.4rem; }
.section-title        { font-size: .93rem; font-weight: 700; color: var(--text); margin: 0 0 .2rem; }
.section-desc         { font-size: .8rem; color: var(--text-muted); margin: 0; }

/* Setting row: label column + control column */
.setting-row          { display: grid; grid-template-columns: 280px 1fr; gap: 1rem 2rem;
                        align-items: start; padding: .9rem 0; border-top: 1px solid var(--border); }
.setting-row:first-of-type { border-top: none; }
.setting-meta         { padding-top: .35rem; }
.setting-label        { font-size: .855rem; font-weight: 600; color: var(--text);
                        display: block; margin-bottom: .2rem; }
.setting-hint         { font-size: .775rem; color: var(--text-muted); line-height: 1.45; }

/* Controls */
.form-control         { display: block; width: 100%; padding: .5rem .75rem;
                        border: 1px solid var(--border); border-radius: 7px;
                        font-size: .875rem; background: var(--card-bg); color: var(--text);
                        transition: border-color .15s, box-shadow .15s; }
.form-control:focus   { outline: none; border-color: var(--primary);
                        box-shadow: 0 0 0 3px rgba(21,101,192,.14); }
.form-control.w-sm    { max-width: 180px; }
.form-control.w-md    { max-width: 320px; }
.form-control.w-lg    { max-width: 480px; }

/* Input with adornment */
.input-addon-wrap     { display: inline-flex; align-items: stretch; border: 1px solid var(--border);
                        border-radius: 7px; overflow: hidden; background: var(--card-bg);
                        transition: border-color .15s, box-shadow .15s; max-width: 180px; width: 100%; }
.input-addon-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(21,101,192,.14); }
.input-addon-wrap .form-control
                      { border: none; border-radius: 0; box-shadow: none; padding-right: .4rem; }
.input-addon-wrap .form-control:focus { border: none; box-shadow: none; }
.input-addon          { display: flex; align-items: center; padding: 0 .65rem;
                        background: var(--content-bg); color: var(--text-muted);
                        font-size: .8rem; font-weight: 500; white-space: nowrap;
                        border-left: 1px solid var(--border); }

/* Toggle switch */
.toggle-row           { display: flex; align-items: center; gap: .75rem; padding: .15rem 0; }
.toggle-switch        { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.toggle-switch input  { opacity: 0; width: 0; height: 0; }
.toggle-slider        { position: absolute; inset: 0; background: #cbd5e1; border-radius: 24px;
                        cursor: pointer; transition: background .2s; }
.toggle-slider::before{ content: ''; position: absolute; width: 18px; height: 18px;
                        left: 3px; bottom: 3px; background: #fff; border-radius: 50%;
                        transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle-switch input:checked + .toggle-slider           { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before   { transform: translateX(18px); }
.toggle-text          { font-size: .875rem; color: var(--text); cursor: pointer; user-select: none; }

/* Semester card picker */
.semester-cards       { display: flex; gap: .6rem; flex-wrap: wrap; }
.semester-card        { border: 2px solid var(--border); border-radius: 10px; padding: .6rem 1.2rem;
                        cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s, color .15s, transform .15s;
                        min-width: 100px; text-align: center; user-select: none; position: relative; }
.semester-card:hover  { border-color: var(--primary); box-shadow: 0 2px 8px rgba(21,101,192,.1); transform: translateY(-2px); }
.semester-card.selected{ border-color: var(--primary); border-width: 3px; background: var(--primary); box-shadow: 0 4px 12px rgba(21,101,192,.4); }
.semester-card.selected .sem-num { color: #fff; }
.semester-card.selected .sem-lbl { color: rgba(255,255,255,.85); }
.semester-card.selected .sem-active-badge { display: inline-block; animation: badgePulse 0.6s ease-in-out; }
.sem-num              { font-size: 1.2rem; font-weight: 700; color: var(--primary); line-height: 1.1; }
.sem-lbl              { font-size: .7rem; font-weight: 500; color: var(--text-muted); margin-top: .15rem; }
.sem-active-badge     { display: none; font-size: .75rem; font-weight: 700; letter-spacing: .06em;
                        color: rgba(255,255,255,1); background: rgba(255,255,255,.25);
                        border-radius: 999px; padding: .35rem .75rem; margin-top: .35rem; }

@keyframes badgePulse {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

/* Tag chips for file types */
.filetypes-wrap       { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.filetype-chip        { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .55rem;
                        background: rgba(21,101,192,.09); color: var(--primary);
                        border-radius: 999px; font-size: .74rem; font-weight: 600; }

/* Maintenance preview */
.maintenance-preview  { background: #fef3c7; border: 1px solid #fbbf24; border-radius: 8px;
                        padding: .65rem 1rem; font-size: .83rem; color: #92400e;
                        margin-top: .75rem; display: none; }
.maintenance-preview.show { display: block; }

/* Footer */
.settings-footer      { display: flex; align-items: center; justify-content: flex-end; gap: .75rem;
                        padding: 1rem 1.75rem; border-top: 1px solid var(--border); }
.save-status          { font-size: .83rem; color: var(--text-muted); opacity: 0;
                        transition: opacity .3s; margin-right: auto; }
.save-status.visible  { opacity: 1; }
.save-status.success  { color: #16a34a; }
.save-status.error    { color: #dc2626; }

/* Responsive: stack on narrow screens */
@media (max-width: 768px) {
    .setting-row      { grid-template-columns: 1fr; gap: .4rem; }
    .settings-section { padding: 1.2rem 1rem; }
    .settings-footer  { padding: .9rem 1rem; }
}

/* Departments tab */
.color-swatch     { display: inline-block; width: 14px; height: 14px; border-radius: 3px;
                    border: 1px solid rgba(0,0,0,.12); flex-shrink: 0; vertical-align: middle; }

/* ==========================================================================
   MODAL FORM ELEMENTS — Unified Styling for Consistency Across All Modals
   ========================================================================== */
/* All modal form elements (inputs, selects, textareas) follow these rules:
   - Consistent padding: 0.625rem 0.75rem
   - Consistent font-size: 0.95rem
   - Consistent border: 1px solid var(--border)
   - Consistent border-radius: var(--radius-sm)
   - Consistent background: var(--card-bg)
   - Consistent focus state: primary color border + shadow
   - Consistent checkbox size: 16px × 16px
*/

/* Label styling for modal form groups */
.dept-modal-body .form-group label,
.um-modal-body .form-group label,
.fm-modal-body .form-group label,
.upload-form-group label,
.edit-doc-form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 0.375rem;
    line-height: 1.3;
}

/* Input, select, textarea sizing in modals */
.dept-modal-body .form-group input:not([type="checkbox"]):not([type="radio"]),
.dept-modal-body .form-group select,
.dept-modal-body .form-group textarea,
.um-modal-body .form-group input:not([type="checkbox"]):not([type="radio"]),
.um-modal-body .form-group select,
.um-modal-body .form-group textarea,
.fm-modal-body .form-group input:not([type="checkbox"]):not([type="radio"]),
.fm-modal-body .form-group select,
.fm-modal-body .form-group textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--text-body);
    background: var(--card-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

/* Focus states for modal form elements */
.dept-modal-body .form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.dept-modal-body .form-group select:focus,
.dept-modal-body .form-group textarea:focus,
.um-modal-body .form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.um-modal-body .form-group select:focus,
.um-modal-body .form-group textarea:focus,
.fm-modal-body .form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.fm-modal-body .form-group select:focus,
.fm-modal-body .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.15);
}

.dept-abbr        { display: inline-block; padding: .15rem .5rem; border-radius: 9999px;
                    font-size: .75rem; font-weight: 700; letter-spacing: .03em; color: #fff; }
.dept-row-parent  { background: var(--content-bg); }
.dept-row-parent td { font-weight: 600; }
.dept-toggle      { display: inline-flex; align-items: center; justify-content: center;
                    width: 22px; height: 22px; border-radius: .3rem; cursor: pointer;
                    color: var(--text-secondary); transition: background .15s, transform .2s; flex-shrink: 0; }
.dept-toggle:hover { background: var(--border); }
.dept-toggle svg  { width: 13px; height: 13px; transition: transform .2s; }
.dept-toggle.open svg { transform: rotate(90deg); }
.dept-row-child.hidden { display: none; }
.dept-row-child td:nth-child(2) { padding-left: 2.25rem; }

/* Units tab */
.unit-status-dot     { display:inline-block; width:10px; height:10px; border-radius:50%; }
.unit-status-dot.on  { background:#22c55e; }
.unit-status-dot.off { background:#cbd5e1; }

/* Periods tab */
.sy-active-badge     { display:inline-flex; align-items:center; padding:.25rem .6rem; border-radius:999px;
                       font-size:.8rem; font-weight:600; background:rgba(21,101,192,.1);
                       color:var(--primary); }
.dept-modal         { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow-lg);
                      width: 100%; max-width: 480px; display: flex; flex-direction: column;
                      max-height: calc(100vh - 2rem); overflow: hidden; }
.dept-modal-header  { display: flex; align-items: center; justify-content: space-between;
                      padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.dept-modal-title   { font-size: 1rem; font-weight: 600; color: var(--text-heading); }
.dept-modal-close   { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
                      border-radius: .375rem; color: var(--text-secondary); transition: background var(--transition); }
.dept-modal-close:hover { background: var(--content-bg); }
.dept-modal-body    { padding: 1rem 1.25rem; overflow-y: auto; display: flex; flex-direction: column; gap: .625rem; }
.dept-modal-footer  { display: flex; justify-content: flex-end; gap: .5rem;
                      padding: .875rem 1.25rem; border-top: 1px solid var(--border); }
.color-row          { display: flex; align-items: center; gap: .75rem; }
.color-preview      { width: 36px; height: 36px; border-radius: .375rem; border: 1px solid var(--border); flex-shrink: 0; }
.color-row input[type="text"] { flex: 1; }

/* KB tab */
.kb-toolbar        { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.kb-search         { position: relative; flex: 1; max-width: 320px; }
.kb-search input   { width: 100%; padding: .42rem .75rem .42rem 2.1rem; border: 1px solid var(--border);
                     border-radius: .5rem; font-size: .855rem; background: var(--content-bg); color: var(--text-body);
                     outline: none; transition: border-color .15s; }
.kb-search input:focus { border-color: var(--primary); }
.kb-search-icon    { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%);
                     color: var(--text-muted); width: 15px; height: 15px; pointer-events: none; }
.kb-title          { font-weight: 600; color: var(--text-heading); margin-bottom: .2rem; }
.kb-preview        { font-size: .78rem; color: var(--text-muted); max-width: 420px;
                     white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-page-badge     { display: inline-flex; align-items: center; padding: .25rem .6rem; border-radius: 999px;
                     font-size: .8rem; font-weight: 600; background: var(--primary-light);
                     color: var(--primary); white-space: nowrap; }
.kb-page-badge.all { background: #f1f5f9; color: var(--text-secondary); }
.kb-active-dot     { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.kb-active-dot.on  { background: #22c55e; }
.kb-active-dot.off { background: #cbd5e1; }
.kb-empty          { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.kb-empty svg      { width: 48px; height: 48px; opacity: .3; margin-bottom: .75rem; }
.modal-overlay     { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: var(--z-critical);
                     display: flex; align-items: center; justify-content: center; padding: 1rem; }

/* ==========================================================================
   Records Compliance Page Styles
   ========================================================================== */

.compliance-wrapper {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
    flex: 1;
}

.compliance-main {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.compliance-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
    border-radius: 0;
    overflow-x: auto;
}

.compliance-tab {
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: all var(--transition);
    font-size: 0.9rem;
}

.compliance-tab:hover {
    color: var(--text-heading);
}

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

.compliance-tab-count {
    background: var(--content-bg);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 0.4rem;
}

.compliance-search {
    flex: 1;
    min-width: 250px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    background: var(--content-bg);
}

.compliance-search input {
    border: none;
    background: transparent;
    flex: 1;
    outline: none;
    color: var(--text-body);
    font-size: 0.9rem;
}

.compliance-search svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.compliance-actions {
    display: flex;
    gap: 0.5rem;
}

.filter-dropdown {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-body);
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 150px;
    transition: all var(--transition);
}

.filter-dropdown:hover {
    border-color: var(--primary);
    background: var(--content-bg);
}

.filter-dropdown:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.compliance-filter-container {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 1rem 1.25rem;
    margin-bottom: 0;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn-export {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--content-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-body);
    transition: all var(--transition);
}

.btn-export:hover {
    background: var(--border);
}

.btn-generate-compliance {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #059669;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    color: white;
    font-weight: 500;
    transition: all var(--transition);
}

.btn-generate-compliance:hover {
    background: #047857;
}

   ========================================================================== */

.btn-cancel {
    background: var(--border);
    color: var(--text-secondary);
}

.btn-cancel:hover {
    background: var(--border-dark);
}

.btn-submit {
    background: #059669;
    color: white;
}

.btn-submit:hover {
    background: #047857;
}

.btn-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.generate-info-message {
    background: var(--primary-light);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.compliance-table-container {
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: 0;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-icon:hover {
    background: var(--content-bg);
    color: var(--text-heading);
}

.btn-icon svg {
    width: 16px;
    height: 16px;
}

.compliance-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.sidebar-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-heading);
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-card-link {
    font-size: 0.8rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.sidebar-card-link:hover {
}

.deadline-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.deadline-item:last-child {
    border-bottom: none;
}

.deadline-title {
    font-weight: 500;
    color: var(--text-heading);
    margin-bottom: 0.2rem;
}

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

.deadline-days {
    color: var(--primary);
    font-weight: 600;
}

.overdue-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.overdue-item:last-child {
    border-bottom: none;
}

.overdue-title {
    font-weight: 500;
    color: var(--text-heading);
    margin-bottom: 0.2rem;
}

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

.overdue-days {
    color: var(--danger);
    font-weight: 600;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
    text-align: center;
}

.empty-state svg {
    width: 40px;
    height: 40px;
    opacity: 0.35;
    margin-bottom: 0.75rem;
}

.unit-date-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--content-bg, #f9fafb);
    border-radius: 4px;
    border-left: 3px solid #2563eb;
    margin-bottom: 0.75rem;
}

.unit-date-group label {
    font-weight: 500;
    color: var(--text-heading);
    font-size: 0.9rem;
    margin: 0;
}

.unit-date-group input[type="date"] {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    width: 100%;
}

.unit-date-group input[type="date"]:disabled {
    background-color: #f3f4f6;
    color: #6b7280;
    cursor: not-allowed;
}

.unit-date-group input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.unit-custom-checkbox {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.dept-unit-check,
.upload-form-group input[type="checkbox"],
.form-group input[type="checkbox"],
.edit-doc-form-group input[type="checkbox"],
.um-modal-body input[type="checkbox"],
.fm-modal-body input[type="checkbox"],
.dept-modal-body input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 2px;
    transition: border-color 0.2s, background-color 0.2s;
    flex-shrink: 0;
}

.dept-unit-check:hover,
.upload-form-group input[type="checkbox"]:hover,
.form-group input[type="checkbox"]:hover,
.edit-doc-form-group input[type="checkbox"]:hover,
.um-modal-body input[type="checkbox"]:hover,
.fm-modal-body input[type="checkbox"]:hover,
.dept-modal-body input[type="checkbox"]:hover {
    border-color: var(--primary);
}

.dept-unit-check:focus,
.upload-form-group input[type="checkbox"]:focus,
.form-group input[type="checkbox"]:focus,
.edit-doc-form-group input[type="checkbox"]:focus,
.um-modal-body input[type="checkbox"]:focus,
.fm-modal-body input[type="checkbox"]:focus,
.dept-modal-body input[type="checkbox"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.2);
}

.btn-apply-all:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

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

.pagination-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    gap: 2rem;
    background: var(--content-bg, #f9fafb);
    flex-wrap: wrap;
}

/* ==========================================================================
   REUSABLE UTILITY CLASSES - Document Pages
   ========================================================================== */

/* Flexbox Utilities */
.flex-center {
    display: flex;
    align-items: center;
}

.flex-center-gap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.flex-expand {
    flex: 1;
    overflow: hidden;
}

/* Padding & Sizing Utilities */
.content-padding {
    padding: 1.25rem;
}

.content-max-width {
    max-width: 900px;
}

.content-padding-max {
    padding: 1.25rem;
    max-width: 900px;
}

/* Table Utilities */
.table-wrapper {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table-row-header {
    border-bottom: 1px solid var(--border);
    background: var(--content-bg);
}

.table-cell-header {
    padding: 0.75rem;
    font-weight: 600;
    color: #000000;
}

.table-cell {
    padding: 0.75rem;
    color: #000000;
    border-bottom: 1px solid var(--border);
}

/* Empty State & Message Utilities */
.empty-state-message {
    color: #000000;
    text-align: center;
    padding: 3rem 1rem;
}

/* Modal & Form Utilities */
.form-group-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.form-help-text {
    color: var(--text-secondary);
    margin-top: 0.25rem;
    display: block;
    font-size: 0.85rem;
}

.modal-form-error {
    color: #ef4444;
}

/* Uploader Avatar */
.uploader-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-body);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Active pagination number styling */
#docsPaginationNumbers .pagination-btn:disabled {
    background: #0066ff !important;
    color: white !important;
    border-color: #0066ff !important;
    opacity: 1 !important;
    cursor: default;
}

.pagination-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-body);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pagination-number:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.pagination-number.active {
    background: #0066ff !important;
    color: white !important;
    border-color: #0066ff !important;
    font-weight: 600;
}

@media (max-width: 1280px) {
    .compliance-wrapper {
        grid-template-columns: 1fr;
    }

    .compliance-sidebar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .compliance-main {
        border-radius: 8px;
    }

    .compliance-filter-container {
        flex-direction: column;
        align-items: stretch;
    }

    .compliance-search {
        min-width: auto;
    }

    .compliance-actions {
        justify-content: space-between;
    }

    .compliance-sidebar {
        grid-template-columns: 1fr;
    }
}
.modal-overlay.hidden { display: none; }
.modal-box         { background: var(--card-bg); border-radius: .85rem; width: 100%; max-width: 680px;
                     max-height: calc(100vh - 2rem); display: flex; flex-direction: column;
                     box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-header      { display: flex; align-items: center; justify-content: space-between;
                     padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-title       { font-size: 1rem; font-weight: 700; color: var(--text-heading); }
.modal-close       { background: none; border: none; cursor: pointer; color: var(--text-muted);
                     padding: .25rem; border-radius: .35rem; line-height: 0; transition: color .15s; }
.modal-close:hover { color: var(--text-body); }
.modal-body        { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: .625rem; font-size: 0.8rem; }
.modal-footer      { padding: .875rem 1.25rem; border-top: 1px solid var(--border);
                     display: flex; justify-content: flex-end; gap: .6rem; }
.kb-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 0.625rem;
}

.kb-form-group:last-child {
    margin-bottom: 0;
}

.kb-form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-heading);
    line-height: 1.3;
}

.kb-form-control {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.75rem;
    font-size: 0.8rem;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text-body);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.kb-form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.15);
}

.kb-form-control:disabled,
.kb-form-control[readonly] {
    background: var(--content-bg);
    color: var(--text-muted);
    cursor: not-allowed;
}

textarea.kb-form-control {
    min-height: 110px;
    resize: vertical;
    line-height: 1.5;
}

.kb-form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Metadata tab */
.meta-tabs          { display: flex; gap: .25rem; border-bottom: 2px solid var(--border); margin-bottom: 1rem; }
.meta-tab-btn       { padding: .55rem 1.1rem; font-size: .875rem; font-weight: 500; color: var(--text-secondary);
                      background: transparent; border: none; border-bottom: 2px solid transparent;
                      margin-bottom: -2px; cursor: pointer; transition: color var(--transition), border-color var(--transition); }
.meta-tab-btn:hover { color: var(--text-heading); }
.meta-tab-btn.active{ color: var(--primary); border-bottom-color: var(--primary); }
.meta-panel         { display: none; }
.meta-panel.active  { display: block; }
.cat-name-cell      { display: flex; align-items: center; gap: .5rem; font-weight: 500; color: var(--text-heading); }
.slug-text          { font-size: .78rem; color: var(--text-muted); font-family: ui-monospace, monospace; }
.desc-text          { font-size: .83rem; color: var(--text-secondary); max-width: 280px;
                      white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-count-badge    { display: inline-flex; align-items: center; justify-content: center;
                      min-width: 26px; height: auto; padding: .25rem .6rem; border-radius: 999px;
                      font-size: .8rem; font-weight: 600; background: var(--primary-light); color: var(--primary); }
.doc-count-badge.zero { background: #f1f5f9; color: var(--text-muted); }
.tag-grid           { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.tag-chip           { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .6rem;
                      border-radius: 999px; font-size: .8rem; font-weight: 600; border: 1.5px solid transparent; }
.tag-count          { font-size: .72rem; opacity: .75; }
.card-filter-bar    { padding: .75rem 1.375rem; border-bottom: 1px solid var(--border); background: var(--content-bg); }
.search-box         { position: relative; max-width: 320px; }
.search-icon        { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%);
                      width: 15px; height: 15px; color: var(--text-muted); pointer-events: none; }
.search-input       { width: 100%; padding: .45rem .75rem .45rem 2.1rem; font-size: .875rem;
                      border: 1px solid var(--border); border-radius: .5rem; background: var(--card-bg);
                      color: var(--text-heading); outline: none;
                      transition: border-color var(--transition), box-shadow var(--transition); }
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
/* Modal overlay - base styling for all modals */
.meta-modal-overlay { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; align-items: center;
                      justify-content: center; padding: 1rem; background: rgba(0,0,0,.45);
                      visibility: hidden; opacity: 0; transition: opacity 0.2s ease, visibility 0.2s ease;
                      pointer-events: none; }
/* Show modal when not hidden */
.meta-modal-overlay:not([hidden]), .meta-modal-overlay.show { visibility: visible; opacity: 1; pointer-events: auto; }
/* Hidden state - explicitly hide */
.meta-modal-overlay[hidden] { display: none; visibility: hidden; opacity: 0; pointer-events: none; }
.meta-modal         { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow-lg);
                      width: 90%; min-width: 300px; max-width: 1100px; display: flex; flex-direction: column;
                      max-height: calc(100vh - 2rem); overflow: hidden; height: auto; }
.meta-modal-header  { display: flex; align-items: center; justify-content: space-between;
                      padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.meta-modal-title   { font-size: 1rem; font-weight: 600; color: var(--text-heading); }
.meta-modal-close   { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
                      border-radius: .375rem; color: var(--text-secondary); transition: background var(--transition); }
.meta-modal-close:hover { background: var(--content-bg); }
.meta-modal-body    { overflow-y: auto; min-height: 4rem; flex: 1 1 auto; }
.meta-modal-footer  { display: flex; justify-content: flex-end; gap: .5rem;
                      padding: .875rem 1.25rem; border-top: 1px solid var(--border); }

/* Meta-modal form elements styling */
.meta-modal-body .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin: 0 0 1rem 0;
    width: 100%;
    box-sizing: border-box;
}

.meta-modal-body .form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-heading);
    line-height: 1.3;
}

.meta-modal-body .form-group .field-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.meta-modal-body p {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.meta-modal-body .form-group input:not([type="checkbox"]):not([type="radio"]),
.meta-modal-body .form-group textarea,
.meta-modal-body .form-group select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-body);
    background: var(--card-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    min-height: 2.5rem;
    cursor: pointer;
}

.meta-modal-body .form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.meta-modal-body .form-group textarea:focus,
.meta-modal-body .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.15);
}

/* ══════════════════════════════════════════════════════════════
   Help Page Styles
   ══════════════════════════════════════════════════════════════ */
.help-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.help-card-section {
    padding: 1.5rem;
}

.help-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-heading);
}

.help-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.help-list-item {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.help-support-card {
    padding: 1.5rem;
}

.help-support-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-heading);
}

.help-support-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ══════════════════════════════════════════════════════════════
   Contact Page Styles
   ══════════════════════════════════════════════════════════════ */
.contact-error-list {
    padding-left: 1.2rem;
}

/* ══════════════════════════════════════════════════════════════
   Activity Logs Page Styles
   ══════════════════════════════════════════════════════════════ */
.logs-table-section {
    margin: 0;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.logs-filter-bar {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--content-bg);
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.logs-filter-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
}

.logs-search-wrapper {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.6rem;
    background: var(--card-bg);
    min-width: 200px;
    flex: 1;
    max-width: 280px;
}

.logs-search-icon {
    width: 13px;
    height: 13px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.logs-search-input {
    border: none;
    background: transparent;
    font-size: 0.8rem;
    width: 100%;
    min-width: 0;
    color: var(--text-body);
    outline: none;
}

.logs-filter-select {
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    background: var(--card-bg);
    color: var(--text-body);
    cursor: pointer;
    height: 30px;
}

.logs-btn-apply,
.logs-btn-clear {
    white-space: nowrap;
}

.logs-btn-clear {
    text-decoration: none;
    text-align: center;
}

.logs-btn-icon {
    width: 14px;
    height: 14px;
}

.logs-table-wrap {
    overflow-x: auto;
}

.logs-table {
    min-width: 860px;
}

.logs-table-header-datetime {
    min-width: 180px;
    text-align: left;
}

.logs-table-header-user {
    min-width: 120px;
    text-align: left;
}

.logs-table-header-action {
    width: 100px;
    text-align: center;
}

.logs-table-header-document {
    min-width: 200px;
    text-align: left;
}

.logs-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 3.5rem 1rem;
    color: var(--text-muted);
    text-align: center;
}

.logs-empty-icon {
    width: 48px;
    height: 48px;
    color: var(--border);
}

.logs-empty-title {
    font-weight: 600;
    color: var(--text-body);
    margin-bottom: 0.25rem;
}

.logs-empty-subtitle {
    font-size: 0.875rem;
}

.logs-empty-subtitle a {
    color: var(--primary);
}

.logs-date-cell {
    white-space: nowrap;
    color: var(--text-muted);
}

/* Folder Management Page: h3 and h4 text size */
#folderPageWrapper h3,
#folderPageWrapper h4 {
    font-size: 12.8px !important;
}

.logs-action-cell {
    text-align: center;
}

.logs-badge {
    color: white;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}

.logs-document-link {
    color: var(--text-link);
    text-decoration: none;
}

.logs-pagination-row {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════════
   Folders Page Styles
   ══════════════════════════════════════════════════════════════ */
/* Back link styling for folder navigation */
#folderBackLink {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

#folderBackLink svg {
    width: 18px;
    height: 18px;
}

#folderBackLink:hover {
    color: var(--primary-dark, #0d47a1);
}

/* Initially hide the title and show the back link via class toggle */
.topbar-title-wrapper.show-back-link .topbar-title,
.topbar-title-wrapper.show-back-link .topbar-subtitle {
    display: none;
}

.topbar-title-wrapper:not(.show-back-link) #folderBackLink {
    display: none;
}

/* ──── Breadcrumb ──────────────────────────────────────────────────────────── */
.folder-breadcrumb {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .875rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
    margin-bottom: 0;
    padding: .5rem 0;
    background: transparent;
    border-radius: 0;
    border: none;
}
.bc-sep { 
    color: var(--text-muted); 
    margin: 0 .1rem;
    font-size: .8rem;
    opacity: .6;
}
.bc-item {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: .45rem .7rem;
    border-radius: .45rem;
    transition: all var(--transition);
    user-select: none;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
}
.bc-item:not(.bc-current):hover { 
    background: var(--primary-light);
    color: var(--primary);
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}
.bc-item.bc-current { 
    color: var(--primary);
    font-weight: 600; 
    cursor: default; 
    pointer-events: none;
    background: var(--primary-light);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}
.bc-item.bc-current svg { 
    color: var(--primary);
    animation: slideInLeft 0.3s ease-out;
}
.bc-item svg { 
    width: 15px; 
    height: 15px; 
    display: inline; 
    flex-shrink: 0;
    opacity: .8;
}
.bc-item.bc-root svg { 
    width: 16px; 
    height: 16px;
}
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-4px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
/* Responsive breadcrumb on smaller screens */
@media (max-width: 640px) {
    .folder-breadcrumb {
        gap: .2rem;
        padding: .5rem;
        font-size: .8rem;
    }
    .bc-item {
        padding: .35rem .5rem;
        font-size: .8rem;
    }
    .bc-sep {
        font-size: .7rem;
        margin: 0 .05rem;
    }
    .bc-item svg {
        width: 13px;
        height: 13px;
    }
}

/* Department Folders card header with breadcrumb */
.dept-folders-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    height: auto;
}

/* ──── Folder Sidebar ────────────────────────────────────────────────────────── */
#folderPageWrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

#folderSidebar {
    display: none;
    border-radius: var(--radius);
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 1rem;
    min-width: 250px;
    max-width: 300px;
    height: fit-content;
    position: sticky;
    top: 1.5rem;
}

#folderSidebar[style*="display: block"] {
    display: block;
}

.folder-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.folder-sidebar-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-heading);
}

#orgTreeContainer {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    padding-top: 0.75rem;
}

.org-tree-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.25rem;
}

.org-tree-unit {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    user-select: none;
    transition: all var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-body);
}

.org-tree-unit:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: translateX(2px);
}

.org-tree-unit.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    font-weight: 600;
    border-left: 3px solid var(--primary);
    padding-left: calc(0.75rem - 3px);
}

.org-tree-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    min-width: 20px;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    padding: 0;
    transition: transform var(--transition);
}

.org-tree-toggle.expanded {
    transform: rotate(90deg);
}

.org-tree-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    min-width: 20px;
    flex-shrink: 0;
}

.org-tree-unit .org-tree-icon svg {
    width: 18px;
    height: 18px;
}

.org-tree-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.org-tree-departments {
    display: none;
    padding-left: 1.5rem;
    margin-top: 0.25rem;
}

.org-tree-departments.expanded {
    display: block;
}

.org-tree-dept {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    user-select: none;
    transition: all var(--transition);
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.15rem;
}

.org-tree-dept:hover {
    background: var(--content-bg);
    color: var(--text-body);
    transform: translateX(2px);
}

.org-tree-dept.active {
    background: rgba(59, 130, 246, 0.12);
    color: var(--primary);
    font-weight: 600;
    border-left: 3px solid var(--primary);
    padding-left: calc(0.75rem - 3px);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.org-tree-dept-icon svg {
    width: 14px;
    height: 14px;
}

.org-tree-dept-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Responsive sidebar layout */
@media (min-width: 1200px) {
    #folderPageWrapper {
        grid-template-columns: 250px 1fr;
    }
    
    #folderSidebar {
        max-height: none;
    }
}

@media (max-width: 768px) {
    #folderPageWrapper {
        grid-template-columns: 1fr;
    }
    
    #folderSidebar {
        max-width: none;
        position: relative;
        top: auto;
    }
    
    .org-tree-unit {
        font-size: 0.875rem;
    }
    
    .org-tree-dept {
        font-size: 0.8rem;
    }
}

/* ──── Toolbar ──────────────────────────────────────────────────────────────── */
.folders-toolbar {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.folders-toolbar-left  { display: flex; align-items: center; gap: .5rem; flex: 1; flex-wrap: wrap; }
.folders-toolbar-right { display: flex; align-items: center; gap: .5rem; }

/* ──── Navigation Cards (Unit / School Year / Semester levels) ──────────────── */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}
.nav-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: 1.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    cursor: pointer;
    text-align: center;
    transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
    user-select: none;
    min-height: 130px;
}
.nav-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: #bfdbfe;
}
.nav-card-icon { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; }
.nav-card-icon svg { width: 48px; height: 48px; }
.nav-card-name {
    font-size: .9rem;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.3;
    word-break: break-word;
}
.nav-card-sub { font-size: .77rem; color: var(--text-muted); }
.nav-card-badge {
    position: absolute;
    top: .6rem;
    left: .6rem;
    font-size: .68rem;
    font-weight: 700;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
}
.nav-card.unit-card::before {
    display: none;
}
.nav-card.dept-card::before {
    display: none;
}
.nav-card.records-card::before {
    display: none;
}
.nav-card.nav-card-add {
    border-style: dashed;
    border-color: var(--primary);
    background: var(--primary-light);
    opacity: .85;
}
.nav-card.nav-card-add:hover { opacity: 1; transform: translateY(-2px); box-shadow: var(--shadow-md); }
/* Three-dot more button on nav cards (mirrors folder-card-more) */
.nav-card-more {
    position: absolute;
    top: .5rem; right: .5rem;
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    border-radius: .375rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    z-index: var(--z-base);
    opacity: 0;
}

/* Document card action button */
.document-card-action-btn {
    position: absolute;
    top: .5rem; right: .5rem;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: .375rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    z-index: var(--z-topbar);
    opacity: 0;
    padding: 0;
}
.nav-card.document-card:hover .document-card-action-btn {
    opacity: 1;
    background: var(--content-bg);
    color: var(--primary);
}
.document-card-action-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}
.nav-card:hover .nav-card-more { opacity: 1; }
.nav-card-more:hover { background: var(--content-bg); color: var(--text-heading); opacity: 1; }
.nav-card.sem-1st  { --sem-color: #f59e0b; }
.nav-card.sem-2nd  { --sem-color: #f59e0b; }
.nav-card.sem-sum  { --sem-color: #f59e0b; }
.nav-card.sem-1st::before,
.nav-card.sem-2nd::before,
.nav-card.sem-sum::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--sem-color);
}

/* Subfolder and document cards at level 3 - consistent with other levels */
.nav-card.subfolder-card::before {
    display: none;
}

.nav-card.document-card::before {
    display: none;
}

/* ──── Folder Cards (department level) ──────────────────────────────────────── */
.folders-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.25rem; align-items: start; }
@media (max-width: 1024px) { .folders-layout { grid-template-columns: 1fr; } }

.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1rem;
}
.folder-list { display: flex; flex-direction: column; gap: .5rem; }

.folder-card-item {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    cursor: pointer;
    transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
    user-select: none;
}
.folder-card-item:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: #bfdbfe; }
.folder-card-item.active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(21,101,192,.15); }
.folder-card-more {
    position: absolute;
    top: .5rem; right: .5rem;
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    border-radius: .375rem;
    color: var(--text-muted);
    transition: background var(--transition), color var(--transition);
}
.folder-card-more:hover { background: var(--content-bg); color: var(--text-heading); }
.folder-card-icon-wrap { margin-bottom: .6rem; }
.folder-card-icon-wrap svg { width: 44px; height: 44px; color: #f59e0b; display: block; }
.folder-dept-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: .35rem;
    vertical-align: middle;
}
.folder-card-name {
    font-size: .875rem; font-weight: 600; color: var(--text-heading);
    line-height: 1.35; margin-bottom: .2rem; word-break: break-word;
}
.folder-card-doccount { font-size: .78rem; color: var(--text-secondary); margin-bottom: .2rem; }
.folder-card-updated  { font-size: .7rem; color: var(--text-muted); margin-bottom: .6rem; }
.folder-card-actions  {
    display: flex; align-items: center; gap: .4rem;
    margin-top: auto; padding-top: .5rem; border-top: 1px solid var(--border);
}
.folder-card-btn {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .2rem .5rem; font-size: .72rem; border-radius: .35rem;
    border: 1px solid var(--border); background: var(--card-bg); color: var(--text-secondary);
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    cursor: pointer;
}
.folder-card-btn:hover { background: var(--content-bg); color: var(--text-heading); border-color: #bfdbfe; }
.folder-card-btn svg { width: 11px; height: 11px; }

/* List view */
.folder-list-row {
    display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--card-bg); cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}
.folder-list-row:hover { background: var(--content-bg); border-color: #bfdbfe; }
.folder-list-row.active { border-color: var(--primary); background: var(--primary-light); }
.folder-list-row-icon svg { width: 28px; height: 28px; color: #f59e0b; flex-shrink: 0; }
.folder-list-row-name { font-size: .875rem; font-weight: 600; color: var(--text-heading); flex: 1; }
.folder-list-row-count { font-size: .78rem; color: var(--text-secondary); flex-shrink: 0; }
.folder-list-row-more  { color: var(--text-muted); flex-shrink: 0; }

/* ──── Context Menu ──────────────────────────────────────────────────────────── */
.folder-ctx-menu {
    position: fixed; background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
    z-index: var(--z-modal-floating); min-width: 160px; padding: .3rem 0;
}
.folder-ctx-menu[hidden] { display: none; }
.folder-ctx-item {
    display: flex; align-items: center; gap: .6rem; padding: .5rem .9rem;
    font-size: .83rem; color: var(--text-body); cursor: pointer; transition: background var(--transition);
}
.folder-ctx-item:hover { background: var(--content-bg); }
.folder-ctx-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.folder-ctx-item.danger { color: var(--danger); }
.folder-ctx-item.danger:hover { background: #fee2e2; }
.folder-ctx-divider { height: 1px; background: var(--border); margin: .3rem 0; }

/* ──── Details Panel ──────────────────────────────────────────────────────────── */
.folder-details-panel {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.folder-details-header {
    display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.folder-details-header-icon svg { width: 40px; height: 40px; color: #f59e0b; }
.folder-details-header-info { flex: 1; min-width: 0; }
.folder-details-header-name {
    font-size: .9rem; font-weight: 700; color: var(--text-heading);
    word-break: break-word; margin-bottom: .15rem;
}
.folder-details-header-sub { font-size: .78rem; color: var(--text-secondary); }
.folder-details-body { padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.folder-details-section-title {
    font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--text-muted); margin-bottom: .4rem;
}
.folder-details-desc { font-size: .83rem; color: var(--text-secondary); line-height: 1.55; }
.folder-details-meta { display: flex; flex-direction: column; gap: .5rem; }
.folder-details-meta-row { display: flex; align-items: flex-start; gap: .5rem; font-size: .8rem; }
.folder-details-meta-row .meta-label { color: var(--text-muted); min-width: 100px; flex-shrink: 0; }
.folder-details-meta-row .meta-val   { color: var(--text-body); }
.folder-details-avatar {
    width: 22px; height: 22px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .58rem; font-weight: 700; color: #fff; flex-shrink: 0;
    background: var(--primary);
}
.folder-details-actions { display: flex; flex-direction: column; gap: .35rem; }
.folder-action-btn {
    display: flex; align-items: center; gap: .6rem; padding: .5rem .75rem;
    border-radius: .4rem; font-size: .83rem; background: transparent;
    border: 1px solid var(--border); color: var(--text-body); cursor: pointer;
    transition: background var(--transition), border-color var(--transition); text-align: left;
}
.folder-action-btn:hover { background: var(--content-bg); border-color: #bfdbfe; }
.folder-action-btn svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--primary); }
.folder-action-btn.danger svg { color: var(--danger); }
.folder-action-btn.danger:hover { background: #fee2e2; border-color: #fca5a5; color: var(--danger); }

.folder-doc-list { display: flex; flex-direction: column; gap: .35rem; }
.folder-doc-item {
    display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem;
    border-radius: .35rem; font-size: .8rem; transition: background var(--transition);
}
.folder-doc-item:hover { background: var(--content-bg); }
.folder-doc-item svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.folder-doc-title { flex: 1; color: var(--text-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-doc-ext { font-size: .68rem; font-weight: 600; padding: .1rem .4rem; border-radius: 999px; flex-shrink: 0; }

.folder-details-empty { padding: 2rem 1.25rem; text-align: center; color: var(--text-muted); font-size: .83rem; }
.folder-details-empty svg { width: 40px; height: 40px; margin: 0 auto .75rem; opacity: .35; }

.folders-empty { padding: 3rem 1rem; text-align: center; color: var(--text-muted); }
.folders-empty svg { width: 48px; height: 48px; margin: 0 auto .75rem; opacity: .35; }
.folders-empty p { font-size: .875rem; }

.folder-cards-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: .875rem; gap: .5rem; flex-wrap: wrap;
}
.folder-count-label { font-size: .83rem; color: var(--text-secondary); }

.view-toggle-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: .4rem;
    border: 1px solid var(--border); background: var(--card-bg); color: var(--text-muted);
    cursor: pointer; transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.view-toggle-btn:hover, .view-toggle-btn.active {
    background: var(--primary-light); border-color: var(--primary); color: var(--primary);
}

.folders-pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: .75rem 0; margin-top: .75rem; gap: .5rem; flex-wrap: wrap;
}
.folders-pagination-info { font-size: .83rem; color: var(--text-secondary); }
.folders-pagination-btns { display: flex; align-items: center; gap: .3rem; }
.page-btn {
    min-width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: .4rem; font-size: .83rem; border: 1px solid var(--border);
    background: var(--card-bg); color: var(--text-body); cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
    padding: 0 .5rem;
}
.page-btn:hover { background: var(--content-bg); border-color: #bfdbfe; }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

.fm-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: var(--z-backdrop);
    display: flex; align-items: center; justify-content: center; padding: 1rem;
    width: 100vw !important; height: 100vh !important;
}
.fm-overlay[hidden] { display: none; }
.fm-overlay.modal-visible { display: flex !important; }
.fm-modal {
    background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    width: 100%; max-width: 480px; display: flex; flex-direction: column;
    height: auto; max-height: calc(100vh - 2rem); overflow: hidden;
}
.fm-modal-lg { max-width: 680px; }
.fm-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.1rem 1.375rem; border-bottom: 1px solid var(--border);
}
.fm-title { font-size: 1rem; font-weight: 600; color: var(--text-heading); }
.fm-close {
    width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
    border-radius: .375rem; color: var(--text-secondary); transition: background var(--transition); cursor: pointer;
}
.fm-close:hover { background: var(--content-bg); color: var(--text-heading); }
.fm-body { padding: 1.375rem; overflow-y: auto; display: flex; flex-direction: column; gap: .9rem; }
.fm-footer {
    display: flex; justify-content: flex-end; gap: .5rem;
    padding: 1rem 1.375rem; border-top: 1px solid var(--border);
}
.fm-location-banner {
    background: var(--primary-light); border: 1px solid #bfdbfe; border-radius: .4rem;
    padding: .65rem .9rem; font-size: .82rem; color: var(--primary);
    display: flex; align-items: center; gap: .5rem;
}
.fm-location-banner svg { width: 15px; height: 15px; flex-shrink: 0; }
.delete-confirm-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: var(--z-modal);
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.delete-confirm-overlay[hidden] { display: none; }
.delete-confirm-box {
    background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    width: 100%; max-width: 380px; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem;
}
.upload-tab-btn { border-radius: 0; }
.upload-tab-btn.active { border-bottom: 2px solid var(--primary); margin-bottom: -2px; color: var(--primary); }
.ctx-pill {
    display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .55rem;
    border-radius: 999px; background: var(--content-bg); border: 1px solid var(--border);
    font-size: .75rem; color: var(--text-secondary);
}
.term-select {
    padding: .3rem .65rem; border: 1px solid var(--border); border-radius: .4rem;
    font-size: .83rem; background: var(--content-bg); color: var(--text-heading);
}

/* Folder page filter bar enhancements */
#folderFilterBar {
    padding: .875rem 1.375rem !important;
}

#folderFilterBar .filter-select {
    min-width: 140px;
    flex: 0 0 auto;
}

body.dark-mode .folder-card-item,
body.dark-mode .folder-details-panel,
body.dark-mode .nav-card { background: var(--card-bg); border-color: var(--border); }
body.dark-mode .term-select { background: var(--card-bg); color: var(--text-heading); }
/* Ensure HTML hidden attribute is respected even when .btn overrides display */
[hidden] { display: none !important; }

/* ══════════════════════════════════════════════════════════════ Analytics Page Styles ══════════════════════════════════════════════════════════════ */

/* KPI cards grid */
.analytics-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Individual KPI card */
.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
    box-shadow: var(--shadow-sm);
}

.kpi-card .kpi-label {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}

.kpi-card .kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}

.kpi-card .kpi-sub {
    font-size: .8rem;
    color: var(--text-muted);
}

/* Charts grid layout */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.charts-grid .chart-card-full {
    grid-column: 1 / -1;
}

/* Chart card styling */
.chart-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.chart-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-card-title {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.chart-card-body {
    padding: 1.25rem;
    position: relative;
}

.chart-wrapper {
    position: relative;
    height: 260px;
}

.chart-wrapper-sm {
    position: relative;
    height: 220px;
}

/* Top documents table styling */
.top-docs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.top-docs-table th {
    text-align: left;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    padding: .5rem .75rem;
    border-bottom: 2px solid var(--border);
}

.top-docs-table td {
    padding: .6rem .75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: top;
}

.top-docs-table tr:last-child td {
    border-bottom: none;
}

.top-docs-table .rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-muted, #eff6ff);
    color: var(--accent, #2563eb);
    font-size: .75rem;
    font-weight: 700;
}

/* Bar chart legend */
.bar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem .75rem;
    margin-top: 1rem;
}

.bar-legend-item {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .78rem;
    color: var(--text-muted);
}

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

/* Analytics responsive */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    .charts-grid .chart-card-full {
        grid-column: 1;
    }
}

/* ══════════════════════════════════════════════════════════════ Department Portal Page Styles ══════════════════════════════════════════════════════════════ */

/* Department portal page header */
.dept-portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dept-portal-header-title {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.dept-portal-header-title svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.dept-portal-header-actions {
    display: flex;
    gap: .75rem;
    align-items: center;
}

.dept-portal-header-stats {
    font-size: .875rem;
    color: var(--text-muted);
}

.dept-portal-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    background: var(--primary);
    color: #fff;
    border-radius: .5rem;
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    transition: opacity .15s;
}

.dept-portal-upload-btn:hover {
    opacity: 0.9;
}

.dept-portal-upload-btn svg {
    width: 14px;
    height: 14px;
}

/* Stats summary bar */
.dept-stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.dept-stat-card {
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.dept-stat-label {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    margin-bottom: .25rem;
}

.dept-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.dept-stat-value.approved { color: #16a34a; }
.dept-stat-value.draft { color: #6b7280; }
.dept-stat-value.review { color: #d97706; }

/* Empty state */
.dept-empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.dept-empty-state-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    display: block;
    opacity: .4;
}

.dept-empty-state-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: .5rem;
}

.dept-empty-state-subtitle {
    font-size: .875rem;
}

/* Department grid */
.dept-portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Department card */
.dept-portal-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.dept-portal-card-banner {
    padding: 1.5rem 1.5rem 1rem;
    position: relative;
    min-height: 90px;
}

.dept-portal-card-banner-decorative {
    position: absolute;
    pointer-events: none;
}

.dept-portal-card-banner-circle1 {
    right: -20px;
    top: -20px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
}

.dept-portal-card-banner-circle2 {
    right: 20px;
    top: 40px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}

.dept-portal-card-banner-content {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: .875rem;
}

.dept-portal-card-badge {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: .75rem;
    background: rgba(255, 255, 255, .2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .05em;
    border: 2px solid rgba(255, 255, 255, .3);
}

.dept-portal-card-info {
    min-width: 0;
}

.dept-portal-card-name {
    margin: 0 0 .2rem;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dept-portal-card-parent {
    font-size: .7rem;
    color: rgba(255, 255, 255, .95);
    font-weight: 600;
    background: rgba(0, 0, 0, .2);
    border-radius: .3rem;
    padding: .1rem .4rem;
    display: inline-block;
    margin-bottom: .15rem;
}

.dept-portal-card-short {
    font-size: .75rem;
    color: rgba(255, 255, 255, .8);
    font-weight: 500;
}

/* Card body */
.dept-portal-card-body {
    padding: 1.25rem 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Doc stats grid */
.dept-doc-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
    text-align: center;
}

.dept-stat-box {
    padding: .5rem .25rem;
    background: var(--bg-subtle, #f8fafc);
    border-radius: .5rem;
}

.dept-stat-box-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.dept-stat-box-label {
    font-size: .7rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.dept-stat-box.approved { background: #f0fdf4; }
.dept-stat-box.approved .dept-stat-box-value { color: #16a34a; }
.dept-stat-box.approved .dept-stat-box-label { color: #16a34a; }

.dept-stat-box.review { background: #fffbeb; }
.dept-stat-box.review .dept-stat-box-value { color: #d97706; }
.dept-stat-box.review .dept-stat-box-label { color: #d97706; }

/* Progress bar */
.dept-progress-container {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.dept-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: .75rem;
    color: var(--text-muted);
}

.dept-progress-bar {
    height: 6px;
    background: var(--border-color, #e2e8f0);
    border-radius: 9999px;
    overflow: hidden;
}

.dept-progress-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width .4s ease;
}

/* Meta info */
.dept-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .8rem;
    color: var(--text-muted);
}

.dept-card-meta-item {
    display: flex;
    align-items: center;
    gap: .3rem;
}

.dept-card-meta-item svg {
    width: 13px;
    height: 13px;
}

/* Drop zone */
.dept-drop-zone {
    margin: 0 1.5rem 1rem;
    border: 2px dashed;
    border-radius: .75rem;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: background .2s;
    background: transparent;
    position: relative;
}

.dept-drop-zone:hover {
    background: rgba(0, 0, 0, .02);
}

.dept-drop-zone.highlight {
    background: rgba(0, 0, 0, .04);
}

.dept-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.dept-drop-icon {
    display: block;
    margin: 0 auto .4rem;
}

.dept-drop-text {
    margin: 0;
    font-size: .8rem;
    font-weight: 600;
}

.dept-drop-subtext {
    margin: .15rem 0 0;
    font-size: .7rem;
    color: var(--text-muted);
}

.dept-drop-status {
    margin-top: .5rem;
    font-size: .75rem;
    font-weight: 500;
}

/* Card footer */
.dept-portal-card-footer {
    padding: .75rem 1.5rem 1.25rem;
    display: flex;
    gap: .6rem;
    border-top: 1px solid var(--border-color, #e2e8f0);
    margin-top: auto;
}

.dept-card-action {
    flex: 1;
    text-align: center;
    padding: .5rem;
    background: var(--bg-subtle, #f8fafc);
    color: var(--text-primary);
    border-radius: .5rem;
    font-size: .825rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--border-color, #e2e8f0);
    transition: background .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
}

.dept-card-action:hover {
    background: var(--border-color, #e2e8f0);
}

.dept-card-action svg {
    width: 13px;
    height: 13px;
    display: inline;
    vertical-align: -.1em;
}

.dept-card-action-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.dept-card-action-primary:hover {
    opacity: 0.9;
}

/* Modal overlay */
.dept-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-critical);
    background: rgba(0, 0, 0, .5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dept-modal-overlay[hidden] {
    display: none;
}

.dept-modal-overlay.show {
    display: flex;
}

.dept-modal {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    width: min(500px, 95vw);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
    position: relative;
}

.dept-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.25rem;
    line-height: 1;
    padding: .25rem;
}

.dept-modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0 0 .25rem;
}

.dept-modal-subtitle {
    font-size: .85rem;
    color: var(--text-muted);
    margin: 0 0 1.5rem;
}

.dept-modal-alert {
    margin-bottom: 1rem;
}

.dept-modal-file-list {
    font-size: .8rem;
    color: var(--text-muted);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: .5rem;
    padding: .625rem .75rem;
    min-height: 2.5rem;
    background: var(--bg-subtle, #f8fafc);
    margin-bottom: 1rem;
}

.dept-modal-form-footer {
    display: flex;
    gap: .75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.dept-modal-btn {
    padding: .5rem 1.25rem;
    border-radius: .5rem;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: opacity .15s;
}

.dept-modal-btn-cancel {
    background: var(--bg-subtle, #f8fafc);
    color: var(--text-primary);
    border: 1px solid var(--border-color, #e2e8f0);
}

.dept-modal-btn-cancel:hover {
    background: var(--border-color, #e2e8f0);
}

.dept-modal-btn-submit {
    background: var(--primary);
    color: #fff;
}

.dept-modal-btn-submit:hover:not(:disabled) {
    opacity: 0.9;
}

.dept-modal-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Modal progress */
.dept-modal-progress {
    display: none;
    margin-top: 1rem;
}

.dept-modal-progress.show {
    display: block;
}

.dept-modal-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: .4rem;
}

.dept-modal-progress-bar {
    height: 8px;
    background: var(--border-color, #e2e8f0);
    border-radius: 9999px;
    overflow: hidden;
}

.dept-modal-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    border-radius: 9999px;
    transition: width .2s;
}

/* ==========================================================================
   Records Management Page Styles
   ========================================================================== */
.rrs-action-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.rrs-visible-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

/* Hide buttons beyond the 4th one */
.rrs-visible-buttons .rrs-action-btn:nth-child(n+5) {
  display: none !important;
}

.rrs-action-menu-container {
  position: relative;
  display: flex;
  align-items: center;
}

.rrs-menu-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 0.4rem !important;
  min-width: auto;
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}

.rrs-menu-btn:hover {
  color: var(--text-heading);
  background: var(--content-bg);
}

.rrs-menu-btn:active {
  background: var(--primary-light);
  color: var(--primary);
}

.rrs-menu-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.rrs-action-menu {
  position: absolute;
  right: 0;
  top: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
  z-index: var(--z-critical);
  min-width: 180px;
  margin-top: 4px;
  display: none;
  flex-direction: column;
}

.rrs-action-item {
  display: flex !important;
  align-items: center;
  padding: 0.5rem 1rem;
  gap: 0.5rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.rrs-action-item:hover {
  background: var(--content-bg);
  color: var(--text-heading);
}

.rrs-action-item.rrs-action-item--danger {
  color: var(--danger);
}

.rrs-action-item.rrs-action-item--danger:hover {
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
}

.rrs-action-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 2;
}

.rrs-action-sep {
  display: block !important;
  height: 1px;
  background: #e5e7eb;
  margin: 0.25rem 0;
}

.rrs-action-btn {
  padding: 0.4rem !important;
  min-width: auto;
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
}

.rrs-action-btn:hover {
  color: var(--text-heading);
  background: var(--content-bg);
}

.rrs-action-btn:active {
  background: var(--primary-light);
  color: var(--primary);
}

.rrs-action-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 2;
  stroke: #000000 !important;
  fill: none !important;
}

.rrs-action-btn--danger {
  color: var(--danger);
}

.rrs-action-btn--danger:hover {
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
}

@media print {
    /* Reset everything first */
    * { margin: 0; padding: 0; }
    
    /* Hide unnecessary elements */
    body > *:not(.layout-wrapper),
    .sidebar, 
    .topbar, 
    .page-actions, 
    #rrsFilterBar,
    .card-header .btn, 
    .rrs-actions,
    .import-modal-overlay,
    .adv-filter-panel {
        display: none !important;
    }
    
    /* Ensure main layout is visible */
    html, body { 
        width: 100%; 
        height: auto; 
        margin: 0;
        padding: 0;
        background: white;
    }
    .layout-wrapper { 
        display: block !important; 
        width: 100%;
        margin: 0;
        padding: 0;
    }
    .dashboard-wrapper {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .dashboard-main {
        display: block !important;
        margin: 0 !important;
        padding: 1cm !important;
    }
    .main-content  { 
        display: block !important;
        margin: 0; 
        padding: 0;
        width: 100%;
    }
    
    /* Make card visible and styled */
    .card { 
        display: block !important;
        box-shadow: none; 
        border: none; 
        page-break-inside: avoid;
        margin: 0;
        padding: 0;
        width: 100%;
    }
    
    /* Show print-only title */
    .print-only-title {
        display: block !important;
        margin-bottom: 1.5cm;
        padding-bottom: 0.75cm;
        border-bottom: 2px solid #000;
        page-break-after: avoid;
    }
    .print-only-title h1 {
        margin: 0 0 0.5cm 0;
        font-size: 18pt;
        font-weight: bold;
        color: #000;
    }
    .print-only-title p {
        margin: 0.25cm 0;
        font-size: 10pt;
        line-height: 1.4;
        color: #333;
    }
    
    /* Table wrapper and styling */
    .table-wrap {
        display: block !important;
        width: 100%;
        margin: 0;
        padding: 0;
        overflow: visible !important;
    }
    
    /* Make table fully visible */
    #rrsTable { 
        display: table !important;
        width: 100%; 
        border-collapse: collapse; 
        font-size: 9pt;
        page-break-inside: avoid;
        background: white !important;
        color: #000 !important;
    }
    #rrsTable thead {
        display: table-header-group !important;
        page-break-after: avoid;
    }
    #rrsTable tbody {
        display: table-row-group !important;
    }
    #rrsTable tr {
        display: table-row !important;
        page-break-inside: avoid;
        background: white !important;
    }
    #rrsTable th { 
        display: table-cell !important;
        background: #e0e0e0 !important; 
        color: #000 !important;
        border: 1px solid #333; 
        padding: 8px;
        text-align: left;
        font-weight: bold;
        -webkit-print-color-adjust: exact; 
        print-color-adjust: exact;
    }
    #rrsTable td { 
        display: table-cell !important;
        border: 1px solid #666; 
        padding: 8px;
        text-align: left;
        vertical-align: top;
        background: white !important;
        color: #000 !important;
    }
    
    /* Force child rows to display */
    #rrsTable .rrs-child-row { 
        display: table-row !important;
        background: #f9f9f9 !important;
    }
    #rrsTable .rrs-parent-row {
        page-break-after: avoid;
        background: #fff !important;
    }
    
    /* Indent child rows */
    #rrsTable .rrs-child-row td:first-child {
        padding-left: 2cm;
        font-style: italic;
    }
    
    /* Hide action columns completely */
    #rrsTable th:last-child,
    #rrsTable td:last-child { 
        display: none !important; 
    }
    
    /* Hide action buttons */
    #rrsTable .rrs-menu-btn,
    #rrsTable .rrs-action-menu,
    #rrsTable .rrs-toggle-btn { 
        display: none !important; 
    }
    
    /* Proper text handling */
    #rrsTable td { 
        word-wrap: break-word; 
        word-break: break-word;
        overflow: visible;
    }
    
    /* Remove link decorations */
    a::after { content: '' !important; }
}

/* Folder Card Menu - Click-Based Dropdown */
.folder-menu {
    position: relative;
    overflow: visible;
}

.folder-menu-btn {
    position: relative;
    z-index: 51;
    cursor: pointer;
    transition: background-color 0.2s ease, border-radius 0.2s ease;
}

.folder-menu-btn:hover {
    background-color: rgba(0, 0, 0, 0.06);
    border-radius: 0.375rem;
}

.folder-menu-content {
    min-width: 14rem;
    max-height: 80vh;
    overflow-y: auto;
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.5rem);
    z-index: 50;
    display: none;
    background: var(--card-bg, #ffffff);
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: fadeIn 0.15s ease-out;
}

.folder-menu-content.open {
    display: flex;
    flex-direction: column;
}

/* Menu item styling */
.folder-menu-content li {
    list-style: none;
}

.folder-menu-content li > a {
    border-radius: 0.375rem;
    padding: 0.625rem 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.folder-menu-content li > a:hover {
    background-color: rgba(0, 0, 0, 0.06);
}

/* Delete action styling */
.folder-menu-content li > a.text-error {
    color: #dc2626;
}

.folder-menu-content li > a.text-error:hover {
    background-color: rgba(220, 38, 38, 0.1);
    color: #991b1b;
}

/* Divider styling */
.folder-menu-content li > div {
    padding: 0.25rem 0;
    height: 1px;
    background-color: #e5e7eb;
    opacity: 0.7;
}

@keyframes fadeIn {
    from { 
        opacity: 0;
        transform: translateY(-4px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Tooltip Styles (DaisyUI-compatible)
   ========================================================================== */
.tooltip {
    position: relative;
    display: inline-flex;
    cursor: help;
}

.tooltip::before {
    content: attr(data-tip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-12px);
    background-color: #1f2937;
    color: #ffffff;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 12.8px !important;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0.2px;
    max-width: 380px;
    min-width: 120px;
    word-break: break-word;
    word-wrap: break-word;
    white-space: normal;
    overflow-wrap: break-word;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease 0.1s, transform 0.2s ease 0.1s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), 0 2px 4px rgba(0, 0, 0, 0.15);
    text-align: center;
    display: block;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 7px);
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #1f2937;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.2s ease 0.1s;
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
    pointer-events: auto;
}


/* ==========================================================================
   Public Documents Page
   ========================================================================== */
.pd-wrap {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
    min-height: 0;
}

/* Hero header */
.pd-hero { display: flex; align-items: flex-start; gap: 1.25rem; margin-bottom: 1.75rem; }
.pd-hero-icon { width: 56px; height: 56px; border-radius: 14px; background: #e3f2fd; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pd-hero-icon svg { width: 28px; height: 28px; stroke: #1565c0; }
.pd-hero-title { font-size: 1.6rem; font-weight: 700; color: var(--color-text-heading); line-height: 1.2; }
.pd-hero-sub { font-size: 0.9rem; color: var(--color-text-secondary); margin-top: 0.35rem; }

/* Search bar */
.pd-search-row { display: flex; gap: 0.75rem; margin-bottom: 2rem; }
.pd-search-input-wrap { flex: 1; position: relative; }
.pd-search-input-wrap svg { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; stroke: var(--color-gray-400); pointer-events: none; }
.pd-search-input { width: 100%; padding: 0.65rem 0.85rem 0.65rem 2.5rem; border: 1px solid var(--color-border); border-radius: var(--border-radius-sm); font-size: 0.9rem; background: #fff; outline: none; transition: border-color 0.15s; box-sizing: border-box; }
.pd-search-input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); }
.pd-adv-btn { display: flex; align-items: center; gap: 0.4rem; padding: 0.65rem 1rem; border: 1px solid var(--color-border); border-radius: var(--border-radius-sm); background: #fff; font-size: 0.875rem; color: var(--color-text-body); cursor: pointer; white-space: nowrap; font-weight: 500; }
.pd-adv-btn:hover { background: var(--color-gray-50); }
.pd-adv-btn svg { width: 16px; height: 16px; }

/* Advanced filters panel */
.pd-adv-panel { display: none; background: #fff; border: 1px solid var(--color-border); border-radius: var(--border-radius-sm); padding: 1rem; margin-top: -1.25rem; margin-bottom: 1.5rem; gap: 0.75rem; }
.pd-adv-panel.open { display: flex; flex-wrap: wrap; align-items: flex-end; }
.pd-adv-panel select, .pd-adv-panel input[type="date"] { padding: 0.5rem 0.65rem; border: 1px solid var(--color-border); border-radius: var(--border-radius-sm); font-size: 0.85rem; min-width: 160px; }

/* Section titles */
.pd-section-title { font-size: 1rem; font-weight: 700; color: var(--color-text-heading); margin-bottom: 1rem; }

/* Category cards */
.pd-cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem; }
@media (max-width: 900px) { .pd-cat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .pd-cat-grid { grid-template-columns: 1fr; } }
.pd-cat-card { background: #fff; border: 1px solid var(--color-border); border-radius: var(--border-radius); padding: 1rem 1.25rem; display: flex; align-items: center; gap: 1rem; transition: box-shadow 0.15s, transform 0.15s; text-decoration: none; color: inherit; }
.pd-cat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.pd-cat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pd-cat-icon svg { width: 22px; height: 22px; }
.pd-cat-name { font-weight: 600; font-size: 0.9rem; color: var(--color-text-heading); }
.pd-cat-count { font-size: 0.82rem; font-weight: 600; color: var(--color-primary); margin-top: 0.15rem; }
.pd-cat-view { font-size: 0.78rem; color: var(--color-gray-400); margin-top: 0.2rem; }
.pd-cat-view span { color: var(--color-primary); }

/* Two-column featured + recent layout */
.pd-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 2rem; }
@media (max-width: 860px) { .pd-two-col { grid-template-columns: 1fr; } }
.pd-panel { background: #fff; border: 1px solid var(--color-border); border-radius: var(--border-radius); overflow: hidden; }
.pd-panel-header { display: flex; justify-content: space-between; align-items: center; padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--color-border); }
.pd-panel-title { font-weight: 700; font-size: 0.95rem; color: var(--color-text-heading); display: flex; align-items: center; gap: 0.4rem; }
.pd-panel-title svg { width: 16px; height: 16px; }
.pd-view-all { font-size: 0.8rem; font-weight: 500; color: var(--color-primary); text-decoration: none; }
.pd-view-all:hover { text-decoration: underline; }

/* Featured document cards */
.pd-featured-list { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--color-border); }
.pd-featured-item { background: #fff; padding: 1rem; position: relative; transition: background 0.15s; }
.pd-featured-item:hover { background: var(--color-gray-50); }
.pd-featured-item a { text-decoration: none; color: inherit; display: block; }
.pd-feat-icon { width: 38px; height: 44px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; font-weight: 700; margin-bottom: 0.6rem; letter-spacing: 0.02em; }
.pd-feat-title { font-weight: 600; font-size: 0.83rem; color: var(--color-text-heading); line-height: 1.35; margin-bottom: 0.3rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pd-feat-desc { font-size: 0.78rem; color: var(--color-gray-500); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 0.5rem; }
.pd-feat-date { font-size: 0.73rem; color: var(--color-gray-400); }
.pd-feat-date-val { color: var(--color-primary); font-weight: 500; }

/* Recently added list */
.pd-recent-list { padding: 0; margin: 0; list-style: none; }
.pd-recent-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--color-border); transition: background 0.15s; }
.pd-recent-item:last-child { border-bottom: none; }
.pd-recent-item:hover { background: var(--color-gray-50); }
.pd-rec-icon { width: 36px; height: 36px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 0.6rem; font-weight: 700; flex-shrink: 0; letter-spacing: 0.02em; }
.pd-rec-info { flex: 1; min-width: 0; }
.pd-rec-title { font-weight: 600; font-size: 0.83rem; color: var(--color-text-heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-rec-sub { font-size: 0.75rem; color: var(--color-gray-500); margin-top: 0.15rem; }
.pd-rec-right { text-align: right; flex-shrink: 0; }
.pd-rec-date { font-size: 0.75rem; color: var(--color-gray-500); white-space: nowrap; }
.pd-rec-view { display: inline-flex; align-items: center; gap: 0.25rem; margin-top: 0.25rem; font-size: 0.78rem; font-weight: 600; color: var(--color-primary); text-decoration: none; }
.pd-rec-view svg { width: 13px; height: 13px; }
.pd-rec-view:hover { text-decoration: underline; }

/* All documents table */
.pd-all-section { background: #fff; border: 1px solid var(--color-border); border-radius: var(--border-radius); overflow: hidden; margin-bottom: 2rem; }
.pd-all-header { display: flex; align-items: center; gap: 0.75rem; padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--color-border); flex-wrap: wrap; }
.pd-all-title { font-weight: 700; font-size: 0.95rem; color: var(--color-text-heading); flex: 1; }
.pd-cat-filter { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.pd-cat-chip { padding: 0.25rem 0.7rem; border-radius: 9999px; border: 1px solid var(--color-border); font-size: 0.78rem; font-weight: 500; text-decoration: none; color: var(--color-text-body); background: #fff; transition: all 0.15s; white-space: nowrap; }
.pd-cat-chip:hover, .pd-cat-chip.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.pd-all-table { width: 100%; border-collapse: collapse; }
.pd-all-table th { padding: 0.65rem 1.25rem; text-align: left; font-size: 0.78rem; font-weight: 600; color: var(--color-gray-500); background: var(--color-gray-50); border-bottom: 1px solid var(--color-border); }
.pd-all-table td { padding: 0.85rem 1.25rem; font-size: 0.85rem; border-bottom: 1px solid var(--color-border-light); vertical-align: middle; }
.pd-all-table tbody tr:last-child td { border-bottom: none; }
.pd-all-table tbody tr:hover td { background: var(--color-gray-50); }
.pd-doc-name { font-weight: 600; color: var(--color-text-heading); }
.pd-doc-name a { color: inherit; text-decoration: none; }
.pd-doc-name a:hover { color: var(--color-primary); }
.pd-doc-meta { font-size: 0.75rem; color: var(--color-gray-400); margin-top: 0.15rem; }
.pd-tbl-icon { width: 32px; height: 36px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 0.58rem; font-weight: 700; flex-shrink: 0; letter-spacing: 0.02em; }
.pd-tbl-name-cell { display: flex; align-items: center; gap: 0.75rem; }
.pd-view-btn { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.3rem 0.7rem; border: 1px solid var(--color-border); border-radius: var(--border-radius-sm); font-size: 0.78rem; font-weight: 500; color: var(--color-primary); text-decoration: none; background: #fff; transition: all 0.15s; white-space: nowrap; }
.pd-view-btn svg { width: 12px; height: 12px; }
.pd-view-btn:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* Empty state */
.pd-empty { padding: 3rem 1.5rem; text-align: center; color: var(--color-gray-400); }
.pd-empty svg { width: 48px; height: 48px; margin-bottom: 0.75rem; opacity: 0.4; }
.pd-empty p { font-size: 0.9rem; }

/* Info footer banner */
.pd-info-banner { display: flex; align-items: center; gap: 1.25rem; padding: 1rem 1.5rem; background: #e3f2fd; border: 1px solid #bbdefb; border-radius: var(--border-radius); margin-bottom: 2rem; }
.pd-info-banner-icon { width: 44px; height: 44px; background: #fff; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pd-info-banner-icon svg { width: 22px; height: 22px; stroke: #1565c0; }
.pd-info-text { flex: 1; font-size: 0.875rem; color: #1565c0; }
.pd-info-text strong { display: block; font-weight: 700; margin-bottom: 0.15rem; }
.pd-learn-btn { display: flex; align-items: center; gap: 0.4rem; padding: 0.55rem 1rem; background: #fff; border: 1px solid #bbdefb; border-radius: var(--border-radius-sm); font-size: 0.82rem; font-weight: 600; color: #1565c0; text-decoration: none; white-space: nowrap; cursor: pointer; flex-shrink: 0; }
.pd-learn-btn svg { width: 14px; height: 14px; }
.pd-learn-btn:hover { background: #bbdefb; }
