/* Analytics 2 — isolated dashboard styles. All selectors are namespaced with a2-. */
.a2-page {
  --a2-blue: #316cf4;
  --a2-blue-soft: #edf4ff;
  --a2-green: #21a45d;
  --a2-green-soft: #edf9f2;
  --a2-orange: #f59e0b;
  --a2-orange-soft: #fff8e9;
  --a2-red: #eb5757;
  --a2-ink: #171a21;
  --a2-muted: #77808f;
  --a2-line: #e9edf2;
  --a2-card: #ffffff;
  color: var(--a2-ink);
  max-width: 1680px;
  margin: 0 auto;
}

.a2-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.a2-heading h1 {
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: -.025em;
}

.a2-heading p {
  margin-top: 5px;
  color: var(--a2-muted);
  font-size: 13px;
}

.a2-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid #dce9e1;
  border-radius: 999px;
  color: #4c6557;
  background: #f7fbf8;
  font-size: 11px;
  font-weight: 700;
}

.a2-live span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3eb875;
  box-shadow: 0 0 0 4px rgba(62,184,117,.13);
}

.a2-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.a2-status {
  display: none;
  margin: -2px 0 14px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.4;
}

.a2-status.visible { display: block; }
.a2-status.loading { color: #315ea8; border-color: #d6e4fb; background: #f2f7ff; }
.a2-status.warning { color: #95620f; border-color: #f3dfaa; background: #fff9e8; }
.a2-status.error { color: #b53f3f; border-color: #f1caca; background: #fff3f3; }
.a2-page.is-loading .a2-kpis,
.a2-page.is-loading .a2-dashboard-grid { opacity: .58; pointer-events: none; }

.a2-filter {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
  min-height: 58px;
  padding: 8px 40px 8px 10px;
  border: 1px solid #e1e6ec;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 7px rgba(34, 45, 61, .03);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}

.a2-filter:hover,
.a2-filter:focus-within {
  border-color: #c7d1df;
  box-shadow: 0 7px 22px rgba(34, 45, 61, .08);
  transform: translateY(-1px);
}

.a2-filter-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 9px;
  color: #b18743;
  background: #faf4e9;
}

.a2-filter-icon svg,
.a2-chevron {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.a2-filter-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.a2-filter-copy small {
  color: #929aa6;
  font-size: 10px;
  font-weight: 600;
}

.a2-filter-copy strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.a2-filter select,
.a2-filter input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.a2-filter input[type="month"]::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.a2-chevron {
  position: absolute;
  top: 50%;
  right: 14px;
  color: #8992a0;
  transform: translateY(-50%);
  pointer-events: none;
}

.a2-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.a2-kpi {
  --a2-kpi: var(--a2-blue);
  --a2-kpi-soft: var(--a2-blue-soft);
  position: relative;
  min-width: 0;
  min-height: 174px;
  padding: 17px 18px 15px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--a2-kpi) 18%, #e7ebf0);
  border-radius: 14px;
  background: linear-gradient(145deg, #fff 54%, var(--a2-kpi-soft));
  box-shadow: 0 2px 10px rgba(29, 39, 55, .035);
}

.a2-kpi::after {
  position: absolute;
  width: 104px;
  height: 104px;
  right: -34px;
  bottom: -48px;
  border-radius: 50%;
  background: var(--a2-kpi);
  content: '';
  opacity: .055;
}

.a2-kpi.revenue { --a2-kpi: #3d7af0; --a2-kpi-soft: #f3f8ff; }
.a2-kpi.profit  { --a2-kpi: #23ad62; --a2-kpi-soft: #f2fcf6; }
.a2-kpi.margin  { --a2-kpi: #ee9b16; --a2-kpi-soft: #fff9ef; }
.a2-kpi.cash    { --a2-kpi: #4d79df; --a2-kpi-soft: #f3f7ff; }

.a2-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.a2-kpi-title {
  font-size: 13px;
  font-weight: 750;
}

.a2-kpi-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  color: var(--a2-kpi);
  background: color-mix(in srgb, var(--a2-kpi) 11%, #fff);
}

.a2-kpi-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.a2-kpi-value {
  margin-top: 10px;
  font-size: clamp(22px, 1.75vw, 29px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -.035em;
  white-space: nowrap;
}

.a2-kpi-change {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  color: var(--a2-muted);
  font-size: 11px;
  font-weight: 600;
}

.a2-kpi-change strong { font-weight: 800; }
.a2-kpi-change.positive strong { color: var(--a2-green); }
.a2-kpi-change.negative strong { color: var(--a2-red); }

.a2-kpi-note {
  margin-top: 10px;
  color: #7d8693;
  font-size: 11px;
  line-height: 1.42;
}

.a2-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.68fr) minmax(380px, .86fr);
  gap: 14px;
  align-items: stretch;
}

.a2-panel {
  overflow: hidden;
  border: 1px solid #e3e7ec;
  border-radius: 15px;
  background: var(--a2-card);
  box-shadow: 0 3px 12px rgba(28, 38, 53, .04);
}

.a2-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 8px;
}

.a2-panel-head h2 {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.a2-panel-head p {
  margin-top: 4px;
  color: var(--a2-muted);
  font-size: 11px;
}

.a2-period-badge {
  padding: 6px 9px;
  border-radius: 7px;
  color: #718096;
  background: #f5f7fa;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.a2-performance-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 174px;
  min-height: 390px;
}

.a2-chart-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 6px 8px 13px 14px;
}

.a2-chart {
  flex: 1;
  min-height: 300px;
}

.a2-chart svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 300px;
  overflow: visible;
}

.a2-chart text {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 10px;
  fill: #8d96a4;
}

.a2-chart-grid {
  stroke: #e8edf3;
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.a2-chart-axis { stroke: #dfe5ec; stroke-width: 1; }
.a2-chart-area { fill: url(#a2-revenue-fill); }

.a2-chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.a2-chart-point {
  stroke: #fff;
  stroke-width: 3;
  transition: r .12s;
}

.a2-chart-point:hover { r: 6; }

.a2-chart-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  min-height: 25px;
  color: #7c8592;
  font-size: 10.5px;
}

.a2-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }

.a2-legend-line {
  position: relative;
  width: 20px;
  height: 2px;
  border-radius: 10px;
  background: currentColor;
}

.a2-legend-line::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: '';
  transform: translate(-50%, -50%);
}

.a2-blue { color: var(--a2-blue); }
.a2-green { color: var(--a2-green); }

.a2-summary {
  display: flex;
  flex-direction: column;
  padding: 13px 14px 14px;
  border-left: 1px solid var(--a2-line);
}

.a2-summary-item {
  padding: 9px 0 13px;
  border-bottom: 1px solid var(--a2-line);
}

.a2-summary-item span {
  display: block;
  color: #8a93a0;
  font-size: 10px;
}

.a2-summary-item strong {
  display: block;
  margin-top: 5px;
  font-size: 17px;
  font-weight: 800;
  white-space: nowrap;
}

.a2-summary-item b {
  display: block;
  margin-top: 4px;
  color: var(--a2-green);
  font-size: 10px;
}

.a2-summary-item b.down { color: var(--a2-red); }
.a2-summary-item b.neutral { color: var(--a2-muted); }

.a2-insight {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: auto;
  padding: 11px;
  border: 1px solid #f6e9a6;
  border-radius: 10px;
  color: #aa6d12;
  background: #fff8ce;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.38;
}

.a2-insight.danger { color: #b74646; border-color: #f2caca; background: #fff1f1; }
.a2-insight.success { color: #247a4b; border-color: #cdebd9; background: #effaf3; }
.a2-insight.neutral { color: #667181; border-color: #dfe4ea; background: #f6f8fa; }

.a2-insight svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.a2-spend {
  display: flex;
  flex-direction: column;
}

.a2-spend-main {
  display: grid;
  grid-template-columns: minmax(160px, .92fr) minmax(170px, 1.08fr);
  gap: 12px;
  align-items: center;
  padding: 10px 20px 18px;
}

.a2-donut-wrap { display: grid; place-items: center; }

.a2-donut {
  position: relative;
  width: min(170px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(#316cf4 0 64%, #22a55f 64% 77%, #9348e6 77% 83%, #f39b0a 83% 88%, #ef5b4f 88% 91%, #6d7682 91% 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.7);
}

.a2-donut::before {
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,.9);
  content: '';
}

.a2-donut-center {
  position: absolute;
  inset: 30%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.a2-donut-center strong {
  font-size: 25px;
  line-height: .95;
  letter-spacing: -.05em;
}

.a2-donut-center b { margin-top: 3px; font-size: 9px; }
.a2-donut-center small { margin-top: 4px; color: #929aa5; font-size: 7px; white-space: nowrap; }

.a2-expense-list { display: flex; flex-direction: column; gap: 9px; }

.a2-expense-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #727b88;
  font-size: 10.5px;
}

.a2-expense-row i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.a2-expense-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.a2-expense-row strong {
  color: #394151;
  font-size: 10.5px;
  white-space: nowrap;
}

.a2-changes {
  margin-top: auto;
  padding: 13px 20px 18px;
  border-top: 1px solid var(--a2-line);
}

.a2-changes h3 { margin-bottom: 9px; font-size: 11px; font-weight: 800; }

.a2-change-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.a2-change {
  padding: 10px;
  border-radius: 9px;
  background: #f7f8fa;
}

.a2-change strong {
  display: block;
  color: #667181;
  font-size: 14px;
  line-height: 1;
}

.a2-change.alert strong { color: var(--a2-red); }
.a2-change.warn strong { color: var(--a2-orange); }
.a2-change.good strong { color: var(--a2-green); }
.a2-change span { display: block; margin-top: 6px; color: #818a97; font-size: 9.5px; }

.a2-empty {
  display: grid;
  min-height: 100%;
  place-items: center;
  padding: 20px;
  color: var(--a2-muted);
  font-size: 11px;
  text-align: center;
}

.a2-change-empty { grid-column: 1 / -1; min-height: 54px; }

@media (max-width: 1280px) {
  .a2-dashboard-grid { grid-template-columns: 1fr; }
  .a2-spend-main { grid-template-columns: 240px minmax(230px, 1fr); }
  .a2-donut { width: 190px; }
}

@media (max-width: 1040px) {
  .a2-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .a2-kpi { min-height: 162px; }
}

@media (max-width: 760px) {
  .a2-heading { margin-bottom: 16px; }
  .a2-heading h1 { font-size: 22px; }
  .a2-live { display: none; }
  .a2-filters { display: grid; grid-template-columns: 1fr 1fr; }
  .a2-filter { min-width: 0; }
  .a2-performance-body { grid-template-columns: 1fr; }
  .a2-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; border-top: 1px solid var(--a2-line); border-left: 0; }
  .a2-insight { grid-column: 1 / -1; margin-top: 12px; }
  .a2-spend-main { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .a2-filters,
  .a2-kpis,
  .a2-spend-main { grid-template-columns: 1fr; }
  .a2-kpi { min-height: 150px; }
  .a2-filter { width: 100%; }
  .a2-change-grid { grid-template-columns: 1fr; }
  .a2-performance-body { min-height: 0; }
  .a2-chart { min-height: 260px; overflow-x: auto; }
  .a2-chart svg { width: 620px; min-height: 260px; }
  .a2-summary { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .a2-page *, .a2-page *::before, .a2-page *::after { transition: none !important; }
}

.a2-dropdown { position: relative; min-width: 0; }
.a2-dropdown .a2-filter { width: 100%; font-family: inherit; text-align: left; color: var(--a2-ink); }
.a2-filter[aria-expanded="true"] { border-color: #a9c2f8; box-shadow: 0 0 0 3px rgba(49,108,244,.08); transform: none; }
.a2-filter[aria-expanded="true"] .a2-chevron { transform: translateY(-50%) rotate(180deg); }
.a2-filter:focus-visible { outline: 2px solid var(--a2-blue); outline-offset: 3px; }
.a2-filter-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 100;
  width: max(100%, 280px);
  max-width: calc(100vw - 48px);
  padding: 8px;
  border: 1px solid #e1e6ef;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(28,38,53,.14), 0 2px 6px rgba(28,38,53,.04);
}
.a2-filter-menu[hidden] { display: none; }
.a2-menu-heading { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 12px; }
.a2-menu-heading strong { font-size: 14px; }
.a2-menu-heading button { width: 30px; height: 30px; border: 0; border-radius: 8px; background: #f5f7fa; color: #657188; font-size: 22px; cursor: pointer; }
.a2-month-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.a2-menu-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 38px; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: #4d5768; font-family: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.a2-month-grid .a2-menu-option { justify-content: center; padding: 10px 4px; }
.a2-menu-option:hover, .a2-menu-heading button:hover { background: #f4f7fc; }
.a2-menu-option[aria-pressed="true"] { background: var(--a2-blue-soft); color: var(--a2-blue); font-weight: 700; }
.a2-filter-menu button:focus-visible { outline: 2px solid var(--a2-blue); outline-offset: -2px; }
.a2-filter-menu button:disabled { color: #b9c0cb; background: transparent; cursor: default; }
.a2-menu-caption { padding: 7px 12px 9px; color: #929aa6; font-size: 10px; font-weight: 600; }
.a2-branch-options { max-height: 280px; overflow-y: auto; overscroll-behavior: contain; }
.a2-option-check { visibility: hidden; flex-shrink: 0; }
.a2-menu-option[aria-pressed="true"] .a2-option-check { visibility: visible; }
