/* ============================================================
   app.css  —  AdminPanel Template Design System
   Edit this ONE file to restyle the entire application.
   ============================================================ */

/* ── Google Fonts (loaded via templ.php <head>) ─────────── */
/* IBM Plex Sans + IBM Plex Mono                             */

/* ── CSS Variables ──────────────────────────────────────── */
:root {
  /* Palette */
  --bg-dark:           #1a1d23;
  --bg-sidebar:        #212529;
  --bg-topbar:         #ffffff;
  --bg-content:        #f4f6f9;
  --bg-card:           #ffffff;
  --accent:            #3b7ddd;
  --accent-hover:      #2f67c6;
  --accent-light:      #e8f0fe;
  --success:           #28a745;
  --success-light:     #e9f7ef;
  --warning:           #ffc107;
  --warning-light:     #fff8e1;
  --danger:            #dc3545;
  --danger-light:      #fde8e8;
  --info:              #17a2b8;
  --info-light:        #e3f6f8;
  --scroll-top-bg:     #212529;
  --scroll-top-fg:     #ffffff;
  --scroll-bottom-bg:  #3b7ddd;
  --scroll-bottom-fg:  #ffffff;

  /* Sidebar */
  --sidebar-text:      #c2c7d0;
  --sidebar-muted:     #6c757d;
  --sidebar-active-bg: rgba(255,255,255,.07);
  --sidebar-border:     rgba(255,255,255,.05);
  --sidebar-tooltip-bg: #1a1d23;
  --sidebar-tooltip-fg: #ffffff;
  --sidebar-w:         232px;
  --sidebar-w-mini:    62px;

  /* Layout */
  --topbar-h:          57px;
  --border:            #dee2e6;
  --border-light:      #f1f3f5;
  --text-main:         #212529;
  --text-muted:        #6c757d;
  --text-light:        #adb5bd;

  /* Tokens */
  --radius:            6px;
  --radius-lg:         10px;
  --shadow-sm:         0 1px 3px rgba(0,0,0,.06);
  --shadow:            0 1px 6px rgba(0,0,0,.08);
  --shadow-md:         0 4px 20px rgba(0,0,0,.10);
  --shadow-lg:         0 10px 40px rgba(0,0,0,.14);
  --transition:        .22s ease;

  /* Typography */
  --font:              'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --mono:              'IBM Plex Mono', 'Courier New', monospace;
}

/* ── Reset ───────────────────────────────────────────────── */
/* ── Dark theme overrides ────────────────────────────────── */
body.dark {
  --bg-topbar:    #1e2127;
  --bg-content:   #151619;
  --bg-card:      #1e2127;
  --bg-sidebar:   #0f1720;
  --sidebar-text: #d0d8e5;
  --sidebar-muted:#8fa0b8;
  --sidebar-active-bg: rgba(92,140,224,.18);
  --sidebar-border: rgba(255,255,255,.08);
  --sidebar-tooltip-bg: #0b1220;
  --sidebar-tooltip-fg: #e9eef9;
  --border:       #2d3138;
  --border-light: #252830;
  --text-main:    #e4e6eb;
  --text-muted:   #9aa0ab;
  --text-light:   #5a6070;
  --accent-light: rgba(59,125,221,.15);
  --shadow-sm:    0 1px 3px rgba(0,0,0,.3);
  --shadow:       0 1px 6px rgba(0,0,0,.4);
  --shadow-md:    0 4px 20px rgba(0,0,0,.5);
  --scroll-top-bg: #2c3139;
  --scroll-top-fg: #eef2f8;
  --scroll-bottom-bg: #5c8ce0;
  --scroll-bottom-fg: #ffffff;
  color-scheme:   dark;
}

body[data-theme="light"] {
  color-scheme: light;
  --bg-topbar: #ffffff;
  --bg-content: #f4f6f9;
  --bg-card: #ffffff;
  --bg-sidebar: #212529;
  --sidebar-text: #c2c7d0;
  --sidebar-muted: #6c757d;
  --sidebar-active-bg: rgba(255,255,255,.07);
  --sidebar-border: rgba(255,255,255,.05);
  --sidebar-tooltip-bg: #1a1d23;
  --sidebar-tooltip-fg: #ffffff;
}
/* Auto mode: mirror dark vars when OS is dark and user hasn't pinned light */
@media (prefers-color-scheme: dark) {
  body:not([data-theme="light"]) {
    --bg-topbar:    #1e2127;
    --bg-content:   #151619;
    --bg-card:      #1e2127;
    --bg-sidebar:   #0f1720;
    --sidebar-text: #d0d8e5;
    --sidebar-muted:#8fa0b8;
    --sidebar-active-bg: rgba(92,140,224,.18);
    --sidebar-border: rgba(255,255,255,.08);
    --sidebar-tooltip-bg: #0b1220;
    --sidebar-tooltip-fg: #e9eef9;
    --border:       #2d3138;
    --border-light: #252830;
    --text-main:    #e4e6eb;
    --text-muted:   #9aa0ab;
    --text-light:   #5a6070;
    --accent-light: rgba(59,125,221,.15);
    --shadow-sm:    0 1px 3px rgba(0,0,0,.3);
    --shadow:       0 1px 6px rgba(0,0,0,.4);
    --shadow-md:    0 4px 20px rgba(0,0,0,.5);
    color-scheme:   dark;
  }
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg-content);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Page Loading Bar ────────────────────────────────────── */
#page-loader {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 9999;
  pointer-events: none;
}
#page-loader-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  border-radius: 0 2px 2px 0;
  transition: width .3s ease, opacity .3s ease;
  box-shadow: 0 0 10px rgba(59,125,221,.6);
}

