*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0b;
  --bg-soft: #111113;
  --surface: #161618;
  --surface-strong: #1c1c1f;
  --surface2: #222225;
  --surface3: #2a2a2e;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #fafafa;
  --muted: #71717a;
  --accent: #3b82f6;
  --accent-strong: #2563eb;
  --accent-dim: rgba(59, 130, 246, 0.1);
  --purple: #8b5cf6;
  --purple-dim: rgba(139, 92, 246, 0.1);
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Layout ── */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 12px 16px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 10;
  overflow: hidden;
}
.sidebar-scroll {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sidebar-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.sidebar-logo {
  margin: 0 4px 20px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface-strong);
  border: 1px solid var(--border);
}
.sidebar-logo h1 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.sidebar-logo p  {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  margin: 1px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: color .15s, background .15s;
}
.nav-item:hover {
  color: var(--text);
  background: var(--surface-strong);
}
.nav-item.active {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--border);
}
.nav-item-disabled {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}
.nav-item-disabled:hover {
  color: var(--muted);
  background: transparent;
}
.nav-soon-badge {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--yellow);
  background: rgba(234, 179, 8, 0.1);
  flex-shrink: 0;
}
.nav-icon {
  width: 20px;
  font-size: 15px;
  display: inline-flex;
  justify-content: center;
  opacity: 0.7;
}
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  opacity: 1;
}
.sidebar-group {
  margin-bottom: 8px;
}
.sidebar-group-label {
  display: block;
  margin: 16px 16px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.sidebar-footer {
  margin: auto 4px 0;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  flex-shrink: 0;
}

.main {
  margin-left: 260px;
  padding: 24px 32px 40px;
  width: calc(100% - 260px);
}
.main-shell {
  max-width: 1100px;
  margin: 0 auto;
}
.app-toolbar {
  display: none;
}
.home-hero {
  margin-bottom: 20px;
  padding: 28px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.home-hero h1 {
  font-size: 26px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.home-hero p {
  max-width: 640px;
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}
.home-dash-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.home-dash-card {
  cursor: pointer;
  transition: border-color .15s, transform .15s;
  padding: 16px;
}
.home-dash-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.home-dash-icon { font-size: 22px; margin-bottom: 8px; }
.home-dash-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.home-dash-desc { color: var(--muted); font-size: 12px; line-height: 1.35; }
.home-metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.home-kpi-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.home-kpi {
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
}
.home-kpi-num { font-size: 22px; font-weight: 600; color: var(--accent); line-height: 1.1; }
.home-kpi-label { font-size: 10px; color: var(--muted); margin-top: 4px; line-height: 1.25; }
.home-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.home-chart-box {
  position: relative;
  height: 200px;
  margin-top: 8px;
}
.home-chart-box.tall { height: 220px; }
.home-attention-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.home-attention-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-strong);
  font-size: 13px;
}
.home-attention-item a { color: var(--accent); text-decoration: none; font-weight: 500; }
.home-attention-item a:hover { text-decoration: underline; }
.home-interactions-muted {
  pointer-events: none;
  opacity: 0.45;
  filter: grayscale(0.15);
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.guide-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}
.guide-card-icon { font-size: 28px; line-height: 1; }
.guide-card h3 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}
.guide-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  flex: 1;
}
.guide-card-meta {
  font-size: 11px;
  color: var(--muted);
}
.guide-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.guide-card-link {
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}
.guide-card-link:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  transform: translateY(-1px);
}
.guide-card-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.guide-detail { scroll-margin-top: 20px; }
.guide-detail-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.guide-detail-toc a {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  font-size: 12px;
  text-decoration: none;
}
.guide-detail-toc a:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.guide-template-box {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-strong);
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.guide-example {
  margin: 10px 0 16px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-size: 13px;
  line-height: 1.5;
}
.guide-example-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
}
.guide-checklist {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}
.guide-checklist li { margin-bottom: 6px; }
[id^="guia-bugs-"] { scroll-margin-top: 20px; }
#home-empty-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
#home-empty-actions[hidden] {
  display: none !important;
}
.home-sync-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.home-hero-compact {
  padding: 22px 24px;
  margin-bottom: 16px;
}
.home-hero-compact h1 { font-size: 22px; margin-bottom: 6px; }
.home-hero-compact p { font-size: 13px; }
.home-metric {
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-strong);
  text-align: center;
}
.home-metric-num { font-size: 18px; font-weight: 600; color: var(--accent); }
.home-metric-label { font-size: 10px; color: var(--muted); margin-top: 4px; line-height: 1.25; }
.app-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 12px;
}
/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  transition: border-color .15s;
}
.card:hover {
  border-color: var(--border-strong);
}
.query-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.query-history-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  overflow: hidden;
}
.query-history-item summary {
  list-style: none;
  cursor: pointer;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.query-history-item summary::-webkit-details-marker { display: none; }
.query-history-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.query-history-meta strong {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.query-history-meta span {
  font-size: 12px;
  color: var(--muted);
}
.query-history-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.query-history-body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
}
.query-history-body pre {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow: auto;
}
.query-history-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  background: var(--accent-dim);
  color: var(--accent);
  margin-left: 8px;
}
.admin-only-page {
  display: none !important;
}

