/* ===================================================================
   企业运营动态管理系统 — 专业企业版 v6.0
   北京飞云志科技有限公司
   支持：亮色/深色双主题，交互画布，粒子，安全增强
   =================================================================== */

:root {
  --bg-body: #f0f4fb;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-header: #f8fafd;
  --primary: #5b6ef5;
  --primary-dark: #4558e0;
  --primary-light: #eef1ff;
  --primary-glow: rgba(91,110,245,0.15);
  --accent: #6c5ce7;
  --accent2: #a855f7;
  --success: #10b860;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --text-primary: #1a2332;
  --text-secondary: #4a5568;
  --text-muted: #8b9cb8;
  --border-light: #e4eaf2;
  --border-accent: #cdd9e8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow: 0 2px 12px rgba(0,0,0,0.05);
  --shadow-md: 0 6px 24px rgba(0,0,0,0.07);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.09);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: 0.22s cubic-bezier(0.4,0,0.2,1);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
}

[data-bs-theme="dark"] {
  --bg-body: #111827;
  --bg-card: #1e293b;
  --bg-input: #1e293b;
  --bg-header: #1e293b;
  --primary: #a78bfa;
  --primary-dark: #8b5cf6;
  --primary-light: #2d1f5e;
  --primary-glow: rgba(167,139,250,0.18);
  --accent: #a78bfa;
  --accent2: #e879a0;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #7b8faa;
  --border-light: #334155;
  --border-accent: #475569;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow: 0 2px 12px rgba(0,0,0,0.35);
  --shadow-md: 0 6px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.45);
  --bs-body-bg: #111827;
  --bs-body-color: #f1f5f9;
  --bs-border-color: #334155;
  --bs-heading-color: #f1f5f9;
  --bs-link-color: #a78bfa;
  --bs-link-hover-color: #c4b5fd;
  --bs-modal-bg: #1e293b;
  --bs-modal-border-color: #334155;
  --bs-white: #1e293b;
  --bs-gray-100: #1e293b;
  --bs-gray-200: #334155;
  --bs-gray-300: #475569;
  --bs-light: #1e293b;
  --bs-dark: #f1f5f9;
  color-scheme: dark;
  background-color: #111827;
  color: #f1f5f9;
}

