/* ========= Self-hosted fonts ========= */
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 300; font-display: swap; src: url('/fonts/dm-sans-300.ttf') format('truetype'); }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/dm-sans-400.ttf') format('truetype'); }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/dm-sans-500.ttf') format('truetype'); }
@font-face { font-family: 'Syne'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/syne-400.ttf') format('truetype'); }
@font-face { font-family: 'Syne'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/syne-500.ttf') format('truetype'); }
@font-face { font-family: 'Syne'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/syne-700.ttf') format('truetype'); }

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

:root {
  /* ---- New design tokens (light) ---- */
  --bg: #f4f5f9;
  --bg2: #ffffff;
  --bg3: #f0f1f6;
  --bg4: #e8eaf2;
  --border: #dde0ec;
  --border2: #c8ccdc;
  --text: #1a1e30;
  --text2: #5a6280;
  --text3: #8a90aa;
  --accent: #185FA5;
  --accent2: #e6f1fb;
  --tag-bg: #e6f1fb;
  --tag-text: #185FA5;
  --pri-high-bg: #fcebeb;
  --pri-high: #A32D2D;
  --pri-med-bg: #faeeda;
  --pri-med: #854F0B;
  --pri-low-bg: #eaf3de;
  --pri-low: #3B6D11;
  --risk-open-bg: #faeeda;
  --risk-open: #854F0B;
  --risk-res-bg: #eaf3de;
  --risk-res: #3B6D11;
  --btn-bg: #f0f1f6;
  --btn-hover: #e4e6f0;
  /* ---- Legacy tokens mapped to new ---- */
  --blue: #185FA5;
  --blue-light: #4c9aff;
  --blue-bg: #e6f1fb;
  --green: #00875a;
  --green-bg: #e3fcef;
  --red: #de350b;
  --red-bg: #ffebe6;
  --orange: #ff8b00;
  --orange-bg: #fff7e6;
  --white: #ffffff;
  --gray-100: #f4f5f9;
  --gray-200: #e8eaf2;
  --gray-300: #dde0ec;
  --gray-400: #c8ccdc;
  --gray-500: #8a90aa;
  --gray-600: #5a6280;
  --gray-700: #3a4260;
  --gray-800: #1a1e30;
  --gray-900: #0d1020;
  --sidebar-w: 240px;
  --header-h: 52px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(9,30,66,.08), 0 0 0 1px rgba(9,30,66,.04);
  --shadow-md: 0 4px 12px rgba(9,30,66,.12);
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  transition: background-color .2s, color .2s;
}

/* ========= Dark Mode ========= */
body[data-theme="dark"] {
  /* ---- New design tokens (dark) ---- */
  --bg: #0b0d14;
  --bg2: #0f1118;
  --bg3: #161825;
  --bg4: #1c2030;
  --border: #2a2e42;
  --border2: #353a52;
  --text: #e8eaf2;
  --text2: #8a90aa;
  --text3: #5a6280;
  --accent: #63a0ff;
  --accent2: #1a2a4a;
  --tag-bg: #1c2338;
  --tag-text: #63a0ff;
  --pri-high-bg: #2a1a1a;
  --pri-high: #e06060;
  --pri-med-bg: #2a2010;
  --pri-med: #e0a040;
  --pri-low-bg: #102218;
  --pri-low: #40b870;
  --risk-open-bg: #2a1a10;
  --risk-open: #e08040;
  --risk-res-bg: #102218;
  --risk-res: #40b870;
  --btn-bg: #1c2030;
  --btn-hover: #252a40;
  /* ---- Legacy tokens (dark) ---- */
  --blue: #63a0ff;
  --blue-light: #63a0ff;
  --blue-bg: #1a2a4a;
  --green: #40b870;
  --green-bg: #102218;
  --red: #e06060;
  --red-bg: #2a1a1a;
  --orange: #e0a040;
  --orange-bg: #2a2010;
  --white: #0f1118;
  --gray-100: #0b0d14;
  --gray-200: #1c2030;
  --gray-300: #2a2e42;
  --gray-400: #353a52;
  --gray-500: #5a6280;
  --gray-600: #8a90aa;
  --gray-700: #b0b8cc;
  --gray-800: #e8eaf2;
  --gray-900: #f0f4ff;
  --shadow: 0 1px 4px rgba(0,0,0,.5), 0 0 0 1px rgba(0,0,0,.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,.6);
}

/* ========= Theme Toggle ========= */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
  font-size: 14px; font-weight: 500;
  color: var(--gray-700);
}
.theme-toggle input { display: none; }
.theme-toggle-track {
  width: 44px; height: 24px;
  background: var(--gray-300);
  border-radius: 100px;
  position: relative;
  flex-shrink: 0;
  transition: background .2s;
}
.theme-toggle input:checked ~ .theme-toggle-track { background: var(--blue); }
.theme-toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.theme-toggle input:checked ~ .theme-toggle-track .theme-toggle-thumb {
  transform: translateX(20px);
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; }
input, textarea, select { font: inherit; }

/* ========= Spinner ========= */
.spinner-wrap { display: flex; align-items: center; justify-content: center; height: 100vh; }
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--gray-300);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========= Toast ========= */
#toast-container {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 9999;
}
.toast {
  padding: 10px 16px; border-radius: var(--radius);
  color: var(--white); font-size: 14px;
  box-shadow: var(--shadow-md);
  animation: slide-in .2s ease;
  max-width: 320px;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.info { background: var(--blue); }
@keyframes slide-in { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ========= Modal ========= */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(9,30,66,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-md);
}
.modal h2 { margin-bottom: 20px; font-size: 18px; color: var(--text); }
.modal-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none;
  font-size: 22px; color: var(--text2);
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* ========= Layout ========= */
#app { min-height: 100vh; }

.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ========= Header/Navbar ========= */
.navbar {
  height: var(--header-h);
  background: var(--bg2);
  border-bottom: 0.5px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
}
.navbar-brand {
  font-family: 'Syne', sans-serif;
  font-size: 16px; font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 8px;
  text-decoration: none;
}
.navbar-brand:hover { opacity: 0.8; }
.navbar-logo-light { width: 26px; height: 26px; object-fit: contain; display: block; }
.navbar-logo-dark  { width: 26px; height: 26px; object-fit: contain; display: none; }
body[data-theme="dark"] .navbar-logo-light { display: none; }
body[data-theme="dark"] .navbar-logo-dark  { display: block; }
.navbar-sep { width: 0.5px; height: 20px; background: var(--border); margin: 0 4px; }
.navbar-spacer { flex: 1; }
.navbar-username {
  font-size: 13px; font-weight: 500;
  color: var(--text2);
}
.navbar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent2);
  border: 1.5px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  color: var(--accent);
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity .15s;
}
button.navbar-avatar:hover { opacity: 0.8; }
.navbar-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nav-icon-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none;
  color: var(--text2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.nav-icon-btn:hover { background: var(--btn-hover); color: var(--text); }
.navbar-user-menu { position: relative; }
.user-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  min-width: 140px;
  z-index: 200;
  overflow: hidden;
}
.user-dropdown .dropdown-item {
  display: block; width: 100%;
  padding: 8px 14px;
  text-align: left;
  background: none; border: none;
  font-size: 13px; font-family: 'DM Sans', sans-serif;
  color: var(--text);
  cursor: pointer;
  transition: background .12s;
}
.user-dropdown .dropdown-item:hover { background: var(--btn-hover); }
.user-dropdown .dropdown-item-danger { color: var(--red); }
.user-dropdown .dropdown-item-danger:hover { background: var(--red-bg); }
.user-dropdown .dropdown-divider { height: 0.5px; background: var(--border); margin: 2px 0; }
.nav-link {
  background: var(--btn-bg);
  border: 0.5px solid var(--border);
  color: var(--text2);
  font-size: 13px;
  padding: 5px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--btn-hover); color: var(--text); }

