#analysis {
  --analysis-green: #138a4b;
  --analysis-green-dark: #0f6f3d;
  --analysis-red: #d93b3b;
  --analysis-red-dark: #b62d2d;
  --analysis-ink: #243229;
  --analysis-muted: #6d7b72;
  --analysis-line: #e1e9e3;
  --analysis-soft: #f4f8f5;
  color: var(--analysis-ink);
}

.analysis-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.analysis-heading h2 {
  margin: 0 0 5px;
  font-size: 22px;
}

.analysis-heading p,
.analysis-updated {
  margin: 0;
  color: var(--analysis-muted);
  font-size: 12px;
}

.analysis-updated {
  flex: 0 0 auto;
  white-space: nowrap;
}

.analysis-filter-card,
.analysis-chart-card,
.analysis-table-card {
  border: 1px solid var(--analysis-line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(30, 48, 37, .055);
}

.analysis-filter-card {
  margin-bottom: 14px;
  padding: 14px;
}

.analysis-side-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 15px;
  border-radius: 12px;
  background: #eef3ef;
  padding: 5px;
}

.analysis-side-tab,
.analysis-period-button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.analysis-side-tab {
  min-height: 42px;
  border-radius: 9px;
  background: transparent;
  color: #647168;
  font-size: 12px;
  font-weight: 900;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.analysis-side-tab:hover {
  background: rgba(255, 255, 255, .7);
  color: var(--analysis-ink);
}

.analysis-side-tab.active[data-side="IN"] {
  background: var(--analysis-green);
  color: #fff;
  box-shadow: 0 4px 10px rgba(19, 138, 75, .2);
}

.analysis-side-tab.active[data-side="OUT"] {
  background: var(--analysis-red);
  color: #fff;
  box-shadow: 0 4px 10px rgba(217, 59, 59, .18);
}

.analysis-filter-grid {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(210px, 1.15fr) auto;
  gap: 12px;
  align-items: end;
}

.analysis-field {
  min-width: 0;
}

.analysis-field > label {
  display: block;
  margin-bottom: 7px;
  color: #5a675f;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.analysis-period-tabs {
  display: flex;
  gap: 4px;
  min-height: 42px;
  border-radius: 10px;
  background: #eef3ef;
  padding: 4px;
}

.analysis-period-button {
  flex: 1 1 auto;
  border-radius: 7px;
  background: transparent;
  color: #6a766e;
  padding: 0 12px;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.analysis-period-button:hover {
  color: var(--analysis-ink);
}

.analysis-period-button.active {
  background: #fff;
  color: var(--analysis-green-dark);
  box-shadow: 0 2px 7px rgba(30, 48, 37, .09);
}

#analysis[data-side="OUT"] .analysis-period-button.active {
  color: var(--analysis-red-dark);
}

.analysis-field select {
  width: 100%;
  height: 42px;
  border: 1px solid #d8e2db;
  border-radius: 10px;
  background: #fff;
  color: var(--analysis-ink);
  padding: 0 11px;
  font: inherit;
  font-size: 12px;
  outline: none;
}

.analysis-field select:focus {
  border-color: var(--analysis-green);
  box-shadow: 0 0 0 3px rgba(19, 138, 75, .09);
}

#analysis[data-side="OUT"] .analysis-field select:focus {
  border-color: var(--analysis-red);
  box-shadow: 0 0 0 3px rgba(217, 59, 59, .08);
}

.analysis-reset {
  height: 42px;
  white-space: nowrap;
}

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

.analysis-kpi {
  min-width: 0;
  border: 1px solid var(--analysis-line);
  border-radius: 13px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 8px 23px rgba(30, 48, 37, .045);
}

.analysis-kpi small {
  display: block;
  min-height: 30px;
  color: var(--analysis-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.analysis-kpi strong {
  display: block;
  overflow: hidden;
  margin-top: 7px;
  color: var(--analysis-ink);
  font-size: 23px;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-kpi .analysis-kpi-detail {
  overflow: hidden;
  margin-top: 8px;
  color: var(--analysis-muted);
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-change-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
}

.analysis-change-row strong {
  min-width: 0;
  margin-top: 0;
}

.analysis-trend {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  border-radius: 999px;
  background: #eaf7ef;
  color: var(--analysis-green-dark);
  padding: 5px 7px;
  font-size: 10px;
  font-weight: 900;
}

.analysis-trend.negative {
  background: #fff0f0;
  color: var(--analysis-red-dark);
}

.analysis-content {
  display: grid;
  gap: 14px;
}

.analysis-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--analysis-line);
  padding: 16px 18px;
}

.analysis-card-head h3 {
  margin: 0 0 4px;
  color: var(--analysis-ink);
  font-size: 16px;
}

.analysis-card-head p {
  margin: 0;
  color: var(--analysis-muted);
  font-size: 11px;
}

.analysis-measure-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #eaf7ef;
  color: var(--analysis-green-dark);
  padding: 6px 9px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .035em;
}

#analysis[data-side="OUT"] .analysis-measure-badge {
  background: #fff0f0;
  color: var(--analysis-red-dark);
}

.analysis-chart-wrap {
  position: relative;
  min-height: 335px;
  padding: 14px 14px 5px;
}

.analysis-chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 300px;
}

.analysis-grid-line {
  stroke: #e5ece7;
  stroke-dasharray: 4 5;
  stroke-width: 1;
}

.analysis-axis-label {
  fill: #77837b;
  font-size: 10px;
  font-weight: 700;
}

.analysis-bar {
  fill: var(--analysis-green);
  transition: opacity .15s ease;
}

#analysis[data-side="OUT"] .analysis-bar {
  fill: var(--analysis-red);
}

.analysis-bar:hover {
  opacity: .76;
}

.analysis-empty-chart {
  display: grid;
  min-height: 300px;
  place-items: center;
  color: var(--analysis-muted);
  font-size: 12px;
  text-align: center;
}

.analysis-table-wrap {
  overflow-x: auto;
  padding: 5px 14px 14px;
}

.analysis-table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
}

.analysis-table th,
.analysis-table td {
  border-bottom: 1px solid #edf1ee;
  padding: 12px 8px;
  font-size: 11px;
  text-align: left;
}

.analysis-table th {
  color: #6d7971;
  font-size: 10px;
  font-weight: 900;
}

.analysis-table th.num,
.analysis-table td.num {
  text-align: right;
}

.analysis-table tbody tr:last-child td {
  border-bottom: 0;
}

.analysis-table .empty {
  padding: 26px 10px;
  color: var(--analysis-muted);
  text-align: center;
}

@media (max-width: 1080px) {
  .analysis-filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .analysis-kpis {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .analysis-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .analysis-updated {
    white-space: normal;
  }

  .analysis-filter-grid,
  .analysis-kpis {
    grid-template-columns: 1fr;
  }

  .analysis-period-tabs {
    width: 100%;
  }

  .analysis-reset {
    width: 100%;
  }

  .analysis-card-head {
    flex-direction: column;
  }

  .analysis-chart-wrap {
    overflow-x: auto;
  }

  .analysis-chart-wrap svg {
    width: 760px;
    max-width: none;
  }
}

/* Grafik telefonda kendi içinde kaysın, sayfayı genişletmesin. */
.analysis-content > * {
  min-width: 0;
}
