.support-modal-body-reports {
  padding: 0;
  overflow: hidden;
}

.reports-page {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  background: var(--bg);
}

.reports-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 16px 0;
}

.reports-body {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  min-height: 0;
  height: 100%;
  padding-top: 14px;
  --reports-filters-w: 280px;
}

.reports-page.is-filters-collapsed .reports-body {
  grid-template-columns: minmax(0, 1fr);
}

.reports-filters-toggle {
  position: absolute;
  top: 18px;
  right: calc(var(--reports-filters-w) - 13px);
  z-index: 12;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(23, 32, 51, 0.1);
  transition:
    right 0.22s ease,
    color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.reports-filters-toggle:hover {
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 4px 12px rgba(23, 32, 51, 0.14);
}

.reports-filters-toggle.is-collapsed,
.reports-page.is-filters-collapsed .reports-filters-toggle {
  right: 13px;
}

.reports-main {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 0 16px 24px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.reports-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.reports-date-range-side {
  width: 100%;
}

.reports-date-range-side input[type="date"] {
  width: calc(50% - 10px) !important;
  flex: 1 1 0;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  padding: 6px 6px;
  font: inherit;
}

.reports-sidebar select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  padding: 6px 8px;
  font: inherit;
}

.reports-ms-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  padding: 6px 10px;
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.reports-ms-trigger:hover,
.reports-ms-trigger.is-open {
  border-color: var(--line-strong);
  background: var(--panel-strong, var(--panel));
}

.reports-ms-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reports-ms-caret {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1;
}

.reports-filter-popup {
  z-index: 140;
}

.reports-grain {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
}

.reports-grain-btn {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  padding: 6px 4px;
  white-space: nowrap;
}

.reports-grain-btn:hover {
  background: var(--accent-soft);
}

.reports-grain-btn.is-active {
  border-color: transparent;
  background: #2563eb;
  color: #fff;
}

.reports-kpi {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  min-width: 0;
}

.reports-kpi-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 88px;
  gap: 8px;
  align-items: center;
}

.reports-kpi-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.reports-kpi-icon svg {
  display: block;
  width: 14px;
  height: 14px;
}