/* ── Spinner Overlay ─────────────────────────────────────── */
#spinner-overlay {
  position: fixed; inset: 0;
  background: rgba(15,18,25,.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fadeIn .2s ease;
}
#spinner-overlay.active { display: flex; }
.spinner-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 36px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-lg);
  min-width: 200px;
}
.spinner-ring {
  width: 46px; height: 46px;
  border: 4px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
.spinner-msg {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: .2px;
}
@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Toast Notifications ─────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 74px;
  right: 18px;
  left: auto;
  bottom: auto;
  transform: none;
  z-index: 10050;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: min(420px, calc(100vw - 24px));
}
#toast-container .toast {
  background: #0f1720;
  color: #eef3fb;
  border: 1px solid #253043;
  border-radius: var(--radius);
  padding: 12px 18px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  pointer-events: all;
  animation: toastIn .3s cubic-bezier(.34,1.56,.64,1);
  border-left: 4px solid var(--accent);
}
#toast-container .toast.success {
  border-left-color: #22c55e;
  border-color: rgba(34,197,94,.45);
  background: #0f1f16;
  color: #ecfff3;
}
#toast-container .toast.error {
  border-left-color: #ef4444;
  border-color: rgba(239,68,68,.45);
  background: #2a1518;
  color: #ffeef0;
}
#toast-container .toast.warning {
  border-left-color: #f59e0b;
  border-color: rgba(245,158,11,.45);
  background: #2b220f;
  color: #fff7e8;
}
#toast-container .toast-icon { font-size: 15px; flex-shrink: 0; }
#toast-container .toast.success .toast-icon { color: #4ade80; }
#toast-container .toast.error   .toast-icon { color: #fca5a5; }
#toast-container .toast.warning .toast-icon { color: #facc15; }
#toast-container .toast .toast-icon { color: #93c5fd; }
#toast-container .toast-close {
  margin-left: auto; background: none; border: none;
  color: rgba(238,243,251,.85); cursor: pointer; font-size: 13px;
  padding: 2px 4px; border-radius: 4px; flex-shrink: 0;
}
#toast-container .toast-close:hover { background: rgba(255,255,255,.12); color: #fff; }
#toast-container .toast.fade-out { animation: toastOut .25s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform:translateY(12px) scale(.96); } to { opacity:1; transform:translateY(0) scale(1); } }
@keyframes toastOut { to   { opacity:0; transform:translateY(8px) scale(.96); } }

/* ── Sidebar ─────────────────────────────────────────────── */
#sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  margin-left: 0px;
  padding-left: 0px;
  background: var(--bg-sidebar);
  display: flex; flex-direction: column;
  z-index: 1000;
  transition: width var(--transition), transform var(--transition);
  overflow: visible;
}
body.sidebar-mini #sidebar { width: var(--sidebar-w-mini); }
body.sidebar-hidden #sidebar { transform: translateX(-100%); }
body.sidebar-hidden #topbar { left: 0; }
body.sidebar-hidden #main-wrapper { margin-left: 0; }
body.sidebar-hidden #footer { margin-left: 0; }

/* Brand */
.sidebar-brand {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 11px;
  padding: 0 15px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  text-decoration: none;
  overflow: hidden;
}
.brand-logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; flex-shrink: 0;
  transition: transform var(--transition);
}
.brand-logo:hover { transform: rotate(-8deg) scale(1.08); }
.brand-text {
  color: #fff; font-weight: 700; font-size: 15px;
  letter-spacing: .3px; white-space: nowrap;
  opacity: 1; transition: opacity var(--transition);
}
.brand-ver {
  color: rgba(255,255,255,.3); font-size: 10px;
  font-family: var(--mono); margin-left: auto;
  white-space: nowrap; opacity: 1;
  transition: opacity var(--transition);
}
body.sidebar-mini .brand-text,
body.sidebar-mini .brand-ver { opacity: 0; pointer-events: none; }

/* User panel */
.sidebar-user {
  padding: 14px 15px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0; overflow: hidden;
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--success));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-info { min-width: 0; overflow: hidden; transition: opacity var(--transition); }
.user-name { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; }
.user-role { color: rgba(255,255,255,.38); font-size: 10.5px; font-family: var(--mono); white-space: nowrap; }
body.sidebar-mini .user-info { opacity: 0; pointer-events: none; width: 0; }

/* Nav scroll area */
.sidebar-nav-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 10px 0 20px;
}
.sidebar-nav-scroll::-webkit-scrollbar { width: 3px; }
.sidebar-nav-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }

.nav-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--sidebar-muted);
  padding: 13px 14px 5px; -webkit-user-select: none; user-select: none; white-space: nowrap;
  opacity: 1; transition: opacity var(--transition);
}
body.sidebar-mini .nav-section-label { opacity: 0; }

