:root{
  --df-bg:#F6F7FB;
  --df-panel:#FFFFFF;
  --df-border:#E5E7EB;
  --df-text:#111827;
  --df-muted:#6B7280;
  --df-primary:#8c4ec5;;
  --df-primary-hover:#5D3E8B;
  --df-focus:rgba(107,76,154,.18);
}

/* ======================================================================
   DARK THEME
   ====================================================================== */
html.df-theme-effective-dark{
  --df-bg:#0f1117;
  --df-panel:#181b23;
  --df-border:#2a2e3a;
  --df-text:#e2e8f0;
  --df-muted:#94a3b8;
  --df-primary:#a78bfa;
  --df-primary-hover:#c4b5fd;
  --df-focus:rgba(167,139,250,.25);
  color-scheme:dark;
}

html.df-theme-effective-dark body{
  background:var(--df-bg) !important;
  color:var(--df-text) !important;
}

/* Override second variable set for departments page */
html.df-theme-effective-dark :root,
html.df-theme-effective-dark{
  --df-page-bg:#0f1117;
  --df-card:#181b23;
  --df-card-soft:#1e2129;
  --df-border-light:#1e2129;
  --df-border-soft:#2a2e3a;
  --df-border-strong:#3b4252;
  --df-text-main:#e2e8f0;
  --df-text-muted:#94a3b8;
  --df-text-faint:#64748b;
  --df-primary-soft:rgba(167,139,250,.12);
  --df-primary-line:rgba(167,139,250,.25);
  --df-dark:#e2e8f0;
  --df-danger-soft:rgba(220,38,38,.12);
  --df-danger-line:rgba(220,38,38,.25);
  --df-shadow-sm:0 1px 2px rgba(0,0,0,.2);
  --df-shadow:0 4px 6px -1px rgba(0,0,0,.25),0 2px 4px -2px rgba(0,0,0,.15);
  --df-panel-soft:rgba(255,255,255,.04);
}