/* ========= Main content ========= */
.page-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ========= Auth Pages ========= */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0052cc 0%, #172b4d 100%);
}
.auth-card {
  background: var(--white);
  border-radius: 8px;
  padding: 40px;
  width: 100%; max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.auth-card h1 {
  font-size: 24px; font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
}
.auth-card .subtitle {
  color: var(--gray-600); font-size: 14px;
  margin-bottom: 28px;
}
.auth-logo {
  font-size: 28px; font-weight: 800;
  color: var(--blue);
  margin-bottom: 24px;
  display: block;
}

/* ========= Login Page (two-panel design) ========= */
.login-wrap {
  min-height: 100vh;
  width: 100%;
  background: #0b0d14;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-inner {
  min-height: 620px;
  width: 100%;
  max-width: 900px;
  background: #0b0d14;
  display: flex;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.5);
  margin: 24px;
}
.login-left {
  width: 45%;
  background: #0d1020;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 40px;
  position: relative;
  overflow: hidden;
}
.login-orbit-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(99,160,255,0.12);
  animation: loginSpin linear infinite;
}
.login-orbit-ring:nth-child(1) { width: 200px; height: 200px; top: -60px; left: -60px; animation-duration: 18s; }
.login-orbit-ring:nth-child(2) { width: 340px; height: 340px; top: -120px; left: -120px; animation-duration: 28s; animation-direction: reverse; }
.login-orbit-ring:nth-child(3) { width: 480px; height: 480px; bottom: -200px; right: -200px; animation-duration: 40s; }
.login-orbit-ring:nth-child(4) { width: 260px; height: 260px; bottom: -80px; right: -80px; animation-duration: 22s; animation-direction: reverse; }
.login-orbit-dot {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #63a0ff;
  top: -3px; left: 50%;
  transform: translateX(-50%);
}
@keyframes loginSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.login-left-content { position: relative; z-index: 2; }
.login-logo-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 40px; }
.login-logo-icon {
  width: 36px; height: 36px;
  object-fit: contain;
}
.login-logo-name {
  font-family: 'Syne', sans-serif;
  font-size: 22px; font-weight: 700;
  color: #e8eaf2;
  letter-spacing: 0.04em;
}
.login-tagline {
  font-size: 13px;
  color: #5a6280;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 28px;
}
.login-headline {
  font-family: 'Syne', sans-serif;
  font-size: 28px; font-weight: 700;
  color: #e8eaf2;
  line-height: 1.3;
  margin-bottom: 14px;
}
.login-headline span { color: #63a0ff; }
.login-sub { font-size: 14px; color: #5a6280; line-height: 1.6; max-width: 280px; }
.login-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  background: #0f1118;
}
.login-form-card { width: 100%; max-width: 340px; }
.login-form-title {
  font-family: 'Syne', sans-serif;
  font-size: 20px; font-weight: 500;
  color: #e8eaf2;
  margin-bottom: 6px;
}
.login-form-sub { font-size: 13px; color: #5a6280; margin-bottom: 28px; }
.login-field-group { margin-bottom: 16px; }
.login-field-label {
  font-size: 12px; font-weight: 500;
  color: #7a86a8;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
}
.login-field-input {
  width: 100%;
  background: #161825;
  border: 0.5px solid #2a2e42;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: #c8ccdc;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.15s;
}
.login-field-input:focus { border-color: rgba(99,160,255,0.5); box-shadow: 0 0 0 3px rgba(99,160,255,0.08); }
.login-field-input::placeholder { color: #3a3f57; }
.login-field-pw-wrap { position: relative; }
.login-field-pw-wrap .login-field-input { padding-right: 40px; }
.login-field-pw-wrap .login-field-input::-ms-reveal,
.login-field-pw-wrap .login-field-input::-webkit-contacts-auto-fill-button,
.login-field-pw-wrap .login-field-input::-webkit-credentials-auto-fill-button { display: none !important; }
.login-pw-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; padding: 0; cursor: pointer;
  color: #ffffff; display: flex; align-items: center;
  transition: color 0.15s;
}
.login-pw-eye:hover { color: #63a0ff; }
.login-forgot-row { display: flex; justify-content: flex-end; margin-top: -8px; margin-bottom: 20px; }
.login-forgot-link { font-size: 12px; color: #63a0ff; text-decoration: none; opacity: 0.8; }
.login-forgot-link:hover { opacity: 1; }
.login-btn {
  width: 100%;
  padding: 11px;
  background: #63a0ff;
  border: none;
  border-radius: 8px;
  font-family: 'Syne', sans-serif;
  font-size: 14px; font-weight: 500;
  color: #0b0d14;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: opacity 0.15s, transform 0.1s;
  margin-bottom: 20px;
}
.login-btn:hover { opacity: 0.9; }
.login-btn:active { transform: scale(0.98); }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.login-divider { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-divider-line { flex: 1; height: 0.5px; background: #2a2e42; }
.login-divider-text { font-size: 12px; color: #3a3f57; }
.login-register-row { text-align: center; font-size: 13px; color: #5a6280; }
.login-register-row a { color: #63a0ff; text-decoration: none; }
.login-error { font-size: 13px; color: #ff6b6b; margin-bottom: 14px; display: none; }
.login-status-bar { margin-top: 28px; display: flex; align-items: center; gap: 6px; font-size: 11px; color: #3a4060; }
.login-status-dot { width: 5px; height: 5px; border-radius: 50%; background: #2a8a5a; }
@media (max-width: 600px) {
  .login-left { display: none; }
  .login-inner { border-radius: 0; margin: 0; min-height: 100vh; }
}

/* ========= Form Elements ========= */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--text2);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  transition: border-color .15s;
  outline: none;
}
.form-control:focus { border-color: var(--blue); }
.form-control.error { border-color: var(--red); }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.form-hint { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* ========= Buttons ========= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  border: none;
  transition: background .15s, box-shadow .15s;
  cursor: pointer;
}
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: #0044aa; }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { background: #b52a00; }
.btn-ghost { background: none; color: var(--blue); border: 1px solid var(--blue); }
.btn-ghost:hover { background: var(--blue-bg); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ========= Projects Page ========= */
.projects-subbar {
  background: var(--bg2);
  border-bottom: 0.5px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 10px;
}
.projects-subbar-title {
  font-family: 'Syne', sans-serif;
  font-size: 18px; font-weight: 700;
  color: var(--text);
  flex: 1;
}
.projects-subbar-right { display: flex; align-items: center; gap: 8px; }
.projects-search-box {
  background: var(--bg3);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  display: flex; align-items: center; gap: 7px;
  min-width: 200px;
}
.projects-search-icon {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 1.5px solid var(--text3);
  position: relative; flex-shrink: 0;
}
.projects-search-icon::after {
  content: '';
  position: absolute;
  width: 4px; height: 1.5px;
  background: var(--text3);
  bottom: -4px; right: -3px;
  transform: rotate(45deg);
}
.projects-search-box input {
  border: none; outline: none;
  background: transparent;
  font-size: 13px; color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  width: 100%;
}
.projects-search-box input::placeholder { color: var(--text3); }
.projects-add-btn {
  background: var(--accent);
  color: #fff; border: none;
  border-radius: var(--radius);
  padding: 7px 14px;
  font-size: 13px; font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: opacity .15s;
  white-space: nowrap;
}
.projects-add-btn:hover { opacity: 0.88; }

.projects-grid {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;
  gap: 18px;
  overflow-y: auto;
  flex: 1;
}
.projects-grid.single-row { grid-auto-rows: minmax(auto, 50%); align-content: start; }
.projects-grid .project-card { display: flex; flex-direction: column; }
.projects-grid .project-card-body { flex: 1; }
@media (max-width: 900px) { .projects-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .projects-grid { grid-template-columns: 1fr; } }
.project-card {
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.project-card:hover { border-color: var(--border2); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.project-card-cover {
  height: 72px;
  background: var(--accent2);
  position: relative;
  overflow: hidden;
}
.project-card-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.favorite-star {
  position: absolute; top: 6px; right: 6px;
  background: none; border: none; cursor: pointer;
  font-size: 22px; line-height: 1; padding: 2px;
  color: rgba(255,255,255,0.45);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
  transition: color .2s, transform .2s;
}
.favorite-star:hover { color: #ffd55a; transform: scale(1.2); }
.favorite-star.active { color: #ffd55a; filter: drop-shadow(0 0 6px rgba(255,213,90,0.6)); }
.project-card-body { padding: 12px 14px 36px; }
.project-card-title {
  font-family: 'Syne', sans-serif;
  font-size: 14px; font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.project-card-desc { font-size: 12px; color: var(--text3); line-height: 1.4; }
.project-card-tags { margin-top: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.project-card-menu-btn {
  position: absolute; bottom: 10px; right: 10px;
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  font-size: 18px; line-height: 1;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .12s, color .12s;
  z-index: 1;
}
.project-card:hover .project-card-menu-btn { opacity: 1; }
.project-card-menu-btn:hover { background: var(--btn-hover); color: var(--text); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text3);
  grid-column: 1 / -1;
}
.empty-state h3 { font-size: 18px; color: var(--text2); margin-bottom: 8px; }
.empty-state p { margin-bottom: 20px; }

/* ========= Tags ========= */
.tag {
  display: inline-flex; align-items: center;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 100px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
}
.tag.removable::after { content: '×'; margin-left: 4px; cursor: pointer; }

.tags-input-wrap { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tags-input-wrap input {
  border: none; outline: none;
  font-size: 13px; flex: 1; min-width: 80px;
  padding: 2px 4px;
  background: transparent;
  color: var(--text);
}
.tags-input-box {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px;
  cursor: text;
  background: var(--bg);
  min-height: 38px;
  position: relative;
}
.tags-input-box:focus-within { border-color: var(--blue); }
.tags-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 200;
  max-height: 160px;
  overflow-y: auto;
}
.tags-suggest-item {
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}
.tags-suggest-item:hover { background: var(--bg3); }

/* ========= Board ========= */
/* Banner image — shown only on the header strip, board canvas stays solid */
.board-container.has-bg .board-header {
  background-size: cover;
  background-position: center;
  padding: 20px 20px;
  position: relative;
  border-bottom-color: transparent;
}
.board-container.has-bg .board-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.68) 0%, rgba(0,0,0,0.42) 100%);
  pointer-events: none;
}
.board-container.has-bg .board-header > * {
  position: relative;
  z-index: 1;
}
.board-container.has-bg .board-header h2,
.board-container.has-bg .board-header .back-link { color: #fff; }
.board-container.has-bg .board-header .back-link:hover { color: rgba(255,255,255,0.75); }
.board-container.has-bg #board-search {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-color: rgba(255,255,255,0.25);
}
.board-container.has-bg #board-search::placeholder { color: rgba(255,255,255,0.6); }


.board-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.board-header {
  padding: 12px 20px;
  background: rgba(255,255,255,.85);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.board-header h2 { font-size: 18px; font-weight: 700; white-space: nowrap; }
.board-project-desc {
  font-size: 13px;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
.board-container.has-bg .board-project-desc { color: rgba(255,255,255,0.8); }
.board-header .back-link {
  color: var(--gray-600);
  font-size: 13px;
  display: flex; align-items: center; gap: 4px;
  cursor: pointer;
  border: none; background: none; padding: 0;
  text-decoration: none;
}
.board-header .back-link:hover { color: var(--blue); }

.board-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

/* Bucket column */
.bucket-col {
  flex-shrink: 0;
  width: 280px;
  background: var(--gray-200);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--header-h) - 100px);
  overflow-y: auto;
}
.bucket-header {
  padding: 10px 12px;
  display: flex; align-items: center; gap: 8px;
  cursor: grab;
}
.bucket-header:active { cursor: grabbing; }

/* Drag-and-drop column reordering */
.bucket-col[draggable="true"] { user-select: none; }
.bucket-col.dragging { opacity: 0.35; }
.bucket-col.drag-over { outline: 2px dashed var(--blue-light); outline-offset: -2px; }

/* Task drag-and-drop between buckets */
.task-card[draggable="true"] { cursor: grab; }
.task-card.task-dragging { opacity: 0.3; }
.bucket-items.task-drop-target { background: rgba(0,82,204,0.08); border-radius: var(--radius); min-height: 40px; }
.task-card.task-drop-above { box-shadow: 0 -3px 0 0 var(--blue); }
.bucket-title {
  font-size: 14px; font-weight: 600;
  color: var(--gray-800);
  flex: 1;
  cursor: pointer;
}
.bucket-title:hover { color: var(--blue); }
.bucket-menu-btn {
  background: none; border: none;
  color: var(--gray-500); font-size: 18px; line-height: 1;
  width: 24px; height: 24px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.bucket-menu-btn:hover { background: var(--gray-300); color: var(--gray-800); }

.bucket-items {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  padding-bottom: 8px;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow .15s;
  position: relative;
  overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-md); }

/* Trello-style thumbnail strip at top of task card */
.card-thumb {
  display: block;
  width: calc(100% + 24px);
  height: 100px;
  object-fit: cover;
  margin: -10px -12px 10px -12px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.card-type-badge {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
}
.card-type-badge.task { color: var(--blue); }
.card-type-badge.risk { color: var(--red); }

.card-description {
  font-size: 13px;
  color: var(--gray-800);
  line-height: 1.4;
  word-break: break-word;
}
.card-footer {
  margin-top: 8px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}

/* ========= Task completion ========= */
.task-body { display: flex; align-items: flex-start; gap: 8px; }
.task-body .card-description { flex: 1; }

.task-check-btn {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--gray-400);
  background: none;
  cursor: pointer;
  font-size: 11px; font-weight: 700;
  color: transparent;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: border-color .15s, background .15s, color .15s;
  margin-top: 1px;
}
.task-check-btn:hover { border-color: var(--green); color: var(--green); }
.task-check-btn.checked {
  background: var(--green); border-color: var(--green); color: #fff;
}
.task-check-btn.checked:hover {
  background: var(--red); border-color: var(--red);
}

@keyframes task-check-shine {
  0%   { box-shadow: 0 0 0 0 rgba(0,200,83,0.7); transform: scale(1); }
  30%  { box-shadow: 0 0 0 10px rgba(0,200,83,0); transform: scale(1.35); }
  60%  { box-shadow: 0 0 6px 2px rgba(0,200,83,0.3); transform: scale(1.15); }
  100% { box-shadow: 0 0 0 0 rgba(0,200,83,0); transform: scale(1); }
}
.task-check-shine {
  animation: task-check-shine 0.55s ease-out forwards;
}

@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translateY(105vh) rotate(800deg); opacity: 0; }
}
.confetti-piece {
  position: absolute;
  pointer-events: none;
  animation: confetti-fall linear forwards;
}

.task-done { opacity: .7; }
.task-done .card-description { text-decoration: line-through; color: var(--gray-500); }

.task-done-date { font-size: 11px; font-weight: 600; color: var(--green); }

/* ========= Checklist progress badge (on task card) ========= */
.checklist-progress {
  font-size: 11px; font-weight: 600;
  padding: 2px 6px; border-radius: 4px;
  background: var(--gray-200); color: var(--gray-500);
  display: inline-flex; align-items: center;
}
.checklist-progress.all-done { background: var(--green-bg); color: var(--green); }

/* ========= Checklist section (in modal) ========= */
.checklist-section label { margin-bottom: 8px; }

.checklist-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--gray-200);
}
.checklist-item:last-child { border-bottom: none; }

.checklist-check-btn {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--gray-400);
  background: none;
  cursor: pointer;
  font-size: 11px; font-weight: 700;
  color: transparent;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: border-color .15s, background .15s, color .15s;
}
.checklist-check-btn:hover { border-color: var(--green); color: var(--green); }
.checklist-check-btn.checked { background: var(--green); border-color: var(--green); color: #fff; }

.checklist-text {
  flex: 1;
  font-size: 14px;
  word-break: break-word;
}
.checklist-text.done {
  text-decoration: line-through;
  color: var(--gray-500);
}

.checklist-delete-btn {
  flex-shrink: 0;
  background: none; border: none; cursor: pointer;
  color: var(--gray-400); font-size: 13px; padding: 2px 4px;
  border-radius: 3px; line-height: 1;
  transition: color .15s, background .15s;
}
.checklist-delete-btn:hover { color: var(--red); background: var(--gray-100); }

.checklist-add-row {
  display: flex; gap: 6px; margin-top: 8px;
}
.checklist-add-row .form-control { flex: 1; }

/* ========= Inline card checklists ========= */
.card-checklist-section {
  margin: 8px -12px 0;
}
.card-checklist-summary {
  list-style: none;
  cursor: pointer;
  padding: 2px 12px 4px;
  display: flex; align-items: center;
}
.card-checklist-summary::-webkit-details-marker { display: none; }

.card-cl-active {
  background: var(--red-bg);
  padding: 6px 12px;
}
.card-cl-done-section { }
.card-cl-done-summary {
  list-style: none;
  cursor: pointer;
  font-size: 11px; font-weight: 600;
  color: var(--green);
  padding: 5px 12px;
  background: var(--green-bg);
  display: flex; align-items: center; gap: 5px;
}
.card-cl-done-summary::-webkit-details-marker { display: none; }
.card-cl-done-summary::before {
  content: '\25B6';
  font-size: 8px;
  display: inline-block;
  transition: transform .2s;
}
details.card-cl-done-section[open] > .card-cl-done-summary::before {
  transform: rotate(90deg);
}
.card-cl-done-items {
  background: var(--green-bg);
  padding: 4px 12px 8px;
}

.card-cl-item {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0;
}
.card-cl-check-btn {
  width: 20px; height: 20px; flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--gray-400);
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: transparent;
  transition: border-color .15s, background .15s;
}
.card-cl-check-btn:hover { border-color: var(--blue); }
.card-cl-check-btn.checked {
  background: var(--gray-500);
  border-color: var(--gray-500);
  color: #fff;
}
.card-cl-text {
  font-size: 12px; color: var(--gray-800); flex: 1;
  word-break: break-word;
}
.card-cl-item.done .card-cl-text {
  text-decoration: line-through; color: var(--gray-500);
}

/* Done tasks collapsible */
.done-tasks-section { margin-top: 6px; }
.done-tasks-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--gray-500);
  cursor: pointer; padding: 4px 8px; border-radius: var(--radius);
  list-style: none; user-select: none;
}
.done-tasks-toggle::-webkit-details-marker { display: none; }
.done-tasks-toggle::marker { display: none; }
.done-tasks-toggle::before {
  content: '\25B6';
  font-size: 9px;
  display: inline-block;
  transition: transform .2s;
}
details.done-tasks-section[open] > .done-tasks-toggle::before {
  transform: rotate(90deg);
}
.done-tasks-toggle:hover { background: var(--gray-200); color: var(--gray-700); }
.done-tasks-list { margin-top: 4px; }

/* Priority badges */
.priority { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.priority.Low { background: var(--green-bg); color: var(--green); }
.priority.Medium { background: var(--orange-bg); color: var(--orange); }
.priority.High { background: var(--red-bg); color: var(--red); }

/* RPN */
.rpn-badge {
  font-size: 11px; font-weight: 700;
  padding: 2px 6px; border-radius: 4px;
  background: var(--red-bg); color: var(--red);
}
.rpn-badge.low { background: var(--green-bg); color: var(--green); }
.rpn-badge.medium { background: var(--orange-bg); color: var(--orange); }

.status-badge {
  font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px;
}
.status-badge.Open { background: var(--orange-bg); color: var(--orange); }
.status-badge.Resolved { background: var(--green-bg); color: var(--green); }

.due-date { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: var(--gray-200); color: var(--gray-500); }
.due-date.due-soon { background: var(--orange-bg); color: var(--orange); }
.due-date.overdue { background: var(--red-bg); color: var(--red); }

/* ========= Bucket Storyboard ========= */
.bucket-storyboard {
  padding: 8px 8px 4px;
  background: var(--gray-200);
  border-bottom: 1px solid var(--gray-300);
  position: relative;
}
.storyboard-edit-icon {
  position: absolute;
  top: 10px; right: 10px;
  font-size: 12px;
  color: var(--gray-400);
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
  user-select: none;
}
.bucket-storyboard:hover:not(:focus-within) .storyboard-edit-icon { opacity: 1; }
.storyboard-saved {
  position: absolute;
  bottom: 8px; right: 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--blue);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
  user-select: none;
}
.bucket-storyboard.just-saved .storyboard-saved { opacity: 1; }
.storyboard-textarea {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 6px 8px;
  font-size: 12px;
  color: var(--gray-700);
  resize: none;
  outline: none;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color .15s, background .15s;
}
.storyboard-textarea::placeholder { color: var(--gray-400); font-style: italic; }
.storyboard-textarea:hover { border-color: var(--gray-300); background: var(--white); }
.storyboard-textarea:focus { border-color: var(--blue); background: var(--white); }

/* ========= Bucket Sections (Tasks / Risks) ========= */
.bucket-section { display: flex; flex-direction: column; }
.bucket-section-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .7px;
  padding: 6px 12px 2px;
  color: var(--gray-500);
}
.tasks-section { background: rgba(0,82,204,.04); }
.tasks-section .bucket-section-label { color: var(--blue); }
.risks-section { background: rgba(222,53,11,.04); }
.risks-section .bucket-section-label { color: var(--red); }

/* Add card / bucket buttons */
.bucket-add-btn {
  margin: 0 8px 8px;
  background: none;
  border: 2px dashed var(--gray-400);
  border-radius: var(--radius);
  color: var(--gray-500);
  padding: 6px;
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.bucket-add-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-bg);
}
.bucket-add-btn.add-risk {
  border-color: var(--red);
  color: var(--red);
}
.bucket-add-btn.add-risk:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-bg);
}

.add-col {
  flex-shrink: 0;
  width: 280px;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.add-col-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 80px;
  background: var(--gray-200);
  border: 2px dashed var(--border2);
  border-radius: var(--radius);
  color: var(--text3);
  padding: 16px 12px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  text-align: center;
}
.add-col-btn:hover {
  background: var(--gray-300);
  border-color: var(--blue-light);
  color: var(--text);
}

.add-col-btn--template {
  border-color: var(--blue);
  color: var(--blue);
}
.add-col-btn--template:hover {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.col-empty-state {
  padding: 20px 12px;
  text-align: center;
  color: var(--text3);
  font-size: 12px;
  line-height: 1.6;
}

.risk-col-header {
  background: var(--red) !important;
  border-radius: var(--radius) var(--radius) 0 0;
}
.risk-col-header .bucket-title,
.risk-col-header .risk-col-count {
  color: #fff !important;
}
.risk-col-header .risk-col-count {
  font-size: 13px;
  opacity: .8;
}

/* Card action icons */
.card-actions {
  position: absolute; top: 6px; right: 6px;
  display: none; gap: 2px;
}
.card:hover .card-actions { display: flex; }
.card-action-btn {
  background: var(--gray-200);
  border: none;
  border-radius: 4px;
  width: 22px; height: 22px;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-600);
}
.card-action-btn:hover { background: var(--gray-300); color: var(--gray-900); }

/* Dropdown menu */
.dropdown {
  position: absolute;
  background: var(--white);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius);
  z-index: 500;
  min-width: 160px;
  padding: 4px 0;
  border: 1px solid var(--gray-200);
}
.dropdown-item {
  display: block; width: 100%;
  padding: 8px 14px;
  font-size: 13px; color: var(--gray-700);
  background: none; border: none; text-align: left;
  cursor: pointer;
}
.dropdown-item:hover { background: var(--gray-100); }
.dropdown-item.danger { color: var(--red); }

/* ========= Bucket Color Swatches ========= */
.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 0; }
.color-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
  outline: none;
  padding: 0;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: var(--gray-800); }
