/* Theme A: Graphite + Teal (enterprise premium) */

:root {
  --a-bg: var(--ds-bg);
  --a-surface: var(--ds-surface);
  --a-surface-elev: var(--ds-surface-elev);
  --a-text: var(--ds-text);
  --a-muted: var(--ds-muted);
  --a-divider: var(--ds-divider);
  --a-border-strong: var(--ds-border-strong);
  --a-accent: var(--ds-accent);
  --a-accent-soft: var(--ds-accent-soft);
  --a-success: var(--ds-success);
  --a-warning: var(--ds-warning);
  --a-danger: var(--ds-danger);
}

body {
  background: var(--a-bg) !important;
  color: var(--a-text) !important;
}

.analyst-shell .hero,
.analyst-shell .panel,
.analyst-shell .analyst-card-surface,
.analyst-shell .analyst-summary-card,
.analyst-shell .analyst-kpi,
.analyst-shell .analyst-complexity-card,
.analyst-shell .analyst-side-box {
  background: var(--a-surface) !important;
  border-color: var(--a-divider) !important;
  color: var(--a-text) !important;
}

.analyst-shell .analyst-sidebar {
  background: #0b1220 !important;
  border-color: #0b1220 !important;
}

.analyst-shell .analyst-sidebar-title,
.analyst-shell .analyst-sidebar > h2,
.analyst-shell .analyst-nav-text,
.analyst-shell .analyst-side-value {
  color: #f8fafc !important;
}

.analyst-shell .analyst-sidebar-sub,
.analyst-shell .analyst-nav-group-label,
.analyst-shell .analyst-side-label {
  color: #cbd5e1 !important;
}

.analyst-shell .analyst-nav-btn {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
}

.analyst-shell .analyst-nav-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.28) !important;
}

.analyst-shell .analyst-nav-btn.is-active {
  background: rgba(15, 118, 110, 0.24) !important;
  border-color: rgba(110, 231, 183, 0.36) !important;
  box-shadow: inset 3px 0 0 var(--a-accent) !important;
}

/* Active text lock to avoid legacy override conflicts */
html body .analyst-shell .analyst-nav-btn.is-active .analyst-nav-text {
  color: #f8fafc !important;
}

.analyst-shell .analyst-nav-icon {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.24) !important;
  color: #e2e8f0 !important;
}

.analyst-shell .analyst-nav-icon-svg {
  width: 14px;
  height: 14px;
  display: block;
}

.analyst-shell .analyst-nav-meta {
  background: var(--a-accent) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}

.analyst-shell .analyst-sidebar-head {
  align-items: center !important;
  gap: 10px !important;
}

.analyst-shell .analyst-sidebar-toggle {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  border-radius: 10px !important;
  color: #dbe7ff !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  flex: 0 0 44px !important;
}

.analyst-shell .analyst-sidebar-toggle-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.analyst-shell .analyst-logout-btn {
  display: none;
  margin-top: 0 !important;
}

.analyst-shell .aw-toggle-glyph {
  display: none !important;
}

.analyst-shell.sidebar-collapsed .analyst-sidebar-toggle-icon {
  transform: scaleX(-1);
}

.analyst-shell h1,
.analyst-shell h2,
.analyst-shell h3,
.analyst-shell .analyst-summary-value,
.analyst-shell .analyst-kpi-value,
.analyst-shell .analyst-complexity-value {
  color: var(--a-text) !important;
}

.analyst-shell .status,
.analyst-shell .analyst-summary-sub,
.analyst-shell .analyst-complexity-sub,
.analyst-shell .analyst-section-help,
.analyst-shell .analyst-summary-label {
  color: var(--a-muted) !important;
}

/* Sidebar text lock: prevents low-contrast overrides from generic muted rules */
html body .analyst-shell .analyst-sidebar .analyst-sidebar-title,
html body .analyst-shell .analyst-sidebar > h2,
html body .analyst-shell .analyst-sidebar .analyst-nav-text,
html body .analyst-shell .analyst-sidebar .analyst-side-value {
  color: #f8fafc !important;
}

