/* ============================================================
   LibTrack AI — Design System
   GitHub-dark inspired. Sits on top of Bootstrap CSS.
   Bootstrap handles grid/utilities; this file handles all visuals.
   ============================================================ */

/* ---- Dark theme tokens (default) ------------------------------------ */
:root,
[data-bs-theme="dark"] {
  --lt-bg:        #0d1117;
  --lt-surface:   #161b22;
  --lt-surface-2: #21262d;
  --lt-surface-3: #1c2128;
  --lt-border:    #30363d;

  --lt-text:    #c9d1d9;
  --lt-muted:   #8b949e;
  --lt-heading: #f0f6fc;
  --lt-brand-lib: #ffffff;
  --lt-nav-hover-bg: #21262d;
  --lt-scrollbar-thumb: #6e7681;
  --lt-scrollbar-thumb-hover: #8b949e;

  --lt-blue:          #58a6ff;
  --lt-blue-hover:    #79c0ff;
  --lt-blue-btn:      #1f6feb;
  --lt-blue-btn-h:    #388bfd;
  --lt-green:         #2ea043;
  --lt-green-h:       #3fb950;
  --lt-red:           #f85149;
  --lt-orange:        #d29922;
  --lt-purple:        #8957e5;
  --lt-purple-h:      #a371f7;

  --lt-grad-primary:   linear-gradient(135deg, #1f6feb 0%, #58a6ff 100%);
  --lt-grad-success:   linear-gradient(135deg, #238636 0%, #2ea043 100%);
  --lt-grad-danger:    linear-gradient(135deg, #da3633 0%, #f85149 100%);
  --lt-grad-purple:    linear-gradient(135deg, #8957e5 0%, #bc8cff 100%);

  --lt-shadow-sm: 0 1px 0 rgba(27,31,36,.04);
  --lt-shadow-md: 0 3px 6px rgba(27,31,36,.24), 0 8px 24px rgba(27,31,36,.24);
  --lt-shadow-lg: 0 12px 40px rgba(1,4,9,.8);

  /* Override Bootstrap CSS variables so its components inherit our palette */
  --bs-body-bg:                  #0d1117;
  --bs-body-color:               #c9d1d9;
  --bs-link-color:               #58a6ff;
  --bs-link-hover-color:         #79c0ff;
  --bs-border-color:             #30363d;
  --bs-border-color-translucent: rgba(48,54,61,.8);
  --bs-card-bg:                  #161b22;
  --bs-card-border-color:        #30363d;
  --bs-table-bg:                 transparent;
  --bs-table-color:              #c9d1d9;
  --bs-table-border-color:       #30363d;
  --bs-table-hover-bg:           rgba(33,38,45,.75);
  --bs-table-striped-bg:         rgba(28,33,40,.5);
  --bs-dropdown-bg:              #161b22;
  --bs-dropdown-border-color:    #30363d;
  --bs-dropdown-link-color:      #c9d1d9;
  --bs-dropdown-link-hover-color:#f0f6fc;
  --bs-dropdown-link-hover-bg:   #21262d;
  --bs-dropdown-divider-bg:      #30363d;
  --bs-modal-bg:                 #161b22;
  --bs-modal-color:              #c9d1d9;
  --bs-modal-header-border-color:#30363d;
  --bs-modal-footer-border-color:#30363d;
  --bs-primary:                  #1f6feb;
  --bs-primary-rgb:              31,111,235;
  --bs-secondary:                #8b949e;
  --bs-success:                  #2ea043;
  --bs-danger:                   #f85149;
  --bs-warning:                  #d29922;
  --bs-info:                     #58a6ff;
}

/* ---- Light theme tokens --------------------------------------------- */
[data-bs-theme="light"] {
  --lt-bg:        #f6f8fa;
  --lt-surface:   #ffffff;
  --lt-surface-2: #f6f8fa;
  --lt-surface-3: #eaeef2;
  --lt-border:    #d0d7de;

  --lt-text:    #1f2328;
  --lt-muted:   #57606a;
  --lt-heading: #1f2328;
  --lt-brand-lib: #0C1117;
  --lt-nav-hover-bg: #eaeef2;
  --lt-scrollbar-thumb: #afb8c1;
  --lt-scrollbar-thumb-hover: #8c959f;

  --lt-blue:       #0969da;
  --lt-blue-hover: #0550ae;
  --lt-blue-btn:   #0969da;
  --lt-blue-btn-h: #0550ae;
  --lt-green:      #1a7f37;
  --lt-green-h:    #2da44e;
  --lt-red:        #d1242f;
  --lt-orange:     #9a6700;
  --lt-purple:     #8250df;
  --lt-purple-h:   #6639ba;

  --lt-shadow-sm: 0 1px 0 rgba(31,35,40,.04);
  --lt-shadow-md: 0 3px 6px rgba(140,149,159,.15);
  --lt-shadow-lg: 0 8px 24px rgba(140,149,159,.2);

  --bs-body-bg:                  #f6f8fa;
  --bs-body-color:               #1f2328;
  --bs-link-color:               #0969da;
  --bs-link-hover-color:         #0550ae;
  --bs-border-color:             #d0d7de;
  --bs-border-color-translucent: rgba(208,215,222,.8);
  --bs-card-bg:                  #ffffff;
  --bs-card-border-color:        #d0d7de;
  --bs-table-border-color:       #d0d7de;
  --bs-table-hover-bg:           rgba(208,215,222,.3);
  --bs-dropdown-bg:              #ffffff;
  --bs-dropdown-border-color:    #d0d7de;
  --bs-dropdown-link-color:      #1f2328;
  --bs-dropdown-link-hover-color:#1f2328;
  --bs-dropdown-link-hover-bg:   #f6f8fa;
  --bs-modal-bg:                 #ffffff;
  --bs-modal-color:              #1f2328;
  --bs-modal-header-border-color:#d0d7de;
  --bs-modal-footer-border-color:#d0d7de;
  --bs-primary:                  #0969da;
  --bs-primary-rgb:              9,105,218;
}

/* ---- Base reset ----------------------------------------------------- */
*,
::before,
::after { box-sizing: border-box; }

html { height: 100%; scroll-behavior: smooth; }

* {
  scrollbar-width: thin;
  scrollbar-color: var(--lt-scrollbar-thumb) transparent;
}

*::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background-color: var(--lt-scrollbar-thumb);
  background-clip: padding-box;
  border: 3px solid transparent;
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: var(--lt-scrollbar-thumb-hover);
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans",
               Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background-color: var(--lt-bg);
  color: var(--lt-text);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--lt-heading);
  font-weight: 600;
  letter-spacing: -0.015em;
}

a {
  color: var(--lt-blue);
  text-decoration: none;
}
a:hover { color: var(--lt-blue-hover); text-decoration: underline; }

hr { border-color: var(--lt-border); opacity: 1; }

/* ---- Navbar --------------------------------------------------------- */
.app-navbar {
  background-color: var(--lt-bg);
  border-bottom: 1px solid var(--lt-border);
  padding: 0;
  height: 56px;
}
.app-navbar > .container-fluid {
  height: 56px;
  align-items: center;
}
.app-navbar .navbar-brand {
  font-size: 15px;
  font-weight: 600;
  color: var(--lt-heading);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  text-decoration: none;
}
.app-navbar .navbar-brand:hover { color: var(--lt-blue); }

.brand-mark {
  width: 26px;
  height: 26px;
  background: var(--lt-grad-primary);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 25px;
  line-height: 1;
}

.brand-lib {
  color: var(--lt-brand-lib);
}

.brand-track {
  color: #006eff;
}

.brand-ai {
  display: inline-block;
  font-size: 14px;
  line-height: 1;
  margin-left: 4px;
  position: relative;
  top: -0.45em;
}

.app-navbar .nav-link {
  color: var(--lt-muted);
  font-size: 13.5px;
  font-weight: 500;
  padding: 0.3rem 0.65rem !important;
  border-radius: 6px;
  transition: color .15s, background .15s;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  text-decoration: none;
}
.app-navbar .nav-link:hover {
  color: var(--lt-text);
  background: var(--lt-nav-hover-bg);
}
.app-navbar .nav-link.active {
  color: var(--lt-heading);
  background: var(--lt-nav-hover-bg);
  font-weight: 600;
}
.app-navbar .nav-link i { font-size: 13px; }

/* Theme-toggle button */
.icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--lt-border);
  border-radius: 6px;
  background: transparent;
  color: var(--lt-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: border-color .15s, color .15s, background .15s;
  padding: 0;
}
.icon-btn:hover {
  border-color: var(--lt-blue);
  color: var(--lt-blue);
  background: var(--lt-surface-2);
}
.mobile-nav-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Navbar toggler (mobile) */
.navbar-toggler {
  border: 1px solid var(--lt-border) !important;
  border-radius: 6px;
  padding: 5px 8px;
  color: var(--lt-muted);
}
.navbar-toggler:focus { box-shadow: none; }
.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='%238b949e' stroke-width='2.5' stroke-linecap='round' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}
[data-bs-theme="light"] .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='%2357606a' stroke-width='2.5' stroke-linecap='round' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