.tutorial-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tutorial-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-strong);
}
.tutorial-step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
}
.tutorial-step-body h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.tutorial-step-body p,
.tutorial-step-body ul {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.tutorial-step-body ul {
  margin: 6px 0 0 16px;
}
.tutorial-step-body li { margin-bottom: 2px; }
.tutorial-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.tutorial-toc {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}
.tutorial-toc a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: border-color .15s, background .15s;
}
.tutorial-toc a:hover {
  border-color: var(--border-strong);
  background: var(--surface2);
  color: var(--accent);
}
[id^="tutorial-"] { scroll-margin-top: 20px; }

.card-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.config-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.author-highlight {
  color: var(--yellow);
  font-weight: 600;
}

/* ── Form elements ── */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}
input[type=text], input[type=password], input[type=date], textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  padding: 10px 12px;
  outline: none;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input[type=text]:focus, input[type=password]:focus, input[type=date]:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
textarea {
  resize: vertical;
  min-height: 80px;
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.5;
}
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.field-hint {
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
  line-height: 1.4;
}

.date-picker-field {
  position: relative;
}
.date-picker-field input[type=date] {
  padding-right: 42px;
  cursor: pointer;
  color-scheme: dark;
}
[data-theme="light"] .date-picker-field input[type=date] {
  color-scheme: light;
}
.date-picker-field input[type=date]::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  cursor: pointer;
  opacity: 0;
}
.date-picker-trigger {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.date-picker-trigger:hover {
  background: var(--surface-strong);
  color: var(--text);
}
.date-picker-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Searchable select ── */
.searchable-select {
  position: relative;
  width: 100%;
}
.searchable-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.searchable-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.searchable-select-trigger:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  outline: none;
}
.searchable-select-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.searchable-select-value.is-placeholder {
  color: var(--muted);
}
.searchable-select-chevron {
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
}
.searchable-select-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
  overflow: hidden;
}
.searchable-select-search {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: var(--bg);
  padding: 10px 12px;
  font-size: 13px;
}
.searchable-select-search:focus {
  box-shadow: none;
  border-bottom-color: var(--accent);
}
.searchable-select-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  max-height: 260px;
  overflow-y: auto;
}
.searchable-select-option {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}
.searchable-select-option:hover,
.searchable-select-option.is-active {
  background: var(--surface-strong);
}
.searchable-select-option.is-selected {
  color: var(--accent);
  font-weight: 500;
}
.searchable-select-empty {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
}
.searchable-select.is-open .searchable-select-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.searchable-select.is-disabled .searchable-select-trigger {
  opacity: .55;
  cursor: not-allowed;
}