* { box-sizing: border-box; }
body {
  background: var(--bg-body);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: .875rem; line-height: 1.6;
  padding-top: 56px; min-height: 100vh;
}
a { color: var(--primary); transition: color var(--transition); text-decoration: none; }
a:hover { color: var(--accent); }
.container.mt-3 { flex: 1; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== Navbar ===== */
.navbar {
  background: rgba(255,255,255,0.92) !important;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04), 0 2px 16px rgba(0,0,0,0.05);
  padding: .38rem 1rem; min-height: 54px;
  border-bottom: 1px solid var(--border-light);
}
.navbar-brand { font-weight: 750; color: var(--text-primary) !important; display: flex; align-items: center; gap: 10px; font-size: 1.02rem; letter-spacing: .3px; }
.navbar-brand .brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent2));
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; color: #fff;
  box-shadow: 0 3px 12px var(--primary-glow), 0 0 0 3px rgba(91,110,245,0.06);
  transition: transform .2s ease;
}
.navbar-brand:hover .brand-icon { transform: scale(1.05); }
.navbar .nav-link {
  color: var(--text-secondary) !important; padding: .38rem .75rem !important;
  border-radius: var(--radius-sm); margin: 0 2px; transition: all var(--transition);
  font-size: .82rem; font-weight: 530;
}
.navbar .nav-link:hover { background: var(--primary-light); color: var(--primary) !important; }
.navbar .nav-link.active { background: var(--primary-light); color: var(--primary) !important; font-weight: 600; }
.navbar .nav-link i { margin-right: 5px; font-size: .92rem; }
.navbar .navbar-text { color: var(--text-muted) !important; font-size: .8rem; }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent2));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; color: #fff; font-weight: 700; margin-right: 6px;
  box-shadow: 0 2px 8px var(--primary-glow);
  flex-shrink: 0; min-width: 30px; min-height: 30px;
}
#nightBanner { margin-top: 4px; }
.brand-subtitle { font-size: .6rem; opacity: .45; display: block; line-height: 1; margin-top: -2px; letter-spacing: 1.2px; color: var(--text-muted); font-weight: 500; }
.dropdown-menu { background: #fff; border: 1px solid var(--border-light); box-shadow: var(--shadow-lg); border-radius: var(--radius); padding: .4rem; }
.dropdown-item { border-radius: var(--radius-sm); padding: .45rem .8rem; font-size: .82rem; color: var(--text-secondary); transition: all .15s ease; }
.dropdown-item:hover { background: var(--primary-light); color: var(--primary); }
.dropdown-item i { margin-right: 7px; width: 18px; text-align: center; }
.dropdown-divider { border-color: var(--border-light); }

/* ===== Footer ===== */
.footer { background: rgba(255,255,255,0.6); color: var(--text-muted); font-size: .73rem; padding: 12px 0; margin-top: 3rem !important; text-align: center; border-top: 1px solid var(--border-light); }
.footer-main { margin-bottom: 2px; }
.footer-beian { margin-top: 4px; }
.footer-beian a { color: var(--text-muted); text-decoration: none; font-size: .72rem; }
.footer-beian a:hover { color: var(--primary); text-decoration: underline; }
.beian-item { display: inline-flex; align-items: center; vertical-align: middle; }
.beian-icon { margin-right: 3px; vertical-align: middle; flex-shrink: 0; }

/* ===== Cards ===== */
.card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: all var(--transition); margin-bottom: 16px;
  position: relative;
}
.card::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0; transition: opacity var(--transition); border-radius: var(--radius) var(--radius) 0 0;
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--border-accent); transform: translateY(-1px); }
.card:hover::after { opacity: 0.6; }
.card-header { background: transparent; border-bottom: 1px solid var(--border-light); font-weight: 650; padding: .75rem 1.1rem; font-size: .87rem; color: var(--text-primary); letter-spacing: .2px; }
.card-body { padding: 1.1rem; }
.card-footer { background: #fafbfc; border-top: 1px solid var(--border-light); padding: .65rem 1.1rem; color: var(--text-secondary); }
.card-hover { transition: all .28s cubic-bezier(0.4,0,0.2,1); }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ===== Tables ===== */
.table { font-size: .83rem; margin-bottom: 0; color: var(--text-primary); }
.table thead th { border-top: none; border-bottom: 2px solid var(--border-light); color: var(--text-muted); font-weight: 650; font-size: .73rem; text-transform: uppercase; letter-spacing: .5px; padding: .65rem .75rem; white-space: nowrap; background: var(--bg-header); }
.table td { padding: .55rem .75rem; vertical-align: middle; border-bottom: 1px solid var(--border-light); }
.table tbody tr { transition: background .15s ease, transform .15s ease; }
.table-hover tbody tr:hover { background: rgba(91,110,245,.04); transform: translateX(2px); }
.table-striped tbody tr:nth-of-type(odd) { background: #f9fafb; }

/* ===== Tabs ===== */
.nav-tabs { border-bottom: 2px solid var(--border-light); gap: 2px; }
.nav-tabs .nav-link { border: none; color: var(--text-muted); font-weight: 550; padding: .55rem 1.1rem; margin-bottom: -2px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; transition: all var(--transition); font-size: .83rem; }
.nav-tabs .nav-link:hover { color: var(--primary); background: rgba(91,110,245,.03); }
.nav-tabs .nav-link.active { color: var(--primary); background: transparent; border-bottom: 3px solid var(--primary); font-weight: 650; }
.nav-tabs .nav-link i { margin-right: 5px; }
.tab-content-card { background: var(--bg-card); border: 1px solid var(--border-light); border-top: none; border-radius: 0 0 var(--radius) var(--radius); padding: 1.2rem; }

/* ===== Forms ===== */
.form-control, .form-select { background: #fff; border: 1.5px solid var(--border-light); border-radius: var(--radius-sm); font-size: .85rem; color: var(--text-primary); padding: .5rem .75rem; transition: all var(--transition); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); outline: none; }
.form-label { font-size: .79rem; font-weight: 550; color: var(--text-secondary); margin-bottom: .3rem; }
.form-text { font-size: .73rem; color: var(--text-muted); }
.is-invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(239,68,68,.12) !important; }
.invalid-feedback { font-size: .75rem; color: var(--danger); }

/* ===== Buttons ===== */
.btn { border-radius: var(--radius-sm); font-weight: 550; font-size: .83rem; padding: .45rem 1rem; transition: all .2s cubic-bezier(0.4,0,0.2,1); position: relative; overflow: hidden; }
.btn:hover { transform: translateY(-1.5px); }
.btn::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at center, rgba(255,255,255,0.3) 0%, transparent 70%); opacity: 0; transition: opacity .2s; }
.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.96) !important; }
.btn-sm { border-radius: 6px; padding: .28rem .6rem; font-size: .77rem; }
.btn-lg { padding: .6rem 1.4rem; font-size: .9rem; border-radius: var(--radius); }
.btn-primary { background: linear-gradient(135deg, var(--primary), #7b8cf8); border: none; color: #fff; box-shadow: 0 2px 8px var(--primary-glow); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(91,110,245,0.3); }
.btn-outline-primary { color: var(--primary); border: 1.5px solid var(--primary); background: transparent; }
.btn-outline-primary:hover { background: var(--primary-light); }
.btn-success { background: linear-gradient(135deg, #10b860, #22c96e); border: none; color: #fff; }
.btn-danger { background: linear-gradient(135deg, var(--danger), #f87171); border: none; color: #fff; }
.btn-danger:hover { background: linear-gradient(135deg, #dc2626, #ef4444); }
.btn-warning { background: linear-gradient(135deg, var(--warning), #fbbf24); border: none; color: #1a1a1a; }
.btn-info { background: linear-gradient(135deg, var(--info), #60a5fa); border: none; color: #fff; }
.btn-outline-danger { color: var(--danger); border: 1.5px solid var(--danger); }
.btn-outline-danger:hover { background: #fde8e8; }
.btn-outline-success { color: var(--success); border: 1.5px solid var(--success); }
.btn-outline-success:hover { background: #dafbe8; }
.btn-outline-info { color: var(--info); border: 1.5px solid var(--info); }
.btn-outline-info:hover { background: #e3f1fb; }
.btn-outline-warning { color: var(--warning); border: 1.5px solid var(--warning); }
.btn-outline-warning:hover { background: #fef4e3; }

/* ===== Badges ===== */
.badge { font-weight: 550; padding: .28em .6em; font-size: .71rem; border-radius: 6px; letter-spacing: .2px; }

/* ===== Progress ===== */
.progress { border-radius: 20px; background: #e8edf5; height: 8px; overflow: hidden; }
.progress-bar { border-radius: 20px; font-size: .65rem; font-weight: 650; background: linear-gradient(90deg, var(--primary), var(--accent2)); position: relative; }
.progress-bar::after { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent); animation: shimmer 2.5s infinite; }
@keyframes shimmer { 0% { left: -100%; } 100% { left: 100%; } }
.progress-bar.bg-success { background: linear-gradient(90deg, #10b860, #22c96e); }
.progress-bar.bg-warning { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.progress-bar.bg-danger  { background: linear-gradient(90deg, #ef4444, #f87171); }
.progress-bar.bg-info    { background: linear-gradient(90deg, #3b82f6, #60a5fa); }

/* ===== Alerts ===== */
.alert { border-radius: var(--radius); border: 1.5px solid transparent; padding: .75rem 1.1rem; font-size: .83rem; }
.alert-warning { background: #fef4e3; color: #92400e; border-color: #fde68a; }
.alert-success { background: #dafbe8; color: #166534; border-color: #bbf7d0; }
.alert-danger  { background: #fde8e8; color: #991b1b; border-color: #fecaca; }
.alert-info    { background: #e3f1fb; color: #075985; border-color: #bae6fd; }

/* ===== Toast ===== */
.toast-container { z-index: 9999; }
.toast { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 280px; animation: toastIn .3s ease-out; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* ===== Page title ===== */
.page-title { font-size: 1.15rem; font-weight: 750; color: var(--text-primary); margin-bottom: 1.1rem; display: flex; align-items: center; gap: 9px; }
.page-title i { color: var(--primary); font-size: 1.2rem; background: var(--primary-light); padding: 7px 9px; border-radius: var(--radius-sm); }
.page-fade-in { animation: pageFadeIn .5s cubic-bezier(0.4,0,0.2,1); }
@keyframes pageFadeIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
/* Card stagger entrance */
.page-fade-in .card { animation: cardIn .5s ease-out both; }
.page-fade-in .card:nth-child(1) { animation-delay: 0s; }
.page-fade-in .card:nth-child(2) { animation-delay: .06s; }
.page-fade-in .card:nth-child(3) { animation-delay: .12s; }
.page-fade-in .card:nth-child(4) { animation-delay: .18s; }
.page-fade-in .card:nth-child(5) { animation-delay: .24s; }
.page-fade-in .card:nth-child(6) { animation-delay: .3s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
/* Stat card color accents */
.stat-card { text-align: center; border-radius: var(--radius); padding: 1.1rem .6rem; transition: all .28s ease; border: 1px solid var(--border-light); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.stat-card:nth-child(1) { border-top: 3px solid var(--primary); }
.stat-card:nth-child(2) { border-top: 3px solid var(--success); }
.stat-card:nth-child(3) { border-top: 3px solid var(--warning); }
.stat-card:nth-child(4) { border-top: 3px solid var(--info); }

/* ===== KPI cards ===== */
.kpi-card { position: relative; overflow: hidden; transition: all .32s cubic-bezier(0.4,0,0.2,1); border-radius: var(--radius); border: 1px solid var(--border-light) !important; border-left: 5px solid var(--primary) !important; cursor: default; }
.kpi-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-accent) !important; }
.kpi-card .kpi-icon { font-size: 2.4rem; opacity: .06; position: absolute; right: 14px; top: 12px; transition: all .3s ease; }
.kpi-card:hover .kpi-icon { opacity: .1; transform: scale(1.08); }
.kpi-card .kpi-value { font-size: 1.85rem; font-weight: 750; line-height: 1.2; }
.kpi-card .kpi-label { font-size: .73rem; text-transform: uppercase; letter-spacing: .6px; opacity: .55; margin-top: 3px; font-weight: 600; }

/* ===== Charts ===== */
.chart-container { width: 100%; height: 290px; }
.chart-container-sm { width: 100%; height: 250px; }
.chart-container-lg { width: 100%; height: 340px; }

/* ===== Login ===== */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #eef2f8 0%, #f4f7fb 40%, #eef3fa 70%, #f8fafc 100%); padding: 20px; position: relative; overflow: hidden; }
.login-page { padding-top: 20px !important; }
.login-card { width: 100%; max-width: 410px; position: relative; z-index: 1; animation: slideInUp .8s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes slideInUp { from { opacity: 0; transform: translateY(60px); } to { opacity: 1; transform: translateY(0); } }
.login-card .card { transition: box-shadow .5s ease; }
.login-card .card:hover { box-shadow: 0 0 0 3px rgba(91,110,245,0.15), var(--shadow-lg); }
.login-page .btn-primary { transition: all .3s cubic-bezier(0.34,1.56,0.64,1); }
.login-page .btn-primary:hover { transform: translateY(-3px) scale(1.02); }
.login-card .card { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-lg); overflow: hidden; box-shadow: 0 0 0 2px rgba(91,110,245,0.1), var(--shadow-lg); animation: borderGlow 4s ease-in-out infinite; }
@keyframes borderGlow { 0%, 100% { box-shadow: 0 0 0 2px rgba(91,110,245,0.1), var(--shadow-lg); } 50% { box-shadow: 0 0 0 2px rgba(168,85,247,0.2), var(--shadow-lg); } }
.login-header { background: linear-gradient(135deg, #f2f5ff, #e8edfa); padding: 2.2rem 1.5rem 1.6rem; text-align: center; border-bottom: 1px solid var(--border-light); }
.login-header .login-icon { font-size: 2.8rem; margin-bottom: .6rem; color: var(--primary); }
.login-header h3 { font-weight: 750; font-size: 1.35rem; margin-bottom: .25rem; letter-spacing: .4px; }
.login-header p { opacity: .5; font-size: .8rem; margin-bottom: 0; font-weight: 500; }
.login-body { padding: 1.6rem; }
.login-footer { background: #f8fafc; padding: .9rem 1.5rem; text-align: center; font-size: .73rem; color: var(--text-muted); border-top: 1px solid var(--border-light); }
#bgCanvas { position: fixed; top:0; left:0; width:100%; height:100%; z-index:0; pointer-events:none; }
.bg-particles { position: fixed; top:0; left:0; width:100%; height:100%; pointer-events:none; z-index:0; overflow:hidden; }
.particle { position: absolute; border-radius: 50%; pointer-events: none; }
.particle.dot { background: var(--primary); opacity: 0; animation: floatDrift linear infinite; }
.particle.orb { background: radial-gradient(circle, var(--accent2) 0%, transparent 70%); opacity: 0; animation: floatSlow linear infinite; }
.particle.spark { background: var(--primary); opacity: 0; box-shadow: 0 0 6px 2px var(--primary); animation: twinkle ease-in-out infinite; }
@keyframes floatDrift { 0% { transform: translateY(105vh) translateX(0) scale(0.3) rotate(0deg); opacity: 0; } 5% { opacity: 0.07; } 85% { opacity: 0.05; } 100% { transform: translateY(-10vh) translateX(60px) scale(1) rotate(180deg); opacity: 0; } }
@keyframes floatSlow { 0% { transform: translateY(105vh) translateX(0) scale(0.5); opacity: 0; } 8% { opacity: 0.05; } 90% { opacity: 0.04; } 100% { transform: translateY(-15vh) translateX(-40px) scale(1.3); opacity: 0; } }
@keyframes twinkle { 0%, 100% { opacity: 0.02; transform: scale(0.8); } 50% { opacity: 0.1; transform: scale(1.4); } }
[data-bs-theme="dark"] .particle.dot { background: #a78bfa; }
[data-bs-theme="dark"] .particle.orb { background: radial-gradient(circle, #e879a0 0%, transparent 70%); }
[data-bs-theme="dark"] .particle.spark { background: #a78bfa; box-shadow: 0 0 6px 2px #a78bfa; }

#toastContainer { z-index: 9999 !important; }

/* ===== Filter ===== */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin-bottom: 1rem; padding: .8rem 1.1rem; background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 140px; }

/* ===== Misc ===== */
.action-btns .btn { padding: .32rem .6rem; font-size: .8rem; margin: 0 2px; min-width: 38px; min-height: 38px; border-radius: var(--radius-sm); }
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3.5rem; opacity: .18; margin-bottom: .8rem; }
.empty-state .empty-text { font-size: .92rem; font-weight: 550; margin-bottom: .3rem; }
.empty-state .empty-hint { font-size: .78rem; opacity: .5; }
.status-badge { display: inline-block; padding: .18em .55em; border-radius: 10px; font-size: .73rem; font-weight: 550; }
.status-badge-active   { background: #dafbe8; color: #166534; }
.status-badge-pending  { background: #fef4e3; color: #92400e; }
.status-badge-done     { background: #eef2ff; color: #1e40af; }
.status-badge-danger   { background: #fde8e8; color: #991b1b; }
.steps { display: flex; align-items: center; flex-wrap: wrap; }
.step { display: flex; align-items: center; font-size: .78rem; color: var(--text-muted); }
.step.active { color: var(--primary); font-weight: 650; }
.step.done { color: var(--success); }
.step .step-dot { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .65rem; font-weight: 700; margin-right: 4px; background: var(--border-light); color: var(--text-muted); transition: all var(--transition); }
.step.active .step-dot { background: var(--primary); color: #fff; box-shadow: 0 2px 8px var(--primary-glow); }
.step.done .step-dot   { background: var(--success); color: #fff; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 750; line-height: 1.2; }
.stat-card .stat-label { font-size: .73rem; color: var(--text-muted); margin-top: 3px; font-weight: 500; }
.modal-backdrop { z-index: 1050 !important; }
.perm-scroll { overflow-x: auto; max-height: 75vh; border: 2px solid var(--border-light); border-radius: var(--radius); margin: 0 -1rem; width: calc(100% + 2rem); }
.perm-scroll::-webkit-scrollbar { height: 10px; }
.perm-scroll::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 10px; }
.perm-scroll::-webkit-scrollbar-thumb:hover { background: #5b6ef5; }
.perm-sticky { position: sticky; background: #fff !important; z-index: 1; }
#permTable thead th.perm-sticky { background: #f8fafc !important; z-index: 3; color: var(--text-muted); font-weight: 650; }
#permTable tbody td.perm-sticky { background: #fff !important; }
.perm-cb:focus { outline: none !important; box-shadow: none !important; }
.perm-cb { cursor: pointer; }
#permTable td { transition: background-color .6s ease; }
[data-bs-theme="dark"] #permTable tbody td.perm-sticky { background: #1e293b !important; }
[data-bs-theme="dark"] #permTable thead th.perm-sticky { background: #1e293b !important; }
[data-bs-theme="dark"] .perm-sticky { background: #1e293b !important; }
.pagination { gap: 2px; }
.pagination .page-link { border-radius: 6px !important; border: 1px solid var(--border-light); color: var(--text-secondary); padding: .35rem .7rem; font-size: .82rem; transition: all .15s ease; }
.pagination .page-link:hover { background: var(--primary-light); color: var(--primary); }
.pagination .active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===== Dark mode override helpers ===== */
html[data-bs-theme="dark"] body { background: #111827 !important; color: #f1f5f9 !important; }
[data-bs-theme="dark"] body .container,
[data-bs-theme="dark"] body .container-fluid { color: #f1f5f9; }
[data-bs-theme="dark"] .bg-white { background-color: #1e293b !important; }
[data-bs-theme="dark"] .btn-outline-secondary { color: #cbd5e1; border-color: #475569; }
[data-bs-theme="dark"] .btn-outline-secondary:hover { background: #334155; color: #f1f5f9; }
[data-bs-theme="dark"] .btn-outline-danger { color: #f87171; border-color: #f87171; }
[data-bs-theme="dark"] h1,[data-bs-theme="dark"] h2,[data-bs-theme="dark"] h3,[data-bs-theme="dark"] h4,[data-bs-theme="dark"] h5,[data-bs-theme="dark"] h6,
[data-bs-theme="dark"] .h1,[data-bs-theme="dark"] .h2,[data-bs-theme="dark"] .h3,[data-bs-theme="dark"] .h4,[data-bs-theme="dark"] .h5,[data-bs-theme="dark"] .h6,
[data-bs-theme="dark"] strong,[data-bs-theme="dark"] .fw-bold,[data-bs-theme="dark"] .fw-semibold,[data-bs-theme="dark"] .page-title { color: #f1f5f9; }
[data-bs-theme="dark"] .text-dark { color: #f1f5f9 !important; }
[data-bs-theme="dark"] .text-primary { color: #a78bfa !important; }
[data-bs-theme="dark"] .text-secondary { color: #cbd5e1 !important; }
[data-bs-theme="dark"] .text-muted { color: var(--text-muted) !important; }
[data-bs-theme="dark"] .navbar.bg-white { background: rgba(17,24,39,0.92) !important; }
[data-bs-theme="dark"] .navbar { border-bottom-color: var(--border-light) !important; }
[data-bs-theme="dark"] .navbar .nav-link { color: var(--text-secondary) !important; }
[data-bs-theme="dark"] .navbar .nav-link:hover { color: var(--primary) !important; }
[data-bs-theme="dark"] .navbar-brand { color: var(--text-primary) !important; }
[data-bs-theme="dark"] .dropdown-menu { background: #1e293b; border-color: var(--border-light); }
[data-bs-theme="dark"] .dropdown-item { color: var(--text-secondary); }
[data-bs-theme="dark"] .dropdown-item:hover { background: var(--primary-light); color: var(--primary); }
[data-bs-theme="dark"] .card { background: var(--bg-card); border-color: var(--border-light); }
[data-bs-theme="dark"] .card-header { border-bottom-color: var(--border-light); color: var(--text-primary); }
[data-bs-theme="dark"] .card-footer { border-top-color: var(--border-light); background: rgba(0,0,0,0.2); }
[data-bs-theme="dark"] .table { color: var(--text-primary); }
[data-bs-theme="dark"] .table thead th { background: var(--bg-header); border-bottom-color: var(--border-light); }
[data-bs-theme="dark"] .table td { border-bottom-color: var(--border-light); }
[data-bs-theme="dark"] .table-hover tbody tr:hover { background: rgba(167,139,250,0.08); }
[data-bs-theme="dark"] .table-striped tbody tr:nth-of-type(odd) { background: rgba(255,255,255,0.02); }
[data-bs-theme="dark"] .form-control,[data-bs-theme="dark"] .form-select { background: var(--bg-input); border-color: var(--border-light); color: var(--text-primary); }
[data-bs-theme="dark"] .form-control:focus,[data-bs-theme="dark"] .form-select:focus { border-color: var(--primary); }
[data-bs-theme="dark"] .modal-content { background: #1e293b; border-color: var(--border-light); }
[data-bs-theme="dark"] .modal-header { border-bottom-color: var(--border-light); }
[data-bs-theme="dark"] .modal-footer { border-top-color: var(--border-light); }
[data-bs-theme="dark"] .nav-tabs { border-bottom-color: var(--border-light); }
[data-bs-theme="dark"] .nav-tabs .nav-link.active { color: var(--primary); }
[data-bs-theme="dark"] .tab-content-card { background: var(--bg-card); border-color: var(--border-light); }
[data-bs-theme="dark"] .filter-bar { background: var(--bg-card); border-color: var(--border-light); }
[data-bs-theme="dark"] .footer { background: rgba(0,0,0,0.3); border-top-color: var(--border-light); }
[data-bs-theme="dark"] .login-card .card { background: #1e293b; }
[data-bs-theme="dark"] .login-header { background: linear-gradient(135deg, #1e1a40, #1e293b); border-bottom-color: var(--border-light); }
[data-bs-theme="dark"] .login-footer { background: rgba(0,0,0,0.2); border-top-color: var(--border-light); }
[data-bs-theme="dark"] .navbar-collapse { background: #111827; }
[data-bs-theme="dark"] .bg-light { background: #1e293b !important; }
[data-bs-theme="dark"] .border { border-color: var(--border-light) !important; }
[data-bs-theme="dark"] .toast,[data-bs-theme="dark"] .toast .toast-header { background: #1e293b; border-color: var(--border-light); color: var(--text-primary); }
[data-bs-theme="dark"] .toast-body { color: var(--text-primary); }
[data-bs-theme="dark"] .badge { color: #fff !important; }
[data-bs-theme="dark"] .alert-warning { background: #2d2010; color: #fbbf24; border-color: #5c4518; }
[data-bs-theme="dark"] .alert-success { background: #0d2820; color: #4ade80; border-color: #1a4a30; }
[data-bs-theme="dark"] .alert-danger  { background: #2d1010; color: #f87171; border-color: #5c2828; }
[data-bs-theme="dark"] .alert-info    { background: #0d1a30; color: #60a5fa; border-color: #1e3a5c; }
[data-bs-theme="dark"] .btn-close { filter: invert(1); }
[data-bs-theme="dark"] .pagination .page-link { background: #1e293b; border-color: var(--border-light); color: var(--text-secondary); }
[data-bs-theme="dark"] .pagination .page-link:hover { background: var(--primary-light); }
[data-bs-theme="dark"] .pagination .active .page-link { background: var(--primary); border-color: var(--primary); }
[data-bs-theme="dark"] .progress { background: #334155; }
[data-bs-theme="dark"] small,[data-bs-theme="dark"] .small { color: #cbd5e1; }
[data-bs-theme="dark"] td,[data-bs-theme="dark"] th { color: #f1f5f9; }
[data-bs-theme="dark"] .order-card { color: #f1f5f9; }
[data-bs-theme="dark"] .order-card .text-muted { color: #7b8faa !important; }

/* ===== Dashboard: weekly plans ===== */
.weekly-plan-header { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.weekly-plan-title { min-width: 0; overflow-wrap: anywhere; }
.weekly-plan-subitems { list-style: none; padding-left: 1.35rem; display: grid; gap: .32rem; }
.weekly-plan-subitem { display: flex; align-items: flex-start; gap: .5rem; min-width: 0; line-height: 1.45; }
.weekly-plan-toggle { flex: 0 0 auto; width: 1.15rem; height: 1.15rem; margin-top: .08rem; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: color .12s ease, transform .12s ease; }
.weekly-plan-toggle:hover { color: var(--primary); transform: scale(1.12); }
.weekly-plan-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.weekly-plan-toggle.is-done { color: var(--success); }
.weekly-plan-toggle:disabled { cursor: wait; opacity: .65; transform: none; }
.weekly-plan-toggle > i { font-size: .82rem; line-height: 1; }
.weekly-plan-subitem-text { min-width: 0; overflow-wrap: anywhere; }
.weekly-plan-item { transition: opacity .16s ease, transform .16s ease; }
.weekly-plan-item.is-removing { opacity: 0; transform: translateX(8px); }

/* ===== Responsive ===== */
@media (max-width: 991px) {
  body { padding-top: 54px; }
  .kpi-card .kpi-value { font-size: 1.35rem; }
  .table { font-size: .76rem; }
  .card-body { padding: .8rem; }
  .login-header { padding: 1.6rem 1rem 1.2rem; }
  .login-body { padding: 1.1rem; }
  .chart-container, .chart-container-sm, .chart-container-lg { height: 220px; }
  .filter-bar .form-control, .filter-bar .form-select { width: 100%; min-width: 0; }
  .navbar-collapse { max-height: 80vh; overflow-y: auto; background: var(--bg-card); padding: .5rem 1rem 1.5rem; border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow-md); }
  .navbar .nav-link { padding: .55rem .75rem !important; font-size: .9rem; border-radius: var(--radius-sm); }
  .navbar .nav-link i { font-size: 1rem; margin-right: 10px; }
  .navbar .dropdown-menu { border: 1px solid var(--border-light); border-radius: var(--radius); padding: .4rem; margin-left: .5rem; background: var(--bg-card); transition: none; }
  .navbar .dropdown-item { padding: .5rem .75rem; font-size: .86rem; border-radius: var(--radius-sm); transition: background .05s; }
  .navbar-text { flex-wrap: wrap; gap: .5rem; padding: .5rem 0; }
  .navbar-text .btn { padding: .4rem .8rem; font-size: .82rem; }
  .navbar-toggler { border-color: var(--border-accent); padding: .25rem .5rem; }
  .navbar-toggler-icon { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(91,110,245,0.8)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"); }
  .modal-dialog { margin: .5rem; max-width: none; }
  .btn { min-height: 40px; transition: all .08s; }
  .btn-sm { min-height: 34px; }
  .form-control, .form-select { font-size: 16px; }
  .dropdown-item { min-height: 40px; }
  .action-btns .btn { min-width: 42px; min-height: 42px; }
  .perm-scroll { max-height: 60vh; margin: 0; width: 100%; }
  .col-6.col-sm-4.col-md-2 { padding: 4px; }
  /* Mobile dark mode navbar */
  [data-bs-theme="dark"] .navbar-collapse { background: var(--bg-card) !important; }
  [data-bs-theme="dark"] .navbar .dropdown-menu { background: var(--bg-card) !important; border-color: var(--border-light) !important; }
  [data-bs-theme="dark"] .navbar .dropdown-item { color: var(--text-secondary) !important; }
  [data-bs-theme="dark"] .navbar .dropdown-item:hover { background: var(--primary-light) !important; color: var(--primary) !important; }
  [data-bs-theme="dark"] .navbar .nav-link { color: var(--text-secondary) !important; }
  [data-bs-theme="dark"] .navbar .dropdown-header { color: var(--text-muted) !important; }
  /* Mobile: disable heavy animations to reduce lag */
  #bgCanvas, .bg-particles { display: none !important; }
}
@media (max-width: 768px) {
  body { padding-top: 56px; }
  .kpi-card .kpi-value { font-size: 1.3rem; }
  .table { font-size: .75rem; }
  .card-body { padding: .75rem; }
  .chart-container, .chart-container-sm, .chart-container-lg { height: 200px; }
  .brand-subtitle { display: none; }
  .page-title { font-size: 1rem; }
  .nav-tabs .nav-link { padding: .4rem .7rem; font-size: .78rem; }
  .tab-content-card { padding: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  #bgCanvas, .bg-particles { display: none !important; }
}
/* End-to-end operations value stream */
.operations-unit-filter { min-width: 150px; }
.operations-flow { display:flex; align-items:stretch; gap:.55rem; overflow-x:auto; padding:.25rem 0 .75rem; }
.operations-stage { min-width:118px; flex:0 0 calc((100% - 12.6rem) / 7); border:1px solid var(--border-color, #dbe3ef); border-radius:12px; padding:.8rem; background:var(--card-bg, #fff); display:grid; grid-template-columns:auto 1fr; gap:.2rem .5rem; align-items:center; }
.operations-stage-number { width:1.65rem; height:1.65rem; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; background:var(--primary, #3b82f6); color:#fff; font-size:.8rem; grid-row:span 2; }
.operations-stage-count { font-size:1.5rem; font-weight:700; color:var(--primary, #3b82f6); }
.operations-stage small { grid-column:2; }
.operations-flow-arrow { align-self:center; flex:0 0 1rem; color:var(--text-muted, #94a3b8); }
@media (max-width: 767.98px) { .operations-flow-arrow { display:none; } .operations-stage { min-width:145px; } }
