/* ============================
   ToolSphere Portal — Shared CSS
   ============================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-primary:        #0e1320;
  --bg-secondary:      #090e1b;
  --bg-card:           rgba(26, 31, 45, 0.7);
  --bg-card-hover:     rgba(38, 45, 66, 0.85);
  --bg-input:          rgba(255,255,255,0.06);
  --bg-input-focus:    rgba(255,255,255,0.09);
  --border:            rgba(255,255,255,0.08);
  --border-focus:      var(--accent);
  --focus-glow:        var(--accent-glow);
  --text-primary:      #f1f5f9;
  --text-secondary:    #94a3b8;
  --text-muted:        #475569;
  --primary:           #6ee7b7;
  --accent:            #10b981;
  --accent-glow:       rgba(16,185,129,0.25);
  --accent-cyan:       #10b981;
  --accent-green:      #10b981;
  --accent-amber:      #f59e0b;
  --accent-red:        #ef4444;
  --accent-purple:     #a855f7;
  --sidebar-w:         260px;
  --header-h:          64px;
  --radius-sm:         8px;
  --radius-md:         12px;
  --radius-lg:         16px;
  --radius-xl:         24px;
  --shadow-sm:         0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:         0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg:         0 16px 48px rgba(0,0,0,0.5);
  --shadow-glow:       0 0 32px rgba(16,185,129,0.2);
  --nav-active-color:  #6ee7b7;
  --nav-active-bg:     rgba(255,255,255,0.05);
  --transition:        all 0.2s cubic-bezier(0.4,0,0.2,1);
}

*,*::before,*::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; }
body {
  font-family:'Inter',system-ui,sans-serif;
  background:var(--bg-primary);
  color:var(--text-primary);
  min-height:100vh;
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
a { color:inherit; text-decoration:none; }
button { cursor:pointer; font-family:inherit; }
input,select,textarea { font-family:inherit; }
img { max-width:100%; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:rgba(255,255,255,0.15); border-radius:99px; }
::-webkit-scrollbar-thumb:hover { background:rgba(255,255,255,0.25); }

/* ── Glass card ── */
.glass {
  background: var(--bg-card);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: var(--transition);
}
.glass:hover {
  background: var(--bg-card-hover);
  border-color: rgba(16,185,129, 0.25);
  box-shadow: 0 8px 30px rgba(16,185,129, 0.12);
}

/* ── Buttons ── */
.btn {
  display:inline-flex; align-items:center; gap:8px;
  padding:10px 20px; border-radius:var(--radius-sm);
  font-size:14px; font-weight:600; border:none;
  transition:var(--transition); white-space:nowrap;
}
.btn-primary {
  background:linear-gradient(135deg,#10b981,#059669);
  color:#fff; box-shadow:0 4px 16px rgba(16,185,129,0.35);
}
.btn-primary:hover { transform:translateY(-1px); box-shadow:0 6px 24px rgba(16,185,129,0.5); }
.btn-primary:active { transform:translateY(0); }
.btn-secondary {
  background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border);
}
.btn-secondary:hover { border-color:var(--accent); background:var(--bg-card-hover); }
.btn-danger { background:rgba(239,68,68,0.15); color:var(--accent-red); border:1px solid rgba(239,68,68,0.25); }
.btn-danger:hover { background:rgba(239,68,68,0.25); border-color:var(--accent-red); }
.btn-success { background:rgba(16,185,129,0.15); color:var(--accent-green); border:1px solid rgba(16,185,129,0.25); }
.btn-success:hover { background:rgba(16,185,129,0.25); }
.btn-sm { padding:6px 14px; font-size:13px; }
.btn-icon { padding:8px; border-radius:var(--radius-sm); background:var(--bg-input); border:1px solid var(--border); color:var(--text-secondary); transition:var(--transition); }
.btn-icon:hover { color:var(--text-primary); border-color:var(--accent); }
.btn-full { width:100%; justify-content:center; }
.btn:disabled { opacity:0.5; cursor:not-allowed; transform:none !important; }