body[data-theme="dark"] .color-swatch.selected { border-color: var(--gray-200); }

/* ---- Dark-mode board overrides ---- */
body[data-theme="dark"] .board-header {
  background: rgba(15,17,24,0.9);
  border-bottom-color: var(--border);
}
body[data-theme="dark"] .board-container.has-bg #board-search {
  background: rgba(255,255,255,0.12);
}

/* ========= Admin Panel ========= */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
@media (max-width: 768px) { .admin-stats-grid { grid-template-columns: repeat(2, 1fr); } }

.admin-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.admin-stat-number { font-size: 2rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.admin-stat-label { font-size: 0.82rem; color: var(--gray-500); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

.admin-users-section { margin-top: 8px; }
.admin-users-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.admin-users-header h2 { font-size: 1.15rem; font-weight: 600; color: var(--text); margin: 0; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.88rem;
}
.admin-table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: rgba(0,0,0,0.02); }
body[data-theme="dark"] .admin-table tbody tr:hover { background: rgba(255,255,255,0.03); }

.admin-user-avatar {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover; display: inline-flex;
  align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 600;
}
.admin-avatar-initial {
  background: var(--blue); color: #fff;
}

.admin-you-badge {
  display: inline-block; font-size: 0.68rem; padding: 1px 6px; border-radius: 10px;
  background: var(--blue); color: #fff; vertical-align: middle; margin-left: 4px;
}

.admin-verified { color: var(--green); font-weight: 700; }
.admin-unverified { color: var(--red); font-weight: 700; }

.admin-actions { white-space: nowrap; }
.admin-actions .btn { font-size: 0.76rem; padding: 4px 10px; }
.admin-actions .btn-danger {
  background: var(--red); color: #fff; border: none;
}
.admin-actions .btn-danger:hover { opacity: 0.85; }

.admin-pagination {
  display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px;
}
.admin-page-info { font-size: 0.85rem; color: var(--gray-500); }

.admin-self-lock {
  font-size: 0.78rem; color: var(--gray-400);
  display: inline-flex; align-items: center; gap: 5px;
}

/* ========= Admin User Drawer ========= */
.admin-drawer-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 400;
}
.admin-drawer-backdrop.open { display: block; }