/* Navbar collapse (app.js toggles .show) */
.navbar-collapse { display: none; }
@media (min-width: 992px) {
  .navbar-collapse {
    display: flex !important;
    flex-basis: auto;
    align-items: center;
  }
  .navbar-toggler { display: none; }
}
.navbar-collapse.show { display: block; width: 100%; }
@media (max-width: 991.98px) {
  .app-navbar {
    height: auto;
    min-height: 56px;
  }
  .app-navbar > .container-fluid {
    height: auto;
    min-height: 56px;
    align-items: center;
  }
  .navbar-collapse.show {
    background: var(--lt-surface);
    border-top: 1px solid var(--lt-border);
    border-bottom: 1px solid var(--lt-border);
    border-radius: 0 0 8px 8px;
    box-shadow: var(--lt-shadow-md);
    margin-top: 8px;
    padding: 8px;
    position: relative;
    z-index: 2;
  }
  .app-navbar .navbar-nav { flex-direction: column; width: 100%; }
  .app-navbar .nav-link {
    border-radius: 6px;
    padding: 10px 12px !important;
    width: 100%;
  }
}
.navbar-nav a {
  margin: 0px 4px;
}
/* User dropdown */
.app-navbar .dropdown-toggle::after { margin-left: 4px; }
.app-navbar .dropdown-menu {
  background: var(--lt-surface);
  border: 1px solid var(--lt-border);
  border-radius: 8px;
  box-shadow: var(--lt-shadow-md);
  padding: 6px;
  min-width: 180px;
  display: none;
}
.app-navbar .dropdown-menu-end {
  left: auto;
  right: 8px;
}
.app-navbar .dropdown-menu.show { display: block; }
.app-navbar .dropdown-item {
  border-radius: 6px;
  font-size: 13.5px;
  margin: 0;
  padding: 7px 12px;
  width: 100%;
  color: var(--lt-text);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .12s;
  text-decoration: none;
}
.app-navbar .dropdown-item i {
  width: 16px;
  margin-right: 0 !important;
  text-align: center;
  flex: 0 0 16px;
}
.app-navbar .dropdown-item:hover {
  background: var(--lt-surface-2);
  color: var(--lt-heading);
  text-decoration: none;
}
.app-navbar .dropdown-item.text-danger { color: var(--lt-red) !important; }
.app-navbar .dropdown-item.text-danger:hover { background: rgba(248,81,73,.12); }
.app-navbar .dropdown-divider {
  border-color: var(--lt-border);
  margin: 4px 0;
  opacity: 1;
}

