*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #F8FAFC;
  color: #334155;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(30,64,175,.04);
}

/* Header */
.header {
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-text h1 { font-size: 22px; font-weight: 800; color: #1E40AF; letter-spacing: -.3px; }
.header-text p { font-size: 13px; color: #94A3B8; margin-top: 4px; }
.badge { background: #DCFCE7; color: #15803D; font-size: 12px; font-weight: 700; padding: 7px 16px; border-radius: 99px; white-space: nowrap; }

/* Location selector */
.loc-bar { padding: 16px 28px; display: flex; align-items: center; gap: 14px; }
.loc-bar label { font-size: 11px; font-weight: 700; color: #94A3B8; text-transform: uppercase; letter-spacing: .7px; white-space: nowrap; }
.loc-select { background: #F8FAFC; border: 1.5px solid #DBEAFE; border-radius: 10px; padding: 10px 16px; font-size: 14px; font-weight: 600; color: #1E40AF; cursor: pointer; flex: 1; max-width: 300px; }

/* KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi { padding: 24px 22px; }
.kpi-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: #94A3B8; margin-bottom: 14px; }
.kpi-value { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -1px; margin-bottom: 8px; }
.kpi-hint { font-size: 12px; color: #CBD5E1; }
.kpi-score { color: #D97706; }
.kpi-total { color: #1E40AF; }
.kpi-mes   { color: #1E40AF; }
.kpi-year  { color: #16A34A; }

/* Charts */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card { padding: 24px 24px 20px; }
.chart-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #94A3B8; margin-bottom: 20px; }

/* Bar chart (CSS) */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-lbl { font-size: 12px; font-weight: 700; color: #64748B; width: 26px; text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; height: 28px; background: #F1F5F9; border-radius: 7px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 7px; display: flex; align-items: center; padding-left: 10px; font-size: 11px; font-weight: 700; color: rgba(255,255,255,.9); transition: width .4s ease; }
.bar-count { font-size: 12px; color: #CBD5E1; width: 28px; text-align: right; flex-shrink: 0; }
.c5 { background: #16A34A; } .c4 { background: #65A30D; } .c3 { background: #D97706; }
.c2 { background: #EA580C; } .c1 { background: #DC2626; }

/* Line chart */
.line-chart-wrap { height: 160px; position: relative; }
.line-chart-wrap canvas { width: 100% !important; height: 100% !important; }
.x-axis { display: flex; justify-content: space-between; margin-top: 8px; }
.x-lbl { font-size: 11px; color: #CBD5E1; }

/* Alert */
.alert {
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: #FFF7ED;
  border-color: #FED7AA;
  border-left: 4px solid #EA580C;
}
.alert-icon { font-size: 22px; flex-shrink: 0; }
.alert-body strong { font-size: 14px; color: #C2410C; font-weight: 700; }
.alert-body p { font-size: 12px; color: #92400E; margin-top: 3px; }
.alert-cta { margin-left: auto; font-size: 12px; color: #EA580C; font-weight: 700; white-space: nowrap; text-decoration: underline; }

/* Table */
.table-card { padding: 24px; overflow: hidden; }
.table-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.table-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #94A3B8; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { font-size: 11px; font-weight: 600; padding: 5px 13px; border-radius: 99px; border: 1.5px solid #E2E8F0; color: #64748B; cursor: pointer; background: #fff; }
.pill.on { background: #1E40AF; color: #fff; border-color: #1E40AF; }
.pill.danger { border-color: #FCA5A5; color: #DC2626; }
.pill.danger.on { background: #DC2626; color: #fff; border-color: #DC2626; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 600px; }
thead th { text-align: left; padding: 10px 12px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #CBD5E1; border-bottom: 1.5px solid #F1F5F9; }
tbody tr { border-bottom: 1px solid #F8FAFC; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #F8FAFC; }
tbody td { padding: 14px 12px; vertical-align: top; line-height: 1.5; }

.star-badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.s5b { background: #DCFCE7; color: #16A34A; } .s4b { background: #F0FDF4; color: #65A30D; }
.s3b { background: #FEFCE8; color: #CA8A04; } .s2b { background: #FFF7ED; color: #EA580C; }
.s1b { background: #FEF2F2; color: #DC2626; }

.reviewer { font-weight: 700; color: #1E293B; }
.review-text { color: #64748B; font-size: 12px; max-width: 240px; }
.response-text { color: #94A3B8; font-size: 12px; font-style: italic; max-width: 240px; overflow: hidden; }
.response-text.collapsed { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.expand-btn { display: block; margin-top: 4px; font-size: 11px; color: #1E40AF; font-weight: 600; cursor: pointer; background: none; border: none; padding: 0; }
.date { font-size: 11px; color: #CBD5E1; white-space: nowrap; }

.table-footer { text-align: center; font-size: 11px; color: #CBD5E1; padding: 16px 0 0; border-top: 1px solid #F1F5F9; margin-top: 8px; }

.error-msg { text-align: center; padding: 40px; color: #94A3B8; font-size: 14px; }

/* Responsive — Tablet */
@media (max-width: 860px) {
  .container { padding: 20px 16px; gap: 14px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .charts-grid { grid-template-columns: 1fr; gap: 14px; }
  .header { padding: 20px 20px; }
  .header-text h1 { font-size: 18px; }
  .loc-bar { padding: 14px 20px; }
  .kpi { padding: 20px 18px; }
  .kpi-value { font-size: 34px; }
}

/* Responsive — Mobile */
@media (max-width: 560px) {
  .container { padding: 14px 12px; gap: 12px; }
  .header { flex-direction: column; align-items: flex-start; padding: 18px 18px; }
  .header-text h1 { font-size: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 16px 14px; }
  .kpi-value { font-size: 28px; }
  .kpi-label { font-size: 9px; }
  .loc-bar { padding: 12px 16px; gap: 10px; }
  .loc-select { max-width: 100%; font-size: 13px; }
  .chart-card { padding: 18px 16px 14px; }
  .table-card { padding: 16px; }
  .alert { padding: 14px 16px; flex-wrap: wrap; }
  .alert-cta { margin-left: 0; margin-top: 6px; }
  .pills { gap: 5px; }
  .pill { font-size: 10px; padding: 4px 10px; }
}