.rot-contexts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rot-context-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 12px;
}
.rot-context-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.rot-context-enabled {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.rot-context-enabled input {
  width: auto;
  margin: 0;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity .15s, background .15s, border-color .15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-strong); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-connected {
  background: #1a7f4b;
  color: #fff;
  border: none;
  cursor: default;
  opacity: 1;
}
.btn-connected:disabled { opacity: 1; cursor: default; }
.qa-pipeline {
  margin-top: 18px;
  padding: 16px 12px 12px;
  border: 1px solid var(--border, #d8dee6);
  border-radius: 12px;
  background: var(--surface, #f7f9fb);
}
.qa-pipeline__head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted, #5a6470);
  margin-bottom: 14px;
  text-align: center;
}
.qa-pipeline__track {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
}
.qa-pipeline__step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-width: 0;
}
.qa-pipeline__step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 17px;
  left: calc(50% + 18px);
  width: calc(100% - 36px);
  height: 2px;
  background: var(--border, #d0d7e0);
  z-index: 0;
  transition: background 0.25s ease;
}
.qa-pipeline__step.is-done:not(:last-child)::after {
  background: #1a7f4b;
}
.qa-pipeline__node {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border, #c5cdd8);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg, #fff);
  position: relative;
  z-index: 1;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, color 0.2s;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted, #5a6470);
}
.qa-pipeline__step.is-pending .qa-pipeline__node {
  opacity: 0.55;
}
.qa-pipeline__step.is-active .qa-pipeline__node {
  border-color: var(--accent, #0066cc);
  color: var(--accent, #0066cc);
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.12);
}
.qa-pipeline__step.is-running .qa-pipeline__node {
  border-color: var(--accent, #0066cc);
  background: var(--accent, #0066cc);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.18);
  animation: qa-pipeline-pulse 1.4s ease-in-out infinite;
}
.qa-pipeline__step.is-done .qa-pipeline__node {
  background: #1a7f4b;
  border-color: #1a7f4b;
  color: #fff;
}
.qa-pipeline__step.is-done .qa-pipeline__num {
  display: none;
}
.qa-pipeline__step.is-done .qa-pipeline__node::before {
  content: '✓';
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}
.qa-pipeline__step.is-error .qa-pipeline__node {
  background: #c0392b;
  border-color: #c0392b;
  color: #fff;
}
.qa-pipeline__step.is-error .qa-pipeline__num {
  display: none;
}
.qa-pipeline__step.is-error .qa-pipeline__node::before {
  content: '!';
  font-size: 16px;
  font-weight: 700;
}
.qa-pipeline__step.is-future .qa-pipeline__node {
  border-style: dashed;
  opacity: 0.45;
}
.qa-pipeline__label {
  margin-top: 8px;
  font-size: 10px;
  text-align: center;
  color: var(--text-muted, #5a6470);
  line-height: 1.25;
  max-width: 68px;
  word-break: break-word;
}
.qa-pipeline__step.is-active .qa-pipeline__label,
.qa-pipeline__step.is-running .qa-pipeline__label {
  color: var(--accent, #0066cc);
  font-weight: 600;
}
.qa-pipeline__step.is-done .qa-pipeline__label {
  color: #1a7f4b;
  font-weight: 600;
}
.qa-pipeline__step.is-error .qa-pipeline__label {
  color: #c0392b;
  font-weight: 600;
}
@keyframes qa-pipeline-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@media (max-width: 720px) {
  .qa-pipeline__track {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 16px;
  }
  .qa-pipeline__step {
    flex: 0 0 33%;
  }
  .qa-pipeline__step:not(:last-child)::after {
    display: none;
  }
}
.qa-structure-panel {
  margin-top: 0;
  max-height: 520px;
  overflow: auto;
  padding: 14px;
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
}
.qa-structure-result-wrap {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.qa-structure-approve-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-strong);
}
.qa-phase-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 14px;
}
.qa-phase-btn.is-current {
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.25);
}
.qa-phase-btn.is-done-phase {
  opacity: 0.55;
  cursor: default;
}
.qa-phase-editor h4 {
  margin: 14px 0 8px;
  font-size: 13px;
}
.qa-phase-editor h4:first-child {
  margin-top: 0;
}
.qa-phase-editor textarea,
.qa-phase-editor input[type="text"] {
  width: 100%;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-family: inherit;
  box-sizing: border-box;
  background: var(--surface-strong);
  color: var(--text);
}
.qa-phase-editor textarea {
  min-height: 88px;
  resize: vertical;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}
.qa-ind-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  background: var(--surface-strong);
}
.qa-ind-row label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.qa-phase-view {
  color: var(--text);
}
.qa-phase-view h4 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text);
}
.qa-view-field {
  margin-bottom: 14px;
}
.qa-view-field > label,
.qa-view-field > .qa-view-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.qa-view-value {
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}
.qa-view-value pre {
  margin: 0;
  padding: 10px;
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  overflow: auto;
  max-height: 200px;
}
.qa-view-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--surface-strong);
  color: var(--text);
}
.qa-view-block-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
}
.qa-view-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface3);
  color: var(--muted);
}
.qa-view-badge.is-yes {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}
.qa-view-badge.is-action {
  background: var(--accent-dim);
  color: var(--accent);
}