html body .analyst-shell .analyst-sidebar .analyst-sidebar-sub,
html body .analyst-shell .analyst-sidebar .analyst-nav-group-label,
html body .analyst-shell .analyst-sidebar .analyst-side-label {
  color: #dbe5f5 !important;
}

.analyst-shell input,
.analyst-shell select,
.analyst-shell textarea {
  background: var(--a-surface) !important;
  color: var(--a-text) !important;
  border: 1px solid var(--a-divider) !important;
}

.analyst-shell input:focus-visible,
.analyst-shell select:focus-visible,
.analyst-shell textarea:focus-visible,
.analyst-shell button:focus-visible {
  outline: 2px solid var(--a-accent) !important;
  outline-offset: 2px !important;
}

.analyst-shell button,
.analyst-shell .btn-secondary {
  border-color: var(--a-divider) !important;
}

.analyst-shell button:not(.analyst-nav-btn):not(.analyst-sidebar-toggle) {
  background: var(--a-accent-soft) !important;
  color: #0b3b36 !important;
  border: 1px solid #c9e6e2 !important;
}

.analyst-shell button:not(.analyst-nav-btn):not(.analyst-sidebar-toggle):hover {
  background: #d9f0ec !important;
}

.analyst-shell .analyst-build-stamp {
  background: var(--a-accent-soft) !important;
  border-color: #c9e6e2 !important;
  color: var(--a-accent) !important;
}

