/* Аналитика — дашборд 6 витрин */

.an-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--grad-card);
  border: 1px solid var(--border);
  border-radius: var(--r2);
}

.an-toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.an-period-presets {
  display: flex;
  gap: 6px;
}

.an-preset {
  padding: 7px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--spring);
}

.an-preset:hover {
  color: var(--text);
  border-color: var(--accent3);
}

.an-preset.active {
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  color: #fff;
  border-color: transparent;
  box-shadow: var(--glow);
}

.an-date-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.an-date-input {
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: var(--bg2);
  color: var(--text);
  font-size: 13px;
}

.an-date-sep {
  color: var(--text3);
}

.an-thresholds summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  font-weight: 600;
  list-style: none;
}

.an-thresholds summary::-webkit-details-marker {
  display: none;
}

.an-thresholds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  background: var(--bg2);
  border-radius: var(--r2);
  border: 1px solid var(--border);
}

.an-thresholds-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text2);
}

.an-thresholds-grid input {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text);
}

.an-btn {
  padding: 8px 16px;
  border-radius: var(--r-pill);
  border: none;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--spring), opacity var(--dur-fast);
}

.an-btn:active {
  transform: scale(0.97);
}

.an-btn--ghost {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border2);
}

.an-btn--ghost:hover {
  border-color: var(--accent3);
}

.an-btn--ghost:hover {
  border-color: var(--accent3);
}

/* Производство = продажи */
.an-production-wrap {
  margin-bottom: 20px;
}

.an-production-panel {
  padding: 16px 18px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--accent) 8%, var(--bg2)),
    var(--bg2)
  );
}

.an-production-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 20px;
  margin-bottom: 14px;
}

.an-production-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.an-production-sub {
  margin: 0;
  font-size: 12px;
  color: var(--text2);
}

.an-production-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
}

.an-production-input {
  width: 160px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: var(--bg2);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.an-production-input:focus {
  outline: none;
  border-color: var(--accent3);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.an-production-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.an-prod-stat {
  padding: 12px 14px;
  border-radius: var(--r2);
  background: var(--bg2);
  border: 1px solid var(--border);
}

.an-prod-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  margin-bottom: 4px;
}

.an-prod-stat-value {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.an-prod-stat-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text2);
  line-height: 1.45;
}

.an-prod-delta {
  display: inline-block;
  font-weight: 700;
  margin-right: 6px;
}

.an-prod-delta.up {
  color: var(--green);
}

.an-prod-delta.down {
  color: var(--red);
}

.an-prod-delta.muted {
  color: var(--text3);
}

.an-prod-prev-hint {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--text3);
}

.an-production-compare--solo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
}

.an-prod-stat--accent .an-prod-stat-value {
  color: var(--accent3);
}

.an-prod-stat--ok .an-prod-stat-value {
  color: var(--green);
}

.an-prod-stat--low .an-prod-stat-value {
  color: var(--yellow);
}

.an-prod-stat--high .an-prod-stat-value {
  color: var(--red);
}

.an-production-bar-wrap {
  margin-bottom: 14px;
}

.an-production-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 6px;
}

.an-production-bar {
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--bg3);
  border: 1px solid var(--border);
  overflow: hidden;
}

.an-production-bar-fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent2), var(--cyan));
  transition: width 0.5s var(--ease);
}

.an-production-bar-fill.low {
  background: linear-gradient(90deg, var(--yellow), #f59e0b);
}

.an-production-bar-fill.high {
  background: linear-gradient(90deg, #f56565, var(--red));
}

.an-production-bar-fill.ok {
  background: linear-gradient(90deg, #059669, var(--green));
}

.an-production-hint {
  font-size: 13px;
  color: var(--text3);
  padding: 8px 0;
}

.an-production-entities {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 720px) {
  .an-production-entities {
    grid-template-columns: 1fr;
  }
}

.an-prod-entity {
  padding: 10px 12px;
  border-radius: var(--r2);
  background: var(--bg3);
  border: 1px solid var(--border);
}

.an-prod-entity-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.an-prod-entity-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text2);
  margin-top: 3px;
}

.an-prod-entity-row strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.an-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.an-kpi {
  position: relative;
  overflow: hidden;
  padding: 16px 18px;
  border-radius: var(--r2);
  background: var(--bg2);
  border: 1px solid var(--border);
  transition: transform var(--dur) var(--spring), box-shadow var(--dur) var(--ease);
}

.an-kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.an-kpi::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--grad);
  opacity: 0.04;
  pointer-events: none;
}

.an-kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  font-weight: 700;
  margin-bottom: 6px;
}

.an-kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.an-kpi-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text2);
}