.nav-list { list-style: none; }

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; color: var(--sidebar-text);
  font-size: 13.5px; font-weight: 400;
  border-left: 3px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  position: relative;
  text-decoration: none;
}
.nav-item.nav-has-ext > .nav-link { padding-right: 44px; }
.nav-link:hover { background: var(--sidebar-active-bg); color: #fff; text-decoration: none; }
.nav-link.active {
  background: var(--sidebar-active-bg);
  color: #fff; border-left-color: var(--accent);
  font-weight: 500;
}
.nav-icon {
  width: 22px; text-align: center;
  font-size: 13px; flex-shrink: 0;
  color: inherit;
}
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; transition: opacity var(--transition); }
body.sidebar-mini .nav-label { opacity: 0; width: 0; overflow: hidden; }
body.sidebar-mini .nav-link {
  width: calc(100% - 10px);
  margin: 0 auto;
  justify-content: center;
  gap: 0;
  padding: 10px 0 !important;
  padding-right: 0 !important;
  border-left-color: transparent;
  border-right: 3px solid transparent;
  text-align: center;
}
body.sidebar-mini .nav-link.active {
  border-left-color: transparent;
  border-right-color: var(--accent);
}
body.sidebar-mini .nav-icon {
  width: 100%;
  font-size: 14px;
  color: #e9edf5;
  display: flex;
  align-items: center;
  justify-content: center;
}
body.sidebar-mini .nav-section-label {
  display: none;
}

.nav-badge {
  font-size: 10px; font-weight: 700; font-family: var(--mono);
  padding: 2px 7px; border-radius: 10px;
  background: var(--accent); color: #fff;
  transition: opacity var(--transition);
}
.nav-badge.green  { background: var(--success); }
.nav-badge.red    { background: var(--danger); }
.nav-badge.yellow { background: var(--warning); color: #333; }
body.sidebar-mini .nav-badge { opacity: 0; width: 0; overflow: hidden; padding: 0; }

.nav-admin-icon {
  font-size: 10px;
  color: rgba(255,255,255,.55);
  margin-left: 2px;
  flex-shrink: 0;
}
body.sidebar-mini .nav-admin-icon { display: none; }
.nav-item.nav-admin-item.is-hidden-by-role { display: none; }

.settings-card {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.settings-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
}
.settings-card-system::before { background: var(--accent); }
.settings-card-application::before { background: var(--success); }
.settings-card-user::before { background: var(--warning); }
.settings-card-theme::before { background: #7c5cff; }

.settings-inline-log {
  margin-top: 12px;
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
}

/* External link icon inside nav items */
.nav-ext-link {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  flex-shrink: 0;
  color: rgba(255,255,255,.28);
  font-size: 10px;
  padding: 3px 5px;
  border-radius: 4px;
  line-height: 1;
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
}
.nav-ext-link:hover {
  color: #fff;
  background: rgba(255,255,255,.12);
  text-decoration: none;
}
body.sidebar-mini .nav-ext-link { display: none; }

/* Sub-nav toggle arrow */
.nav-arrow {
  font-size: 11px; margin-left: auto; flex-shrink: 0;
  transition: transform var(--transition), opacity var(--transition);
}
body.sidebar-mini .nav-arrow { opacity: 0; width: 0; overflow: hidden; }
.nav-item.open > .nav-link .nav-arrow { transform: rotate(180deg); }

/* Sub-nav */
.sub-nav { list-style: none; max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.nav-item.open .sub-nav { max-height: 300px; }
.sub-nav .nav-link { padding-left: 48px; font-size: 13px; }

/* Sidebar hover tooltip (only in condensed mode) */
.nav-link:hover::after {
  display: none;
}
body.sidebar-mini .nav-link:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--sidebar-tooltip-bg); color: var(--sidebar-tooltip-fg);
  font-size: 12px; padding: 4px 10px; border-radius: 4px;
  white-space: nowrap; pointer-events: none;
  box-shadow: var(--shadow-md); z-index: 2000;
  display: block;
}

.sidebar-user {
  position: relative;
}

.sidebar-user:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-dark);
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  z-index: 2000;
}

/* ── Topbar ───────────────────────────────────────────────── */
#topbar {
  position: fixed; top: 0;
  left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 10px;
  z-index: 900;
  box-shadow: var(--shadow);
  transition: left var(--transition);
}
body.sidebar-mini #topbar { left: var(--sidebar-w-mini); }

.topbar-toggle {
  color: var(--text-muted); font-size: 15px;
  border: none; background: none; cursor: pointer;
  padding: 7px 9px; border-radius: var(--radius);
  transition: all var(--transition);
}
.topbar-toggle:hover { background: var(--bg-content); color: var(--text-main); }

.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-muted);
}
.breadcrumb .bc-sep { color: var(--border); margin: 0 2px; }
.breadcrumb .bc-current { color: var(--text-main); font-weight: 500; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.topbar-theme-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 10px;
  background: var(--bg-card);
  color: var(--text-muted);
}
.topbar-theme-wrap i {
  font-size: 12px;
  color: var(--accent);
}
.topbar-theme-select {
  border: none;
  background: transparent;
  color: var(--text-main);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  min-width: 68px;
  cursor: pointer;
}
.topbar-theme-select option {
  color: #212529;
}