.analyst-shell .analyst-executive-strip {
  margin: 8px 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #d7e2f0;
  background: linear-gradient(180deg, #f8fbff 0%, #f4f8ff 100%);
}

.analyst-shell .analyst-executive-strip > h2,
.analyst-shell .analyst-executive-strip > h3 {
  margin: 0 0 4px;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

.analyst-shell .analyst-alert.warn {
  border-color: #f4d7bb !important;
  background: #fff9f2 !important;
}

.analyst-shell .analyst-alert.danger {
  border-color: #f2c7c7 !important;
  background: #fff6f6 !important;
}

.analyst-shell .analyst-alert.good {
  border-color: #cde8d5 !important;
  background: #f6fcf8 !important;
}

.analyst-shell .analyst-action-priority {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #ffffff;
  background: #0f766e;
  vertical-align: middle;
}

.analyst-shell .analyst-chart-desc {
  margin: 4px 0 10px !important;
  color: var(--a-muted) !important;
  font-size: 0.9rem !important;
  line-height: 1.5 !important;
}

.analyst-shell .analyst-line-chart-wrap {
  display: grid;
  gap: 8px;
}

.analyst-shell .analyst-line-chart {
  width: 100%;
  height: 180px;
  display: block;
}

.analyst-shell .analyst-line-axis {
  stroke: #dbe4ef;
  stroke-width: 1;
}

.analyst-shell .analyst-line-area {
  fill: url(#trendAreaFill);
}

.analyst-shell .analyst-line-stroke {
  fill: none;
  stroke: #0f766e;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.analyst-shell .analyst-line-dot {
  fill: #0f766e;
  stroke: #ffffff;
  stroke-width: 1.5;
}

.analyst-shell .analyst-line-labels {
  display: flex;
  justify-content: space-between;
  color: var(--a-muted);
  font-size: 0.74rem;
}

.analyst-shell .analyst-mix-donut-wrap {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.analyst-shell .analyst-mix-donut {
  width: 132px;
  height: 132px;
  border-radius: 999px;
  background: var(--mix-gradient);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.analyst-shell .analyst-mix-donut::after {
  content: "";
  position: absolute;
  inset: 21px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #e2e8f0;
}

.analyst-shell .analyst-mix-legend {
  display: grid;
  gap: 7px;
}

.analyst-shell .analyst-mix-legend-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.analyst-shell .analyst-mix-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.analyst-shell .analyst-mix-legend-label {
  color: var(--a-text);
  font-size: 0.83rem;
}

.analyst-shell .analyst-mix-legend-value {
  color: var(--a-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.analyst-shell .analyst-col-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(24px, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 170px;
  padding-top: 8px;
}

.analyst-shell .analyst-col-item {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.analyst-shell .analyst-col-track {
  width: 100%;
  height: 130px;
  border-radius: 8px;
  background: #eff4fb;
  display: flex;
  align-items: end;
  overflow: hidden;
}

.analyst-shell .analyst-col-fill {
  width: 100%;
  background: linear-gradient(180deg, #67c8bc 0%, #0f766e 100%);
  border-radius: 8px 8px 0 0;
}

.analyst-shell .analyst-col-label {
  color: var(--a-muted);
  font-size: 0.72rem;
}

@media (max-width: 780px) {
  .analyst-shell .analyst-mix-donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

@media (max-width: 720px) {
  .analyst-shell .analyst-hero {
    margin-top: 8px !important;
    padding: 12px !important;
    border-radius: 14px !important;
  }

  .analyst-shell .analyst-hero h1 {
    margin: 6px 0 4px !important;
    font-size: 1.7rem !important;
    line-height: 1.12 !important;
  }

  .analyst-shell .analyst-hero .status {
    margin: 0 0 8px !important;
    font-size: 0.9rem !important;
  }

  .analyst-shell .session-shell {
    padding: 8px 10px !important;
    margin-bottom: 8px !important;
  }

  .analyst-shell .analyst-toolbar {
    margin-top: 10px !important;
    gap: 6px !important;
  }
}

/* UI41: modern animated sidebar background (subtle enterprise motion) */
.analyst-shell .analyst-sidebar {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 12% 8%, rgba(15, 118, 110, 0.14), transparent 55%),
    linear-gradient(160deg, #0b1220 0%, #0f172a 48%, #111827 100%) !important;
  border-color: #0b1220 !important;
}

.analyst-shell .analyst-sidebar::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto auto;
  width: 68%;
  height: 54%;
  pointer-events: none;
  background: radial-gradient(circle at 40% 40%, rgba(15, 118, 110, 0.12), rgba(15, 118, 110, 0) 70%);
  filter: blur(10px);
  transform: translate3d(0, 0, 0);
  animation: ui41SidebarDrift 14s ease-in-out infinite alternate;
}

@keyframes ui41SidebarDrift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.9;
  }
  50% {
    transform: translate3d(-6px, 4px, 0) scale(1.02);
    opacity: 0.75;
  }
  100% {
    transform: translate3d(4px, -3px, 0) scale(0.98);
    opacity: 0.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .analyst-shell .analyst-sidebar::before {
    animation: none !important;
  }
}

.analyst-shell .analyst-quick-actions {
  position: sticky;
  top: 10px;
  z-index: 5;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #d7e3f1;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(4px);
}

.analyst-shell .analyst-quick-actions-title {
  font-size: 0.82rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 700;
  color: #334155;
}

.analyst-shell .analyst-quick-actions-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.analyst-shell .analyst-quick-actions-buttons button {
  min-height: 38px;
}

.analyst-shell .analyst-explain-btn {
  margin-top: 6px;
  min-height: 34px;
}

.analyst-shell .analyst-explain-panel {
  margin-top: 8px;
  border: 1px solid #d7e3f1;
  border-radius: 10px;
  background: #f8fbff;
}

/* Layout consistency utilities */
.analyst-shell .analyst-mt-10 { margin-top: 10px !important; }
.analyst-shell .analyst-mt-12 { margin-top: 12px !important; }
.analyst-shell .analyst-mb-12 { margin-bottom: 12px !important; }
.analyst-shell .analyst-span-full { grid-column: 1 / -1 !important; }

@media (max-width: 720px) {
  .analyst-shell .analyst-quick-actions {
    top: 6px;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
  }
}

/* Accessibility hardening: prevent low-contrast regressions across shells */
html body .analyst-shell .analyst-sidebar .analyst-sidebar-title {
  font-size: 1.08rem !important;
  font-weight: 760 !important;
  letter-spacing: 0 !important;
  color: #f8fafc !important;
}

html body .analyst-shell .analyst-sidebar .analyst-sidebar-sub,
html body .analyst-shell .analyst-sidebar .analyst-nav-group-label,
html body .analyst-shell .analyst-sidebar .analyst-side-label {
  color: #dbe5f5 !important;
  font-size: 0.8rem !important;
  line-height: 1.35 !important;
}

html body .analyst-shell .analyst-sidebar .analyst-side-value {
  color: #f8fafc !important;
  font-size: 1.1rem !important;
  line-height: 1.25 !important;
}

html body .analyst-shell .analyst-nav-btn {
  min-height: 44px !important;
}

html body .analyst-shell .analyst-nav-btn .analyst-nav-text {
  color: #f8fafc !important;
  font-size: 0.94rem !important;
  line-height: 1.3 !important;
}

html body .analyst-shell .analyst-nav-btn .analyst-nav-meta {
  background: #334155 !important;
  color: #ffffff !important;
}

html body .analyst-shell .analyst-nav-btn.is-active .analyst-nav-text,
html body .analyst-shell .analyst-nav-btn.is-active .analyst-nav-meta {
  color: #ffffff !important;
}

html body .analyst-shell .analyst-nav-btn.is-active .analyst-nav-icon {
  color: var(--a-accent) !important;
}

html body .analyst-shell .analyst-nav-btn:focus-visible,
html body .analyst-shell .analyst-sidebar-toggle:focus-visible,
html body .analyst-shell button:focus-visible,
html body .analyst-shell select:focus-visible,
html body .analyst-shell input:focus-visible,
html body .analyst-shell textarea:focus-visible,
html body .analyst-shell .aw-help:focus-visible {
  outline: 3px solid #67e8f9 !important;
  outline-offset: 2px !important;
}

html body .analyst-shell .aw-help {
  min-width: 24px !important;
  min-height: 24px !important;
}

html body .analyst-shell .analyst-section-help,
html body .analyst-shell .status,
html body .analyst-shell .analyst-summary-sub,
html body .analyst-shell .analyst-complexity-sub,
html body .analyst-shell .analyst-summary-label {
  color: #334155 !important;
  font-size: 0.92rem !important;
  line-height: 1.5 !important;
}

html body .analyst-shell .analyst-kpi-label,
html body .analyst-shell .analyst-complexity-label,
html body .analyst-shell .analyst-chart-desc,
html body .analyst-shell .analyst-side-label,
html body .analyst-shell .analyst-legend-item {
  color: #334155 !important;
}

html body .analyst-shell .analyst-kpi-value,
html body .analyst-shell .analyst-summary-value,
html body .analyst-shell .analyst-complexity-value,
html body .analyst-shell h1,
html body .analyst-shell h2,
html body .analyst-shell h3 {
  color: #0f172a !important;
}

html body .analyst-shell table,
html body .analyst-shell th,
html body .analyst-shell td {
  color: #0f172a !important;
}

html body .analyst-shell th {
  background: #f8fafc !important;
}

html body .analyst-shell tr:nth-child(even) td {
  background: #fcfdff !important;
}

html body .analyst-shell button[disabled],
html body .analyst-shell button:disabled {
  opacity: 1 !important;
  color: #64748b !important;
  background: #eef2f7 !important;
  border-color: #d7dee8 !important;
  cursor: not-allowed !important;
}

html body .analyst-shell .empty,
html body .analyst-shell .analyst-empty,
html body .analyst-shell .no-data {
  color: #475569 !important;
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

html body .analyst-shell .analyst-toolbar .field input[type="text"] {
  min-height: 38px;
}

html body .analyst-shell .analyst-action-feedback {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

html body .analyst-shell .analyst-action-feedback-btn {
  min-height: 32px !important;
  padding: 4px 10px !important;
  font-size: 0.78rem !important;
  border-radius: 9px !important;
}

html body .analyst-shell .analyst-action-feedback-btn.is-active {
  border-color: #0f766e !important;
  background: #e8f5f3 !important;
  color: #0f766e !important;
}

html body .analyst-shell .analyst-action-feedback-state {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #5b6676;
}