.qa-structure-panel h4 { margin: 12px 0 6px; font-size: 14px; color: var(--text); }
.qa-structure-panel ul { margin: 0 0 8px 18px; padding: 0; color: var(--text); }
.qa-structure-panel .qa-meta { color: var(--muted); margin-bottom: 10px; }
.qa-structure-panel a { color: var(--accent); }
.btn-ghost  {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover {
  background: var(--surface-strong);
  border-color: var(--border-strong);
}
.btn-green  {
  background: var(--green);
  color: #fff;
}
.btn-green:hover { opacity: .9; }
.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
  gap: 4px;
}

/* ── Page header ── */
.page-header {
  margin-bottom: 16px;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.page-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  margin-bottom: 8px;
  border-radius: 4px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.page-header h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.page-header p  { color: var(--muted); font-size: 13px; }
.page-header + .tip {
  margin-top: -4px;
}

/* ── Tab pages ── */
.main-shell > .tab-page { display: none !important; }
.main-shell > .tab-page.active {
  display: block !important;
  animation: fadeUp .32s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Connection badge ── */
.conn-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  color: var(--muted);
  margin-top: 6px;
}
.conn-badge.ok  { background: rgba(34,197,94,.1); color: var(--green); border-color: rgba(34,197,94,.2); }
.conn-badge.err { background: rgba(239,68,68,.1); color: var(--red); border-color: rgba(239,68,68,.2); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Status steps ── */
.steps { display: grid; gap: 8px; margin: 16px 0; }
.step {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex-shrink: 0; }
.step-dot.loading { background: var(--yellow); animation: blink 1s infinite; }
.step-dot.ok      { background: var(--green); }
.step-dot.err     { background: var(--red); }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Log ── */
.log {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 11px;
  color: var(--accent);
  padding: 12px;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  margin-top: 12px;
  display: none;
}

/* ── Metrics ── */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.metric .num {
  font-size: 24px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.metric .lbl {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Tip box ── */
.tip {
  background: var(--accent-dim);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--accent);
  line-height: 1.5;
  margin-bottom: 14px;
}
.tip code {
  background: rgba(0,0,0,.2);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Consolas', monospace;
}
.rot-preview {
  display: grid;
  gap: 12px;
}
.rot-header-box {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  border: 1px solid var(--border);
}
.rot-header-box strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.rot-header-box p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}
.rot-source-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.rot-source-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  border: 1px solid var(--border);
}
.rot-source-item strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.rot-source-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.rot-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.rot-source-item p {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

/* ── Map grid ── */
.map-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px 16px;
  align-items: center;
}
.map-grid label {
  text-align: left;
  font-size: 12px;
  color: #c8d7eb;
  font-weight: 700;
}

/* ── Divider ── */
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Success area ── */
#result-area { display: none; }
.result-box {
  border: 1px solid rgba(34,197,94,.2);
  background: rgba(34,197,94,.05);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
}
.result-box h3 { font-size: 15px; font-weight: 600; color: var(--green); margin-bottom: 12px; }

.rot-email-preview {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #dbe3f0;
  border-radius: var(--radius);
  padding: 28px 32px;
  min-height: 75vh;
  max-height: 90vh;
  overflow: auto;
  overflow-x: auto;
  font-family: Calibri, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  box-sizing: border-box;
  width: 100%;
}

.rot-email-preview .rot-bug-charts-row {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.rot-email-preview .rot-chart-card {
  width: 33.333%;
  vertical-align: top;
  padding: 4px;
  box-sizing: border-box;
}

.rot-email-preview .rot-bug-pbi-block {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  box-sizing: border-box;
}

.rot-email-preview .rot-bug-charts-row svg,
.rot-email-preview .rot-bug-charts-row img {
  display: block;
  max-width: 100%;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

.rot-email-preview table {
  max-width: 100%;
  width: 100%;
}

.rot-email-preview .rot-email-preview-table {
  display: block;
  overflow-x: auto;
}

@media (max-width: 760px) {
  .rot-email-preview {
    padding: 16px;
  }
}

.rot-email-preview h2 {
  margin: 28px 0 12px;
  font-size: 16px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 6px;
  color: #0f172a;
}

.rot-email-preview h2:first-of-type {
  margin-top: 0;
}

.rot-email-preview h3 {
  margin: 16px 0 8px;
  font-size: 14px;
  color: #0f172a;
}

.rot-email-preview table {
  max-width: 100%;
}

.rot-email-preview a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.rot-email-preview ul {
  margin: 8px 0 16px;
  padding-left: 22px;
}

/* ── Scrollbar ── */
scrollbar-width: thin;
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Responsive ── */
@media (max-width: 1180px) {
  .sidebar {
    width: 220px;
  }
  .main {
    margin-left: 220px;
    width: calc(100% - 220px);
  }
  .app-toolbar {
    margin-bottom: 12px;
  }
  .home-dash-grid,
  .home-metrics-grid,
  .home-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .home-charts-grid {
    grid-template-columns: 1fr;
  }
  .guide-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .shell {
    display: block;
  }
  .sidebar {
    position: static;
    width: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .main {
    margin-left: 0;
    width: 100%;
    padding: 20px 16px 32px;
  }
  .main-shell {
    max-width: none;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .row3 {
    grid-template-columns: 1fr;
  }
  .sidebar-group {
    margin-bottom: 4px;
  }
}

@media (max-width: 720px) {
  .home-hero {
    padding: 20px 18px;
  }
  .home-hero h1 {
    font-size: 22px;
  }
  .page-header {
    padding: 16px;
  }
  .card {
    padding: 18px;
  }
  .row2,
  .metrics,
  .map-grid,
  .home-dash-grid,
  .home-metrics-grid,
  .home-kpi-row {
    grid-template-columns: 1fr;
  }
  .nav-item {
    padding: 11px 12px;
  }
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --surface: #ffffff;
  --surface-strong: #f9fafb;
  --surface2: #f3f4f6;
  --surface3: #e5e7eb;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);
  --text: #111827;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-dim: rgba(37, 99, 235, 0.08);
  --purple: #7c3aed;
  --purple-dim: rgba(124, 58, 237, 0.08);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.theme-fab {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 1200;
  width: 42px;
  height: 42px;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  color: var(--text);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: background .15s, border-color .15s, transform .15s;
}
.theme-fab:hover {
  background: var(--surface2);
  border-color: var(--accent);
  transform: scale(1.04);
}
.theme-toggle-btn {
  width: auto;
  margin: 0;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.theme-toggle-btn:hover {
  background: var(--surface3);
  border-color: var(--border-strong);
}
.app-topbar-actions {
  flex-shrink: 0;
}

.cp-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.cp-metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color .15s;
  min-width: 0;
}
.cp-metric:hover { border-color: var(--border-strong); }
.cp-metric.active { border-color: var(--accent); }
.cp-metric.active.accent { border-color: var(--accent); }
.cp-metric.active.purple { border-color: var(--purple); }
.cp-metric.active.blue { border-color: #3b82f6; }
.cp-metric.active.yellow { border-color: #eab308; }
.cp-metric.active.green { border-color: var(--green); }
.cp-metric.active.red { border-color: var(--red); }
.cp-metric.active.amber { border-color: #f59e0b; }
.cp-metric-icon { font-size: 13px; margin-bottom: 2px; line-height: 1; }
.cp-metric-num { font-size: 17px; font-weight: 600; line-height: 1.1; }
.cp-metric-label {
  color: var(--muted);
  font-size: 10px;
  margin-top: 3px;
  line-height: 1.25;
}
.cp-metric.accent .cp-metric-num { color: var(--accent); }
.cp-metric.purple .cp-metric-num { color: var(--purple); }
.cp-metric.blue .cp-metric-num { color: #3b82f6; }
.cp-metric.yellow .cp-metric-num { color: #eab308; }
.cp-metric.green .cp-metric-num { color: var(--green); }
.cp-metric.red .cp-metric-num { color: var(--red); }
.cp-metric.amber .cp-metric-num { color: #f59e0b; }

.cp-header-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.cp-page-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 4px;
}
.cp-page-header-top h2 {
  margin-bottom: 0;
}
.cp-sync-btn {
  flex-shrink: 0;
  margin-top: 2px;
}
.cp-sync-meta { color: var(--muted); font-size: 12px; }

.cp-attention-list { display: grid; gap: 8px; }
.cp-attention-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color .15s;
}
.cp-attention-item:hover {
  border-color: var(--border-strong);
}
.cp-attention-item.is-attention {
  border-color: rgba(234, 179, 8, 0.3);
  background: rgba(234, 179, 8, 0.05);
  border-left: 3px solid var(--yellow);
}
[data-theme="light"] .cp-attention-item.is-attention {
  background: rgba(234, 179, 8, 0.08);
}
.cp-attention-item.is-blocked {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
  border-left: 3px solid var(--red);
}
[data-theme="light"] .cp-attention-item.is-blocked {
  background: rgba(239, 68, 68, 0.05);
}
.cp-attention-item a { color: var(--accent); text-decoration: none; font-weight: 500; }
[data-theme="light"] .cp-attention-item a { color: var(--accent-strong); }
.cp-attention-reason { color: var(--muted); font-size: 12px; margin-top: 4px; }
.cp-attention-item.is-attention .cp-attention-reason { color: var(--yellow); }
[data-theme="light"] .cp-attention-item.is-attention .cp-attention-reason { color: #a16207; }
.cp-attention-item.is-blocked .cp-attention-reason { color: var(--red); }
[data-theme="light"] .cp-attention-item.is-blocked .cp-attention-reason { color: #dc2626; }
.cp-item-status {
  flex-shrink: 0;
  max-width: 42%;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-strong, var(--surface));
}
.cp-attention-item.is-blocked .cp-item-status {
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.35);
}
.cp-attention-item.is-attention .cp-item-status {
  color: var(--yellow);
  border-color: rgba(234, 179, 8, 0.35);
}

.cp-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 14px 0 12px;
}
.cp-tab {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  transition: color .15s, background .15s, border-color .15s;
}
.cp-tab:hover {
  color: var(--text);
  background: var(--surface-strong);
}
.cp-tab.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}

.cp-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.cp-table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.cp-table { width: 100%; border-collapse: collapse; min-width: 980px; }
.cp-table th, .cp-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
}
.cp-table th {
  background: var(--surface-strong);
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  font-weight: 500;
  font-size: 12px;
}
.cp-table tr:hover td { background: var(--surface-strong); }
.cp-table tr.blocked-row td { background: rgba(239, 68, 68, 0.05); }
.cp-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface3);
  color: var(--text);
}
.cp-badge.blocked { background: rgba(239,68,68,.1); color: var(--red); }
[data-theme="light"] .cp-badge.blocked { color: #b91c1c; }
.cp-badge.done { background: rgba(34,197,94,.1); color: var(--green); }
[data-theme="light"] .cp-badge.done { color: #15803d; }
.cp-badge.transition { background: var(--accent-dim); color: var(--accent); }

.cp-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 12px 0;
}
.cp-progress-bar {
  height: 6px;
  background: var(--surface3);
  border-radius: 3px;
  overflow: hidden;
  margin: 10px 0;
}
.cp-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}
.cp-chart { width: 100%; height: 120px; margin-top: 10px; }
.cp-pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 12px;
  flex-wrap: wrap;
}
.cp-star { cursor: pointer; border: none; background: none; font-size: 14px; }
.cp-star.active { color: var(--yellow); }

@media (max-width: 1280px) {
  .cp-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .cp-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cp-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .cp-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cp-filters { grid-template-columns: 1fr; }
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.login-overlay[hidden] { display: none !important; }
.app-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1900;
  padding: 10px 16px;
  background: var(--surface-strong);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-loading-bar[hidden] { display: none !important; }
.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 24px 48px rgba(0,0,0,.35);
}
.login-card h2 { margin: 8px 0 6px; font-size: 22px; }
.login-card p { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.login-error { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 8px; }
.auth-user-box {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}
.auth-user-box strong { color: var(--text); display: block; margin-bottom: 4px; }
.auth-role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 11px;
  margin-right: 6px;
}
.users-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.users-table th, .users-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
}
.users-table th { color: var(--muted); font-weight: 500; }

.rot-charts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.rot-chart-panel {
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 260px;
}
.rot-chart-panel h4 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.rot-chart-canvas-wrap {
  position: relative;
  height: 220px;
}
.rot-pivot-mount {
  overflow-x: auto;
}
.rot-pivot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.rot-pivot-table th,
.rot-pivot-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: center;
}
.rot-pivot-table th {
  background: rgba(148, 163, 184, 0.08);
  color: var(--muted);
  font-weight: 600;
}
.rot-pivot-table td.row-label {
  text-align: left;
  font-weight: 600;
}
.rot-pivot-table td.heat {
  background: #e87722;
  color: #fff;
  font-weight: 700;
}
.rot-pivot-table td.total {
  font-weight: 700;
}
@media (max-width: 1100px) {
  .rot-charts-grid {
    grid-template-columns: 1fr;
  }
}
