﻿:root {
  --bg: #f3f5f7;
  --ink: #17202a;
  --muted: #647282;
  --line: #dfe5ea;
  --panel: #ffffff;
  --green: #12a150;
  --red: #e23c3c;
  --blue: #2f74d0;
  --amber: #f4a51c;
  --shadow: 0 18px 40px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.sidebar-collapsed .app-shell {
  grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  background: #15202b;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--green), var(--blue));
  font-weight: 800;
}

.brand strong,
.brand small,
.source-card span,
.source-card strong,
.source-card small {
  display: block;
}

.sidebar-toggle {
  margin-left: auto;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

.brand small,
.source-card small {
  color: #b8c4cf;
  margin-top: 4px;
  line-height: 1.5;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-list a {
  color: #d7e0e8;
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.nav-list a.active,
.nav-list a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.source-card {
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.source-card span {
  color: #9eb0bf;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.source-card strong {
  margin-top: 8px;
  word-break: break-word;
}

.analytic-trigger {
  min-height: 22px;
  margin-top: 9px;
  padding: 2px 7px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  background: transparent;
  color: #9eb0bf;
  font-size: 10px;
  opacity: 0.7;
}

.analytic-trigger:hover,
.analytic-trigger:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  opacity: 1;
}

.sidebar-collapsed .brand div,
.sidebar-collapsed .nav-list,
.sidebar-collapsed .source-card {
  display: none;
}

.sidebar-collapsed .sidebar {
  align-items: center;
  padding-inline: 15px;
}

.sidebar-collapsed .brand {
  display: grid;
  gap: 12px;
}

.sidebar-collapsed .sidebar-toggle {
  margin-left: 0;
}

.dashboard {
  padding: 18px;
  min-width: 0;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
}

.topbar p,
.panel-head p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.35;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.actions input {
  display: none;
}

button,
.upload-btn {
  border: 0;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  background: var(--green);
  color: #fff;
  text-decoration: none;
}

button {
  background: #e5ebf0;
  color: var(--ink);
}

.filter-panel {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(140px, 0.36fr) minmax(250px, 0.56fr) minmax(340px, 0.78fr);
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.is-hidden {
  display: none !important;
}

.filter-group {
  display: grid;
  gap: 8px;
}

.filter-group > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.date-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.date-range label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.date-range input,
.mini-filter input,
.select-filter {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.select-filter {
  width: 100%;
  font-weight: 800;
}

.segmented {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: #edf1f4;
  border-radius: 8px;
  width: fit-content;
  max-width: 100%;
}

.segmented label {
  position: relative;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label:has(input:checked) {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(23, 32, 42, 0.08);
}

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

.kpi-targets article {
  min-height: 68px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  display: grid;
  align-content: space-between;
}

.kpi-targets span,
.kpi-targets small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.kpi-targets strong {
  font-size: 20px;
  line-height: 1;
}

.kpi-targets .kpi-total {
  background: #10291d;
  border-color: #10291d;
  color: #fff;
}

.kpi-targets .kpi-total span,
.kpi-targets .kpi-total small {
  color: #bfe3cf;
}

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

.metric-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 14px;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0;
}

.metric-total {
  background: #10291d;
  color: #fff;
  border-color: #10291d;
}

.metric-total span,
.metric-total small {
  color: #bfe3cf;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(360px, 1.08fr) minmax(320px, 0.88fr);
  gap: 10px;
  align-items: stretch;
}

.panel {
  padding: 12px;
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.panel h2 {
  font-size: 16px;
}

.wide-panel {
  grid-column: span 2;
}

.ticket-panel {
  margin-top: 12px;
}

#trend,
#detailTickets,
#spbuList {
  scroll-margin-top: 18px;
  margin-bottom: 70vh;
}

.trend-filter-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(180px, 0.65fr) minmax(260px, 0.9fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.trend-filter-note {
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 10px 12px;
  border-left: 3px solid var(--green);
  background: #fff;
}

.trend-filter-note span,
.trend-filter-note small {
  color: var(--muted);
  font-size: 12px;
}

.trend-filter-note span {
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.trend-filter-note strong {
  font-size: 15px;
}

.trend-chart-wrap {
  min-width: 0;
  padding: 12px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.trend-breakdown-filter-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr)) minmax(250px, 1.2fr);
  gap: 12px;
  align-items: end;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.trend-breakdown-note {
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 10px 12px;
  border-left: 3px solid var(--blue);
  background: #fff;
}

.trend-breakdown-note strong {
  font-size: 13px;
}

.trend-breakdown-note small {
  color: var(--muted);
  font-size: 12px;
}

.trend-breakdown-table-wrap {
  max-width: 100%;
  margin-top: 12px;
  overflow-x: auto;
}

.trend-total-breakdown-wrap {
  max-width: 100%;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.trend-total-breakdown {
  max-height: 460px;
  overflow: auto;
}

.trend-breakdown-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
}

.trend-breakdown-heading h3 {
  margin: 0;
  font-size: 15px;
}

.trend-breakdown-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.trend-breakdown-table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
}

.trend-breakdown-table th,
.trend-breakdown-table td {
  padding: 9px 8px;
  vertical-align: top;
}

.trend-breakdown-table th:nth-child(1),
.trend-breakdown-table td:nth-child(1) {
  width: 105px;
}

.trend-breakdown-table th:nth-child(2),
.trend-breakdown-table td:nth-child(2),
.trend-breakdown-table th:nth-child(3),
.trend-breakdown-table td:nth-child(3),
.trend-breakdown-table th:nth-child(4),
.trend-breakdown-table td:nth-child(4) {
  width: 105px;
  white-space: nowrap;
}

.trend-breakdown-table th:nth-child(5),
.trend-breakdown-table td:nth-child(5) {
  width: auto;
}

.trend-breakdown-tree {
  display: grid;
  gap: 5px;
}

.trend-tree-category,
.trend-tree-subcategory1,
.trend-tree-subcategory2 {
  min-width: 0;
}

.trend-tree-category-row,
.trend-tree-subcategory1-row,
.trend-tree-subcategory2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
}

.trend-tree-category {
  display: grid;
  gap: 4px;
  padding: 5px 7px;
  border-radius: 5px;
  background: #f1f6f3;
}

.trend-tree-subcategory1 {
  display: grid;
  gap: 3px;
  margin-left: 16px;
  color: var(--ink);
}

.trend-tree-subcategory2 {
  margin-left: 32px;
  color: var(--muted);
  font-size: 12px;
}

.trend-tree-category strong,
.trend-tree-subcategory1 strong,
.trend-tree-subcategory2 strong {
  white-space: nowrap;
  font-size: 12px;
}

.trend-tree-subcategory1 span,
.trend-tree-subcategory2 span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trend-breakdown-empty {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.trend-chart-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.trend-chart {
  display: block;
  width: 100%;
  min-width: 760px;
  height: auto;
}

.trend-grid-line {
  stroke: #e8edf0;
  stroke-width: 1;
}

.trend-axis-line {
  stroke: #aab5bd;
  stroke-width: 1;
}

.trend-axis-title,
.trend-axis-value,
.trend-month-label {
  fill: var(--muted);
  font-family: inherit;
}

.trend-axis-title {
  font-size: 13px;
  font-weight: 900;
}

.trend-axis-title-left,
.trend-total-label {
  fill: var(--green);
}

.trend-axis-title-right,
.trend-sla-label {
  fill: var(--blue);
}

.trend-axis-value {
  font-size: 11px;
  font-weight: 700;
}

.trend-month-label {
  font-size: 12px;
  font-weight: 800;
}

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

.trend-line-total {
  stroke: var(--green);
}

.trend-line-sla {
  stroke: var(--blue);
}

.trend-point {
  stroke: #fff;
  stroke-width: 2;
}

.trend-point-total {
  fill: var(--green);
}

.trend-point-sla {
  fill: var(--blue);
}

.trend-point-label {
  font-size: 11px;
  font-weight: 900;
}

.trend-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
  padding-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.trend-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.trend-legend-line {
  display: inline-block;
  width: 22px;
  height: 3px;
  border-radius: 99px;
}

.trend-legend-line.tickets {
  background: var(--green);
}

.trend-legend-line.sla {
  background: var(--blue);
}

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.pie-wrap {
  display: grid;
  grid-template-columns: minmax(132px, 160px) 1fr;
  gap: 12px;
  align-items: center;
}

.pie-chart {
  width: 100%;
  max-width: 160px;
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.pie-chart::after {
  content: "";
  position: absolute;
  inset: 23%;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.legend,
.bar-list {
  display: grid;
  gap: 6px;
}

.legend-item {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  width: 100%;
  min-height: 30px;
  padding: 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.legend-item:hover,
.bar-row:hover {
  background: #f6f8fa;
}

.legend-item.active {
  background: #e8f6ee;
  box-shadow: inset 0 0 0 1px #8bd1a9;
}

.category-filter-chip {
  max-width: 150px;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid #8bd1a9;
  border-radius: 6px;
  background: #e8f6ee;
  color: #0b6b37;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-item span {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-item em {
  color: var(--muted);
  font-style: normal;
}

.bar-row {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.bar-label span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 8px;
  border-radius: 999px;
  background: #edf1f4;
  overflow: hidden;
}

.bar-track i,
.stack i {
  display: block;
  height: 100%;
}

.category-table-wrap,
.ticket-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th {
  text-align: left;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
}

td {
  padding: 9px 8px;
  border-bottom: 1px solid #edf1f4;
  font-size: 14px;
  vertical-align: middle;
  line-height: 1.25;
}

.spbu-detail-table table {
  table-layout: fixed;
}

.ticket-table {
  table-layout: auto;
  width: max-content;
  min-width: 100%;
}

.ticket-table th:nth-child(1),
.ticket-table td:nth-child(1) {
  min-width: 190px;
}

.ticket-table th:nth-child(2),
.ticket-table td:nth-child(2) {
  min-width: 190px;
}

.ticket-table th:nth-child(3),
.ticket-table td:nth-child(3) {
  min-width: 105px;
}

.ticket-table th:nth-child(4),
.ticket-table td:nth-child(4) {
  min-width: 110px;
}

.detail-ticket-table th:nth-child(9),
.detail-ticket-table td:nth-child(9),
.detail-ticket-table th:nth-child(10),
.detail-ticket-table td:nth-child(10) {
  min-width: 150px;
}

.detail-ticket-table th:nth-child(11),
.detail-ticket-table td:nth-child(11),
.progress-ticket-table th:nth-child(7),
.progress-ticket-table td:nth-child(7) {
  min-width: 320px;
}

.detail-ticket-table th:nth-child(12),
.detail-ticket-table td:nth-child(12),
.progress-ticket-table th:nth-child(8),
.progress-ticket-table td:nth-child(8) {
  min-width: 170px;
}

.progress-ticket-table th:nth-child(5),
.progress-ticket-table td:nth-child(5),
.progress-ticket-table th:nth-child(6),
.progress-ticket-table td:nth-child(6) {
  min-width: 150px;
}

.detail-ticket-table th:nth-child(5),
.detail-ticket-table td:nth-child(5),
.detail-ticket-table th:nth-child(6),
.detail-ticket-table td:nth-child(6),
.detail-ticket-table th:nth-child(7),
.detail-ticket-table td:nth-child(7),
.detail-ticket-table th:nth-child(8),
.detail-ticket-table td:nth-child(8),
.progress-ticket-table th:nth-child(3),
.progress-ticket-table td:nth-child(3),
.progress-ticket-table th:nth-child(4),
.progress-ticket-table td:nth-child(4) {
  min-width: 170px;
}

.ticket-table th,
.ticket-table td {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.spbu-detail-table th,
.spbu-detail-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-table th:last-child,
.ticket-table td:last-child,
.spbu-detail-table th:last-child,
.spbu-detail-table td:last-child {
  width: 58px;
  text-align: center;
}

.mini-filter input {
  width: min(320px, 36vw);
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-actions input {
  width: min(340px, 38vw);
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.spbu-list {
  display: grid;
  gap: 10px;
}

.spbu-filter-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(180px, 260px);
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.breakdown-filter-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(260px, 0.7fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.breakdown-target-note {
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 0 12px;
  border-left: 3px solid var(--green);
}

.breakdown-target-note span,
.breakdown-target-note small {
  color: var(--muted);
  font-size: 12px;
}

.breakdown-target-note span {
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.breakdown-target-note strong {
  font-size: 15px;
}

.breakdown-target-note strong i {
  color: var(--muted);
  font-style: normal;
  padding: 0 4px;
}

.region-breakdown-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.region-breakdown-summary article {
  min-height: 78px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.region-breakdown-summary span,
.region-breakdown-summary small {
  display: block;
  color: var(--muted);
}

.region-breakdown-summary span {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.region-breakdown-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 28px;
  line-height: 1;
}

.region-breakdown-summary small {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 700;
}

.region-breakdown-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.region-breakdown-table {
  min-width: 980px;
  table-layout: fixed;
}

.region-breakdown-table th,
.region-breakdown-table td {
  padding: 9px 8px;
  white-space: nowrap;
}

.region-breakdown-table th:nth-child(1),
.region-breakdown-table td:nth-child(1) {
  width: 130px;
}

.region-breakdown-table th:nth-child(2),
.region-breakdown-table td:nth-child(2),
.region-breakdown-table th:nth-child(3),
.region-breakdown-table td:nth-child(3),
.region-breakdown-table th:nth-child(5),
.region-breakdown-table td:nth-child(5) {
  width: 105px;
}

.region-breakdown-table th:nth-child(4),
.region-breakdown-table td:nth-child(4),
.region-breakdown-table th:nth-child(6),
.region-breakdown-table td:nth-child(6) {
  width: 245px;
}

.region-breakdown-table th:last-child,
.region-breakdown-table td:last-child {
  width: 95px;
  text-align: center;
}

.breakdown-rate {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.breakdown-rate strong {
  font-size: 13px;
}

.breakdown-rate small {
  color: var(--muted);
  font-size: 11px;
}

.breakdown-track {
  position: relative;
  height: 8px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f4;
}

.breakdown-track i {
  display: block;
  height: 100%;
}

.breakdown-track b {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: var(--ink);
}

.region-detail-button {
  min-height: 30px;
  padding: 0 10px;
  background: #e8f6ee;
  color: #0b6b37;
  font-size: 12px;
}

.region-detail-button:hover,
.region-detail-button:focus-visible {
  background: var(--green);
  color: #fff;
}

.spbu-summary-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.spbu-summary-cards article {
  min-height: 78px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.spbu-summary-cards span,
.spbu-summary-cards small {
  display: block;
  color: var(--muted);
}

.spbu-summary-cards span {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.spbu-summary-cards strong {
  display: block;
  margin-top: 5px;
  font-size: 28px;
  line-height: 1;
}

.spbu-summary-cards small {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 700;
}

.spbu-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.spbu-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 10px 12px;
  background: #f7faf9;
  border-bottom: 1px solid var(--line);
}

.spbu-card-head > div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.spbu-card-head strong {
  font-size: 16px;
}

.spbu-card-head span {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spbu-card-head em {
  flex: 0 0 auto;
  min-height: 26px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e9f7ef;
  color: var(--green);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.spbu-metrics {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  min-width: max-content;
}

.spbu-metrics em {
  white-space: nowrap;
}

.spbu-metrics em.good {
  background: #e9f7ef;
  color: #0f7f3d;
}

.spbu-metrics em.risk {
  background: #fff1df;
  color: #a15d00;
}

.spbu-metrics em.neutral {
  background: #eef4fb;
  color: #31536f;
}

.spbu-detail-table {
  overflow-x: auto;
}

.spbu-detail-table table {
  min-width: 1180px;
}

.spbu-detail-table th:nth-child(1),
.spbu-detail-table td:nth-child(1) {
  width: 130px;
}

.spbu-detail-table th:nth-child(2),
.spbu-detail-table td:nth-child(2) {
  width: 150px;
}

.spbu-detail-table th:nth-child(6),
.spbu-detail-table td:nth-child(6) {
  width: 310px;
}

.spbu-detail-table th:nth-child(7),
.spbu-detail-table td:nth-child(7) {
  width: 150px;
}

.spbu-detail-table th,
.spbu-detail-table td {
  padding: 7px 8px;
  font-size: 12px;
}

.info-button {
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border-radius: 50%;
  background: #e9f2ff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.info-button:hover,
.info-button:focus-visible {
  background: var(--blue);
  color: #fff;
}

.info-button.copied {
  background: var(--green);
  color: #fff;
}

.info-button.muted {
  background: #eef2f5;
  color: #8a98a6;
}

.remark-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 25, 35, 0.45);
}

.remark-modal-card {
  width: min(680px, 100%);
  max-height: min(76vh, 620px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(12, 22, 34, 0.28);
}

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

.remark-modal-head span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.remark-modal-head strong {
  display: block;
  margin-top: 3px;
  font-size: 17px;
}

.remark-close {
  width: 34px;
  min-width: 34px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.remark-modal-body {
  overflow: auto;
  padding: 16px;
  color: var(--ink);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.remark-edit-panel {
  display: grid;
  gap: 8px;
  padding: 0 16px 14px;
}

.remark-edit-panel input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
}

.remark-edit-panel small {
  color: var(--muted);
  font-size: 12px;
}

.remark-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: #f8fafb;
}

.remark-modal-actions #copyRemarkModal {
  background: var(--green);
  color: #fff;
}

.remark-modal-actions #submitRemarkSpbu {
  background: var(--blue);
  color: #fff;
}

.analytic-modal-card {
  width: min(760px, 100%);
  max-height: min(82vh, 760px);
}

.analytic-modal-body {
  display: grid;
  gap: 12px;
}

.analytic-modal-body > p {
  margin: 0;
  color: var(--muted);
}

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

.analytic-stat-grid article {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
}

.analytic-stat-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.analytic-stat-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.analytic-field {
  gap: 5px;
}

.analytic-field input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
}

.analytic-field small {
  color: var(--muted);
  font-size: 11px;
}

.analytic-review {
  display: grid;
  gap: 6px;
  max-height: 190px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
}

.analytic-review:empty {
  display: none;
}

.analytic-review-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.analytic-review-row:last-child {
  border-bottom: 0;
}

.analytic-review-row span {
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
}

.analytic-review-row small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.analytic-review-row select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  background: #fff;
  font: inherit;
}

.remark-modal-actions #submitRegionAnalytic {
  background: var(--blue);
  color: #fff;
}

#saveSpbuUpdate {
  background: #1f6feb;
  color: #fff;
}

.subcategory-mode {
  margin-bottom: 10px;
}

.pareto-list {
  display: grid;
  gap: 6px;
}

.pareto-row {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 0;
  padding: 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.pareto-row:hover,
.pareto-row:focus-visible {
  background: #f3f6f8;
}

.pareto-meta {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.pareto-meta span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pareto-meta strong {
  font-size: 13px;
}

.pareto-meta em {
  color: var(--blue);
  font-style: normal;
  font-weight: 800;
  display: none;
}

.pareto-track {
  position: relative;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f4;
}

.pareto-track i {
  display: block;
  height: 100%;
}

.pareto-track b {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 1px;
  background: #17202a;
}

.stacked-summary {
  display: grid;
  gap: 22px;
  margin-top: 8px;
}

.stacked-summary > div > span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 700;
}

.stack {
  position: relative;
  display: flex;
  height: 28px;
  overflow: hidden;
  border-radius: 8px;
  background: #edf1f4;
}

.stack small {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #17202a;
  font-size: 12px;
  font-weight: 800;
}

.closed,
.in {
  background: var(--green);
}

.open,
.out {
  background: var(--red);
}

.counter-pill,
.sla-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.counter-pill {
  min-height: 28px;
  padding: 0 10px;
  background: #e9f7ef;
  color: var(--green);
}

.sla-badge {
  padding: 4px 8px;
}

.sla-badge.good {
  background: #e9f7ef;
  color: #0f7f3d;
}

.sla-badge.risk {
  background: #fff1df;
  color: #a15d00;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

.empty.compact {
  padding: 14px;
  border-radius: 8px;
  background: #f6f8fa;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar-collapsed .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .nav-list {
    grid-auto-flow: column;
    overflow-x: auto;
  }

  .source-card {
    margin-top: 0;
    margin-left: auto;
    max-width: 280px;
  }

  .sidebar-collapsed .sidebar {
    justify-content: space-between;
  }

  .sidebar-collapsed .brand div,
  .sidebar-collapsed .nav-list {
    display: none;
  }

  .filter-panel,
  .kpi-grid,
  .analytics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-targets {
    grid-column: span 2;
  }

  .pareto-panel {
    grid-column: span 2;
  }

  .status-panel {
    grid-column: span 2;
  }

  .trend-filter-panel,
  .trend-breakdown-filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dashboard {
    padding: 14px;
  }

  .topbar,
  .panel-head,
  .pie-wrap {
    display: grid;
  }

  .actions {
    justify-content: flex-start;
  }

  .filter-panel,
  .kpi-grid,
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .kpi-targets {
    grid-column: auto;
  }

  .wide-panel,
  .pareto-panel,
  .status-panel {
    grid-column: auto;
  }

  .metric-card strong {
    font-size: 28px;
  }

  .mini-filter input {
    width: 100%;
  }

  .detail-actions,
  .detail-actions input {
    width: 100%;
  }

  .spbu-filter-panel {
    grid-template-columns: 1fr;
  }

  .breakdown-filter-panel,
  .trend-filter-panel,
  .trend-breakdown-filter-panel {
    grid-template-columns: 1fr;
  }

  .trend-breakdown-heading {
    display: grid;
  }

  .spbu-summary-cards,
  .region-breakdown-summary {
    grid-template-columns: 1fr;
  }

  .date-range,
  .pareto-meta {
    grid-template-columns: 1fr;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
  }

  .source-card {
    max-width: none;
    margin-left: 0;
  }

  .analytic-stat-grid,
  .analytic-review-row {
    grid-template-columns: 1fr;
  }
}