/* --- Tailwind overrides for dark theme --- */
html.df-theme-effective-dark .bg-white{background:#181b23 !important;}
html.df-theme-effective-dark .bg-gray-50{background:#1e2129 !important;}
html.df-theme-effective-dark .bg-gray-100{background:#1e2129 !important;}
html.df-theme-effective-dark .bg-\[\#F6F7FB\]{background:#0f1117 !important;}

html.df-theme-effective-dark .text-gray-900{color:#e2e8f0 !important;}
html.df-theme-effective-dark .text-gray-800{color:#cbd5e1 !important;}
html.df-theme-effective-dark .text-gray-700{color:#cbd5e1 !important;}
html.df-theme-effective-dark .text-gray-600{color:#94a3b8 !important;}
html.df-theme-effective-dark .text-gray-500{color:#64748b !important;}
html.df-theme-effective-dark .text-\[\#111827\]{color:#e2e8f0 !important;}
html.df-theme-effective-dark .text-\[\#6B7280\]{color:#94a3b8 !important;}
html.df-theme-effective-dark .text-\[\#6B4C9A\]{color:#a78bfa !important;}
html.df-theme-effective-dark .text-\[\#8B6BB1\]{color:#a78bfa !important;}

html.df-theme-effective-dark .border-gray-200{border-color:#2a2e3a !important;}
html.df-theme-effective-dark .border-gray-300{border-color:#2a2e3a !important;}
html.df-theme-effective-dark .border-\[\#E5E7EB\]{border-color:#2a2e3a !important;}

html.df-theme-effective-dark .bg-purple-50{background:rgba(167,139,250,.1) !important;}
html.df-theme-effective-dark .bg-purple-100{background:rgba(167,139,250,.15) !important;}
html.df-theme-effective-dark .bg-green-50{background:rgba(5,150,105,.1) !important;}
html.df-theme-effective-dark .bg-blue-50{background:rgba(59,130,246,.1) !important;}
html.df-theme-effective-dark .bg-red-50{background:rgba(220,38,38,.1) !important;}
html.df-theme-effective-dark .bg-yellow-50{background:rgba(234,179,8,.1) !important;}

html.df-theme-effective-dark .shadow-sm{box-shadow:0 1px 2px rgba(0,0,0,.25) !important;}
html.df-theme-effective-dark .shadow-md{box-shadow:0 4px 6px -1px rgba(0,0,0,.3) !important;}
html.df-theme-effective-dark .hover\:shadow-md:hover{box-shadow:0 4px 8px rgba(0,0,0,.35) !important;}
html.df-theme-effective-dark .hover\:bg-gray-50:hover{background:#252830 !important;}

html.df-theme-effective-dark .ring-1.ring-gray-200{--tw-ring-color:#2a2e3a !important;}

/* Header dark */
html.df-theme-effective-dark header,
html.df-theme-effective-dark header.border-b.border-gray-200.bg-white{
  background:rgba(15,17,23,.92) !important;
  border-bottom-color:#2a2e3a !important;
  backdrop-filter:blur(14px);
}

html.df-theme-effective-dark .df-header-title{color:#e2e8f0;}
html.df-theme-effective-dark .df-header-meta-stack{color:#64748b;}
html.df-theme-effective-dark .df-header-meta-dot{color:#3b4252;}
html.df-theme-effective-dark .df-header-meta-link{color:#a78bfa;}
html.df-theme-effective-dark .df-header-role{color:#94a3b8;}
html.df-theme-effective-dark .df-header-role strong{color:#e2e8f0;}

html.df-theme-effective-dark .df-header-nav-link,
html.df-theme-effective-dark .df-header-action-link{
  background:rgba(255,255,255,.05);
  border-color:#2a2e3a;
  color:#94a3b8;
}
html.df-theme-effective-dark .df-header-nav-link:hover,
html.df-theme-effective-dark .df-header-action-link:hover{
  background:rgba(167,139,250,.1);
  border-color:rgba(167,139,250,.3);
  color:#c4b5fd;
}
html.df-theme-effective-dark .df-header-nav-link.is-active{
  background:rgba(167,139,250,.15);
  border-color:rgba(167,139,250,.35);
  color:#c4b5fd;
}

/* Cards and panels dark */
html.df-theme-effective-dark .df-card,
html.df-theme-effective-dark .df-panel,
html.df-theme-effective-dark .df-summary-card,
html.df-theme-effective-dark .df-table-wrap{
  background:#181b23;
  border-color:#2a2e3a;
}

/* Buttons dark */
html.df-theme-effective-dark .df-btn-primary{
  background:#7c3aed;
  color:#fff;
}
html.df-theme-effective-dark .df-btn-primary:hover{
  background:#6d28d9;
}
html.df-theme-effective-dark .df-btn-light{
  background:rgba(255,255,255,.06);
  border-color:#2a2e3a;
  color:#cbd5e1;
}
html.df-theme-effective-dark .df-btn-light:hover{
  background:rgba(255,255,255,.1);
  border-color:#3b4252;
}

/* Inputs dark */
html.df-theme-effective-dark input:not([type="checkbox"]):not([type="radio"]),
html.df-theme-effective-dark select,
html.df-theme-effective-dark textarea{
  background:#1e2129 !important;
  border-color:#2a2e3a !important;
  color:#e2e8f0 !important;
}
html.df-theme-effective-dark input::placeholder,
html.df-theme-effective-dark textarea::placeholder{
  color:#64748b !important;
}
html.df-theme-effective-dark input:focus,
html.df-theme-effective-dark select:focus,
html.df-theme-effective-dark textarea:focus{
  border-color:#7c3aed !important;
  box-shadow:0 0 0 3px rgba(124,58,237,.2) !important;
}

/* Table dark */
html.df-theme-effective-dark .df-table th{
  background:#1e2129;
  color:#94a3b8;
  border-color:#2a2e3a;
}
html.df-theme-effective-dark .df-table td{
  border-color:#1e2129;
  color:#cbd5e1;
}
html.df-theme-effective-dark .df-table tr:hover td{
  background:rgba(167,139,250,.04);
}

/* Flash messages dark */
html.df-theme-effective-dark .df-flash{
  background:#1e2129;
  border-color:#2a2e3a;
  color:#e2e8f0;
}

/* Dropzone dark */
html.df-theme-effective-dark .df-dropzone{
  background:#1e2129;
  border-color:#2a2e3a;
}
html.df-theme-effective-dark .df-dropzone:hover{
  border-color:#7c3aed;
  background:rgba(124,58,237,.05);
}

/* Mobile sidebar dark */
html.df-theme-effective-dark .df-mobile-sidebar{
  background:#13161e;
  border-color:#2a2e3a;
}
html.df-theme-effective-dark .df-mobile-sidebar-head{
  border-color:#2a2e3a;
}
html.df-theme-effective-dark .df-mobile-sidebar-link{
  color:#94a3b8;
}
html.df-theme-effective-dark .df-mobile-sidebar-link:hover,
html.df-theme-effective-dark .df-mobile-sidebar-link.is-active{
  background:rgba(167,139,250,.1);
  color:#c4b5fd;
}

/* Settings menu dark */
html.df-theme-effective-dark .df-ui-menu{
  background:#181b23;
  border-color:#2a2e3a;
  box-shadow:0 8px 24px rgba(0,0,0,.4);
}
html.df-theme-effective-dark .df-ui-menu-title{color:#e2e8f0;}
html.df-theme-effective-dark .df-ui-menu-subtitle{color:#64748b;}
html.df-theme-effective-dark .df-ui-label{color:#94a3b8;}
html.df-theme-effective-dark .df-ui-choice{
  background:rgba(255,255,255,.04);
  border-color:#2a2e3a;
  color:#94a3b8;
}
html.df-theme-effective-dark .df-ui-choice:hover{
  background:rgba(167,139,250,.08);
  color:#c4b5fd;
}
html.df-theme-effective-dark .df-ui-choice.is-active{
  background:rgba(167,139,250,.15);
  border-color:rgba(167,139,250,.4);
  color:#c4b5fd;
}
html.df-theme-effective-dark .df-ui-toggle strong{color:#e2e8f0;}
html.df-theme-effective-dark .df-ui-toggle span{color:#64748b;}

/* Modal dark */
html.df-theme-effective-dark .df-modal{
  background:#181b23;
  border-color:#2a2e3a;
}
html.df-theme-effective-dark .df-modal-subtitle{color:#64748b;}

/* Dashboard specific - inline styles override */
html.df-theme-effective-dark .bg-\[\#6B4C9A\]{background:#7c3aed !important;}
html.df-theme-effective-dark .text-\[\#374151\]{color:#cbd5e1 !important;}

/* Scrollbar dark */
html.df-theme-effective-dark ::-webkit-scrollbar{width:8px;height:8px;}
html.df-theme-effective-dark ::-webkit-scrollbar-track{background:#0f1117;}
html.df-theme-effective-dark ::-webkit-scrollbar-thumb{background:#2a2e3a;border-radius:4px;}
html.df-theme-effective-dark ::-webkit-scrollbar-thumb:hover{background:#3b4252;}

/* ======================================================================
   THEME TOGGLE BUTTON
   ====================================================================== */
.df-theme-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:44px;
  height:44px;
  border-radius:50%;
  border:1px solid #E5E7EB;
  background:#FFFFFF;
  color:#475569;
  cursor:pointer;
  transition:all .25s cubic-bezier(.4,0,.2,1);
  position:relative;
  overflow:hidden;
  flex-shrink:0;
}
.df-theme-toggle:hover{
  background:#F7F2FF;
  border-color:#D9C8F0;
  color:#6B4C9A;
  transform:scale(1.05);
}
.df-theme-toggle:active{
  transform:scale(.95);
}

.df-theme-toggle-icon{
  width:20px;
  height:20px;
  transition:opacity .3s ease,transform .4s cubic-bezier(.4,0,.2,1);
  position:absolute;
}

/* Sun icon visible by default (light mode) */
.df-theme-toggle .df-theme-icon-sun{
  opacity:1;
  transform:rotate(0deg) scale(1);
}
.df-theme-toggle .df-theme-icon-moon{
  opacity:0;
  transform:rotate(90deg) scale(0.5);
}

/* Moon icon visible in dark mode */
.df-theme-toggle.is-dark .df-theme-icon-sun{
  opacity:0;
  transform:rotate(-90deg) scale(0.5);
}
.df-theme-toggle.is-dark .df-theme-icon-moon{
  opacity:1;
  transform:rotate(0deg) scale(1);
}

/* Dark theme style for the toggle itself */
html.df-theme-effective-dark .df-theme-toggle{
  background:rgba(255,255,255,.06);
  border-color:#2a2e3a;
  color:#94a3b8;
}
html.df-theme-effective-dark .df-theme-toggle:hover{
  background:rgba(167,139,250,.12);
  border-color:rgba(167,139,250,.35);
  color:#c4b5fd;
}

/* Mobile theme toggle */
.df-mobile-theme-toggle-wrap{
  margin-top:8px;
  padding-top:8px;
  border-top:1px solid #E5E7EB;
}
html.df-theme-effective-dark .df-mobile-theme-toggle-wrap{
  border-top-color:#2a2e3a;
}

.df-mobile-theme-toggle .df-theme-icon-sun{display:inline;}
.df-mobile-theme-toggle .df-theme-icon-moon{display:none;}
.df-mobile-theme-toggle.is-dark .df-theme-icon-sun{display:none;}
.df-mobile-theme-toggle.is-dark .df-theme-icon-moon{display:inline;}

/* Focus visible for toggle */
.df-theme-toggle:focus-visible{
  outline:3px solid var(--df-focus);
  outline-offset:2px;
}

/* Large font mode */
body.df-font-large .df-theme-toggle{
  width:50px;
  height:50px;
}
body.df-font-large .df-theme-toggle-icon{
  width:22px;
  height:22px;
}

/*
  Accessibility / readability modes
  - df-font-large: larger base font for older users
  - df-density-compact: denser layout for power-users
  - df-contrast: higher contrast palette
*/
html{font-size:16px;}
body{background:var(--df-bg) !important; color:var(--df-text);}

body.df-font-large{font-size:18px;}
body.df-font-large .df-btn{font-size:1rem;padding:.75rem 1.2rem;border-radius:14px;}
body.df-font-large .df-table td, body.df-font-large .df-table th{padding:1rem 1rem;}
body.df-font-large .df-dropzone-title{font-size:1rem;}
body.df-font-large .df-dropzone-sub{font-size:.9rem;}
body.df-font-large header nav a{font-size:1rem !important;}
body.df-font-large input, body.df-font-large select, body.df-font-large textarea{font-size:1rem !important;}

body.df-density-compact .df-card{border-radius:14px;}
body.df-density-compact .df-card.p-5{padding:1.05rem;}
body.df-density-compact .df-btn{padding:.45rem .9rem;border-radius:12px;}
body.df-density-compact .df-table td, body.df-density-compact .df-table th{padding:.65rem .75rem;}

body.df-contrast{
  --df-bg:#FFFFFF;
  --df-panel:#FFFFFF;
  --df-border:#CBD5E1;
  --df-text:#0B1220;
  --df-muted:#334155;
  --df-primary:#4B2F86;
  --df-primary-hover:#3E2671;
  --df-focus:rgba(75,47,134,.25);
}

/* Clear keyboard focus */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible{
  outline:3px solid var(--df-focus);
  outline-offset:2px;
}

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

.password-wrapper input {
    width: 100%;
    padding-right: 45px;
}

.toggle-password {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    border: none;
    background: none;
    cursor: pointer;
    color: #888;
}

.toggle-password:hover {
    color: #6c4ccf;
}

/* Helpful hint box */
.df-help{
  background:rgba(107,76,154,.06);
  border:1px solid rgba(107,76,154,.20);
  border-radius:16px;
  padding:12px 14px;
  color:#2B1E3B;
}
.df-help-title{font-weight:700;}
.df-help ul{margin-top:6px;margin-left:1.2rem;list-style:disc;}
.df-help li{margin:.2rem 0;}

/* Make table rows easier to click */
.df-row-click{cursor:pointer;}
.df-row-click:hover{background:rgba(107,76,154,.04);}

/* Base */
html,body{color:var(--df-text);}

/* Inputs */
input,select,textarea{outline:none;}
input:focus,select:focus,textarea:focus{
  border-color:var(--df-primary) !important;
  box-shadow:0 0 0 3px var(--df-focus);
}

/* Reusable surfaces */
.df-card{
  background:var(--df-panel);
  border:1px solid var(--df-border);
  border-radius:18px;
  box-shadow:0 1px 2px rgba(16,24,40,.06);
}
.df-card:hover{box-shadow:0 6px 18px rgba(16,24,40,.08);}

.df-table-wrap{
  background:var(--df-panel);
  border:1px solid var(--df-border);
  border-radius:18px;
  overflow:auto;
}
.df-table{width:100%; border-collapse:separate; border-spacing:0;}
.df-table thead th{
  background:#F8FAFC;
  color:#475569;
  font-weight:600;
  letter-spacing:.01em;
  white-space:nowrap;
}
.df-table td,.df-table th{padding:.85rem 1rem;}
.df-table tbody tr td{border-top:1px solid #F1F5F9;}
.df-table tbody tr:hover{background:rgba(107,76,154,.04);}

/* Buttons */
.df-btn{display:inline-flex;align-items:center;justify-content:center;gap:.5rem;border-radius:12px;padding:.55rem 1rem;font-size:.875rem;font-weight:600;line-height:1.2;}
.df-btn-primary{background:var(--df-primary);color:#fff;}
.df-btn-primary:hover{background:var(--df-primary-hover);}
.df-btn-dark{background:#111827;color:#fff;}
.df-btn-dark:hover{background:#0B1220;}
.df-btn-light{background:#F3F4F6;color:#374151;}
.df-btn-light:hover{background:#E5E7EB;}
.df-link{color:var(--df-primary);}
.df-link:hover{text-decoration:underline;}

/* File dropzone */
.df-dropzone{
  border:1px dashed #CBD5E1;
  border-radius:18px;
  background:linear-gradient(180deg,#FFFFFF 0%, #FBFBFE 100%);
  padding:16px;
  cursor:pointer;
}
.df-dropzone:hover{border-color:var(--df-primary);}
.df-dropzone.dragover{
  border-color:var(--df-primary);
  box-shadow:0 0 0 3px var(--df-focus);
}
.df-dropzone-title{font-weight:600;color:#111827;}
.df-dropzone-sub{color:var(--df-muted);font-size:.8rem;margin-top:4px;}
.df-filelist{margin-top:10px;display:flex;flex-direction:column;gap:6px;}
.df-fileitem{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 10px;border:1px solid #EEF2F7;border-radius:12px;background:#FFFFFF;}
.df-fileitem-name{min-width:0;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:.875rem;color:#111827;}
.df-fileitem-meta{font-size:.75rem;color:var(--df-muted);white-space:nowrap;}

/* Lightweight "Office" editor (MVP) */
.df-editor-toolbar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:10px;border:1px solid #E5E7EB;border-radius:14px;background:#F9FAFB;}
.df-etsep{width:1px;height:22px;background:#E5E7EB;margin:0 4px;}
.df-etbtn{border:1px solid #E5E7EB;background:#fff;color:#111827;border-radius:10px;padding:6px 10px;font-size:13px;line-height:1;cursor:pointer;}
.df-etbtn:hover{background:#F3F4F6;}
.df-etbtn:active{transform:translateY(1px);}
.df-etbtn-primary{background:#8B6BB1;border-color:#8B6BB1;color:#fff;}
.df-etbtn-primary:hover{background:#6B4C9A;border-color:#6B4C9A;}
.df-editor{margin-top:12px;min-height:65vh;padding:18px;border:1px solid #E5E7EB;border-radius:18px;background:#fff;outline:none;overflow:auto;}
.df-editor:focus{box-shadow:0 0 0 3px rgba(139,107,177,.18);border-color:rgba(139,107,177,.65);}

/* Document workspace / preview */
.df-doc-tabs{display:flex;align-items:center;gap:10px;flex-wrap:wrap;background:#fff;}
.df-doc-tab{
  border:1px solid #E5E7EB;
  background:#fff;
  color:#4B5563;
  border-radius:999px;
  padding:8px 14px;
  font-size:.875rem;
  font-weight:600;
  line-height:1;
}
.df-doc-tab:hover{background:#F9FAFB;color:#111827;}
.df-doc-tab.is-active{background:rgba(107,76,154,.10);border-color:rgba(107,76,154,.28);color:#5D3E8B;}
.df-doc-panel.hidden{display:none;}
.df-doc-preview-shell{min-height:300px;}
.df-doc-rich-preview{min-height:65vh;max-height:72vh;overflow:auto;}
.df-doc-rich-preview table{border-collapse:collapse;width:100%;}
.df-doc-rich-preview table td,.df-doc-rich-preview table th{border:1px solid #E5E7EB;padding:8px 10px;}
.df-doc-sheet-tabs{display:flex;gap:8px;flex-wrap:wrap;}
.df-doc-sheet-tab{
  border:1px solid #E5E7EB;
  background:#fff;
  color:#475569;
  border-radius:12px;
  padding:8px 12px;
  font-size:.82rem;
  font-weight:600;
}
.df-doc-sheet-tab:hover{background:#F8FAFC;}
.df-doc-sheet-tab.is-active{background:#EEF2FF;border-color:#C4B5FD;color:#5B21B6;}
.df-doc-sheet-wrap table{border-collapse:collapse;min-width:100%;}
.df-doc-sheet-wrap table td,.df-doc-sheet-wrap table th{border:1px solid #E5E7EB;padding:8px 10px;font-size:.875rem;vertical-align:top;}
.df-doc-sheet-wrap table tr:nth-child(even){background:#FAFAFC;}
.df-doc-info-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;}
.df-doc-info-item{border:1px solid #E5E7EB;background:#fff;border-radius:14px;padding:14px;}
.df-doc-info-label{font-size:.78rem;color:#6B7280;margin-bottom:6px;}
.df-doc-info-value{font-size:.95rem;color:#111827;font-weight:600;word-break:break-word;}
.df-editor-toolbar-sticky{position:sticky;top:0;z-index:5;}
.df-editor-select{
  border:1px solid #D1D5DB;
  background:#fff;
  color:#111827;
  border-radius:10px;
  padding:6px 10px;
  font-size:13px;
  line-height:1;
  min-height:36px;
}
.df-editor-color-wrap{
  display:inline-flex;
  align-items:center;
  gap:6px;
  border:1px solid #E5E7EB;
  background:#fff;
  border-radius:10px;
  padding:4px 8px;
  min-height:36px;
  color:#111827;
  font-size:13px;
}
.df-editor-color-wrap input[type="color"]{
  width:24px;
  height:24px;
  padding:0;
  border:none;
  background:transparent;
  cursor:pointer;
}
/* ===== Admin users actions ===== */

.df-actions-col{
  width:1%;
  white-space:nowrap;
}

.df-actions-cell{
  width:1%;
  white-space:nowrap;
  vertical-align:top;
}

.df-user-actions{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:8px;
  width:172px;
  min-width:172px;
  margin-left:auto;
}

.df-user-actions form{
  display:block;
  width:100%;
  margin:0;
}

.df-user-actions .df-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:100%;
  min-height:38px;
  padding:.62rem .95rem;
  border:1px solid transparent;
  border-radius:12px;
  box-sizing:border-box;
  font-size:.8125rem;
  font-weight:600;
  line-height:1.15;
  text-align:center;
  text-decoration:none;
  appearance:none;
  -webkit-appearance:none;
  cursor:pointer;
  transition:background-color .16s ease,border-color .16s ease,color .16s ease,box-shadow .16s ease;
}

/* button variants for users table */
.df-btn-info{
  background:#EFF6FF;
  border-color:#BFDBFE;
  color:#1D4ED8;
}
.df-btn-info:hover{
  background:#DBEAFE;
  border-color:#93C5FD;
  color:#1E40AF;
}

.df-btn-success{
  background:#ECFDF5;
  border-color:#A7F3D0;
  color:#047857;
}
.df-btn-success:hover{
  background:#D1FAE5;
  border-color:#6EE7B7;
  color:#065F46;
}

.df-btn-danger-soft{
  background:#FEF2F2;
  border-color:#FECACA;
  color:#B91C1C;
}
.df-btn-danger-soft:hover{
  background:#FEE2E2;
  border-color:#FCA5A5;
  color:#991B1B;
}

.df-btn-neutral{
  background:#FFFFFF;
  border-color:#D1D5DB;
  color:#374151;
}
.df-btn-neutral:hover{
  background:#F9FAFB;
  border-color:#9CA3AF;
  color:#111827;
}

.df-btn-danger{
  background:#FFFFFF;
  border-color:#FCA5A5;
  color:#DC2626;
}
.df-btn-danger:hover{
  background:#FEF2F2;
  border-color:#F87171;
  color:#B91C1C;
}

.df-btn-disabled,
.df-btn:disabled{
  opacity:.55;
  cursor:not-allowed;
  pointer-events:none;
  box-shadow:none;
}

/* compact mode */
body.df-density-compact .df-user-actions{
  width:156px;
  min-width:156px;
  gap:6px;
}
body.df-density-compact .df-user-actions .df-btn{
  min-height:34px;
  padding:.5rem .8rem;
  font-size:.76rem;
}

/* large font mode */
body.df-font-large .df-user-actions{
  width:190px;
  min-width:190px;
}
body.df-font-large .df-user-actions .df-btn{
  min-height:44px;
  padding:.78rem 1rem;
  font-size:.95rem;
}

/* responsive */
@media (max-width: 1180px){
  .df-user-actions{
    width:150px;
    min-width:150px;
    gap:6px;
  }

  .df-user-actions .df-btn{
    min-height:36px;
    padding:.55rem .75rem;
    font-size:.78rem;
  }
}
@media (max-width: 1024px){
  .df-doc-info-grid{grid-template-columns:1fr;}
  .df-editor-toolbar-sticky{position:static;}
}


/* ===== Header icon navigation ===== */
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;}
.df-header-icon-svg{width:22px;height:22px;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;fill:none;display:block;}
.df-header-icon-link,.df-header-nav-icon{position:relative;display:inline-flex;align-items:center;justify-content:center;width:46px;height:46px;border-radius:14px;color:#6B7280;background:#FFFFFF;border:1px solid transparent;transition:background-color .18s ease,border-color .18s ease,color .18s ease,transform .18s ease,box-shadow .18s ease;}
.df-header-icon-link:hover,.df-header-nav-icon:hover{color:#6B4C9A;background:#F7F2FF;border-color:#D9C8F0;transform:translateY(-1px);}
.df-header-nav-icon.is-active{color:#6B4C9A;background:#F1EAFE;border-color:#CDB7EB;box-shadow:0 1px 6px rgba(107,76,154,.10);}
.df-header-icon-link[data-tooltip]::after,.df-header-nav-icon[data-tooltip]::after{content:attr(data-tooltip);position:absolute;left:50%;top:calc(100% + 10px);transform:translateX(-50%) translateY(-4px);background:#111827;color:#FFFFFF;font-size:12px;line-height:1;padding:8px 10px;border-radius:10px;white-space:nowrap;opacity:0;pointer-events:none;box-shadow:0 8px 24px rgba(17,24,39,.18);transition:opacity .16s ease, transform .16s ease;z-index:30;}
.df-header-icon-link[data-tooltip]::before,.df-header-nav-icon[data-tooltip]::before{content:"";position:absolute;left:50%;top:calc(100% + 4px);transform:translateX(-50%) translateY(-4px);border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #111827;opacity:0;pointer-events:none;transition:opacity .16s ease, transform .16s ease;z-index:30;}
.df-header-icon-link:hover::after,.df-header-icon-link:hover::before,.df-header-icon-link:focus-visible::after,.df-header-icon-link:focus-visible::before,.df-header-nav-icon:hover::after,.df-header-nav-icon:hover::before,.df-header-nav-icon:focus-visible::after,.df-header-nav-icon:focus-visible::before{opacity:1;transform:translateX(-50%) translateY(0);}
.df-mobile-menu-toggle{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;border-radius:14px;border:1px solid #E5E7EB;background:#FFFFFF;color:#6B7280;transition:background-color .18s ease,border-color .18s ease,color .18s ease;}
.df-mobile-menu-toggle:hover{color:#6B4C9A;background:#F7F2FF;border-color:#D9C8F0;}
.df-mobile-sidebar-overlay{position:fixed;inset:0;background:rgba(15,23,42,.36);opacity:0;pointer-events:none;transition:opacity .2s ease;z-index:70;}
.df-mobile-sidebar{position:fixed;top:0;left:0;width:min(320px, 86vw);height:100vh;background:#FFFFFF;border-right:1px solid #E5E7EB;box-shadow:0 18px 40px rgba(15,23,42,.18);transform:translateX(-100%);transition:transform .22s ease;z-index:80;display:flex;flex-direction:column;}
.df-mobile-sidebar-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:20px 18px 16px;border-bottom:1px solid #F1F5F9;}
.df-mobile-sidebar-close{width:40px;height:40px;border-radius:12px;border:1px solid #E5E7EB;background:#FFFFFF;color:#6B7280;font-size:20px;line-height:1;}
.df-mobile-sidebar-nav{padding:14px;overflow-y:auto;display:flex;flex-direction:column;gap:8px;}
.df-mobile-sidebar-link{display:flex;align-items:center;gap:14px;min-height:52px;padding:0 14px;border-radius:14px;color:#374151;text-decoration:none;border:1px solid transparent;background:#FFFFFF;transition:background-color .18s ease,border-color .18s ease,color .18s ease;}
.df-mobile-sidebar-link:hover{background:#F9FAFB;color:#111827;}
.df-mobile-sidebar-link.is-active{background:#F1EAFE;border-color:#CDB7EB;color:#5D3E8B;}
.df-mobile-sidebar-icon{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;flex:0 0 22px;}
.df-mobile-sidebar-label{font-size:15px;font-weight:600;line-height:1.2;}
.df-mobile-sidebar-logout{margin-top:8px;border-top:1px solid #F1F5F9;padding-top:14px;}
body.df-mobile-sidebar-open{overflow:hidden;}
body.df-mobile-sidebar-open .df-mobile-sidebar-overlay{opacity:1;pointer-events:auto;}
body.df-mobile-sidebar-open .df-mobile-sidebar{transform:translateX(0);}
@media (min-width: 1024px){.df-mobile-menu-toggle,.df-mobile-sidebar,.df-mobile-sidebar-overlay{display:none !important;}}
.df-brand-logo{width:48px;height:48px;display:inline-flex;align-items:center;justify-content:center;flex:0 0 48px;}
.df-brand-logo svg{width:48px;height:48px;display:block;}
.df-brand-logo-mobile{width:42px;height:42px;flex-basis:42px;}
.df-brand-logo-mobile svg{width:42px;height:42px;}
body.df-font-large .df-header-icon-link,body.df-font-large .df-header-nav-icon{width:52px;height:52px;border-radius:16px;}
body.df-font-large .df-header-icon-svg{width:24px;height:24px;}
@media (max-width: 768px){.df-header-icon-svg{width:21px;height:21px;}.df-brand-logo{width:44px;height:44px;flex-basis:44px;}.df-brand-logo svg{width:44px;height:44px;}}

/* ===== Departments page scroll hotfix ===== */
.df-departments-page{max-width:1700px;}
.df-top-scroll{overflow-x:auto;overflow-y:hidden;height:16px;margin-bottom:8px;background:#fff;border:1px solid #E5E7EB;border-bottom:none;border-radius:16px 16px 0 0;}
.df-top-scroll-inner{height:1px;}
.df-bottom-scroll{overflow-x:auto;overflow-y:visible;border:1px solid #E5E7EB;border-radius:0 0 18px 18px;background:#fff;}
.df-bottom-scroll table{min-width:1500px;}
.df-top-scroll::-webkit-scrollbar,.df-bottom-scroll::-webkit-scrollbar{height:12px;}
.df-top-scroll::-webkit-scrollbar-thumb,.df-bottom-scroll::-webkit-scrollbar-thumb{background:#C4B5FD;border-radius:999px;border:2px solid #FFFFFF;}
.df-top-scroll::-webkit-scrollbar-track,.df-bottom-scroll::-webkit-scrollbar-track{background:#F3F4F6;border-radius:999px;}
.df-dept-actions{display:flex;flex-direction:column;align-items:flex-end;gap:8px;min-width:140px;}
.df-dept-name-cell{min-width:260px;}
.df-dept-code-cell{min-width:170px;}
.df-dept-share-cell{min-width:150px;}
.df-dept-actions-cell{min-width:170px;white-space:nowrap;}
.df-dept-progress{width:110px;height:8px;border-radius:999px;background:#F3F4F6;overflow:hidden;margin-top:6px;}
.df-dept-progress > span{display:block;height:100%;background:var(--df-primary);border-radius:999px;}
@media (max-width: 1280px){.df-departments-grid{grid-template-columns:1fr !important;}}

.df-support-icon{
display:flex;
align-items:center;
}

.df-support-icon-svg{
width:14px;
height:14px;
stroke:#6B4C9A;
stroke-width:1.8;
fill:none;
}

/* ==========================================================================
   VARIABLES (Strict Palette & Design Tokens)
   ========================================================================== */
:root {
  /* Backgrounds */
  --df-page-bg: #f8fafc;
  --df-card: #ffffff;
  --df-card-soft: #f8fafc;
  
  /* Borders (Softened to reduce grid noise) */
  --df-border-light: #f1f5f9;
  --df-border: #e2e8f0;
  --df-border-strong: #cbd5e1;
  
  /* Typography (Clear hierarchy) */
  --df-text-main: #0f172a;
  --df-text-muted: #64748b;
  --df-text-faint: #94a3b8;
  
  /* Primary Brand Colors (Refined, professional) */
  --df-primary: #491678;
  --df-primary-hover: #491c74;
  --df-primary-soft: #eef2ff;
  --df-primary-line: #c7d2fe;
  
  /* Semantic Colors */
  --df-dark: #1e293b;
  --df-success: #059669;
  --df-danger: #dc2626;
  --df-danger-soft: #fef2f2;
  --df-danger-line: #fecaca;
  
  /* Geometry & Physics */
  --df-radius-xl: 16px;
  --df-radius-lg: 12px;
  --df-radius-md: 8px;
  --df-radius-sm: 6px;
  
  /* Shadows (Crisp, layered, less muddy) */
  --df-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --df-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.03);
}

/* ==========================================================================
   BASE & LAYOUT
   ========================================================================== */
.df-departments-page,
.df-departments-page * {
  box-sizing: border-box;
}

.df-departments-page {
  max-width: 1680px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  color: var(--df-text-main);
  background-color: var(--df-page-bg);
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

.df-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}

.df-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 24px;
}

.df-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ==========================================================================
   HEADER & TYPOGRAPHY
   ========================================================================== */
.df-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.df-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin-left: -12px; /* Visual alignment */
  border-radius: var(--df-radius-md);
  color: var(--df-text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.df-back-link:hover {
  background: var(--df-border-light);
  color: var(--df-text-main);
}

.df-page-title {
  margin: 12px 0 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.df-page-subtitle {
  max-width: 800px;
  margin: 8px 0 0;
  color: var(--df-text-muted);
  font-size: 15px;
}

/* ==========================================================================
   COMPONENTS (Cards, Buttons, Alerts)
   ========================================================================== */
.df-summary-card,
.df-panel {
  background: var(--df-card);
  border: 1px solid var(--df-border);
  border-radius: var(--df-radius-xl);
  box-shadow: var(--df-shadow-sm);
}

.df-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.df-summary-card {
  padding: 20px;
}

.df-summary-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--df-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.df-summary-value {
  margin-top: 8px;
  font-size: 32px;
  font-weight: 700;
  color: var(--df-primary);
  line-height: 1;
}

.df-summary-meta {
  margin-top: 8px;
  font-size: 13px;
  color: var(--df-text-faint);
}

.df-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--df-radius-md);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.df-btn-primary {
  background: var(--df-primary);
  color: #fff;
  box-shadow: var(--df-shadow-sm);
}

.df-btn-primary:hover {
  background: var(--df-primary-hover);
  transform: translateY(-1px);
}

.df-btn-light {
  background: var(--df-card);
  color: var(--df-text-main);
  border-color: var(--df-border);
}

.df-btn-light:hover {
  background: var(--df-card-soft);
  border-color: var(--df-border-strong);
}

.df-alert {
  margin-top: 20px;
  padding: 12px 16px;
  border-radius: var(--df-radius-lg);
  font-size: 14px;
  line-height: 1.5;
}

.df-alert-danger {
  background: var(--df-danger-soft);
  border: 1px solid var(--df-danger-line);
  color: var(--df-danger);
}

/* ==========================================================================
   PANELS & TOOLBARS
   ========================================================================== */
.df-panel {
  padding: 20px;
}

.df-panel-head,
.df-toolbar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.df-panel-head h2,
.df-toolbar-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.df-toolbar-head p,
.df-panel-note {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--df-text-muted);
}

.df-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  gap: 16px;
  align-items: end;
  margin-top: 16px;
}

.df-filter > span,
.df-field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--df-text-muted);
}

.df-field input,
.df-field select,
.df-row-input,
.df-row-select,
.df-filter input,
.df-filter select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--df-border);
  border-radius: var(--df-radius-md);
  background: var(--df-card);
  color: var(--df-text-main);
  padding: 0 12px;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.df-field input:focus,
.df-field select:focus,
.df-filter input:focus,
.df-filter select:focus {
  outline: none;
  border-color: var(--df-primary);
  box-shadow: 0 0 0 3px var(--df-primary-soft);
}

/* ==========================================================================
   TREE VIEW (Optimized for low noise)
   ========================================================================== */
.df-tree-panel {
  max-height: calc(100vh - 240px);
  overflow-y: auto;
  padding-right: 8px;
}

.df-tree-list,
.df-tree-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.df-tree-list ul {
  margin: 4px 0 0 12px;
  padding: 0 0 0 12px;
  /* Replaced dashed line with a clean, solid, low-contrast line */
  border-left: 1px solid var(--df-border); 
}

.df-tree-item + .df-tree-item {
  margin-top: 4px;
}

.df-tree-node {
  width: 100%;
  display: block;
  text-align: left;
  padding: 8px 12px;
  border-radius: var(--df-radius-md);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.df-tree-node:hover {
  background: var(--df-card-soft);
}

.df-tree-node-main {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--df-text-main);
}

.df-tree-node-meta {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--df-text-muted);
}

/* ==========================================================================
   DATA TABLE & STRUCTURE (Optimized for readability)
   ========================================================================== */
.df-registry-panel {
  padding: 0;
  overflow: hidden;
}

.df-table-wrap {
  overflow-x: auto;
}

.df-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1000px;
}

.df-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--df-card-soft);
  color: var(--df-text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--df-border);
  padding: 12px 16px;
  text-align: left;
}

.df-table td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--df-border-light);
}

.df-table tbody tr {
  transition: background-color 0.1s ease;
}

.df-table tbody tr:hover {
  background: var(--df-page-bg);
}

/* Softer highlight states */
.df-table tbody tr.is-context { background: #f8fafc; }
.df-table tbody tr.is-match { background: var(--df-primary-soft); }
.df-table tbody tr.is-pulse { animation: dfPulse 1.5s cubic-bezier(0.4, 0, 0.2, 1); }

@keyframes dfPulse {
  0% { background: var(--df-primary-soft); }
  100% { background: transparent; }
}

/* Root Row (Cleaned up) */
.df-root-row td {
  background: var(--df-card-soft);
  border-bottom-color: var(--df-border);
  border-top: 1px solid var(--df-border);
}

.df-root-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--df-text-muted);
}

.df-root-summary strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--df-text-main);
}

/* Structure Cells (Roots, Branches, Leaves) */
.df-structure-cell {
  min-width: 400px;
}

.df-structure {
  display: flex;
  align-items: center; /* Changed from flex-start for better vertical centering */
  gap: 8px;
}

.df-indent {
  width: calc(var(--depth, 0) * 20px); /* Increased slightly for clearer hierarchy */
  flex: 0 0 auto;
}

/* Toggle Button (Minimized visual weight) */
.df-row-toggle {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--df-text-faint);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s ease;
}

.df-row-toggle:hover {
  background: var(--df-border-light);
  color: var(--df-text-main);
}

.df-row-dot {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.df-row-dot::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--df-border-strong);
}

.df-structure-main {
  min-width: 0;
  flex: 1 1 auto;
  padding-top: 2px;
}

.df-row-name-input {
  font-weight: 600;
  color: var(--df-text-main);
}

.df-row-path {
  margin-top: 4px;
  color: var(--df-text-muted);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* People Pills (Stripped of heavy backgrounds) */
.df-people-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.df-person-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid var(--df-border);
  background: var(--df-card);
  color: var(--df-text-muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

/* Utilities */
.df-cell-code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  color: var(--df-text-muted);
}

.ta-right {
  text-align: right !important;
}

/* ==========================================================================
   MEDIA QUERIES
   ========================================================================== */
@media (max-width: 1200px) {
  .df-layout {
    grid-template-columns: 1fr;
  }
  .df-sidebar {
    position: static;
  }
  .df-tree-panel {
    max-height: 360px;
  }
}

@media (max-width: 768px) {
  .df-departments-page {
    padding: 20px 16px;
  }
  .df-summary {
    grid-template-columns: 1fr;
  }
  .df-toolbar {
    grid-template-columns: 1fr;
  }
}
/* ===== Header navigation refresh ===== */
.df-header-meta-stack{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-top:4px;
  font-size:.84rem;
  color:#6B7280;
}
.df-header-meta-item{white-space:nowrap;}
.df-header-meta-dot{color:#CBD5E1;}
.df-header-meta-link{
  color:#6B4C9A;
  text-decoration:none;
  font-weight:600;
}
.df-header-meta-link:hover{text-decoration:underline;}
.df-header-nav-row{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.df-header-nav-link,
.df-header-action-link{
  display:inline-flex;
  align-items:center;
  gap:10px;
  min-height:46px;
  padding:0 14px;
  border-radius:14px;
  border:1px solid #E5E7EB;
  background:#FFFFFF;
  color:#475569;
  text-decoration:none;
  transition:background-color .18s ease,border-color .18s ease,color .18s ease,transform .18s ease,box-shadow .18s ease;
}
.df-header-nav-link:hover,
.df-header-action-link:hover{
  color:#6B4C9A;
  background:#F7F2FF;
  border-color:#D9C8F0;
  transform:translateY(-1px);
}
.df-header-nav-link.is-active{
  color:#6B4C9A;
  background:#F1EAFE;
  border-color:#CDB7EB;
  box-shadow:0 1px 6px rgba(107,76,154,.10);
}
.df-header-nav-link-icon,
.df-header-action-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:22px;
  height:22px;
  flex:0 0 22px;
}
.df-header-nav-link-label,
.df-header-action-label{
  font-size:.9rem;
  font-weight:600;
  line-height:1.1;
  white-space:nowrap;
}
body.df-font-large .df-header-nav-link,
body.df-font-large .df-header-action-link{
  min-height:52px;
  padding:0 16px;
}
body.df-font-large .df-header-nav-link-label,
body.df-font-large .df-header-action-label{
  font-size:1rem;
}
@media (max-width: 1279px){
  .df-header-meta-stack{gap:8px;font-size:.8rem;}
}

/* ===== Departments UX polish ===== */
.df-head-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.df-guide-strip{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
  margin-top:16px;
}
.df-guide-step{
  padding:12px 14px;
  border:1px solid #E5E7EB;
  border-radius:14px;
  background:#FFFFFF;
  color:#475569;
  font-size:.85rem;
  line-height:1.45;
}
.df-guide-step strong{
  color:#111827;
}
.df-link-btn{
  border:none;
  background:transparent;
  color:var(--df-primary);
  font-size:.86rem;
  font-weight:600;
  cursor:pointer;
  padding:0;
}
.df-link-btn:hover{text-decoration:underline;}
.df-toolbar-count{
  display:inline-flex;
  align-items:center;
  min-height:38px;
  padding:0 12px;
  border-radius:999px;
  background:#F8FAFC;
  border:1px solid #E5E7EB;
  color:#475569;
  font-size:.84rem;
  font-weight:600;
}
.df-toolbar{grid-template-columns:minmax(250px,1.3fr) minmax(160px,.7fr) minmax(160px,.7fr) minmax(160px,.7fr) auto;}
.filter-wide{grid-column:auto;}
.df-toolbar-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.df-field small,
.df-filter small{
  margin-top:6px;
  color:#64748B;
  font-size:.76rem;
  line-height:1.45;
}
.df-presets{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:14px 0 16px;
}
.df-preset{
  display:inline-flex;
  align-items:center;
  min-height:32px;
  padding:0 10px;
  border-radius:999px;
  border:1px solid #E5E7EB;
  background:#FFFFFF;
  color:#475569;
  font-size:.78rem;
  font-weight:600;
  cursor:pointer;
  transition:background-color .18s ease,border-color .18s ease,color .18s ease;
}
.df-preset:hover{
  background:#F7F2FF;
  border-color:#D9C8F0;
  color:#6B4C9A;
}
.df-btn-block{width:100%;}
.df-table-wrap{position:relative;}
.df-sticky-col-left,
.df-sticky-col-right{position:sticky;background:inherit;z-index:6;}
.df-sticky-col-left{left:0;box-shadow:1px 0 0 #EEF2F7;}
.df-sticky-col-right{right:0;box-shadow:-1px 0 0 #EEF2F7;}
.df-table thead .df-sticky-col-left,
.df-table thead .df-sticky-col-right{z-index:12;background:var(--df-card-soft);}
.df-root-row .df-sticky-col-left,
.df-root-row .df-sticky-col-right{background:var(--df-card-soft);}
.df-root-summary{justify-content:space-between;}
.df-row-meta-line{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin-top:8px;
  color:#64748B;
  font-size:.76rem;
}
.df-row-parent-select{margin-top:10px;max-width:320px;}
.df-cell-id{margin-top:6px;font-size:.74rem;color:#94A3B8;}
.df-cell-number{font-size:1rem;font-weight:700;color:#0F172A;}
.df-cell-sub{margin-top:4px;font-size:.75rem;color:#64748B;}
.df-row-actions{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:8px;
  min-width:170px;
}
.df-row-action-stack{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}
.df-row-state{
  font-size:.74rem;
  color:#64748B;
  text-align:right;
}
.df-badge-dirty{
  color:#92400E;
  background:#FFF7ED;
  border-color:#FED7AA;
}
.is-hidden{display:none !important;}
.df-btn-row-save.is-disabled,
.df-btn-row-save[disabled]{
  opacity:.48;
  cursor:not-allowed;
  pointer-events:none;
  box-shadow:none;
}
.df-table tbody tr.is-dirty{background:#FFFDF7;}
.df-table tbody tr.is-dirty .df-sticky-col-left,
.df-table tbody tr.is-dirty .df-sticky-col-right{background:#FFFDF7;}
@media (max-width: 1200px){
  .df-guide-strip{grid-template-columns:1fr;}
  .df-toolbar{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media (max-width: 768px){
  .df-head-actions{width:100%;}
  .df-head-actions .df-btn{flex:1 1 auto;}
  .df-toolbar{grid-template-columns:1fr;}
  .df-sticky-col-left,
  .df-sticky-col-right,
  .df-table thead .df-sticky-col-left,
  .df-table thead .df-sticky-col-right{position:static;box-shadow:none;}
}

.df-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.df-modal-backdrop[hidden] {
  display: none;
}

.df-modal {
  width: min(1280px, 96vw);
  max-height: 90vh;
  overflow: hidden;
  border-radius: 24px;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
}

.df-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid #e5e7eb;
}

.df-modal-head h2 {
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1.1;
}

.df-modal-subtitle {
  margin: 0;
  color: #64748b;
  line-height: 1.5;
}

.df-modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.df-modal-body {
  padding: 20px 24px 24px;
  overflow: auto;
}

.df-tree-panel-modal {
  height: calc(90vh - 150px);
  max-height: none;
  overflow: auto;
  padding-right: 8px;
}

.df-tree-modal .df-tree-list {
  min-width: 900px;
}

.df-tree-modal .df-tree-node {
  width: 100%;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.df-tree-modal .df-tree-node-main {
  max-width: 65%;
  white-space: normal;
  line-height: 1.5;
}

.df-tree-modal .df-tree-node-meta {
  flex-shrink: 0;
  text-align: right;
  white-space: nowrap;
}

body.df-modal-open {
  overflow: hidden;
}

@media (max-width: 980px) {
  .df-modal {
    width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }

  .df-modal-head {
    flex-direction: column;
    align-items: stretch;
  }

  .df-modal-actions {
    justify-content: stretch;
  }

  .df-modal-actions .df-btn {
    flex: 1 1 auto;
  }

  .df-tree-modal .df-tree-list {
    min-width: 0;
  }

  .df-tree-modal .df-tree-node {
    flex-direction: column;
    align-items: flex-start;
  }

  .df-tree-modal .df-tree-node-main,
  .df-tree-modal .df-tree-node-meta {
    max-width: 100%;
    text-align: left;
    white-space: normal;
  }
}

/* РЈС‚РѕР»С‰РµРЅРёРµ СѓР·Р»РѕРІ РґРµСЂРµРІР° РІ РјРѕРґР°Р»РєРµ */
.df-tree-modal .df-tree-list {
  gap: 8px;
}

.df-tree-modal .df-tree-item {
  position: relative;
}

.df-tree-modal .df-tree-list .df-tree-list {
  margin-left: 26px;
  padding-left: 22px;
  border-left: 2px solid #d7deea;
}

.df-tree-modal .df-tree-node {
  padding: 10px 14px;
  border-radius: 14px;
  min-height: 48px;
}

.df-tree-modal .df-tree-node-main {
  font-size: 17px;
  font-weight: 650;
  line-height: 1.45;
  color: #1e293b;
}

.df-tree-modal .df-tree-node-meta {
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
}

.df-tree-modal .df-tree-item::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 24px;
  width: 14px;
  border-top: 2px solid #d7deea;
}

.df-tree-modal .df-tree-list > .df-tree-item::before {
  top: 24px;
}

.df-tree-modal .df-tree-node:hover {
  background: #f8fafc;
}

.df-tree-modal .df-tree-node:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}

.df-native-select {
  display: none;
}

.df-smart-select {
  position: relative;
  width: 100%;
}

.df-smart-select-trigger {
  width: 100%;
  min-height: 48px;
  border: 1px solid #d1d5db;
  border-radius: 0.75rem;
  background: #fff;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  text-align: left;
  color: #111827;
  font: inherit;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.df-smart-select-trigger:hover {
  border-color: #c4cad4;
}

.df-smart-select-trigger:focus-visible {
  outline: none;
  border-color: #8B6BB1;
  box-shadow: 0 0 0 4px rgba(139, 107, 177, 0.12);
}

.df-smart-caret {
  color: #6b7280;
  flex-shrink: 0;
}

.df-smart-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  z-index: 300;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

.df-smart-search-wrap {
  padding: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}

.df-smart-search {
  width: 100%;
  min-height: 44px;
  border: 1px solid #d1d5db;
  border-radius: 0.75rem;
  padding: 0.65rem 0.9rem;
  font: inherit;
  color: #111827;
  outline: none;
  background: #fff;
}

.df-smart-search:focus {
  border-color: #8B6BB1;
  box-shadow: 0 0 0 4px rgba(139, 107, 177, 0.12);
}

.df-smart-options {
  max-height: 320px;
  overflow: auto;
  padding: 0.5rem;
}

.df-smart-option {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.75rem 0.9rem;
  border-radius: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  cursor: pointer;
}

.df-smart-option:hover,
.df-smart-option.is-active {
  background: #f6f2fb;
}

.df-smart-option-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.4;
}

.df-smart-option-meta {
  font-size: 0.75rem;
  color: #6b7280;
  line-height: 1.35;
}

.df-smart-empty {
  padding: 0.9rem;
  color: #6b7280;
  font-size: 0.875rem;
}


/* ==========================================================================
   ADS ACADEMIC REFRESH LAYER
   Calm enterprise UI with academic character.
   Add this block at the end so it softly overrides older rules.
   ========================================================================== */
:root{
  --df-bg:#F5F7FB;
  --df-panel:#FFFFFF;
  --df-panel-soft:#FAFBFD;
  --df-border:#DFE6F0;
  --df-border-soft:#ECF1F6;
  --df-text:#172033;
  --df-muted:#64748B;
  --df-primary:#5E3A91;
  --df-primary-hover:#4E3078;
  --df-primary-soft:#F4EEFF;
  --df-focus:rgba(94,58,145,.16);
  --df-shadow-sm:0 1px 2px rgba(16,24,40,.04);
  --df-shadow-md:0 10px 24px rgba(15,23,42,.06);
  --df-radius-card:20px;
  --df-radius-ui:14px;
  --df-content-width:1240px;
}

/* Page rhythm */
html{scroll-behavior:smooth;}
body{
  background:
    radial-gradient(circle at top left, rgba(94,58,145,.035), transparent 20%),
    linear-gradient(180deg, #F8FAFD 0%, #F5F7FB 100%) !important;
  color:var(--df-text);
}

.max-w-7xl{
  max-width:var(--df-content-width) !important;
}

/* Header */
header.border-b.border-gray-200.bg-white{
  position:sticky;
  top:0;
  z-index:40;
  background:rgba(255,255,255,.92) !important;
  backdrop-filter:blur(14px);
  border-bottom:1px solid var(--df-border-soft) !important;
  box-shadow:0 1px 0 rgba(15,23,42,.02);
}

header .max-w-7xl.mx-auto.px-6.py-3{
  padding-top:1rem !important;
  padding-bottom:.9rem !important;
}

.df-brand-logo{
  width:52px;
  height:52px;
  flex-basis:52px;
}

.df-header-meta-stack{
  gap:8px;
  margin-top:6px;
  font-size:.8rem;
  color:var(--df-muted);
}

.df-header-meta-dot{
  color:#CBD5E1;
}

.df-header-meta-link{
  font-weight:600;
}

.df-header-nav-row{
  gap:8px;
}

.df-header-nav-link,
.df-header-action-link{
  min-height:42px;
  padding:0 13px;
  border-radius:999px;
  border-color:var(--df-border-soft);
  color:#465467;
  background:rgba(255,255,255,.78);
  box-shadow:none;
}

.df-header-nav-link:hover,
.df-header-action-link:hover{
  transform:none;
  background:var(--df-panel-soft);
  border-color:#D4DDEC;
  color:var(--df-primary);
}

.df-header-nav-link.is-active{
  background:var(--df-primary-soft);
  color:var(--df-primary);
  border-color:#D8C7F2;
  box-shadow:inset 0 0 0 1px rgba(94,58,145,.03);
}

.df-header-nav-link-label,
.df-header-action-label{
  font-size:.86rem;
  font-weight:600;
}

/* General surfaces */
.df-card,
.df-panel,
.df-summary-card,
.df-table-wrap,
.df-modal{
  background:var(--df-panel);
  border:1px solid var(--df-border-soft);
  box-shadow:var(--df-shadow-sm);
}

.df-card,
.df-panel,
.df-summary-card{
  border-radius:var(--df-radius-card);
}

.df-card:hover,
.df-summary-card:hover{
  box-shadow:var(--df-shadow-md);
}

/* Buttons */
.df-btn,
.df-btn-light,
.df-btn-primary,
.df-btn-dark,
.df-btn-neutral,
.df-btn-info,
.df-btn-success,
.df-btn-danger-soft,
.df-btn-danger{
  border-radius:999px;
  min-height:40px;
  font-weight:600;
  letter-spacing:.01em;
}

.df-btn-primary{
  background:linear-gradient(180deg, #6840A0 0%, #5E3A91 100%);
  border-color:#5E3A91;
  box-shadow:0 8px 18px rgba(94,58,145,.14);
}
.df-btn-primary:hover{
  background:linear-gradient(180deg, #5E3A91 0%, #4E3078 100%);
}

.df-btn-light,
.df-btn-neutral{
  background:#FFFFFF;
  border-color:var(--df-border);
  color:#334155;
}
.df-btn-light:hover,
.df-btn-neutral:hover{
  background:var(--df-panel-soft);
  border-color:#CCD7E5;
  color:var(--df-text);
}

/* Inputs */
input,
select,
textarea,
.df-editor-select,
.df-smart-select-trigger,
.df-smart-search{
  border-color:var(--df-border) !important;
  border-radius:14px !important;
  background:#fff;
}

input::placeholder,
textarea::placeholder{
  color:#94A3B8;
}

input:focus,
select:focus,
textarea:focus,
.df-smart-select-trigger:focus-visible,
.df-smart-search:focus{
  border-color:var(--df-primary) !important;
  box-shadow:0 0 0 4px rgba(94,58,145,.10) !important;
}

/* Dashboard + content spacing */
main .max-w-7xl,
section .max-w-7xl,
div.max-w-7xl{
  position:relative;
}

h1,h2,h3{
  letter-spacing:-.02em;
}

.text-\[1\.05rem\].font-semibold.text-gray-900.leading-tight.truncate{
  color:#182132 !important;
}

.text-sm.text-\[\#6B7280\].hidden.lg\:block,
.text-sm.text-gray-500,
.text-sm.text-\[\#6B7280\]{
  color:var(--df-muted) !important;
}

/* Dashboard cards become calmer */
.rounded-2xl.border.border-gray-200.bg-white,
.rounded-3xl.border.border-gray-200.bg-white,
.rounded-\[28px\].border.border-gray-200.bg-white,
.bg-white.border.border-gray-200.rounded-2xl{
  border-color:var(--df-border-soft) !important;
  border-radius:24px !important;
  box-shadow:var(--df-shadow-sm) !important;
}

.rounded-2xl.border.border-gray-200.bg-white:hover,
.rounded-3xl.border.border-gray-200.bg-white:hover,
.rounded-\[28px\].border.border-gray-200.bg-white:hover{
  box-shadow:var(--df-shadow-md) !important;
}

/* Generic stat cards */
[class*="grid"] > .rounded-2xl.border.border-gray-200.bg-white{
  padding:1.35rem !important;
}


/* Section titles */
.text-3xl.font-semibold,
.text-2xl.font-semibold,
.text-2xl.font-bold,
.text-xl.font-semibold{
  color:#5f5f5f !important;
}

/* Reduce visual noise in tables */
.df-table-wrap{
  border-radius:22px;
  overflow:hidden;
}

.df-table thead th{
  background:#FAFBFD;
  color:#66758A;
  font-size:.76rem;
  letter-spacing:.055em;
  text-transform:uppercase;
  border-bottom:1px solid var(--df-border-soft);
}

.df-table td{
  color:#263244;
}

.df-table tbody tr td{
  border-top:none;
  border-bottom:1px solid var(--df-border-soft);
}

.df-table tbody tr:hover{
  background:#FBFCFE;
}

/* File area and editors */
.df-dropzone{
  border-color:#D8E1EE;
  border-radius:20px;
  background:linear-gradient(180deg,#FFFFFF 0%, #FBFCFE 100%);
}

.df-editor-toolbar{
  background:#FBFCFE;
  border-color:var(--df-border-soft);
}

.df-editor{
  border-color:var(--df-border-soft);
  border-radius:22px;
}

/* Departments page: keep it academic, less dramatic */
.df-departments-page{
  max-width:1360px;
  padding:28px 24px 48px;
  background:transparent;
}

.df-layout{
  gap:20px;
  grid-template-columns:300px minmax(0,1fr);
}

.df-sidebar,
.df-content{
  gap:18px;
}

.df-page-title{
  font-size:2rem;
  line-height:1.12;
}

.df-page-subtitle{
  color:var(--df-muted);
  max-width:760px;
}

.df-summary{
  gap:14px;
}

.df-summary-card{
  padding:18px 18px 16px;
  border-color:var(--df-border-soft);
}

.df-summary-label{
  font-size:.75rem;
  letter-spacing:.07em;
  color:#6B7280;
}

.df-summary-value{
  margin-top:10px;
  font-size:2rem;
  color:var(--df-primary);
}

.df-summary-meta{
  color:#76869B;
}

.df-guide-strip{
  gap:10px;
}

.df-guide-step{
  border-radius:16px;
  border-color:var(--df-border-soft);
  background:#FFFFFF;
  color:#526072;
  box-shadow:var(--df-shadow-sm);
}

.df-guide-step strong{
  color:var(--df-text);
}

.df-toolbar{
  gap:12px;
}

.df-toolbar-count{
  background:#FFFFFF;
  border-color:var(--df-border-soft);
  color:#5B6B7F;
}

.df-presets{
  gap:7px;
}

.df-preset{
  min-height:30px;
  background:#FFFFFF;
  border-color:var(--df-border-soft);
  color:#607086;
}

.df-preset:hover{
  background:var(--df-primary-soft);
  border-color:#D8C7F2;
  color:var(--df-primary);
}

.df-root-row td,
.df-table thead .df-sticky-col-left,
.df-table thead .df-sticky-col-right,
.df-root-row .df-sticky-col-left,
.df-root-row .df-sticky-col-right{
  background:#FAFBFD !important;
}

/* Modals */
.df-modal{
  border-radius:28px;
}
.df-modal-head{
  border-bottom:1px solid var(--df-border-soft);
}
.df-modal-head h2{
  color:var(--df-text);
}
.df-modal-subtitle{
  color:var(--df-muted);
}

/* Support links should not dominate */
.df-header-meta-stack a[href*="/support/"]{
  opacity:.92;
}

/* Mobile */
@media (max-width: 1024px){
  .df-header-nav-row{
    gap:7px;
  }

  .df-departments-page{
    padding:22px 16px 34px;
  }

  .df-layout{
    grid-template-columns:1fr;
  }
}

@media (max-width: 768px){
  header .max-w-7xl.mx-auto.px-6.py-3{
    padding-left:1rem !important;
    padding-right:1rem !important;
  }

  .df-header-meta-stack{
    display:none;
  }

  .df-header-action-link{
    min-height:40px;
    padding:0 12px;
  }

  .df-summary{
    grid-template-columns:1fr;
  }

  .df-page-title{
    font-size:1.7rem;
  }
}
