.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  background-color: #0A3690;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 16px 0;
}

.sidebar-brand {
  padding: 0 16px 20px;
  border-bottom: 1px solid #0A3690;
  margin-bottom: 12px;
}

.sidebar-logo {
  display: block;
  width: 10%;
  max-width: 100%;
  height: auto;
}

.sidebar-tagline {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: #fff;
}

.sidebar-brand h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.02em;
}

.sidebar-brand p {
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: #fff;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0 8px;
  flex: 1;
}

.sidebar-nav a {
  display: block;
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: 6px;
  color: #8AEADC;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.sidebar-nav a:hover {
  color: var(--primary-1);
}

.sidebar-nav a.active {
  color: #fff;
  font-weight: 700;
}

.main-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
  position: relative;
}

.main-column::before {
  content: "";
  position: absolute;
  top: 80px;
  right: 0;
  width: 60%;
  height: 500px;
  background: radial-gradient(ellipse at 80% 20%, rgba(75, 117, 205, 0.12), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.main-column > * {
  position: relative;
  z-index: 1;
}

.page-header {
  height: var(--header-height);
  padding: 0 40px;
  display: flex;
  align-items: center;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.page-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 900;
  color: var(--primary-1);
  letter-spacing: 0.15px;
}

.page-tabs {
  display: flex;
  gap: 0;
  padding: 0 40px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.page-tab {
  padding: 12px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.page-tab:hover {
  color: var(--primary-1);
}

.page-tab.active {
  color: var(--primary-1);
  border-bottom-color: var(--primary-1);
}

.page-content {
  padding: 20px 40px 40px;
  flex: 1;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

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

@media (max-width: 600px) {
  .kpi-row {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: linear-gradient(254deg, #fff 7.4%, rgba(255, 255, 255, 0.2) 115%);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid #eee;
  box-shadow: var(--shadow-card);
}

.kpi-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.kpi-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary-1);
  margin: 0;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--black);
  margin: 4px 0 0;
  letter-spacing: 0.5px;
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--gray);
  margin: 4px 0 0;
}

.kpi-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.kpi-icon img {
  display: block;
  width: 48px;
  height: 48px;
}

.charts-row {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1000px) {
  .charts-row {
    grid-template-columns: 1fr;
  }
}

.dashboard-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid #eee;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.dashboard-card-header {
  padding: 16px 20px;
  background: var(--primary-2);
  border-bottom: 1px solid var(--border);
}

.dashboard-card-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 900;
  color: var(--primary-1);
}

.dashboard-card-body {
  padding: 20px;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: 100px 1fr 40px;
  align-items: center;
  gap: 12px;
}

.bar-label {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.bar-track {
  height: 28px;
  background: #f0f0f0;
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 2px;
  min-width: 2px;
  transition: width 0.3s ease;
}

.bar-value {
  font-size: 0.65rem;
  font-weight: 900;
  text-align: right;
}

.bar-colors-0 { background: var(--primary-1); }
.bar-colors-1 { background: var(--primary-light); }
.bar-colors-2 { background: var(--primary-mid); }
.bar-colors-3 { background: var(--primary-soft); }
.bar-colors-4 { background: var(--primary-accent); }

.summary-panel .summary-block {
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}

.summary-block-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.summary-icon {
  flex-shrink: 0;
}

.summary-panel .summary-block:last-child {
  border-bottom: none;
}

.summary-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray);
  margin: 0 0 4px;
}

.summary-value {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.summary-pct {
  font-size: 0.8rem;
  color: var(--gray);
  margin: 4px 0 0;
}

.error-types h4 {
  margin: 0 0 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray);
}

.error-type-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 8px;
  color: var(--black);
}

.table-card .dashboard-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.table-card .dashboard-card-header p {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--gray);
}

.table-toolbar {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid #eee;
  align-items: center;
}

.table-toolbar .search-input {
  flex: 1;
  width: auto;
  min-width: 0;
}

.table-toolbar-actions {
  display: flex;
  gap: 8px;
}

.config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px 20px 0;
}

.config-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.project-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-1);
}

.project-filter select,
#rule-project,
#rule-ga {
  min-width: 180px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--white);
  color: var(--black);
}

#rules-content .table-wrap {
  overflow-x: auto;
}

#rules-content table.data-table th,
#rules-content table.data-table td {
  white-space: nowrap;
}

#rules-content table.data-table th:nth-child(2),
#rules-content table.data-table td:nth-child(2) {
  min-width: 140px;
}

.config-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 900;
  color: var(--primary-1);
}

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .page-content {
    padding: 16px;
  }

  .page-header,
  .page-tabs {
    padding: 0 16px;
  }
}

.inspector-panel {
  width: min(1328px, calc(100vw - 2rem));
  max-height: 90vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inspector-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 24px 40px;
  border-bottom: 1px solid var(--border);
}

.inspector-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--primary-1);
}

.inspector-header p {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: var(--gray);
}

.inspector-close {
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem 0.6rem;
}

.inspector-search {
  padding: 12px 40px;
  border-bottom: 1px solid #eee;
  background: var(--primary-2);
}

.inspector-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.inspector-table-wrap {
  max-height: none;
  flex: 1;
}

.inspector-table .value-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  max-width: 220px;
  word-break: break-word;
}

.inspector-table tr.row-failed {
  background: #fff8f8;
}

table.data-table tr.row-failed:hover {
  background: #fff0f0;
}