/* ---- Page layout ---------------------------------------------------- */
.app-main {
  padding: 28px 0 64px;
  min-height: calc(100vh - 56px - 48px);
}

.page-header {
  padding: 20px 0 20px;
  border-bottom: 1px solid var(--lt-border);
  margin-bottom: 28px;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--lt-heading);
  margin-bottom: 2px;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 13px;
  color: var(--lt-muted);
  margin: 0;
}

/* ---- Auth pages ----------------------------------------------------- */
.auth-shell {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

.auth-card {
  width: 100%;
  background: var(--lt-surface);
  border: 1px solid var(--lt-border);
  border-radius: 12px;
  box-shadow: var(--lt-shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}
.auth-header .brand-mark {
  width: 44px;
  height: 44px;
  font-size: 20px;
  margin: 0 auto 14px;
}
.auth-logo-mark {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-logo-mark img {
  display: block;
  width: 54px;
  height: 54px;
  object-fit: contain;
}
.auth-header h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 6px;
}
.auth-header p {
  font-size: 13px;
  color: var(--lt-muted);
  margin: 0;
}
.btn-github {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-color: var(--lt-border);
  background: #f0f6fc;
  color: #0d1117;
  font-weight: 600;
}
.btn-github:hover,
.btn-github:focus {
  border-color: #8b949e;
  background: #ffffff;
  color: #0d1117;
}
.btn-github:disabled {
  border-color: var(--lt-border);
  background: var(--lt-surface-3);
  color: var(--lt-muted);
  opacity: 0.8;
}
.auth-social-note {
  color: var(--lt-muted);
  font-size: 12px;
  margin: 8px 0 0;
  text-align: center;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--lt-muted);
  font-size: 12px;
  margin-top: 18px;
  text-transform: uppercase;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--lt-border);
}