.admin-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 340px; max-width: 95vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  z-index: 401;
  transform: translateX(100%);
  transition: transform .25s ease;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.admin-drawer.open { transform: translateX(0); }

.admin-drawer-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; cursor: pointer;
  font-size: 16px; color: var(--gray-400); line-height: 1;
  padding: 4px;
}
.admin-drawer-close:hover { color: var(--text); }

.admin-drawer-content { padding: 48px 24px 24px; }

.admin-drawer-hero {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 24px;
}
.admin-drawer-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700;
}
.admin-drawer-avatar-initial {
  background: var(--blue); color: #fff;
}
.admin-drawer-name {
  font-size: 1rem; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.admin-drawer-email { font-size: 0.83rem; color: var(--gray-500); margin-top: 2px; word-break: break-all; }

.admin-drawer-details {
  display: grid; grid-template-columns: auto 1fr;
  gap: 8px 16px; margin: 0 0 24px;
  font-size: 0.85rem;
}
.admin-drawer-details dt { color: var(--gray-500); font-weight: 500; white-space: nowrap; }
.admin-drawer-details dd { color: var(--text); margin: 0; }

.admin-drawer-actions {
  display: flex; flex-direction: column; gap: 8px;
}
.admin-drawer-actions .btn { justify-content: center; }

.admin-drawer-self-note {
  font-size: 0.82rem; color: var(--gray-400);
  background: var(--gray-100); border-radius: var(--radius);
  padding: 10px 14px; margin: 0;
  display: flex; align-items: center; gap: 6px;
}
body[data-theme="dark"] .admin-drawer-self-note { background: var(--bg2); }

.admin-cb-col { width: 36px; text-align: center; }
.admin-cb-col input[type="checkbox"] { cursor: pointer; width: 16px; height: 16px; accent-color: var(--blue); }

.admin-bulk-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--blue);
  border-radius: var(--radius); font-size: 0.88rem;
}
.admin-bulk-bar span { font-weight: 600; color: var(--text); }
body[data-theme="dark"] .admin-bulk-bar { border-color: rgba(0,82,204,0.5); }