.topbar-btn {
  position: relative; width: 36px; height: 36px;
  border: none; background: none; border-radius: 50%;
  cursor: pointer; color: var(--text-muted); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.topbar-btn:hover { background: var(--bg-content); color: var(--text-main); }
.topbar-debug-chip {
  width: auto;
  min-width: 82px;
  border-radius: 999px;
  border: 1px solid rgba(220,53,69,.45);
  background: rgba(220,53,69,.12);
  color: #9c1523;
  font-size: 11px;
  font-weight: 700;
  gap: 6px;
  padding: 0 10px;
}
.topbar-debug-chip:hover {
  background: rgba(220,53,69,.18);
  color: #7f0f1a;
}
.topbar-debug-chip.debug-off {
  border-color: rgba(108,117,125,.45);
  background: rgba(108,117,125,.12);
  color: #4e5964;
}
.topbar-debug-chip.debug-off:hover {
  background: rgba(108,117,125,.18);
  color: #37424d;
}
.topbar-log-quick {
  border: 1px solid var(--border);
  color: var(--accent);
  background: var(--bg-content);
}
.topbar-log-quick:hover {
  border-color: rgba(59,125,221,.45);
  color: var(--accent-hover);
}
.topbar-badge {
  position: absolute; top: 3px; right: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700; font-family: var(--mono);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-topbar);
}
.topbar-divider {
  width: 1px; height: 24px; background: var(--border); margin: 0 4px;
}
.topbar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--success));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 12px;
  cursor: pointer; margin-left: 6px; flex-shrink: 0;
  transition: transform var(--transition), box-shadow var(--transition);
}
.topbar-avatar:hover { transform: scale(1.08); box-shadow: 0 0 0 3px var(--accent-light); }

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; padding: 4px 8px 4px 4px;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.topbar-user:hover { background: var(--bg-content); }
.topbar-user-name {
  font-size: 13px; font-weight: 500;
  color: var(--text-main); white-space: nowrap;
}

.user-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  font-family: var(--mono);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-content);
  color: var(--text-muted);
  white-space: nowrap;
}
.user-type-chip.admin {
  background: var(--info-light);
  color: #0c7585;
  border-color: rgba(23,162,184,.3);
}
.user-type-chip.user {
  background: var(--warning-light);
  color: #8a6200;
  border-color: rgba(255,193,7,.4);
}

[data-admin-only="1"].is-hidden-by-role,
.is-hidden-by-role [data-admin-only="1"],
[data-admin-only="1"].is-hidden-by-role.topbar-menu-item {
  display: none !important;
}

.topbar-dropdown {
  position: absolute;
  top: calc(var(--topbar-h) - 2px);
  right: 18px;
  width: min(360px, calc(100vw - 24px));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 980;
  padding: 12px;
}
.topbar-dropdown-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--text-main);
}
.topbar-dropdown-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}
.topbar-search-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.topbar-search-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font: inherit;
  color: var(--text-main);
  background: var(--bg-content);
  outline: none;
}
.topbar-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,125,221,.12);
}
.topbar-search-results {
  margin-top: 10px;
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}
.topbar-search-empty {
  padding: 12px;
  color: var(--text-muted);
  font-size: 12px;
  background: var(--bg-content);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.topbar-search-result,
.topbar-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--bg-content);
  color: var(--text-main);
  font: inherit;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.topbar-search-result:hover,
.topbar-menu-item:hover {
  background: var(--accent-light);
  border-color: rgba(59,125,221,.16);
}
.topbar-menu-list {
  list-style: none;
  display: grid;
  gap: 8px;
}
.topbar-menu-list li { margin: 0; }
.topbar-menu-item { text-decoration: none; }
.topbar-menu-item i {
  width: 16px;
  text-align: center;
  color: var(--accent);
  flex-shrink: 0;
}
.topbar-profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 2px 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}
.topbar-avatar-lg {
  width: 42px;
  height: 42px;
  font-size: 14px;
}
.topbar-profile-name {
  font-weight: 600;
  color: var(--text-main);
}
.topbar-user-dropdown { width: min(320px, calc(100vw - 24px)); }

