/* ============================================================
   ISO/IEC 27000:2020 Assessment Platform - Design System
   Premium Enterprise-Grade Aesthetics
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- CSS Custom Properties ---- */
:root {
  /* Primary palette */
  --primary-50: #eef2ff;
  --primary-100: #dbe4ff;
  --primary-200: #bfcfff;
  --primary-300: #93aeff;
  --primary-400: #6384fc;
  --primary-500: #3d5af5;
  --primary-600: #2a3dea;
  --primary-700: #222fd6;
  --primary-800: #2128ad;
  --primary-900: #212889;

  /* Accent / Teal */
  --accent-50: #edfcf9;
  --accent-100: #d2f7f0;
  --accent-200: #a9ede2;
  --accent-300: #72ddd0;
  --accent-400: #3ec5b8;
  --accent-500: #24aa9f;
  --accent-600: #1a8882;
  --accent-700: #196d6a;
  --accent-800: #195756;
  --accent-900: #194848;

  /* Semantic */
  --success-50: #ecfdf5;
  --success-100: #d1fae5;
  --success-500: #10b981;
  --success-600: #059669;
  --success-700: #047857;

  --warning-50: #fffbeb;
  --warning-100: #fef3c7;
  --warning-500: #f59e0b;
  --warning-600: #d97706;

  --danger-50: #fef2f2;
  --danger-100: #fee2e2;
  --danger-500: #ef4444;
  --danger-600: #dc2626;
  --danger-700: #b91c1c;

  --info-50: #eff6ff;
  --info-500: #3b82f6;
  --info-600: #2563eb;

  /* Neutral - Light mode */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --gray-950: #020617;

  /* Theme tokens */
  --bg-primary: #f0f2f6;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f8fafc;
  --bg-sidebar: linear-gradient(195deg, #1a1f36 0%, #111827 100%);
  --bg-sidebar-solid: #1a1f36;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #ffffff;
  --bg-modal-overlay: rgba(15, 23, 42, 0.6);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;
  --text-link: var(--primary-600);
  --text-sidebar: #e2e8f0;
  --text-sidebar-active: #ffffff;
  --text-sidebar-muted: #94a3b8;

  --border-primary: #e2e8f0;
  --border-secondary: #f1f5f9;
  --border-focus: var(--primary-500);
  --border-input: #cbd5e1;

  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --shadow-glow: 0 0 20px rgba(61, 90, 245, 0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;

  --sidebar-width: 272px;
  --sidebar-collapsed-width: 72px;
  --header-height: 64px;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ---- Dark Mode ---- */
[data-theme="dark"] {
  --bg-primary: #0b0f1a;
  --bg-secondary: #111827;
  --bg-tertiary: #1e293b;
  --bg-sidebar: linear-gradient(195deg, #0d1117 0%, #070b14 100%);
  --bg-sidebar-solid: #0d1117;
  --bg-card: #1e293b;
  --bg-card-hover: #263348;
  --bg-input: #1e293b;
  --bg-modal-overlay: rgba(0, 0, 0, 0.7);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-link: var(--primary-400);
  --text-sidebar: #cbd5e1;
  --text-sidebar-active: #ffffff;
  --text-sidebar-muted: #64748b;

  --border-primary: #1e293b;
  --border-secondary: #334155;
  --border-input: #475569;

  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -4px rgba(0,0,0,0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.5), 0 8px 10px -6px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px rgba(61, 90, 245, 0.25);
}

/* ---- Global Reset ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color var(--transition-base), color var(--transition-base);
}

a { color: var(--text-link); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--primary-700); }

img { max-width: 100%; display: block; }

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}
h1 { font-size: 1.875rem; letter-spacing: -0.025em; }
h2 { font-size: 1.5rem; letter-spacing: -0.02em; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }

.text-muted { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-primary-color { color: var(--primary-600); }
.text-success { color: var(--success-600); }
.text-warning { color: var(--warning-600); }
.text-danger { color: var(--danger-600); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ---- Login Page ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 35%, #0f172a 65%, #1a1f36 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(61, 90, 245, 0.15) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  border-radius: 50%;
  animation: floatOrb 8s ease-in-out infinite;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(36, 170, 159, 0.1) 0%, transparent 70%);
  bottom: -150px;
  left: -150px;
  border-radius: 50%;
  animation: floatOrb 10s ease-in-out infinite reverse;
}

@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  position: relative;
  z-index: 2;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), var(--shadow-glow);
  animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.login-logo .shield-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
  box-shadow: 0 4px 12px rgba(61, 90, 245, 0.3);
}

.login-logo h1 {
  font-size: 1.5rem;
  background: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  text-align: center;
  color: #94a3b8;
  font-size: 0.875rem;
  margin-bottom: 32px;
}

.login-card .form-group {
  margin-bottom: 20px;
}

.login-card label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: #f1f5f9;
  font-size: 0.9375rem;
  font-family: var(--font-family);
  transition: all var(--transition-fast);
  outline: none;
}

.login-card input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(61, 90, 245, 0.2);
}

.login-card input::placeholder {
  color: #475569;
}

.login-card .btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 8px;
  position: relative;
  overflow: hidden;
}

.login-card .btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(61, 90, 245, 0.4);
}

.login-card .btn-login:active {
  transform: translateY(0);
}

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  margin-bottom: 16px;
  display: none;
}

.login-credentials {
  margin-top: 24px;
  padding: 16px;
  background: rgba(61, 90, 245, 0.08);
  border: 1px solid rgba(61, 90, 245, 0.15);
  border-radius: var(--radius-md);
}

.login-credentials h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-400);
  margin-bottom: 8px;
}

.login-credentials p {
  font-size: 0.8125rem;
  color: #94a3b8;
  line-height: 1.5;
}

.login-credentials code {
  background: rgba(255,255,255,0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: #e2e8f0;
}

/* ---- Layout ---- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: width var(--transition-base), transform var(--transition-base);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  flex-shrink: 0;
}

.sidebar-brand {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-sidebar-active);
  white-space: nowrap;
}

.sidebar-brand small {
  display: block;
  font-size: 0.6875rem;
  font-weight: 400;
  color: var(--text-sidebar-muted);
  margin-top: 1px;
}

.sidebar-nav {
  padding: 12px;
  flex: 1;
}

.sidebar-section-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-sidebar-muted);
  padding: 16px 12px 8px;
  font-weight: 600;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-sidebar);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  margin-bottom: 2px;
  white-space: nowrap;
  user-select: none;
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-sidebar-active);
}

.sidebar-item.active {
  background: rgba(61, 90, 245, 0.15);
  color: var(--primary-400);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary-500);
  border-radius: 0 3px 3px 0;
}

.sidebar-item .icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-item .badge {
  margin-left: auto;
  background: var(--primary-500);
  color: white;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  min-width: 22px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sidebar-user:hover {
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary-400), var(--accent-400));
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-sidebar-active);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.6875rem;
  color: var(--text-sidebar-muted);
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  transition: margin-left var(--transition-base);
}

/* ---- Header ---- */
.top-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.header-breadcrumb .sep {
  color: var(--text-tertiary);
}

.header-breadcrumb .current {
  color: var(--text-primary);
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 20px;
  transition: all var(--transition-fast);
}

.header-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.theme-toggle {
  position: relative;
}

.mobile-menu-btn {
  display: none;
}

/* ---- Page Content ---- */
.page-content {
  padding: 28px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-header-info h1 {
  font-size: 1.625rem;
  margin-bottom: 4px;
}

.page-header-info p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.page-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---- Stat Cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(61, 90, 245, 0.04) 0%, transparent 70%);
  border-radius: 50%;
  transform: translate(30px, -30px);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-50); color: var(--primary-600); }
.stat-icon.green { background: var(--success-50); color: var(--success-600); }
.stat-icon.amber { background: var(--warning-50); color: var(--warning-600); }
.stat-icon.red { background: var(--danger-50); color: var(--danger-600); }
.stat-icon.teal { background: var(--accent-50); color: var(--accent-600); }
.stat-icon.purple { background: #f3f0ff; color: #7c3aed; }

[data-theme="dark"] .stat-icon.blue { background: rgba(61, 90, 245, 0.12); }
[data-theme="dark"] .stat-icon.green { background: rgba(16, 185, 129, 0.12); }
[data-theme="dark"] .stat-icon.amber { background: rgba(245, 158, 11, 0.12); }
[data-theme="dark"] .stat-icon.red { background: rgba(239, 68, 68, 0.12); }
[data-theme="dark"] .stat-icon.teal { background: rgba(36, 170, 159, 0.12); }
[data-theme="dark"] .stat-icon.purple { background: rgba(124, 58, 237, 0.12); }

.stat-info {
  flex: 1;
  min-width: 0;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-change {
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 4px;
}

.stat-change.positive { color: var(--success-600); }
.stat-change.negative { color: var(--danger-600); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(61, 90, 245, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 4px 15px rgba(61, 90, 245, 0.4);
  transform: translateY(-1px);
  color: white;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-primary);
}
.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-input);
}

.btn-success {
  background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}
.btn-success:hover {
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger-500) 0%, var(--danger-600) 100%);
  color: white;
}
.btn-danger:hover { color: white; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 8px 12px;
}
.btn-ghost:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.btn-sm { padding: 6px 14px; font-size: 0.8125rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-icon { padding: 8px; width: 38px; height: 38px; }

/* ---- Forms ---- */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--danger-500);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: var(--font-family);
  color: var(--text-primary);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(61, 90, 245, 0.15);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8.825c-.2 0-.4-.075-.55-.225l-3-3a.776.776 0 0 1 0-1.1.776.776 0 0 1 1.1 0L6 6.95 8.45 4.5a.776.776 0 0 1 1.1 0 .776.776 0 0 1 0 1.1l-3 3c-.15.15-.35.225-.55.225Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-help {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.form-error {
  font-size: 0.75rem;
  color: var(--danger-500);
  margin-top: 4px;
}

/* ---- Tables ---- */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-primary);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead {
  background: var(--bg-tertiary);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border-primary);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-secondary);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: var(--success-50); color: var(--success-700); }