/* ========= Profile Page ========= */
.profile-page {
  padding: 32px 24px;
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.profile-page .back-link {
  align-self: flex-start;
  color: var(--gray-600); font-size: 13px;
  border: none; background: none; cursor: pointer; padding: 0;
  margin-bottom: 4px;
  text-decoration: none;
}
.profile-page .back-link:hover { color: var(--blue); }

/* Hero / identity card */
.profile-hero {
  background: linear-gradient(135deg, var(--blue) 0%, #172b4d 100%);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex; align-items: center; gap: 20px;
}
.profile-avatar-wrap { position: relative; flex-shrink: 0; }
.avatar-lg {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  border: 3px solid rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
  color: white;
  text-transform: uppercase;
  overflow: hidden;
}
.avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.avatar-change-btn {
  position: absolute; bottom: 0; right: 0;
  width: 24px; height: 24px;
  background: var(--white);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--gray-700);
  cursor: pointer;
  box-shadow: var(--shadow);
  border: 2px solid var(--gray-200);
  transition: background .15s;
}
.avatar-change-btn:hover { background: var(--gray-100); }
.profile-hero-info { flex: 1; }
.profile-hero-name {
  font-size: 18px; font-weight: 700; color: #fff;
  margin-bottom: 2px;
}
.profile-hero-email {
  font-size: 13px; color: rgba(255,255,255,.75);
  margin-bottom: 4px;
  word-break: break-all;
}
.profile-hero-label { font-size: 12px; color: rgba(255,255,255,.55); }

/* Settings cards */
.settings-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.settings-card-header {
  padding: 14px 20px;
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-100);
}
.settings-card-body { padding: 20px; }
.settings-row {
  display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
}
.settings-row-title { font-size: 14px; font-weight: 600; color: var(--gray-800); margin-bottom: 2px; }
.settings-row-desc { font-size: 12px; color: var(--gray-500); line-height: 1.4; }

.settings-divider { border: none; border-top: 1px solid var(--gray-200); margin: 16px 0; }

/* Danger zone card override */
.settings-card.danger-zone { border: 1px solid var(--red-bg); }
.settings-card.danger-zone .settings-card-header {
  background: var(--red-bg); color: var(--red); border-bottom-color: #ffc9bb;
}


/* ========= RPN Sliders ========= */
.rpn-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rpn-row label { width: 110px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--gray-700); flex-shrink: 0; }
.rpn-row input[type="range"] { flex: 1; accent-color: var(--blue); }
.rpn-row .rpn-val { width: 24px; text-align: center; font-weight: 700; color: var(--blue); }
.rpn-result {
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 4px;
}
.rpn-result strong { font-size: 22px; }

/* ========= Misc ========= */
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 16px 0; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--gray-500); }

.section-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--gray-500);
  margin-bottom: 6px;
}

.inline-edit {
  border: none; outline: none;
  background: transparent;
  font: inherit;
  width: 100%;
}
.inline-edit:focus {
  background: var(--white);
  border-radius: 3px;
  box-shadow: 0 0 0 2px var(--blue);
  padding: 0 2px;
}