body.dark .card-footer { background: #1b1f25; }
body.dark th { background: #171a1f; }
body.dark tbody tr:hover td { background: #1a1d23; }
/* Summary/info tiles: in dark mode bg-content equals page bg, so use card bg instead */
body.dark .settings-summary-tile {
  background: #252931;
  border-color: #3a3f4d;
}
body.dark .faq-item {
  background: #252931;
  border-color: #3a3f4d;
}
/* Ensure select option text is legible in dark — browser-rendered options use system colours */
body.dark .form-control option {
  background: #20252d;
  color: #e8edf6;
}
body.dark .topbar-theme-wrap {
  background: #20252d;
  border-color: #3b4452;
}
body.dark .topbar-theme-select {
  color: #e8edf6;
}
body.dark .topbar-theme-select option {
  background: #20252d;
  color: #e8edf6;
}

.settings-layout {
  display: block;
}
.settings-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.settings-tab {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.settings-tab.active {
  background: var(--accent-light);
  color: var(--accent-hover);
  border-color: rgba(59,125,221,.35);
}
.settings-panel { display: none; }
.settings-panel.active { display: block; }

.settings-dashboard-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.settings-card-dashboard::before { background: var(--info); }
.settings-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.settings-summary-tile {
  background: var(--bg-content);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  gap: 4px;
}
.settings-summary-label,
.settings-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  font-weight: 700;
}
.settings-summary-value {
  font-size: 13px;
  color: var(--text-main);
  word-break: break-word;
}
.settings-summary-note {
  font-size: 12px;
  color: var(--text-muted);
}
.settings-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.settings-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.field-group {
  display: grid;
  gap: 6px;
}
.field-group span {
  font-size: 12px;
  color: var(--text-muted);
}
.field-group-wide { grid-column: 1 / -1; }
.form-control {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-content);
  color: var(--text-main);
  padding: 10px 12px;
  font: inherit;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,125,221,.12);
}
.form-control-color {
  height: 42px;
  padding: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  min-width: 56px;
}

body.dark .form-control,
body.dark textarea.form-control,
body.dark .form-control-color {
  background: #20252d;
  color: #e8edf6;
  border-color: #3b4452;
}
body.dark .form-control::placeholder,
body.dark textarea.form-control::placeholder {
  color: #8d98ab;
}
body.dark .form-control-color::-webkit-color-swatch-wrapper {
  padding: 1px;
}
body.dark .form-control-color::-webkit-color-swatch {
  border: 1px solid #4a5465;
  border-radius: 4px;
}
.user-settings-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.user-settings-preview {
  background: var(--bg-content);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}
.saved-themes-shell {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}
.saved-themes-list {
  display: grid;
  gap: 10px;
}
.saved-theme-card {
  background: var(--bg-content);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.saved-theme-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,125,221,.08);
}
.saved-theme-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.card-header .badge {
  margin-left: auto;
}
[data-admin-lock-note] {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--bg-content);
  border: 1px dashed var(--border);
}
.settings-unsaved-note {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--warning-light);
  border: 1px dashed rgba(255,193,7,.55);
  color: #8a6200;
}
.log-viewer {
  margin: 0;
  background: #101214;
  color: #d7dde8;
  border-radius: var(--radius);
  padding: 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  max-height: 520px;
  overflow: auto;
}

.log-viewer-list {
  margin: 0;
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  max-height: 520px;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.log-entry {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  padding: 10px 12px;
  display: grid;
  gap: 8px;
}
.log-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.log-entry-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
}
.log-entry-message {
  color: var(--text-main);
  font-size: 13px;
}
.log-entry-context {
  margin: 0;
  background: var(--bg-content);
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 8px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
  white-space: pre-wrap;
}
.log-level-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: .3px;
}
.log-level-info {
  background: var(--info-light);
  color: #0c7585;
  border: 1px solid rgba(23,162,184,.35);
}
.log-level-warning {
  background: var(--warning-light);
  color: #8a6200;
  border: 1px solid rgba(255,193,7,.45);
}
.log-level-error {
  background: var(--danger-light);
  color: #8b1c1c;
  border: 1px solid rgba(220,53,69,.35);
}
.log-level-debug {
  background: var(--accent-light);
  color: var(--accent-hover);
  border: 1px solid rgba(59,125,221,.35);
}
.log-priority-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: .3px;
  border: 1px solid transparent;
}
.log-priority-pill.priority-low {
  background: var(--bg-content);
  color: var(--text-muted);
  border-color: var(--border);
}
.log-priority-pill.priority-high {
  background: var(--warning-light);
  color: #8a6200;
  border-color: rgba(255,193,7,.45);
}
.log-priority-pill.priority-critical {
  background: var(--danger-light);
  color: #8b1c1c;
  border-color: rgba(220,53,69,.4);
}
.log-entry-info { border-left: 3px solid var(--info); }
.log-entry-warning { border-left: 3px solid var(--warning); }
.log-entry-error { border-left: 3px solid var(--danger); }
.log-entry-debug { border-left: 3px solid var(--accent); }

.log-dashboard-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.log-info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.info-box {
  display: flex;
  align-items: stretch;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  min-height: 132px;
}
.info-box[data-settings-open] {
  cursor: pointer;
}
.info-box[data-settings-open]:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.info-box-icon {
  width: 54px;
  min-width: 54px;
  height: 54px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  flex-shrink: 0;
}
.info-box-content {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 4px;
  align-content: start;
}
.info-box-action {
  align-self: flex-end;
  flex-shrink: 0;
}
.info-box-text {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  font-weight: 700;
}
.info-box-number {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.15;
  word-break: break-word;
}
.info-box-more {
  font-size: 12px;
  color: var(--text-muted);
}
.info-box-info .info-box-icon { background: var(--info); }
.info-box-success .info-box-icon { background: var(--success); }
.info-box-warning .info-box-icon { background: var(--warning); }
.info-box-danger .info-box-icon { background: var(--danger); }

