.dashboard-page {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* ─────────────────────────────────────────────
   MINIMAL LIVING BACKGROUND (project + sub-agent dashboard pages)
   Scoped under `.dash-min` (set by project_base.html/agent_base.html only),
   so the 5+ other templates sharing this stylesheet are untouched. Reuses
   the .th-bg-* markup/JS contract from home.css/projects.css's `.dash-pro`
   but pared down — fewer orbs, no grid/noise layer, lower opacities — since
   these pages are content-dense and the backdrop should stay out of the way.
   Star count on .th-bg-constellation is set per-user via the canvas's
   data-density attribute (home.js), defaulting to a low value and editable
   from the profile page; the home page's own constellation never reads
   data-density and is not affected by that setting. */
.dash-min .mesh-bg { display: none !important; }
.dash-min .th-bg {
  position: fixed;
  inset: 0;
  /* Negative, not 0: .main-content/.ad-main here have no position of their
     own (unlike .sidebar's explicit z-index:10), so under the CSS2.1 paint
     order a z-index:0 fixed layer would stack ABOVE that unpositioned
     in-flow content and blank out the whole page. A negative z-index paints
     in the stacking context's "below everything in-flow" pass instead,
     which is what home.css/projects.css's z-index:0 relies on their pages'
     content being explicitly positioned to opt out of — these pages aren't. */
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(1000px 600px at 80% -10%, rgba(59, 130, 246, .08), transparent 60%),
    linear-gradient(180deg, #08080e 0%, #070710 45%, #06060c 100%);
}
.dash-min .th-bg-aurora {
  position: absolute;
  inset: -30% -10% auto -10%;
  height: 70vh;
  background:
    conic-gradient(from 120deg at 50% 40%,
      rgba(96, 165, 250, 0) 0deg, rgba(96, 165, 250, .08) 70deg,
      rgba(59, 130, 246, .03) 150deg, rgba(147, 197, 253, .07) 240deg,
      rgba(96, 165, 250, 0) 360deg);
  filter: blur(80px);
  opacity: .4;
  animation: dmAurora 34s linear infinite;
}
@keyframes dmAurora { from { transform: rotate(0deg) scale(1.1); } to { transform: rotate(360deg) scale(1.1); } }
.dash-min .th-bg-orb { position: absolute; border-radius: 50%; filter: blur(100px); opacity: .6; }
.dash-min .th-bg-orb-1 { width: 420px; height: 420px; top: -14%; left: -10%; background: rgba(96, 165, 250, .06); animation: dmOrb1 28s ease-in-out infinite; }
.dash-min .th-bg-orb-2 { width: 380px; height: 380px; bottom: -16%; right: -8%; background: rgba(59, 130, 246, .05); animation: dmOrb2 32s ease-in-out infinite; }
@keyframes dmOrb1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(40px,30px)} }
@keyframes dmOrb2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-35px,25px)} }
.dash-min .th-bg-constellation { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .32; }
.dash-min .th-bg-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(130% 100% at 50% 0%, transparent 55%, rgba(4, 4, 9, .5) 100%);
}

.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.app-body .main-content {
  height: auto;
}

/* ── Sidebar ──────────────────────────────────────── */

.sidebar {
  position: relative;
  z-index: 10;
  width: 260px;
  min-width: 260px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--sidebar-border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-brand {
  margin-bottom: 4px;
  padding-left: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.pd-logo {
  width: 120px;
  display: block;
  margin-bottom: 12px;
}

.sidebar-sub {
  font-size: 11px;
  color: var(--text-muted);
  padding-left: 4px;
  margin-bottom: 24px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--text-muted);
  margin: 12px 0 6px 4px;
  padding-top: 10px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-section-label:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-list li {
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all .25s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.nav-list li::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: var(--surface);
  opacity: 0;
  transition: opacity .25s ease;
}

.nav-list li:hover::before { opacity: 1; }
.nav-list li:hover { color: var(--text); border-color: var(--glass-border); }

.nav-list li.active {
  color: var(--accent);
  border-color: var(--accent);
}

.nav-list li.active::before {
  opacity: 1;
  background: var(--glow);
}

.nav-list li .nav-icon { position: relative; z-index: 1; font-size: 14px; width: 18px; text-align: center; }
.nav-list li .nav-svg { width: 18px; height: 18px; flex-shrink: 0; position: relative; z-index: 1; color: inherit; }
.nav-list li .name { position: relative; z-index: 1; font-size: 12.5px; }

.nav-list li a {
  position: relative;
  z-index: 1;
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.nav-list li.nav-disabled {
  opacity: .35;
  cursor: not-allowed;
  pointer-events: none;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--glass-border);
}

.sidebar-user .su-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user .su-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--sidebar-border);
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: .05em;
}