.reports-kpi-title {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reports-kpi-info {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  cursor: help;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.reports-kpi-stats {
  min-width: 0;
}

.reports-kpi-value {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.05;
  color: var(--text);
  letter-spacing: -0.02em;
}

.reports-kpi-trend {
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
}

.reports-kpi-delta {
  font-weight: 700;
}

.reports-kpi-delta.is-up {
  color: #16a34a;
}

.reports-kpi-delta.is-down {
  color: #ef4444;
}

.reports-kpi-delta.is-neutral {
  color: var(--muted);
}

.reports-kpi-trend-sep {
  width: 1px;
  height: 10px;
  background: var(--line-strong);
  display: inline-block;
}

.reports-kpi-trend-label {
  color: var(--muted);
}

.reports-kpi-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.reports-kpi-spark {
  width: 100%;
  height: 34px;
  display: block;
}

.reports-kpi-spark-empty {
  height: 34px;
}

.reports-kpi-spark-line {
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reports-kpi-spark-area {
  stroke: none;
}

.reports-kpi-spark-dot {
  stroke-width: 0;
}

.reports-kpi-spark-dot-core {
  fill: var(--panel);
  stroke-width: 0;
}

.reports-kpi.tone-blue .reports-kpi-icon,
.reports-kpi.tone-sky .reports-kpi-icon {
  background: #e8f1ff;
  color: #2563eb;
}

.reports-kpi.tone-green .reports-kpi-icon {
  background: #e9f9ef;
  color: #16a34a;
}

.reports-kpi.tone-amber .reports-kpi-icon {
  background: #fff4df;
  color: #c2410c;
}

.reports-kpi.tone-red .reports-kpi-icon {
  background: #feecec;
  color: #dc2626;
}

.reports-kpi-spark-blue .reports-kpi-spark-line,
.reports-kpi-spark-blue .reports-kpi-spark-dot { stroke: #3b82f6; fill: #3b82f6; }
.reports-kpi-spark-blue .reports-kpi-spark-area { fill: rgba(59, 130, 246, 0.16); }

.reports-kpi-spark-green .reports-kpi-spark-line,
.reports-kpi-spark-green .reports-kpi-spark-dot { stroke: #22c55e; fill: #22c55e; }
.reports-kpi-spark-green .reports-kpi-spark-area { fill: rgba(34, 197, 94, 0.14); }

.reports-kpi-spark-sky .reports-kpi-spark-line,
.reports-kpi-spark-sky .reports-kpi-spark-dot { stroke: #38bdf8; fill: #38bdf8; }
.reports-kpi-spark-sky .reports-kpi-spark-area { fill: rgba(56, 189, 248, 0.16); }

.reports-kpi-spark-amber .reports-kpi-spark-line,
.reports-kpi-spark-amber .reports-kpi-spark-dot { stroke: #f59e0b; fill: #f59e0b; }
.reports-kpi-spark-amber .reports-kpi-spark-area { fill: rgba(245, 158, 11, 0.16); }

.reports-kpi-spark-red .reports-kpi-spark-line,
.reports-kpi-spark-red .reports-kpi-spark-dot { stroke: #ef4444; fill: #ef4444; }
.reports-kpi-spark-red .reports-kpi-spark-area { fill: rgba(239, 68, 68, 0.14); }

body[data-theme="dark"] .reports-kpi.tone-blue .reports-kpi-icon,
body[data-theme="dark"] .reports-kpi.tone-sky .reports-kpi-icon {
  background: #1e3a5f;
  color: #93c5fd;
}

body[data-theme="dark"] .reports-kpi.tone-green .reports-kpi-icon {
  background: #14532d;
  color: #86efac;
}

body[data-theme="dark"] .reports-kpi.tone-amber .reports-kpi-icon {
  background: #422006;
  color: #fcd34d;
}

body[data-theme="dark"] .reports-kpi.tone-red .reports-kpi-icon {
  background: #450a0a;
  color: #fca5a5;
}

.reports-charts,
.reports-tables {
  display: grid;
  gap: 12px;
}

.reports-charts,
.reports-tables {
  grid-template-columns: 1fr;
}

.reports-chart-card,
.reports-table-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  min-width: 0;
}

.reports-chart-head,
.reports-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.reports-table-head-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.reports-table-columns-wrap {
  flex: 0 0 auto;
}

.reports-data-table {
  width: 100%;
}

.reports-data-table .support-table-draggable-header {
  cursor: grab;
}

.reports-chart-head h4,
.reports-table-head h4,
.reports-sidebar-head h4 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
}

.reports-chart-head-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.reports-chart-kind {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
}

.reports-chart-kind-btn {
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  padding: 5px 10px;
  white-space: nowrap;
}

.reports-chart-kind-btn:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.reports-chart-kind-btn.is-active {
  background: #2563eb;
  color: #fff;
}

.reports-chart-hit {
  cursor: pointer;
  pointer-events: all;
}

.reports-point-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.reports-point-filter:hover {
  background: #dbeafe;
}

body[data-theme="dark"] .reports-point-filter {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(37, 99, 235, 0.18);
  color: #93c5fd;
}

.reports-chart-canvas-wrap {
  height: 320px;
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.reports-chart-host {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reports-chart-host svg {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: block;
}

.reports-chart-empty {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.reports-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.8rem;
  font-weight: 700;
}

.reports-count-badge.is-green {
  background: #dcfce7;
  color: #15803d;
}

body[data-theme="dark"] .reports-count-badge {
  background: rgba(37, 99, 235, 0.22);
  color: #93c5fd;
}

body[data-theme="dark"] .reports-count-badge.is-green {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

body[data-theme="dark"] .reports-priority-critical {
  color: #f87171;
}

body[data-theme="dark"] .reports-priority-high {
  color: #fbbf24;
}

body[data-theme="dark"] .reports-priority-medium {
  color: #60a5fa;
}

.reports-table-scroll-wrap {
  position: relative;
}

.reports-table-scroll {
  overflow: auto;
  height: 280px;
  min-height: 120px;
  max-height: 900px;
}

.reports-table-resize-handle {
  height: 10px;
  margin: 0 10px -2px;
  cursor: ns-resize;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.reports-table-resize-handle::after {
  content: "";
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 45%, transparent);
  transition: background 0.15s ease, width 0.15s ease;
}

.reports-table-resize-handle:hover::after,
.reports-table-resize-handle.is-active::after {
  width: 64px;
  background: color-mix(in srgb, var(--accent) 70%, transparent);
}

body.is-reports-table-resizing,
body.is-reports-table-resizing * {
  cursor: ns-resize !important;
  user-select: none !important;
}

.reports-table-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.reports-table-card th,
.reports-table-card td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.reports-table-card th {
  color: var(--muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
  text-align: center;
  padding-right: 12px;
}

.reports-table-card th .support-table-header-inner {
  justify-content: center;
}

.reports-table-card tbody tr {
  cursor: pointer;
}

.reports-table-card tbody tr:hover {
  background: var(--hover-row);
}

.reports-ticket-no {
  color: var(--link);
  font-weight: 700;
  white-space: nowrap;
}

.reports-receipt-col {
  width: 2.2rem;
  text-align: center !important;
  vertical-align: middle !important;
  padding-left: 4px !important;
  padding-right: 4px !important;
  color: var(--muted);
}

.reports-receipt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.1rem;
  color: #16a34a;
  line-height: 0;
}

.reports-receipt-empty {
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
}

.reports-receipt-check {
  width: 14px;
  height: 11px;
  display: block;
}

.reports-receipt-pair {
  display: inline-grid;
  grid-template-columns: 10px 10px;
  align-items: center;
  width: 18px;
}

.reports-receipt-pair .reports-receipt-check:first-child {
  grid-column: 1;
  grid-row: 1;
  transform: translateX(-1px);
}

.reports-receipt-pair .reports-receipt-check:last-child {
  grid-column: 2;
  grid-row: 1;
  margin-left: -6px;
}

.reports-receipt.is-single {
  color: #64748b;
}

.reports-receipt.is-double {
  color: #16a34a;
}

.reports-empty-cell {
  color: var(--muted);
  text-align: center !important;
}

.reports-priority {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.reports-priority-critical {
  color: #b91c1c;
}

.reports-priority-high {
  color: #b45309;
}

.reports-priority-medium {
  color: #2563eb;
}

.reports-priority-low {
  color: var(--muted);
}

.reports-sidebar {
  border-left: 1px solid var(--line);
  background: var(--panel);
  padding: 0 14px 14px;
  overflow: auto;
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 0;
}

.reports-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.reports-sidebar-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.reports-side-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  padding: 7px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

.reports-side-btn:hover {
  background: var(--accent-soft);
}

.reports-side-field {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.reports-side-field select {
  width: 100%;
}

.reports-side-label {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.reports-status-block {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}

.reports-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.reports-check input {
  width: 16px;
  height: 16px;
}

@media (max-width: 1280px) {
  .reports-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .reports-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .reports-sidebar {
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: 42vh;
  }

  .reports-charts,
  .reports-tables {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .reports-kpis {
    grid-template-columns: 1fr;
  }
}