body.dark .info-box {
  background: #1e2127;
  border-color: #2d3138;
}
body.dark .info-box-text,
body.dark .info-box-more {
  color: #a5adba;
}
body.dark .info-box-number {
  color: #eef2f8;
}
.log-dash-btn {
  margin-top: 8px;
}
.log-toolbar {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.log-toolbar .form-control {
  width: 180px;
  min-width: 180px;
}

.faq-list {
  display: grid;
  gap: 12px;
}
.faq-item {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--bg-content);
  padding: 14px;
}
.faq-item h3 {
  margin: 0 0 6px;
  font-size: 15px;
}
.faq-item p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.issue-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
/* Issue summary numbers: make them prominent like stat cards */
.issue-summary-grid .settings-summary-value {
  font-size: 26px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--accent);
  line-height: 1.1;
}
.issue-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.issue-summary-head-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-main);
  font-weight: 700;
}
.issue-summary-head-note {
  font-size: 12px;
  color: var(--text-muted);
}
.issue-summary-grid .issue-summary-tile {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  padding: 14px;
}
.issue-summary-grid .issue-summary-tile::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--accent);
}
.issue-summary-grid .issue-summary-tile .settings-summary-label i {
  margin-right: 5px;
}
.issue-summary-grid .issue-open::before { background: var(--warning); }
.issue-summary-grid .issue-closed::before { background: var(--success); }
.issue-summary-grid .issue-bugs::before { background: var(--danger); }
.issue-summary-grid .issue-tasks::before { background: var(--info); }
.issue-summary-grid .issue-flow::before { background: #7c5cff; }
.issue-summary-grid .issue-open .settings-summary-value { color: #b78600; }
.issue-summary-grid .issue-closed .settings-summary-value { color: var(--success); }
.issue-summary-grid .issue-bugs .settings-summary-value { color: var(--danger); }
.issue-summary-grid .issue-tasks .settings-summary-value { color: #0c7585; }
.issue-summary-grid .issue-flow .settings-summary-value {
  font-size: 20px;
  color: #5b4ecb;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.kanban-lane {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  min-height: 380px;
  display: flex;
  flex-direction: column;
}
.kanban-lane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
  padding: 10px 12px;
}
.kanban-lane-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.kanban-lane-count {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(59,125,221,.22);
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
}
.kanban-lane-body {
  padding: 10px;
  display: grid;
  gap: 10px;
  min-height: 320px;
}
.kanban-lane-body.is-over {
  background: var(--accent-light);
}
.kanban-card {
  background: var(--bg-content);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px;
  cursor: grab;
  box-shadow: var(--shadow-sm);
}
.kanban-card.is-dragging {
  opacity: .6;
  transform: rotate(1deg);
}
.kanban-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}
.kanban-card-meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
}

.file-manager-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 320px;
  gap: 16px;
}
.file-tree,
.file-tree ul {
  list-style: none;
  display: grid;
  gap: 6px;
}
.file-tree-item {
  width: 100%;
  border: 1px solid transparent;
  background: var(--bg-content);
  color: var(--text-main);
  border-radius: var(--radius);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.file-tree-item.active,
.file-tree-item:hover {
  background: var(--accent-light);
  border-color: rgba(59,125,221,.2);
}
.file-row-btn {
  border: none;
  background: none;
  color: var(--accent-hover);
  font: inherit;
  cursor: pointer;
  padding: 0;
}
.file-row-btn:hover {
  text-decoration: underline;
}
.file-preview {
  margin: 0;
  background: var(--bg-content);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--text-main);
  min-height: 260px;
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
}
.issue-center-grid {
  align-items: start;
}

[data-issue-list] tr.issue-hidden {
  display: none;
}

.wizard-shell {
  display: grid;
  gap: 16px;
}

.wizard-header {
  background: linear-gradient(135deg, rgba(59,125,221,.12), rgba(23,162,184,.1));
  border: 1px solid rgba(59,125,221,.2);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.wizard-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.wizard-progress-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  font-weight: 700;
}

.wizard-progress-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent-hover);
  font-weight: 700;
}

.wizard-stepper {
  list-style: none;
  margin: 0;
  padding: 2px 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  position: relative;
}

.wizard-step {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 12px 10px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  cursor: pointer;
}

.wizard-step:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.wizard-step:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wizard-step::after {
  content: '';
  position: absolute;
  top: 26px;
  right: -10px;
  width: 10px;
  height: 2px;
  background: var(--border);
}

.wizard-step:last-child::after {
  display: none;
}

.wizard-step-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 700;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-content);
}

.wizard-step-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.wizard-step-note {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
}

.wizard-step.done {
  border-color: rgba(40,167,69,.4);
  background: linear-gradient(180deg, rgba(40,167,69,.1), rgba(40,167,69,.04));
}

.wizard-step.done .wizard-step-badge {
  border-color: rgba(40,167,69,.55);
  background: rgba(40,167,69,.15);
  color: var(--success);
}

.wizard-step.done::after {
  background: rgba(40,167,69,.45);
}

.wizard-step.current {
  border-color: rgba(255,193,7,.5);
  box-shadow: 0 0 0 3px rgba(255,193,7,.12);
}

.wizard-step.current .wizard-step-badge {
  border-color: rgba(255,193,7,.55);
  background: rgba(255,193,7,.18);
  color: #7a5c00;
}

.wizard-step.pending {
  opacity: .9;
}

[data-wizard-panel][hidden] {
  display: none !important;
}

.wizard-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,193,7,.45);
  background: rgba(255,193,7,.16);
  color: #7a5c00;
}

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 12px;
}

.table-toolbar-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.wizard-main {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 16px;
}

.wizard-side {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-content);
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.wizard-side-item {
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-muted);
}

body.dark .wizard-header {
  background: linear-gradient(135deg, rgba(92,140,224,.2), rgba(23,162,184,.16));
  border-color: rgba(92,140,224,.35);
}

body.dark .wizard-step {
  background: #20252d;
  border-color: #3b4452;
}

body.dark .wizard-step::after {
  background: #3b4452;
}

body.dark .wizard-side {
  background: #1b2028;
  border-color: #333b49;
}

body.dark .wizard-side-item {
  border-color: #3c4452;
  color: #aab3c4;
}