/* ── Main ─────────────────────────────────────────── */

.main-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.main-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 0 48px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  width: 100%;
}

/* ── Topbar ───────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.topbar-left h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--heading);
  letter-spacing: -.02em;
}

.topbar-left p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-search {
  position: relative;
}

.topbar-search input {
  padding: 9px 14px 9px 36px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
  width: 220px;
  transition: all .25s ease;
}

.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); }

.topbar-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  border: 2px solid var(--glass-border);
  transition: border-color .25s ease;
}

.topbar-avatar:hover { border-color: var(--accent); }

.topbar-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all .25s ease;
  position: relative;
}

.topbar-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--accent); }

.topbar-btn .dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}

.topbar-btn .count-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 100px;
  line-height: 16px;
  min-width: 16px;
  text-align: center;
  border: 2px solid var(--bg);
}

/* ── Overview Tab ─────────────────────────────────── */

.overview-grid {
  display: grid;
  gap: 20px;
}

.overview-welcome {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 32px;
  backdrop-filter: blur(12px);
}

.overview-welcome h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 8px;
}

.overview-welcome p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
  max-width: 500px;
}

.overview-welcome .welcome-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.overview-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.overview-stat {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  backdrop-filter: blur(12px);
  transition: all .35s ease;
}

.overview-stat:hover {
  transform: translateY(-4px);
  background: var(--surface-hover);
}

.overview-stat .os-svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
  margin-bottom: 10px;
  display: block;
}

.overview-stat .os-icon {
  font-size: 20px;
  margin-bottom: 8px;
  display: inline-block;
}

.overview-stat .os-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.overview-stat .os-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.overview-quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.quick-action {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all .3s ease;
  backdrop-filter: blur(8px);
  text-decoration: none;
  display: block;
}

.quick-action:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  background: var(--surface-hover);
}

.quick-action .qa-svg { width: 24px; height: 24px; display: block; margin: 0 auto 8px; color: var(--accent); }
.quick-action .qa-icon { font-size: 24px; display: block; margin-bottom: 6px; }
.quick-action .qa-label { font-size: 12px; font-weight: 600; color: var(--text); }

/* ── Tab Content ──────────────────────────────────── */

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ── Page Header ──────────────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--heading);
}

.btn-primary-sm {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  background: var(--gradient-1);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .25s ease;
  text-decoration: none;
}

.btn-primary-sm:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(96,165,250,.3);
}

/* ── Projects Grid ────────────────────────────────── */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.project-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 24px;
  backdrop-filter: blur(12px);
  transition: all .35s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.project-card:hover {
  transform: translateY(-4px);
  background: var(--surface-hover);
}

.project-card .pc-accent {
  position: absolute;
  top: 0; left: 0; right: 0;
  width: 100%;
  height: 5px;
  border-radius: inherit;
  opacity: 0;
  transition: opacity .35s ease;
  z-index: 1;
}

.project-card:hover .pc-accent { opacity: 1; }

.project-card .pc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.project-card .pc-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--heading);
}

.project-card .pc-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .25s ease;
}

.project-card:hover .pc-actions { opacity: 1; }

.project-card .pc-action {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all .2s ease;
}

.project-card .pc-action:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--accent);
}

.project-card .pc-action.delete:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.project-card .pc-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card .pc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.project-card .pc-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.project-card .pc-meta .color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid var(--glass-border);
}

.project-card .pc-stats {
  display: flex;
  gap: 16px;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--glass-border);
}

.project-card .pc-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.project-card .pc-stat .stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--heading);
}

/* ── Empty State ──────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 80px 20px;
  background: var(--glass);
  border: 2px dashed var(--glass-border);
  border-radius: 20px;
  backdrop-filter: blur(12px);
  transition: all .35s ease;
}

.empty-state:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.empty-state .empty-svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  display: block;
  color: var(--text-muted);
  opacity: .5;
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
  opacity: .5;
}

.empty-state h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Section heading ──────────────────────────────── */

.section-heading {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 16px;
}

/* ── Responsive ───────────────────────────────────── */

@media (max-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .overview-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .overview-quick {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-page {
    flex-direction: column;
    overflow: auto;
    height: auto;
  }

  .sidebar {
    width: 100%;
    min-width: unset;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
    padding: 16px 20px;
    max-height: 45vh;
  }

  .sidebar-footer { display: none; }

  .main-content {  }
  .main-inner { padding: 24px 16px; }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .overview-stats {
    grid-template-columns: 1fr;
  }

  .overview-quick {
    grid-template-columns: 1fr 1fr;
  }

  .topbar-search input { width: 140px; }
}
