:root {
  --qc-shell-bg: #f7f4ef;
  --qc-shell-surface: #ffffff;
  --qc-shell-muted-surface: #f3eee7;
  --qc-shell-border: rgba(120, 95, 75, 0.2);
  --qc-shell-border-strong: rgba(120, 95, 75, 0.32);
  --qc-shell-text: #1e1a16;
  --qc-shell-muted: #7a6f66;
  --qc-shell-accent: #d97706;
  --qc-shell-accent-soft: rgba(217, 119, 6, 0.1);
  --qc-shell-blue: #1677ff;
  --qc-shell-green: #16a34a;
  --qc-shell-red: #dc2626;
  --qc-shell-orange: #f59e0b;
  --qc-shell-shadow: 0 10px 28px rgba(35, 27, 18, 0.08);
  --qc-shell-sidebar: 286px;
}

body.qc-shell-body {
  background: var(--qc-shell-bg);
}

body.qc-shell-dark {
  --qc-shell-bg: #16130f;
  --qc-shell-surface: #211d18;
  --qc-shell-muted-surface: #2a251f;
  --qc-shell-border: rgba(241, 211, 179, 0.18);
  --qc-shell-border-strong: rgba(241, 211, 179, 0.28);
  --qc-shell-text: #f7efe7;
  --qc-shell-muted: #b8aa9d;
  --qc-shell-accent-soft: rgba(245, 158, 11, 0.14);
  color: var(--qc-shell-text);
}

#mainView.qc-shell-root,
.container.qc-shell-root,
.wrap.qc-shell-root {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.qc-shell-root[style*="display: none"] {
  display: none !important;
}

.qc-app-frame {
  display: grid;
  grid-template-columns: var(--qc-shell-sidebar) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--qc-shell-bg);
  color: var(--qc-shell-text);
}

.qc-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--qc-shell-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(243, 238, 231, 0.92));
  overflow-y: auto;
  z-index: 20;
}

.qc-shell-dark .qc-sidebar {
  background: linear-gradient(180deg, rgba(33, 29, 24, 0.96), rgba(24, 21, 17, 0.98));
}

.qc-sidebar-brand {
  padding: 22px 22px 20px;
  border-bottom: 1px solid var(--qc-shell-border);
}

.qc-brand-title {
  font-size: 24px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--qc-shell-text);
}

.qc-brand-subtitle {
  margin-top: 9px;
  font-size: 14px;
  color: var(--qc-shell-muted);
}

.qc-nav {
  padding: 20px 14px;
  display: grid;
  gap: 22px;
}

.qc-nav-group {
  display: grid;
  gap: 7px;
}

.qc-nav-label {
  padding: 0 10px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--qc-shell-muted);
}

.qc-nav-link {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--qc-shell-muted);
  text-decoration: none;
  font-size: 16px;
  font-weight: 700;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.qc-nav-link:hover {
  background: var(--qc-shell-accent-soft);
  color: var(--qc-shell-text);
  transform: translateX(2px);
}

.qc-nav-link[aria-current="page"] {
  background: var(--qc-shell-surface);
  color: var(--qc-shell-text);
  box-shadow: 0 1px 0 var(--qc-shell-border);
}

.qc-nav-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.qc-sidebar-footer {
  margin-top: auto;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.qc-sidebar-action {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 12px;
  font: inherit;
  font-weight: 700;
  color: var(--qc-shell-muted);
  background: var(--qc-shell-muted-surface);
  cursor: pointer;
}

.qc-sidebar-action:hover {
  color: var(--qc-shell-text);
  border-color: var(--qc-shell-border);
}

.qc-version {
  text-align: center;
  font-size: 12px;
  color: var(--qc-shell-muted);
  padding: 8px 0 2px;
}

.qc-workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.qc-page-header {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 34px 38px 18px;
  background: linear-gradient(180deg, var(--qc-shell-bg) 70%, rgba(247, 244, 239, 0));
}

.qc-shell-dark .qc-page-header {
  background: linear-gradient(180deg, var(--qc-shell-bg) 70%, rgba(22, 19, 15, 0));
}

.qc-page-title {
  font-size: 30px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--qc-shell-text);
}

.qc-page-subtitle {
  margin-top: 7px;
  font-size: 15px;
  color: var(--qc-shell-muted);
}

.qc-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qc-icon-button {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  border: 1px solid var(--qc-shell-border);
  background: var(--qc-shell-surface);
  color: var(--qc-shell-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.qc-icon-button:hover {
  border-color: var(--qc-shell-border-strong);
  color: var(--qc-shell-text);
  background: var(--qc-shell-muted-surface);
}

.qc-menu-button {
  display: none;
}

.qc-page-body {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 18px 38px 46px;
  display: grid;
  gap: 24px;
}

body[data-app-page="overview"] .qc-page-body > .header {
  display: none;
}

body[data-app-page="cache"] .qc-page-body > .header {
  display: none;
}

.qc-dashboard-overview {
  display: grid;
  gap: 24px;
}

.qc-overview-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 18px;
}

.qc-metric-card {
  min-height: 172px;
  padding: 22px 24px;
  border: 1px solid var(--qc-shell-border-strong);
  border-radius: 8px;
  background: var(--qc-shell-surface);
  box-shadow: var(--qc-shell-shadow);
  display: grid;
  align-content: space-between;
  gap: 22px;
}

.qc-metric-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--qc-shell-muted);
}

.qc-metric-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--qc-shell-blue);
}

.qc-metric-dot.green {
  background: var(--qc-shell-green);
}

.qc-metric-dot.red {
  background: var(--qc-shell-red);
}

.qc-metric-dot.orange {
  background: var(--qc-shell-orange);
}

.qc-metric-value {
  font-size: clamp(42px, 5vw, 66px);
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--qc-shell-text);
  overflow-wrap: anywhere;
}

.qc-metric-caption {
  font-size: 14px;
  color: var(--qc-shell-muted);
}

.qc-section-anchor {
  scroll-margin-top: 120px;
}

body.qc-sidebar-open {
  overflow: hidden;
}

.qc-sidebar-backdrop {
  display: none;
}

@media (max-width: 1180px) {
  .qc-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .qc-app-frame {
    grid-template-columns: 1fr;
  }

  .qc-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(82vw, var(--qc-shell-sidebar));
    transform: translateX(-105%);
    transition: transform 220ms ease;
    box-shadow: var(--qc-shell-shadow);
  }

  body.qc-sidebar-open .qc-sidebar {
    transform: translateX(0);
  }

  .qc-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    border: 0;
    background: rgba(20, 16, 12, 0.38);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
    z-index: 18;
  }

  body.qc-sidebar-open .qc-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .qc-menu-button {
    display: inline-flex;
  }

  .qc-page-header {
    padding: 18px 18px 8px;
  }

  .qc-page-body {
    padding: 14px 18px 30px;
  }
}

/* pause infinite animations when page is hidden to save GPU/CPU */
body[data-page-hidden] .aurora-layer,
body[data-page-hidden] .orb,
body[data-page-hidden] .floating-bubble,
body[data-page-hidden] .glow-pulse,
body[data-page-hidden] [class*="animate-spin"],
body[data-page-hidden] [class*="animate-pulse"] {
  animation-play-state: paused !important;
}

@media (max-width: 640px) {
  .qc-page-title {
    font-size: 24px;
  }

  .qc-page-subtitle {
    font-size: 13px;
  }

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

  .qc-metric-card {
    min-height: 140px;
  }
}