@media (max-width: 992px) {
  .settings-layout,
  .settings-form-grid,
  .settings-summary-grid,
  .user-settings-layout { grid-template-columns: 1fr; }
  .settings-dashboard-grid { grid-template-columns: 1fr; }
  .log-dashboard-grid { grid-template-columns: 1fr; }
  .issue-summary-grid { grid-template-columns: 1fr; }
  .log-toolbar .form-control { width: 100%; min-width: 0; }
  .wizard-stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wizard-step::after { display: none; }
  .wizard-main { grid-template-columns: 1fr; }
}

/* ── Main Wrapper ────────────────────────────────────────── */
#main-wrapper {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  transition: margin-left var(--transition);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--topbar-h));
}
body.sidebar-mini #main-wrapper { margin-left: var(--sidebar-w-mini); }

/* ── Content Area ────────────────────────────────────────── */
#content-area {
  flex: 1;
  padding: 20px;
  animation: contentFade .25s ease;
}
@keyframes contentFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Page Header */
.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px; flex-wrap: wrap; gap: 12px;
}
.page-title  { font-size: 21px; font-weight: 700; line-height: 1.2; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 22px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
  display: flex; align-items: center; gap: 16px;
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card.green  { border-left-color: var(--success); }
.stat-card.yellow { border-left-color: var(--warning); }
.stat-card.red    { border-left-color: var(--danger); }
.stat-card.info   { border-left-color: var(--info); }

.stat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--accent-light); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.stat-card.green  .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card.yellow .stat-icon { background: var(--warning-light); color: #b78600; }
.stat-card.red    .stat-icon { background: var(--danger-light);  color: var(--danger); }
.stat-card.info   .stat-icon { background: var(--info-light);    color: var(--info); }

.stat-val   { font-size: 24px; font-weight: 700; line-height: 1; font-family: var(--mono); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.stat-trend {
  margin-left: auto; font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 5px; font-family: var(--mono); flex-shrink: 0;
}
.stat-trend.up   { background: var(--success-light); color: var(--success); }
.stat-trend.down { background: var(--danger-light);  color: var(--danger); }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title   { font-size: 15px; font-weight: 600; }
.card-tools   { display: flex; gap: 6px; }
.card-body    { padding: 20px; }
.card-footer  { padding: 12px 20px; border-top: 1px solid var(--border-light); background: #fafbfc; border-radius: 0 0 var(--radius) var(--radius); }

.card-grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.card-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }

/* ── Card colour variants (coloured header) ─────────────── */
.card-primary .card-header,
.card-success .card-header,
.card-warning .card-header,
.card-danger  .card-header,
.card-info    .card-header,
.card-dark    .card-header {
  border-bottom: none;
}
.card-primary .card-header { background: var(--accent);  }
.card-success .card-header { background: var(--success); }
.card-warning .card-header { background: var(--warning); }
.card-danger  .card-header { background: var(--danger);  }
.card-info    .card-header { background: var(--info);    }
.card-dark    .card-header { background: #343a40;        }
.card-primary .card-header .card-title,
.card-success .card-header .card-title,
.card-danger  .card-header .card-title,
.card-info    .card-header .card-title,
.card-dark    .card-header .card-title { color: #fff; }
.card-warning .card-header .card-title { color: #212529; }
.card-primary .card-header .card-tools .btn,
.card-success .card-header .card-tools .btn,
.card-danger  .card-header .card-tools .btn,
.card-info    .card-header .card-tools .btn,
.card-dark    .card-header .card-tools .btn {
  color: rgba(255,255,255,.85);
  border-color: rgba(255,255,255,.25);
}
.card-warning .card-header .card-tools .btn {
  color: rgba(0,0,0,.7);
  border-color: rgba(0,0,0,.2);
}
/* Card outline variants — coloured top stripe, plain header */
.card-outline-primary { border-top: 3px solid var(--accent);  }
.card-outline-success { border-top: 3px solid var(--success); }
.card-outline-warning { border-top: 3px solid var(--warning); }
.card-outline-danger  { border-top: 3px solid var(--danger);  }
.card-outline-info    { border-top: 3px solid var(--info);    }
.card-outline-dark    { border-top: 3px solid #343a40;        }
/* Card with coloured left accent stripe */
.card-accent-primary { border-left: 4px solid var(--accent);  }
.card-accent-success { border-left: 4px solid var(--success); }
.card-accent-warning { border-left: 4px solid var(--warning); }
.card-accent-danger  { border-left: 4px solid var(--danger);  }
.card-accent-info    { border-left: 4px solid var(--info);    }
.card-accent-dark    { border-left: 4px solid #343a40;        }

/* ── Table ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table  { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  background: #f8f9fa; color: var(--text-muted);
  font-weight: 700; text-transform: uppercase;
  font-size: 10.5px; letter-spacing: .6px;
  padding: 10px 14px; text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover td { background: #fafbfc; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  font-family: var(--mono); padding: 3px 8px; border-radius: 10px;
  letter-spacing: .3px;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: #b78600; }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-info    { background: var(--info-light);     color: #0c7585; }
.badge-default { background: var(--bg-content);     color: var(--text-muted); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; font-family: var(--font);
  cursor: pointer; border: 1px solid transparent;
  transition: all var(--transition); text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary   { background: var(--accent);   color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: var(--bg-card);  color: var(--text-muted); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-content); color: var(--text-main); }
.btn-success   { background: var(--success);  color: #fff; border-color: var(--success); }
.btn-danger    { background: var(--danger);   color: #fff; border-color: var(--danger); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-icon { padding: 7px 10px; }

/* Not implemented controls: temporary visual marker for cleanup tracking. */
[data-not-implemented="true"] {
  position: relative;
}

body.show-not-implemented-markers [data-not-implemented="true"]::after {
  content: '!';
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 14px;
  height: 14px;
  margin-left: 5px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
  color: #4a3900;
  background: var(--warning);
  box-shadow: 0 0 0 1px rgba(74, 57, 0, 0.2);
}

/* ── Progress Bar ────────────────────────────────────────── */
.progress { background: var(--border-light); border-radius: 4px; height: 8px; overflow: hidden; margin-top: 6px; }
.progress-bar {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  transition: width .6s ease;
}
.progress-bar.green  { background: linear-gradient(90deg, var(--success), #5dd87b); }
.progress-bar.yellow { background: linear-gradient(90deg, var(--warning), #ffdd57); }
.progress-bar.red    { background: linear-gradient(90deg, var(--danger), #ff7b89); }

/* ── Alert boxes ─────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 13.5px; display: flex; align-items: flex-start; gap: 10px;
  border-left: 4px solid;
}
.alert i { margin-top: 1px; flex-shrink: 0; }
.alert-info    { background: var(--info-light);    border-color: var(--info);    color: #0c7585; }
.alert-success { background: var(--success-light); border-color: var(--success); color: #1a6e30; }
.alert-warning { background: var(--warning-light); border-color: var(--warning); color: #7a5c00; }
.alert-danger  { background: var(--danger-light);  border-color: var(--danger);  color: #8b1c1c; }

/* ── Footer ──────────────────────────────────────────────── */
#footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
  font-size: 12px; color: var(--text-muted);
  flex-shrink: 0;
}
#footer strong { color: var(--text-main); }
#footer a { color: var(--accent); }
#footer a:hover { text-decoration: underline; }
.footer-debug-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(220,53,69,.45);
  background: rgba(220,53,69,.12);
  color: #9c1523 !important;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}
.footer-debug-pill.debug-off {
  border-color: rgba(108,117,125,.45);
  background: rgba(108,117,125,.12);
  color: #4e5964 !important;
}
.footer-log-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(59,125,221,.35);
  background: rgba(59,125,221,.1);
  color: #275cb3 !important;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}
body.dark .topbar-debug-chip,
body.dark .footer-debug-pill {
  background: rgba(239,68,68,.2);
  border-color: rgba(239,68,68,.55);
  color: #ffc9cf !important;
}
body.dark .topbar-log-quick,
body.dark .footer-log-shortcut {
  border-color: rgba(59,125,221,.55);
  background: rgba(59,125,221,.22);
  color: #d5e6ff !important;
}
body.dark .topbar-debug-chip.debug-off,
body.dark .footer-debug-pill.debug-off {
  background: rgba(148,163,184,.2);
  border-color: rgba(148,163,184,.55);
  color: #d7dee9 !important;
}

/* ── Scroll-to-top/bottom arrows ─────────────────────────── */
#scroll-arrows {
  position: fixed; right: 22px; bottom: 80px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 800; pointer-events: none;
}
.scroll-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  pointer-events: all;
  opacity: 0; transform: scale(.8);
}
.scroll-btn.visible { opacity: 1; transform: scale(1); }
.scroll-btn.to-top {
  background: var(--scroll-top-bg); color: var(--scroll-top-fg);
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
}
.scroll-btn.to-bottom {
  background: var(--scroll-bottom-bg); color: var(--scroll-bottom-fg);
  box-shadow: 0 4px 14px rgba(59,125,221,.4);
}
.scroll-btn:hover { transform: scale(1.1) !important; }

/* ── Error container ─────────────────────────────────────── */
#error-container {
  padding: 40px 24px;
  display: flex; flex-direction: column;
  align-items: center; text-align: center; gap: 16px;
}
.error-icon { font-size: 48px; color: var(--danger); }
.error-title { font-size: 20px; font-weight: 700; }
.error-msg { color: var(--text-muted); font-size: 14px; max-width: 420px; }
.error-code { font-family: var(--mono); font-size: 12px; color: var(--text-light); }

/* ── Overlay mobile backdrop ─────────────────────────────── */
#sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 999;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .card-grid-2, .card-grid-3 { grid-template-columns: 1fr; }
  .log-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kanban-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .file-manager-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  body.sidebar-open #sidebar { transform: translateX(0); }
  body.sidebar-open #sidebar-backdrop { display: block; }
  #topbar { left: 0 !important; }
  #main-wrapper { margin-left: 0 !important; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  #content-area { padding: 16px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .log-info-grid { grid-template-columns: 1fr; }
  .kanban-board { grid-template-columns: 1fr; }
  .issue-summary-head { flex-direction: column; align-items: flex-start; }
}

/* ── Utility classes ─────────────────────────────────────── */
.d-flex    { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; } .mt-4 { margin-top: 20px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 20px; }
.text-muted { color: var(--text-muted); }
.text-mono  { font-family: var(--mono); }
.text-sm    { font-size: 12px; }
.fw-600     { font-weight: 600; }
.fw-700     { font-weight: 700; }