.an-kpi--accent .an-kpi-value {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.an-kpi--warn .an-kpi-value {
  color: var(--yellow);
}

.an-kpi--danger .an-kpi-value {
  color: var(--red);
}

.an-grid-head,
.an-alerts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.an-section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.an-period-label {
  font-size: 12px;
  color: var(--text3);
}

.an-col-labels {
  display: grid;
  grid-template-columns: 88px repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 8px;
  padding: 0 4px;
}

.an-col-labels span {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  text-align: center;
}

.an-col-labels span:first-child {
  text-align: left;
}

.an-vitrines-board {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 32px;
}

.an-platform-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 14px;
  align-items: stretch;
}

.an-row-label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.an-row-label-text {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text2);
  padding: 8px 6px;
  border-radius: var(--r2);
  border: 1px solid var(--border);
  background: var(--bg3);
  width: 100%;
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
}

.an-platform-row--wb .an-row-label-text {
  color: #a855f7;
  border-color: color-mix(in srgb, #a855f7 25%, var(--border));
  background: color-mix(in srgb, #a855f7 8%, var(--bg2));
}

.an-platform-row--ozon .an-row-label-text {
  color: #2563eb;
  border-color: color-mix(in srgb, #2563eb 25%, var(--border));
  background: color-mix(in srgb, #2563eb 8%, var(--bg2));
}

.an-vitrines-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media (max-width: 900px) {
  .an-col-labels {
    display: none;
  }

  .an-platform-row {
    grid-template-columns: 1fr;
  }

  .an-row-label {
    margin-bottom: -6px;
  }

  .an-row-label-text {
    text-align: left;
  }

  .an-vitrines-row {
    grid-template-columns: 1fr;
  }
}

.an-vitrines-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}

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

@media (max-width: 640px) {
  .an-vitrines-grid {
    grid-template-columns: 1fr;
  }
}

.an-kpi--money .an-kpi-value {
  font-size: 19px;
  color: var(--cyan);
}

.an-metric--money .an-metric-value {
  font-size: clamp(11px, 1.25vw, 14px);
  color: var(--cyan);
}

.an-vitrine--empty {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r);
  border: 1px dashed var(--border2);
  background: var(--bg2);
}

.an-vitrine {
  --v-accent: var(--accent);
  position: relative;
  padding: 0;
  border-radius: var(--r);
  background: var(--bg2);
  border: 1px solid var(--border);
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px);
  animation: anCardIn 0.55s var(--ease) forwards;
}

.an-vitrine--wb {
  --v-accent: #a855f7;
}

.an-vitrine--ozon {
  --v-accent: #2563eb;
}

@keyframes anCardIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.an-vitrine-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, color-mix(in srgb, var(--v-accent) 12%, transparent), transparent);
}

.an-vitrine-entity {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.an-vitrine-platform {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--v-accent) 18%, transparent);
  color: var(--v-accent);
}

.an-vitrine-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
}

.an-metric {
  padding: 10px 10px;
  background: var(--bg2);
  min-width: 0;
  overflow: hidden;
}

.an-metric-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text3);
  margin-bottom: 4px;
  line-height: 1.2;
}

.an-metric-value {
  font-size: clamp(12px, 1.35vw, 16px);
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.an-metric-sub {
  font-size: 10px;
  margin-top: 2px;
  color: var(--text2);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.an-metric-sub.up {
  color: var(--green);
}

.an-metric-sub.down {
  color: var(--red);
}

.an-metric-sub.muted {
  color: var(--text3);
}

.an-alert-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.an-filter-chip {
  padding: 5px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border2);
  background: var(--bg3);
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}

.an-filter-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.an-alerts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.an-alert {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px 14px;
  align-items: start;
  padding: 14px 16px;
  border-radius: var(--r2);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text3);
  opacity: 0;
  animation: anAlertIn 0.4s var(--ease) forwards;
  transition: transform var(--dur-fast) var(--spring), box-shadow var(--dur-fast);
}

.an-alert:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.an-alert--high {
  border-left-color: var(--red);
}

.an-alert--warn {
  border-left-color: var(--yellow);
}

.an-alert--info {
  border-left-color: var(--blue);
}

@keyframes anAlertIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.an-alert-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: var(--bg3);
}

.an-alert-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}

.an-alert-msg {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.45;
}

.an-alert-meta {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
}

.an-alert-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent3);
  cursor: pointer;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: transparent;
  transition: background var(--dur-fast);
}

.an-alert-link:hover {
  background: var(--bg3);
}

.an-loading {
  padding: 48px 24px;
  text-align: center;
  color: var(--text2);
}

.an-loading-spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 12px;
  border: 3px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: anSpin 0.8s linear infinite;
}

@keyframes anSpin {
  to {
    transform: rotate(360deg);
  }
}

.an-fade-in {
  animation: anFade 0.35s var(--ease);
}

@keyframes anFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.an-empty {
  padding: 32px;
  text-align: center;
  color: var(--text3);
  border: 1px dashed var(--border2);
  border-radius: var(--r2);
}