/* ---- Cards ---------------------------------------------------------- */
.card {
  background: var(--lt-surface);
  border: 1px solid var(--lt-border);
  border-radius: 8px;
  box-shadow: none;
}
.card-header {
  border-bottom: 1px solid var(--lt-border);
  background: var(--lt-surface-3);
  padding: 14px 20px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--lt-heading);
}
.card-body { padding: 20px; }

/* Override Bootstrap's bg-primary card-header used in projects */
.card-header.bg-primary {
  background: var(--lt-surface-3) !important;
  color: var(--lt-heading) !important;
  border-bottom: 1px solid var(--lt-border);
}
.card-header.bg-primary .badge.bg-light {
  background: var(--lt-surface-2) !important;
  color: var(--lt-muted) !important;
  border: 1px solid var(--lt-border);
}

/* KPI stat cards */
.stat-card {
  border: none !important;
  border-radius: 10px !important;
  transition: transform .2s, box-shadow .2s;
  cursor: default;
  overflow: hidden;
  position: relative;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 100px; height: 100px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
  pointer-events: none;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,.4) !important;
}

.card-gradient-primary   { background: linear-gradient(135deg, #1f6feb 0%, #388bfd 100%); }
.card-gradient-success   { background: linear-gradient(135deg, #238636 0%, #2ea043 100%); }
.card-gradient-dark      { background: linear-gradient(135deg, #da3633 0%, #f85149 100%); }
.card-gradient-secondary { background: linear-gradient(135deg, #8957e5 0%, #a371f7 100%); }

.kpi-value {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #fff;
  margin: 8px 0;
}
.kpi-icon {
  width: 38px;
  height: 38px;
  background: rgba(255,255,255,.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: #fff;
  flex-shrink: 0;
}

.chart-card .card-header {
  padding: 16px 20px 8px;
  background: transparent;
  border-bottom: none;
}
.chart-card .page-subtitle { margin-top: 2px; }
.dashboard-chart-lg {
  display: block;
  width: 100% !important;
  height: 340px !important;
  max-height: 340px;
}
.dashboard-chart-sm-wrap {
  height: 220px;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px 18px;
}
.dashboard-chart-sm-wrap canvas {
  display: block;
  width: 190px !important;
  height: 190px !important;
  max-width: 100%;
}
.dashboard-insight-card .card-header {
  padding-bottom: 8px;
}
.dashboard-list {
  display: grid;
  gap: 8px;
}
.dashboard-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 10px;
  background: var(--lt-surface-2);
  border: 1px solid var(--lt-border);
  border-radius: 8px;
}
.insight-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex: 0 0 auto;
  background: var(--lt-muted);
}
.insight-dot-danger { background: var(--lt-red); }
.insight-dot-warning { background: var(--lt-orange); }
.insight-dot-info { background: var(--lt-blue); }
.insight-dot-primary { background: var(--lt-purple); }
.insight-dot-success { background: var(--lt-green); }
.scan-health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.scan-health-grid > div {
  padding: 12px;
  background: var(--lt-surface-2);
  border: 1px solid var(--lt-border);
  border-radius: 8px;
}

/* ---- Tables --------------------------------------------------------- */
.table {
  color: var(--lt-text);
  border-color: var(--lt-border);
  font-size: 13.5px;
  margin-bottom: 0;
}
.table > thead > tr > th {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--lt-muted);
  background: var(--lt-surface-3);
  border-bottom: 1px solid var(--lt-border);
  padding: 10px 16px;
  white-space: nowrap;
}
.table > tbody > tr > td {
  padding: 12px 16px;
  border-color: var(--lt-border);
  vertical-align: middle;
}
.table-hover > tbody > tr:hover > td {
  background-color: var(--lt-surface-3);
}

/* Security alerts: keep the main table focused, reveal supporting metadata on tap/click. */
.security-alerts-table {
  min-width: 980px;
}
.security-alert-row {
  position: relative;
}
.security-summary-cell {
  min-width: 300px;
  line-height: 1.45;
}
.security-alert-row .icon-btn {
  width: 30px;
  height: 30px;
}
.security-severity-badge {
  max-width: 140px;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  color: #fff;
  background: var(--lt-orange);
}
.security-severity-badge[data-severity*="critical"] {
  background: var(--lt-red);
}
.security-severity-badge[data-severity*="high"] {
  background: #f97316;
}
.security-severity-badge[data-severity*="medium"],
.security-severity-badge[data-severity*="moderate"] {
  background: var(--lt-orange);
  color: #161b22;
}
.security-severity-badge[data-severity*="low"] {
  background: var(--lt-green);
}

@media (max-width: 768px) {
  .security-alerts-table {
    min-width: 780px;
  }
}

/* Stack component chips (projects.html) */
.border.rounded-3.bg-primary-subtle {
  background: var(--lt-surface-2) !important;
  border-color: var(--lt-border) !important;
}
.border.rounded-3.bg-primary-subtle .text-uppercase.text-muted {
  color: var(--lt-muted) !important;
  font-size: 10.5px;
  letter-spacing: .06em;
}
.stack-preview-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.stack-preview-chip {
  min-width: 132px;
  max-width: 170px;
  padding: 8px 10px;
}
.stack-preview-chip .fw-semibold {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stack-overflow {
  position: relative;
}
.stack-overflow-trigger {
  min-height: 34px;
  border: 1px solid var(--lt-border);
  border-radius: 999px;
  background: var(--lt-surface-3);
  color: var(--lt-text);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
}
.stack-overflow-trigger:hover,
.stack-overflow-trigger:focus,
.stack-overflow.is-open .stack-overflow-trigger {
  border-color: var(--lt-blue);
  color: var(--lt-blue);
  outline: none;
}
.stack-overflow-panel {
  display: none;
  width: min(300px, 70vw);
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  background: var(--lt-surface);
  border: 1px solid var(--lt-border);
  border-radius: 8px;
  box-shadow: var(--lt-shadow-md);
}
.stack-overflow-panel-floating {
  position: fixed;
  z-index: 3000;
  display: block;
}
.stack-overflow-item {
  padding: 8px 10px;
  border-radius: 6px;
}
.stack-overflow-item + .stack-overflow-item {
  border-top: 1px solid var(--lt-border);
}
.stack-overflow-name {
  color: var(--lt-heading);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.stack-overflow-meta {
  color: var(--lt-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

/* ---- Forms ---------------------------------------------------------- */
.form-control,
.form-select {
  background-color: var(--lt-surface);
  border: 1px solid var(--lt-border);
  border-radius: 6px;
  color: var(--lt-text);
  font-size: 14px;
  padding: 7px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus,
.form-select:focus {
  background-color: var(--lt-surface);
  border-color: var(--lt-blue);
  box-shadow: 0 0 0 3px rgba(31,111,235,.25);
  color: var(--lt-text);
  outline: none;
}
.form-control::placeholder { color: var(--lt-muted); opacity: 1; }
.form-control:disabled,
.form-select:disabled { opacity: .5; cursor: not-allowed; }

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--lt-text);
  margin-bottom: 6px;
}
.form-text { font-size: 12px; color: var(--lt-muted); }

.form-check-input {
  background-color: var(--lt-surface);
  border-color: var(--lt-border);
}
.form-check-input:checked {
  background-color: var(--lt-blue-btn);
  border-color: var(--lt-blue-btn);
}

/* Input group — password toggle */
.input-group > .form-control { border-right: none; }
.input-group .btn-outline-secondary {
  border: 1px solid var(--lt-border);
  border-left: none;
  color: var(--lt-muted);
  background: var(--lt-surface);
  border-radius: 0 6px 6px 0;
}
.input-group .btn-outline-secondary:hover {
  background: var(--lt-surface-2);
  color: var(--lt-text);
  border-color: var(--lt-border);
}

/* Auto-fill override */
input:-webkit-autofill,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--lt-surface) inset !important;
  -webkit-text-fill-color: var(--lt-text) !important;
  caret-color: var(--lt-text);
}
[data-bs-theme="light"] input:-webkit-autofill,
[data-bs-theme="light"] input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  -webkit-text-fill-color: #1f2328 !important;
}

/* ---- Buttons -------------------------------------------------------- */
.btn {
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 6px;
  padding: 5px 16px;
  line-height: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
  text-decoration: none;
}
.btn:focus { outline: none; }
.btn-sm  { font-size: 12px;  padding: 4px 12px; }
.btn-lg  { font-size: 15px;  padding: 10px 20px; }

.btn-primary {
  background-color: var(--lt-blue-btn);
  border-color:     var(--lt-blue-btn);
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--lt-blue-btn-h);
  border-color:     var(--lt-blue-btn-h);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(31,111,235,.3);
}

.btn-outline-primary {
  border-color: var(--lt-border);
  color: var(--lt-blue);
  background: transparent;
}
.btn-outline-primary:hover {
  background: var(--lt-surface-2);
  border-color: var(--lt-blue);
  color: var(--lt-blue-hover);
}

.btn-outline-secondary {
  border-color: var(--lt-border);
  color: var(--lt-text);
  background: transparent;
}
.btn-outline-secondary:hover {
  background: var(--lt-surface-2);
  color: var(--lt-heading);
  border-color: var(--lt-border);
}

.btn-danger {
  background-color: var(--lt-red);
  border-color:     var(--lt-red);
  color: #fff;
}
.btn-danger:hover { background-color: #da3633; border-color: #da3633; color: #fff; }

.btn-success {
  background-color: var(--lt-green);
  border-color:     var(--lt-green);
  color: #fff;
}
.btn-success:hover { background-color: var(--lt-green-h); border-color: var(--lt-green-h); color: #fff; }

.btn-close {
  filter: invert(1) grayscale(1) brightness(2);
  opacity: .6;
}
[data-bs-theme="light"] .btn-close { filter: none; }

/* ---- Badges --------------------------------------------------------- */
.badge {
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 9px;
  letter-spacing: .02em;
}
.badge-pill-custom {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
}
.bg-primary   { background-color: var(--lt-blue-btn) !important; }
.bg-success   { background-color: var(--lt-green)    !important; }
.bg-danger    { background-color: var(--lt-red)      !important; }
.bg-warning   { background-color: var(--lt-orange)   !important; color: #fff !important; }
.bg-secondary { background-color: var(--lt-surface-2) !important; color: var(--lt-text) !important; }
.text-primary { color: var(--lt-blue)   !important; }
.text-muted   { color: var(--lt-muted)  !important; }
.text-success { color: var(--lt-green)  !important; }
.text-danger  { color: var(--lt-red)    !important; }
.text-warning { color: var(--lt-orange) !important; }

/* ---- Alerts --------------------------------------------------------- */
.alert {
  border-radius: 6px;
  font-size: 13.5px;
  padding: 10px 16px;
  border-width: 1px;
}
.alert-danger {
  background: rgba(248,81,73,.1);
  border-color: rgba(248,81,73,.4);
  color: #ffa198;
}
.alert-success {
  background: rgba(46,160,67,.1);
  border-color: rgba(46,160,67,.4);
  color: #56d364;
}
.alert-warning {
  background: rgba(210,153,34,.1);
  border-color: rgba(210,153,34,.4);
  color: #d29922;
}
[data-bs-theme="light"] .alert-danger {
  background: #ffebe9;
  border-color: rgba(209,36,47,.4);
  color: #d1242f;
}
[data-bs-theme="light"] .alert-success {
  background: #dafbe1;
  border-color: rgba(26,127,55,.4);
  color: #1a7f37;
}

/* ---- Modals --------------------------------------------------------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1050;
  overflow-y: auto;
}
.modal.show { display: block; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1040;
  background: rgba(1,4,9,.7);
  opacity: 0;
  transition: opacity .2s;
}
.modal-backdrop.show { opacity: 1; }

.modal-content {
  background: var(--lt-surface);
  border: 1px solid var(--lt-border);
  border-radius: 10px;
  color: var(--lt-text);
  box-shadow: var(--lt-shadow-lg);
}
.modal-header {
  border-bottom: 1px solid var(--lt-border);
  padding: 16px 20px;
  align-items: center;
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--lt-heading);
}
.modal-project-name {
  color: var(--lt-heading);
}
.modal-body  { padding: 20px; }
.modal-footer {
  border-top: 1px solid var(--lt-border);
  padding: 12px 20px;
  gap: 8px;
}

/* ---- Dropdowns (app.js toggles .show) ------------------------------ */
.dropdown-menu {
  background: var(--lt-surface);
  border: 1px solid var(--lt-border);
  border-radius: 8px;
  box-shadow: var(--lt-shadow-md);
  padding: 6px;
  font-size: 13.5px;
  display: none;
  min-width: 160px;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  border-radius: 6px;
  padding: 7px 12px;
  color: var(--lt-text);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .12s;
  text-decoration: none;
}
.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--lt-surface-2);
  color: var(--lt-heading);
  text-decoration: none;
}
.dropdown-item.text-danger { color: var(--lt-red) !important; }
.dropdown-item.text-danger:hover { background: rgba(248,81,73,.1); }
.dropdown-divider { border-color: var(--lt-border); opacity: 1; margin: 4px 0; }

/* ---- Toasts --------------------------------------------------------- */
.toast-container { z-index: 1100; }

.toast {
  background: var(--lt-surface);
  border: 1px solid var(--lt-border);
  border-radius: 8px;
  box-shadow: var(--lt-shadow-md);
  font-size: 13.5px;
  min-width: 260px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .25s, transform .25s;
  color: var(--lt-text);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.hide { opacity: 0; transform: translateY(-8px); }
.toast .toast-body { padding: 12px 16px; font-weight: 500; }
.toast.bg-success {
  background: rgba(46,160,67,.15) !important;
  border-color: rgba(46,160,67,.4);
  color: #56d364 !important;
}
.toast.bg-danger {
  background: rgba(248,81,73,.15) !important;
  border-color: rgba(248,81,73,.4);
  color: #ffa198 !important;
}
.toast.bg-primary {
  background: rgba(31,111,235,.15) !important;
  border-color: rgba(31,111,235,.4);
  color: var(--lt-blue) !important;
}

/* ---- Pagination ----------------------------------------------------- */
.page-link {
  background: var(--lt-surface);
  border-color: var(--lt-border);
  color: var(--lt-blue);
  font-size: 13px;
}
.page-link:hover {
  background: var(--lt-surface-2);
  border-color: var(--lt-border);
  color: var(--lt-blue-hover);
}
.page-item.active .page-link {
  background: var(--lt-blue-btn);
  border-color: var(--lt-blue-btn);
  color: #fff;
}
.page-item.disabled .page-link {
  background: var(--lt-surface);
  color: var(--lt-muted);
  border-color: var(--lt-border);
}

/* ---- Footer --------------------------------------------------------- */
.app-footer {
  padding: 12px 24px;
  font-size: 12px;
  color: var(--lt-muted);
  border-top: 1px solid var(--lt-border);
  text-align: center;
  background: var(--lt-bg);
}

/* ---- Utility overrides --------------------------------------------- */
.shadow-sm { box-shadow: var(--lt-shadow-sm) !important; }
.shadow    { box-shadow: var(--lt-shadow-md) !important; }
.border-0  { border: none !important; }
.rounded-3 { border-radius: 8px !important; }
.text-break { word-break: break-word; overflow-wrap: break-word; }
.fw-semibold { font-weight: 600; }
.fw-medium   { font-weight: 500; }

select.form-select option {
  background: var(--lt-surface);
  color: var(--lt-text);
}

/* d-grid (used on auth submit buttons) */
.d-grid { display: grid; }
.d-grid .btn { width: 100%; justify-content: center; }

/* ---- Responsive ------------------------------------------------------ */
@media (max-width: 768px) {
  .app-main    { padding: 16px 0 40px; }
  .page-header { padding: 16px 0; margin-bottom: 16px; }
  .kpi-value   { font-size: 30px; }
  .section-title { font-size: 18px; }
  .card-body   { padding: 16px; }
}

/* ============================================================
   GitHub repository picker (Add / Edit Project modals)
   ============================================================ */

.repo-import {
  border: 1px solid var(--lt-border);
  border-radius: 12px;
  background: var(--lt-surface-2);
  overflow: hidden;
}

.repo-import-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--lt-border);
  background: var(--lt-surface);
}

.repo-import-title {
  display: flex;
  align-items: center;
  gap: .625rem;
  min-width: 0;
}

.repo-import-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 8px;
  background: var(--lt-surface-3);
  color: var(--lt-heading);
  font-size: 1rem;
}

.repo-import-label {
  display: block;
  font-weight: 600;
  color: var(--lt-heading);
  line-height: 1.2;
}

.repo-import-sub {
  display: block;
  color: var(--lt-muted);
  font-size: .78rem;
  line-height: 1.3;
}

/* ---- search ---- */
.repo-search {
  position: relative;
  padding: .75rem 1rem .5rem;
}

.repo-search-icon {
  position: absolute;
  left: 1.75rem;
  top: 50%;
  transform: translateY(-25%);
  color: var(--lt-muted);
  font-size: .85rem;
  pointer-events: none;
}

.repo-search .github-repo-search {
  padding-left: 2.25rem;
  font-size: .875rem;
}

/* ---- list ---- */
.repo-list {
  max-height: 264px;
  overflow-y: auto;
  padding: 0 .5rem .5rem;
  scrollbar-width: thin;
}

.repo-list:focus-visible {
  outline: 2px solid var(--lt-blue);
  outline-offset: -2px;
  border-radius: 8px;
}

.repo-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  width: 100%;
  padding: .625rem .75rem;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  color: var(--lt-text);
  transition: background-color .12s ease, border-color .12s ease;
}

.repo-item + .repo-item { margin-top: 2px; }
.repo-item:hover { background: var(--lt-nav-hover-bg); }

.repo-item.is-selected {
  background: rgba(88, 166, 255, .12);
  border-color: var(--lt-blue);
}

.repo-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 6px;
  object-fit: cover;
  margin-top: 2px;
}

.repo-avatar-fallback {
  display: grid;
  place-items: center;
  background: var(--lt-surface-3);
  color: var(--lt-muted);
}

.repo-body {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: .175rem;
}

.repo-title-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}

.repo-name {
  font-weight: 600;
  font-size: .875rem;
  color: var(--lt-heading);
  overflow-wrap: anywhere;
}

.repo-desc {
  font-size: .8rem;
  color: var(--lt-muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.repo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  font-size: .75rem;
  color: var(--lt-muted);
}

.repo-meta-item {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}

.repo-lang-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.repo-tag {
  font-size: .68rem;
  font-weight: 500;
  line-height: 1;
  padding: .2rem .45rem;
  border-radius: 999px;
  border: 1px solid var(--lt-border);
  color: var(--lt-muted);
  white-space: nowrap;
}

.repo-tag.is-private { border-color: var(--lt-orange); color: var(--lt-orange); }
.repo-tag.is-public  { border-color: var(--lt-border);  color: var(--lt-muted); }
.repo-tag.is-archived{ border-color: var(--lt-red);     color: var(--lt-red); }

.repo-check {
  margin-top: 4px;
  color: var(--lt-blue);
  opacity: 0;
  transition: opacity .12s ease;
  flex: 0 0 auto;
}

.repo-item.is-selected .repo-check { opacity: 1; }

.repo-list-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 2rem 1rem;
  color: var(--lt-muted);
  font-size: .85rem;
  text-align: center;
}

.repo-list-empty i { font-size: 1.1rem; }

/* ---- footer ---- */
.repo-import-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .625rem 1rem;
  border-top: 1px solid var(--lt-border);
  background: var(--lt-surface);
}

.github-repo-helper {
  color: var(--lt-muted);
  font-size: .8rem;
  min-width: 0;
}

.github-import-status:not(:empty) {
  padding: .5rem 1rem .75rem;
  font-size: .8rem;
  background: var(--lt-surface);
}

.github-import-status.is-muted   { color: var(--lt-muted); }
.github-import-status.is-success { color: var(--lt-green-h); }
.github-import-status.is-error   { color: var(--lt-red); }

/* Brief highlight so it is obvious which fields the import filled in. */
@keyframes lt-autofill-flash {
  from { background-color: rgba(88, 166, 255, .18); }
  to   { background-color: transparent; }
}

.field-autofilled {
  animation: lt-autofill-flash 1.2s ease-out;
  border-color: var(--lt-blue) !important;
}

@media (max-width: 575.98px) {
  .repo-import-foot { flex-direction: column; align-items: stretch; }
  .repo-import-foot .github-import-btn { width: 100%; }
  .repo-list { max-height: 220px; }
}