/* ── Form inputs ── */
.form-group { display:flex; flex-direction:column; gap:6px; margin-bottom:16px; }
.form-group label { font-size:13px; font-weight:600; color:var(--text-secondary); text-transform:uppercase; letter-spacing:0.5px; }
.form-control {
  width:100%; padding:12px 16px;
  background:var(--bg-input) !important; border:1px solid var(--border) !important;
  border-radius:var(--radius-sm); color:var(--text-primary) !important;
  font-size:14px; transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  outline: none !important;
}
.form-control:focus {
  outline:none !important;
  border-color:var(--border-focus) !important;
  box-shadow:0 0 0 3px var(--focus-glow) !important;
  background:var(--bg-input-focus) !important;
}
.form-control::placeholder { color:var(--text-muted); }
.input-wrap { position:relative; }
.input-wrap .form-control { padding-right:44px; }
.input-wrap .input-icon { position:absolute; right:14px; top:50%; transform:translateY(-50%); color:var(--text-muted); cursor:pointer; font-size:15px; transition:var(--transition); }
.input-wrap .input-icon:hover { color:var(--text-secondary); }
select.form-control option { background:#1e2a3a !important; color:var(--text-primary) !important; }

/* ── Badge ── */
.badge {
  display:inline-flex; align-items:center; gap:4px;
  padding:3px 10px; border-radius:99px; font-size:12px; font-weight:600;
}
.badge-active   { background:rgba(16,185,129,0.15); color:#34d399; border:1px solid rgba(16,185,129,0.2); }
.badge-disabled { background:rgba(239,68,68,0.12); color:#f87171; border:1px solid rgba(239,68,68,0.2); }
.badge-admin    { background:rgba(168,85,247,0.15); color:#c084fc; border:1px solid rgba(168,85,247,0.2); }
.badge-user     { background:rgba(16,185,129,0.12); color:#6ee7b7; border:1px solid rgba(16,185,129,0.2); }
.badge-cat      { background:rgba(16,185,129,0.12); color:#6ee7b7; border:1px solid rgba(16,185,129,0.2); }
.badge-login    { background:rgba(16,185,129,0.12); color:#6ee7b7; }
.badge-logout   { background:rgba(148,163,184,0.12); color:#94a3b8; }
.badge-click    { background:rgba(16,185,129,0.12); color:#6ee7b7; }

/* ── Table ── */
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
thead th {
  padding:12px 16px; text-align:left;
  font-size:12px; font-weight:700; color:var(--text-muted);
  text-transform:uppercase; letter-spacing:0.5px;
  border-bottom:1px solid var(--border);
  white-space:nowrap;
}
tbody tr {
  border-bottom:1px solid var(--border);
  transition:var(--transition);
}
tbody tr:hover { background:rgba(255,255,255,0.03); }
tbody tr:last-child { border-bottom:none; }
tbody td { padding:14px 16px; font-size:14px; vertical-align:middle; }
.td-actions { display:flex; gap:6px; align-items:center; }

/* ── Modal ── */
.modal-overlay {
  position:fixed; inset:0; z-index:1000;
  background:rgba(0,0,0,0.75); backdrop-filter:blur(4px);
  display:flex; align-items:center; justify-content:center;
  padding:20px; opacity:0; pointer-events:none; transition:opacity 0.2s;
}
.modal-overlay.active { opacity:1; pointer-events:all; }
.modal {
  background:#0f1629; border:1px solid var(--border);
  border-radius:var(--radius-lg); padding:28px;
  width:100%; max-width:520px; max-height:90vh; overflow-y:auto;
  transform:scale(0.95) translateY(10px); transition:transform 0.25s;
}
.modal-overlay.active .modal { transform:scale(1) translateY(0); }
.modal-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; }
.modal-title { font-size:18px; font-weight:700; }
.modal-close { background:none; border:none; color:var(--text-muted); font-size:20px; line-height:1; padding:4px; border-radius:4px; transition:var(--transition); }
.modal-close:hover { color:var(--text-primary); background:var(--bg-input); }
.modal-footer { display:flex; gap:10px; justify-content:flex-end; margin-top:24px; }

/* ── Toast ── */
.toast-container { position:fixed; top:24px; right:24px; z-index:9999; display:flex; flex-direction:column; gap:10px; }
.toast {
  display:flex; align-items:center; gap:12px;
  padding:16px 20px; border-radius:var(--radius-md);
  font-size:14px; font-weight:600; min-width:280px;
  background:var(--bg-card);
  backdrop-filter:blur(16px); 
  border:1px solid var(--border);
  color:var(--text-primary);
  transform:translateX(120%); transition:transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow:var(--shadow-lg);
}
.toast.show { transform:translateX(0); }
.toast-success { border-left:4px solid var(--accent-green); }
.toast-error   { border-left:4px solid var(--accent-red); }
.toast-info    { border-left:4px solid var(--accent); }

/* ── Stat card ── */
.stat-card {
  background:var(--bg-card); border:1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius:var(--radius-md); padding:22px 24px;
  transition:var(--transition);
}
.stat-card:hover { border-color:rgba(16,185,129,0.3); box-shadow:var(--shadow-glow); }
.stat-card .stat-icon { font-size:28px; margin-bottom:12px; display:block; }
.stat-card .stat-value { font-size:32px; font-weight:800; color:var(--text-primary); line-height:1; }
.stat-card .stat-label { font-size:13px; color:var(--text-muted); margin-top:4px; font-weight:500; }
.stat-card .stat-sub { font-size:12px; color:var(--text-muted); margin-top:6px; }

/* ── Section header ── */
.section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:24px; flex-wrap:wrap; gap:12px; }
.section-title { font-size:20px; font-weight:700; }
.section-subtitle { font-size:14px; color:var(--text-muted); margin-top:2px; }

/* ── Search & filter bar ── */
.filter-bar { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:20px; }
.search-input-wrap { position:relative; flex:1; min-width:220px; }
.search-input-wrap i { position:absolute; left:14px; top:50%; transform:translateY(-50%); color:var(--text-muted); font-size:14px; }
.search-input-wrap .form-control { padding-left:40px; }

/* ── Pagination ── */
.pagination { display:flex; align-items:center; gap:6px; justify-content:center; margin-top:20px; }
.page-btn { padding:6px 12px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius-sm); color:var(--text-secondary); font-size:13px; transition:var(--transition); }
.page-btn:hover { border-color:var(--accent); color:var(--text-primary); }
.page-btn.active { background:var(--accent); border-color:var(--accent); color:#fff; }
.page-btn:disabled { opacity:0.4; cursor:not-allowed; }
.page-info { font-size:13px; color:var(--text-muted); margin:0 8px; }

/* ── Empty state ── */
.empty-state { text-align:center; padding:60px 20px; color:var(--text-muted); }
.empty-state .empty-icon { font-size:48px; margin-bottom:16px; opacity:0.5; display:block; }
.empty-state h3 { font-size:16px; font-weight:600; color:var(--text-secondary); margin-bottom:8px; }
.empty-state p { font-size:14px; }

/* ── Avatar ── */
.avatar {
  width:36px; height:36px; border-radius:50%;
  background:linear-gradient(135deg,var(--accent),var(--accent-cyan));
  display:inline-flex; align-items:center; justify-content:center;
  font-size:14px; font-weight:700; color:#fff;
  flex-shrink:0;
}
.user-pill {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* ── Tool card (dashboard) ── */
.tool-card {
  background:var(--bg-card); border:1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius:var(--radius-lg); padding:24px;
  transition:var(--transition); display:flex; flex-direction:column;
  gap:12px;
}
.tool-card:hover {
  border-color:rgba(16,185,129,0.4);
  box-shadow:0 8px 32px rgba(16,185,129,0.15), 0 0 0 1px rgba(16,185,129,0.1);
  transform:translateY(-3px);
}
.tool-card .tool-emoji { font-size:32px; line-height:1; }
.tool-card .tool-name { font-size:16px; font-weight:700; }
.tool-card .tool-desc { font-size:13px; color:var(--text-muted); line-height:1.6; flex:1; }
.tool-card .tool-footer { display:flex; justify-content:space-between; align-items:center; margin-top:4px; }

/* ── Sidebar ── */
.sidebar {
  position:fixed; top:0; left:0; width:var(--sidebar-w); height:100vh;
  background:var(--bg-secondary); border-right:1px solid var(--border);
  display:flex; flex-direction:column; z-index:100;
  transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}
.sidebar-logo { padding:20px 24px; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:12px; }
.sidebar-logo .logo-icon { width:36px; height:36px; background:linear-gradient(135deg,var(--accent),var(--accent-cyan)); border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:18px; font-weight:800; color:#fff; flex-shrink:0; }
.sidebar-logo .logo-text { font-size:17px; font-weight:800; background:linear-gradient(135deg,#fff,var(--accent-cyan)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; }
.sidebar-nav { flex:1; overflow-y:auto; padding:16px 12px; display:flex; flex-direction:column; gap:2px; }
.nav-item {
  display:flex; align-items:center; gap:12px;
  padding:11px 14px; border-radius:var(--radius-sm);
  font-size:14px; font-weight:500; color:var(--text-secondary);
  cursor:pointer; transition:var(--transition); border:none; background:none; width:100%; text-align:left;
}
.nav-item:hover { background:rgba(255,255,255,0.05); color:var(--text-primary); }
.nav-item.active { background:var(--nav-active-bg) !important; color:var(--nav-active-color) !important; font-weight:600; border-left: 2px solid var(--accent) !important; }
.nav-item.active .nav-icon { color:var(--nav-active-color) !important; }
.nav-icon { font-size:16px; width:20px; text-align:center; }
.sidebar-footer { padding:16px 12px; border-top:1px solid var(--border); }
.user-card { display:flex; align-items:center; gap:12px; padding:12px; border-radius:var(--radius-sm); background:var(--bg-card); border:1px solid var(--border); }
.user-card .user-info .user-name { font-size:13px; font-weight:600; }
.user-card .user-info .user-role { font-size:11px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; }

/* ── Admin layout ── */
.admin-layout { display:flex; min-height:100vh; }
.admin-main { flex:1; margin-left:var(--sidebar-w); display:flex; flex-direction:column; }
.admin-header {
  height:var(--header-h); background:rgba(8,13,26,0.98);
  border-bottom:1px solid var(--border);
  /* backdrop-filter removed — was causing major scroll lag */
  position:sticky; top:0; z-index:50;
  display:flex; align-items:center; justify-content:space-between;
  padding:0 28px;
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.admin-content { flex:1; padding:28px; overflow-y:auto; contain:layout style; }
.section-panel { display:none; }
.section-panel.active { display:block; }

/* ── Grid layouts ── */
.stats-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:16px; margin-bottom:28px; }
.tools-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:20px; }
.two-col { display:grid; grid-template-columns:1fr 1fr; gap:20px; align-items: start; }

/* ── Chart bar ── */
.chart-bar-wrap { display:flex; flex-direction:column; gap:10px; }
.chart-bar-row { display:flex; align-items:center; gap:12px; }
.chart-bar-label { font-size:13px; color:var(--text-secondary); width:160px; flex-shrink:0; display:flex; align-items:center; gap:6px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chart-bar-track { flex:1; height:8px; background:rgba(255,255,255,0.06); border-radius:99px; overflow:hidden; }
.chart-bar-fill { height:100%; background:linear-gradient(90deg,var(--accent),var(--accent-cyan)); border-radius:99px; transition:width 0.8s cubic-bezier(0.4,0,0.2,1); }
.chart-bar-val { font-size:13px; font-weight:600; color:var(--text-secondary); width:40px; text-align:right; }

/* ── Assignment panel ── */
.assign-grid { display:grid; grid-template-columns:280px 1fr; gap:20px; }
.assign-user-list { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-md); overflow:hidden; }
.assign-user-item { display:flex; align-items:center; gap:10px; padding:12px 16px; cursor:pointer; transition:var(--transition); border-bottom:1px solid var(--border); }
.assign-user-item:last-child { border-bottom:none; }
.assign-user-item:hover { background:rgba(255,255,255,0.04); }
.assign-user-item.selected { background:rgba(16,185,129,0.12); border-right:2px solid var(--accent); }
.assign-tools-panel { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-md); padding:20px; }
.tool-checkbox-item { display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:var(--radius-sm); transition:var(--transition); cursor:pointer; }
.tool-checkbox-item:hover { background:rgba(255,255,255,0.04); }
.tool-checkbox-item input[type=checkbox] { width:16px; height:16px; accent-color:var(--accent); cursor:pointer; }

/* ── Activity feed ── */
.activity-item { display:flex; align-items:flex-start; gap:12px; padding:12px 0; border-bottom:1px solid var(--border); }
.activity-item:last-child { border-bottom:none; }
.activity-dot { width:8px; height:8px; border-radius:50%; margin-top:6px; flex-shrink:0; }
.activity-dot-login  { background:var(--accent-green); }
.activity-dot-logout { background:var(--text-muted); }
.activity-dot-click  { background:var(--accent); }
.activity-meta { font-size:13px; color:var(--text-secondary); margin-top:2px; }
.activity-time { font-size:12px; color:var(--text-muted); margin-top:2px; }

/* ── Loading ── */
.loading-spinner { display:inline-block; width:18px; height:18px; border:2px solid rgba(255,255,255,0.2); border-top-color:#fff; border-radius:50%; animation:spin 0.7s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* ── Animated bg gradient (login page) ── */
.gradient-bg {
  position:fixed; inset:0; z-index:-1;
  background:radial-gradient(ellipse 80% 80% at 50% -20%,rgba(16,185,129,0.20) 0%,transparent 60%),
             radial-gradient(ellipse 60% 60% at 80% 50%,rgba(52,211,153,0.10) 0%,transparent 60%),
             radial-gradient(ellipse 50% 50% at 20% 80%,rgba(16,185,129,0.05) 0%,transparent 60%),
             var(--bg-primary);
}
.gradient-orb {
  position:absolute; border-radius:50%; filter:blur(60px);
  /* animation disabled — filter:blur + animation caused constant GPU drain */
  will-change: auto;
}
.orb-1 { width:400px; height:400px; background:rgba(16,185,129,0.08); top:-100px; right:-100px; }
.orb-2 { width:300px; height:300px; background:rgba(52,211,153,0.05); bottom:-50px; left:-80px; }

/* ── Divider ── */
.divider { height:1px; background:var(--border); margin:20px 0; }

/* ── Responsive ── */
@media (max-width:900px) {
  .sidebar { transform:translateX(-100%); }
  .sidebar.open { transform:translateX(0); box-shadow:var(--shadow-lg); }
  .admin-main { margin-left:0; }
  .admin-header { padding:0 16px; }
  .admin-content { padding:16px; }
  .assign-grid { grid-template-columns:1fr; }
  .two-col { grid-template-columns:1fr; }
  .stats-grid { grid-template-columns:1fr 1fr; }
  .tools-grid { grid-template-columns:1fr; }
}
@media (max-width:480px) {
  .stats-grid { grid-template-columns:1fr; }
}

/* ── Confirm dialog ── */
.confirm-text { font-size:15px; color:var(--text-secondary); margin-bottom:4px; }
.confirm-sub { font-size:13px; color:var(--text-muted); }

/* ══════════════════════════════════════════════════════
   FIX: Native <select> dropdown dark styling
   color-scheme:dark tells the OS/browser to render
   the expanded native dropdown list in dark colors.
   Works on Chrome 80+, Edge 80+, Firefox 64+.
   ══════════════════════════════════════════════════════ */
select.form-control {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 38px;
  /* dark caret arrow SVG embedded */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 12px 8px;
  color-scheme: dark;
}
select.form-control option {
  background-color: #0f1629 !important;
  color: #f1f5f9 !important;
}
/* Date inputs also honor color-scheme */
input[type="date"].form-control,
input[type="month"].form-control { color-scheme: dark; }

/* ══════════════════════════════════════════════════════
   LIGHT MODE THEME — toggled by adding class 'light' to <html>
   ══════════════════════════════════════════════════════ */
html.light {
  --accent:        #10b981; /* Green accent */
  --accent-glow:   rgba(16,185,129,0.25);
  --bg-primary:    #f8fafc;
  --bg-secondary:  #ffffff;
  --bg-card:       rgba(255,255,255,0.95);
  --bg-card-hover: #ffffff;
  --bg-input:      #ffffff;
  --bg-input-focus: #ffffff;
  --border:        rgba(16,185,129,0.2); /* Subtle green border */
  --border-focus:  var(--accent);
  --focus-glow:    rgba(16,185,129,0.15);
  --text-primary:  #064e3b; /* Very dark green */
  --text-secondary:#047857; /* Dark green */
  --text-muted:    #64748b;
  --shadow-sm:     0 2px 8px rgba(16,185,129,0.05);
  --shadow-md:     0 8px 24px rgba(16,185,129,0.08);
  --shadow-glow:   0 0 32px rgba(16,185,129,0.12);
  --nav-active-color: var(--accent);
  --nav-active-bg:  rgba(16,185,129,0.10);
  color-scheme: light;
}
html.light body { background: var(--bg-primary); color: var(--text-primary); }
html.light .gradient-bg { opacity: 0.04 !important; }
html.light .gradient-orb { opacity: 0.3; }
html.light .sidebar {
  background: #ffffff;
  border-right: 1px solid rgba(0,0,0,0.09);
  box-shadow: 2px 0 12px rgba(0,0,0,0.06);
}
html.light .sidebar-logo .logo-text {
  background: none;
  -webkit-text-fill-color: var(--accent);
  color: var(--accent);
}
html.light .nav-item { color: #475569; }
html.light .nav-item:hover { background: rgba(0,0,0,0.05); color: #0f172a; }
html.light .nav-item.active { background: rgba(16,185,129,0.10); }
html.light .user-card { background: #f8fafc; border-color: rgba(0,0,0,0.08); }
html.light .user-name { color: #0f172a; }
html.light .user-role { color: #64748b; }
html.light .admin-header {
  background: rgba(255,255,255,0.96);
  border-bottom-color: rgba(0,0,0,0.08);
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}
html.light .page-title { color: #0f172a; }
html.light .page-sub { color: #64748b; }
html.light .glass {
  background: rgba(255,255,255,0.92);
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
html.light .glass:hover { background: rgba(255,255,255,1); }
html.light .stat-card {
  background: #ffffff;
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
html.light .stat-card-nav:hover {
  background: #ffffff;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--card-accent, var(--accent));
}
html.light .stat-value { color: #0f172a; }
html.light .stat-label { color: #475569; }
html.light .stat-sub { color: #64748b; }
html.light .form-control::placeholder { color: #94a3b8; }
html.light select.form-control { color-scheme: light; }
html.light select.form-control option { background-color: #ffffff !important; color: #0f172a !important; }
html.light input[type="date"].form-control { color-scheme: light; }
html.light .btn-secondary { background: rgba(0,0,0,0.05); color: #334155; border-color: rgba(0,0,0,0.10); }
html.light .btn-secondary:hover { background: rgba(0,0,0,0.09); color: #0f172a; }
html.light .btn-icon { background: rgba(0,0,0,0.05); color: #475569; border-color: transparent; }
html.light .modal { background: #ffffff; border-color: rgba(0,0,0,0.10); }
html.light .modal-header { border-bottom-color: rgba(0,0,0,0.08); }
html.light .modal-title { color: #0f172a; }
html.light .modal-overlay { background: rgba(0,0,0,0.35); }
html.light thead th { color: #64748b; border-bottom-color: rgba(0,0,0,0.08); background: rgba(0,0,0,0.02); }
html.light tbody tr { border-bottom-color: rgba(0,0,0,0.06); }
html.light tbody tr:hover { background: rgba(16,185,129,0.03); }
html.light .user-pill { background: rgba(0,0,0,0.05) !important; border-color: rgba(0,0,0,0.09) !important; }
html.light .activity-item { border-bottom-color: rgba(0,0,0,0.06); }
html.light .activity-dot-login { background: #10b981; }
html.light .activity-dot-logout { background: #94a3b8; }
html.light .activity-dot-click  { background: var(--accent); }
html.light .page-btn { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.09); color: #475569; }
html.light .page-btn.active { background: var(--accent); color: #ffffff; border-color: var(--accent); }
html.light .page-btn:hover:not(.active) { background: rgba(0,0,0,0.09); }

html.light .toast { background: #ffffff; border: 1px solid rgba(16,185,129,0.2); color: #064e3b; box-shadow: 0 8px 24px rgba(16,185,129,0.12); }
html.light .toast-success { border-left: 5px solid #10b981; }
html.light .toast-error { border-left: 5px solid #ef4444; }

html.light .badge-admin { background: rgba(16,185,129,0.12); color: #10b981; }
html.light .badge-user  { background: rgba(16,185,129,0.10); color: #059669; }
html.light .chart-bar-fill { background: linear-gradient(90deg, var(--accent), var(--accent-cyan)); }
html.light .chart-bar-track { background: rgba(0,0,0,0.07); }
html.light .action-tag.tag-login  { background: rgba(16,185,129,0.12); color: #059669; }
html.light .action-tag.tag-logout { background: rgba(100,116,139,0.10); color: #64748b; }
html.light .action-tag.tag-click  { background: rgba(16,185,129,0.10); color: #10b981; }

/* ── Theme toggle button ── */
.theme-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px; padding: 6px 14px;
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  cursor: pointer; transition: var(--transition); white-space: nowrap;
}
.theme-btn:hover { border-color: var(--accent); color: var(--text-primary); background: rgba(255, 255, 255, 0.09); transform: translateY(-1px); }
.theme-btn .theme-icon { font-size: 14px; }

html.light .theme-btn {
  background: rgba(0, 0, 0, 0.04); border-color: rgba(0, 0, 0, 0.08);
  color: var(--text-secondary);
}
html.light .theme-btn:hover {
  background: rgba(0, 0, 0, 0.07); border-color: var(--accent);
  color: var(--text-primary);
}

/* ── Stat cards: clickable nav ── */
.stat-card-nav { cursor: pointer; transition: var(--transition); }
.stat-card-nav:hover { border-color: var(--accent) !important; transform: translateY(-3px); box-shadow: 0 0 0 1px var(--accent), var(--shadow-glow) !important; }
.stat-card-nav:hover .stat-icon { transform: scale(1.2); }
.stat-icon { transition: transform 0.2s ease; display: inline-block; }

/* ══════════════════════════════════════════════════════
   TOOL ASSIGNMENTS REDESIGN
   ══════════════════════════════════════════════════════ */

/* User picker grid (shown when no user selected) */
.assign-user-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.assign-u-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); cursor: pointer;
  transition: var(--transition);
}
.assign-u-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.assign-u-card .u-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.assign-u-card .u-email { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.assign-u-card .u-badge { margin-left: auto; flex-shrink: 0; }
html.light .assign-u-card { background: #ffffff; border-color: rgba(0,0,0,0.09); box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
html.light .assign-u-card:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(16,185,129,0.12); }

/* Selected user chip header */
.assign-chip-header {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; margin-bottom: 20px;
  background: rgba(16,185,129,0.07); border: 1px solid rgba(16,185,129,0.22);
  border-radius: var(--radius-md);
}
.assign-chip-header .chip-info { flex: 1; min-width: 0; }
.assign-chip-header .chip-name { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.assign-chip-header .chip-count { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.assign-chip-header .chip-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(239,68,68,0.10); border: 1px solid rgba(239,68,68,0.2);
  color: var(--accent-red); font-size: 16px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--transition); flex-shrink: 0;
}
.assign-chip-header .chip-close:hover { background: rgba(239,68,68,0.2); }
html.light .assign-chip-header { background: rgba(16,185,129,0.05); }

/* Tool toggle cards */
.tool-toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 8px;
}
.tool-toggle-card {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: var(--transition); user-select: none;
}
.tool-toggle-card:hover { border-color: rgba(16,185,129,0.35); background: var(--bg-card-hover); }
.tool-toggle-card.on { border-color: rgba(16,185,129,0.5); background: rgba(16,185,129,0.07); }
html.light .tool-toggle-card { background: #ffffff; border-color: rgba(0,0,0,0.09); }
html.light .tool-toggle-card:hover { border-color: rgba(16,185,129,0.3); background: rgba(16,185,129,0.03); }
html.light .tool-toggle-card.on { border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.06); }
.ttc-check {
  width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0;
  border: 2px solid var(--border); display: flex; align-items: center;
  justify-content: center; font-size: 11px; transition: var(--transition);
}
.tool-toggle-card.on .ttc-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.ttc-icon { font-size: 20px; flex-shrink: 0; }
.ttc-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ttc-cat  { font-size: 11px; color: var(--text-muted); }
.assign-tools-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; flex-wrap: wrap; gap: 10px;
}

/* ── Notifications Panel ── */
.notification-trigger { position: relative; cursor: pointer; border:none; background:none; padding:4px; display:inline-flex; align-items:center; justify-content:center; color:var(--text-muted); transition:var(--transition); border-radius:50%; }
.notification-trigger:hover { color:var(--text-primary); background:var(--bg-input); }
.notification-trigger .badge { 
  position: absolute; top: 2px; right: 2px; 
  width: 8px; height: 8px; border-radius: 50%; 
  background: var(--accent-red); 
  border: 2px solid var(--bg-card); 
}
.notifications-wrapper { position: relative; display: inline-flex; }
.notifications-panel {
  position: absolute; top: 100%; right: 0; margin-top:8px;
  width: 380px; max-width: calc(100vw - 40px);
  background: var(--bg-card);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transform: scale(0.95) translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  overflow: hidden;
}
.notifications-panel.active { opacity: 1; pointer-events: auto; transform: scale(1) translateY(0); }
.notif-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.notif-header h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); margin:0;}
.notif-header .badge { background: rgba(16,185,129,0.15); color: var(--accent); padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.notif-list { display: flex; flex-direction: column; max-height: 400px; overflow-y: auto; }
.notif-item { padding: 16px 20px; display: flex; gap: 14px; border-bottom: 1px solid var(--border); transition: background 0.2s; cursor: pointer; }
.notif-item:hover { background: rgba(255,255,255,0.03); }
.notif-item:last-child { border-bottom: none; }
.notif-icon { width: 36px; height: 36px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 18px; }
.notif-info { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.notif-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; margin:0;}
.notif-time { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-top: 8px; display: block; }
.notif-footer { padding: 12px; text-align: center; border-top: 1px solid var(--border); background: rgba(255,255,255,0.02); }
.notif-footer a { font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; transition: var(--transition); }
.notif-footer a:hover { color: var(--accent-light); }
html.light .notifications-panel { background: #ffffff; border-color: rgba(0,0,0,0.09); }
html.light .notif-item:hover { background: rgba(0,0,0,0.03); }
html.light .notif-footer { background: rgba(0,0,0,0.02); }
html.light .notification-trigger .badge { border-color: #ffffff; }

/* ── Settings Sections SPA ── */
.settings-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 992px) { .settings-grid { grid-template-columns: 2fr 1fr; } }
.settings-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 24px; }
.settings-section-title { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; margin-bottom: 24px; color: var(--text-primary); }
.settings-section-title i { color: var(--accent); font-size: 20px; }
.form-row { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 16px; }
@media (min-width: 600px) { .form-row { grid-template-columns: 1fr 1fr; } }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Toggle Switch native */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--bg-input); transition: .3s; border-radius: 24px; border: 1px solid var(--border); }
.toggle-slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: var(--text-muted); transition: .3s; border-radius: 50%; }
.toggle-switch input:checked + .toggle-slider { background-color: rgba(16,185,129,0.2); border-color: var(--accent); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); background-color: var(--accent); }
html.light .toggle-switch input:checked + .toggle-slider { background-color: var(--accent); }
html.light .toggle-switch input:checked + .toggle-slider:before { background-color: #fff; }