.badge-warning { background: var(--warning-50); color: var(--warning-600); }
.badge-danger { background: var(--danger-50); color: var(--danger-700); }
.badge-info { background: var(--info-50); color: var(--info-600); }
.badge-neutral { background: var(--gray-100); color: var(--gray-600); }
.badge-primary { background: var(--primary-50); color: var(--primary-700); }

[data-theme="dark"] .badge-success { background: rgba(16,185,129,0.15); color: #6ee7b7; }
[data-theme="dark"] .badge-warning { background: rgba(245,158,11,0.15); color: #fcd34d; }
[data-theme="dark"] .badge-danger { background: rgba(239,68,68,0.15); color: #fca5a5; }
[data-theme="dark"] .badge-info { background: rgba(59,130,246,0.15); color: #93bbfd; }
[data-theme="dark"] .badge-neutral { background: rgba(148,163,184,0.15); color: #cbd5e1; }
[data-theme="dark"] .badge-primary { background: rgba(61,90,245,0.15); color: #93aeff; }

/* ---- Progress Bars ---- */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

[data-theme="dark"] .progress-bar {
  background: var(--gray-700);
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
  background: linear-gradient(90deg, var(--primary-500), var(--accent-500));
}

.progress-fill.green { background: linear-gradient(90deg, var(--success-500), #34d399); }
.progress-fill.amber { background: linear-gradient(90deg, var(--warning-500), #fbbf24); }
.progress-fill.red { background: linear-gradient(90deg, var(--danger-500), #f87171); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-modal-overlay);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-primary);
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 18px;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-primary);
}

.modal.modal-lg {
  max-width: 720px;
}

/* ---- Charts ---- */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.chart-card canvas {
  max-height: 300px;
}

/* ---- Compliance Gauge ---- */
.gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
}

.gauge-svg {
  width: 200px;
  height: 120px;
  overflow: visible;
}

.gauge-bg {
  fill: none;
  stroke: var(--gray-200);
  stroke-width: 18;
}

[data-theme="dark"] .gauge-bg {
  stroke: var(--gray-700);
}

.gauge-fill {
  fill: none;
  stroke-width: 18;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease-out;
}

.gauge-value {
  font-size: 2rem;
  font-weight: 800;
  text-anchor: middle;
  fill: var(--text-primary);
}

.gauge-label {
  font-size: 0.75rem;
  fill: var(--text-secondary);
  text-anchor: middle;
}

/* ---- Risk Heatmap ---- */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
}

.heatmap-cell {
  aspect-ratio: 1.2;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: default;
  transition: transform var(--transition-fast);
  position: relative;
}

.heatmap-cell:hover {
  transform: scale(1.05);
  z-index: 2;
}

.heatmap-cell .cell-title {
  font-size: 0.625rem;
  font-weight: 500;
  opacity: 0.9;
  text-align: center;
  line-height: 1.2;
  padding: 0 4px;
  margin-bottom: 2px;
}

.heatmap-cell .cell-value {
  font-size: 1.125rem;
  font-weight: 700;
}

.heat-critical { background: rgba(239, 68, 68, 0.9); color: white; }
.heat-high { background: rgba(245, 158, 11, 0.85); color: white; }
.heat-medium { background: rgba(234, 179, 8, 0.8); color: #422006; }
.heat-low { background: rgba(16, 185, 129, 0.8); color: white; }

/* ---- Dept Comparison Bars ---- */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 10px 0;
}

.bar-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bar-label {
  width: 140px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  flex: 1;
  height: 28px;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

[data-theme="dark"] .bar-track {
  background: var(--gray-700);
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  transition: width 0.8s ease-out;
  min-width: fit-content;
}

.bar-fill.gradient-1 { background: linear-gradient(90deg, var(--primary-500), var(--primary-400)); }
.bar-fill.gradient-2 { background: linear-gradient(90deg, var(--accent-500), var(--accent-400)); }
.bar-fill.gradient-3 { background: linear-gradient(90deg, var(--success-500), var(--success-400)); }
.bar-fill.gradient-4 { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

/* ---- Assessment ---- */
.assessment-progress {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.assessment-progress .progress-info {
  flex-shrink: 0;
}

.assessment-progress .progress-bar {
  flex: 1;
  height: 12px;
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  transition: border-color var(--transition-fast);
}

.question-card:hover {
  border-color: var(--primary-300);
}

.question-card.answered {
  border-color: var(--success-500);
  border-left-width: 3px;
}

.question-number {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.question-text {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.question-control {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

/* Maturity Scale */
.maturity-scale {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.maturity-option {
  flex: 1;
  min-width: 60px;
  padding: 12px 8px;
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-secondary);
}

.maturity-option:hover {
  border-color: var(--primary-400);
  background: var(--primary-50);
}

[data-theme="dark"] .maturity-option:hover {
  background: rgba(61, 90, 245, 0.1);
}

.maturity-option.selected {
  border-color: var(--primary-500);
  background: var(--primary-50);
  color: var(--primary-700);
}

[data-theme="dark"] .maturity-option.selected {
  background: rgba(61, 90, 245, 0.15);
  color: var(--primary-300);
}

.maturity-option .level {
  font-size: 1.25rem;
  font-weight: 700;
  display: block;
}

.maturity-option .level-label {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  display: block;
  margin-top: 2px;
}

/* Yes/No Toggle */
.yesno-group {
  display: flex;
  gap: 12px;
}

.yesno-btn {
  padding: 12px 32px;
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font-family);
  transition: all var(--transition-fast);
  color: var(--text-primary);
}

.yesno-btn:hover {
  border-color: var(--primary-400);
}

.yesno-btn.selected.yes {
  border-color: var(--success-500);
  background: var(--success-50);
  color: var(--success-700);
}

.yesno-btn.selected.no {
  border-color: var(--danger-500);
  background: var(--danger-50);
  color: var(--danger-700);
}

[data-theme="dark"] .yesno-btn.selected.yes { background: rgba(16,185,129,0.15); color: #6ee7b7; }
[data-theme="dark"] .yesno-btn.selected.no { background: rgba(239,68,68,0.15); color: #fca5a5; }

/* ---- Tabs ---- */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-primary);
  margin-bottom: 24px;
  gap: 0;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  position: relative;
  transition: color var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--primary-600);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary-500);
  border-radius: 2px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Search Bar ---- */
.search-bar {
  position: relative;
  max-width: 320px;
  margin-bottom: 16px;
}

.search-bar input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: var(--font-family);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.search-bar input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(61, 90, 245, 0.12);
}

.search-bar .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 16px;
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.125rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.875rem;
  max-width: 400px;
  margin: 0 auto;
}

/* ---- Toast Notifications ---- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: white;
  min-width: 280px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease-out;
  display: flex;
  align-items: center;
  gap: 10px;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.success { background: linear-gradient(135deg, var(--success-600), var(--success-500)); }
.toast.error { background: linear-gradient(135deg, var(--danger-600), var(--danger-500)); }
.toast.warning { background: linear-gradient(135deg, var(--warning-600), var(--warning-500)); }
.toast.info { background: linear-gradient(135deg, var(--info-600), var(--info-500)); }

/* ---- Audit Log ---- */
.audit-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.audit-entry {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.audit-entry:hover {
  background: var(--bg-card-hover);
}

.audit-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.audit-dot.login { background: var(--info-500); }
.audit-dot.create { background: var(--success-500); }
.audit-dot.update { background: var(--warning-500); }
.audit-dot.delete { background: var(--danger-500); }

.audit-info {
  flex: 1;
  min-width: 0;
}

.audit-action {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.audit-detail {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.audit-time {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* ---- Utility ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.p-4 { padding: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--gray-600); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .mobile-menu-btn {
    display: flex;
  }
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .page-content { padding: 16px; }
  .page-header { flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr; }
  .top-header { padding: 0 16px; }
  .maturity-scale { flex-wrap: wrap; }
  .maturity-option { min-width: 55px; }
  .bar-label { width: 100px; font-size: 0.75rem; }
}

@media (max-width: 480px) {
  .login-card { padding: 32px 24px; }
  .yesno-group { flex-direction: column; }
  .modal { margin: 10px; }
}
