:root {
  font-family: Arial, Helvetica, sans-serif;
  color: #1f2937;
  background: #f3f4f6;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; font-size: 14px; line-height: 1.5; }
.container { width: min(1080px, calc(100% - 32px)); margin: 0 auto; }
.app-header { padding: 22px 0; color: #fff; background: #243447; border-bottom: 1px solid #172333; }
.app-header h1 { margin: 0; font-size: 22px; font-weight: 600; }
.app-header p { margin: 3px 0 0; color: #cbd5e1; font-size: 13px; }
main.container { padding-top: 24px; padding-bottom: 48px; }
.tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 1px solid #cbd5e1; }
.tab { padding: 11px 20px; border: 0; border-bottom: 3px solid transparent; color: #526273; background: transparent; cursor: pointer; font: 600 14px/1 Arial, sans-serif; }
.tab:hover { color: #1d4f7c; }
.tab.active { color: #1d4f7c; border-bottom-color: #286796; }
.card { margin-bottom: 20px; overflow: hidden; background: #fff; border: 1px solid #d6dbe1; border-radius: 4px; box-shadow: 0 1px 2px #0000000a; }
.card-header { padding: 20px 24px; border-bottom: 1px solid #e2e6ea; background: #fafbfc; }
.card-header.compact { padding: 16px 20px; }
h2, h3 { color: #26384a; font-weight: 600; }
.card-header h2, .card-header h3 { margin: 0; font-size: 18px; }
.card-header h3 { font-size: 15px; }
.card-header p { margin: 4px 0 0; color: #647180; font-size: 13px; }
.form-body { padding: 24px; }
.field { margin-bottom: 21px; }
.field > label { display: block; margin-bottom: 7px; font-weight: 600; }
input, textarea, button { font: inherit; }
input[type="file"], input[type="text"], textarea { width: 100%; min-height: 39px; border: 1px solid #b8c1cc; border-radius: 3px; color: #1f2937; background: #fff; }
input[type="file"] { padding: 7px 9px; }
input[type="text"], textarea { padding: 9px 11px; }
textarea { resize: vertical; font-family: Consolas, "Courier New", monospace; line-height: 1.55; }
input:focus, textarea:focus { border-color: #3478a8; outline: 2px solid #3478a826; outline-offset: 0; }
.help { margin-top: 5px; color: #697586; font-size: 12px; }
.input-action { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.button { min-height: 38px; padding: 8px 16px; border: 1px solid transparent; border-radius: 3px; cursor: pointer; font-weight: 600; }
.button:disabled { opacity: .6; cursor: wait; }
.button.primary { color: #fff; border-color: #1e5c89; background: #286796; }
.button.primary:hover { background: #1f5983; }
.button.secondary { color: #34495e; border-color: #b8c1cc; background: #fff; }
.button.secondary:hover { background: #f3f5f7; }
.checkbox-row { display: flex; gap: 10px; align-items: flex-start; margin: 5px 0 20px; cursor: pointer; }
.checkbox-row input { margin-top: 4px; }
.checkbox-row strong, .checkbox-row small { display: block; }
.checkbox-row small { margin-top: 2px; color: #697586; font-weight: 400; }
.rules { margin: 0 0 20px; padding: 12px 15px; border: 1px solid #d6dbe1; border-radius: 3px; background: #fafbfc; }
.rules summary { cursor: pointer; font-weight: 600; }
.rules ol { margin: 12px 0 2px; padding-left: 22px; color: #526273; }
.alert { margin: 0 0 18px; padding: 11px 13px; border: 1px solid; border-radius: 3px; }
.alert.error { color: #842029; border-color: #f1aeb5; background: #f8d7da; }
.alert.success { color: #0f5132; border-color: #a3cfbb; background: #d1e7dd; }
.alert.warning { color: #664d03; border-color: #ffecb5; background: #fff3cd; }
.report { margin-top: 26px; }
.report-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 14px; }
.report-heading h2 { margin: 0; font-size: 19px; }
.report-heading p { margin: 3px 0 0; color: #647180; font-size: 12px; }
.chart-layout { display: grid; grid-template-columns: 270px 1fr; gap: 30px; align-items: center; padding: 24px; }
.pie-chart-wrap { position: relative; width: 230px; height: 230px; margin: 0 auto; }
.pie-chart { display: block; width: 100%; height: 100%; filter: drop-shadow(0 1px 1px #00000014); }
.pie-chart path { stroke: #fff; stroke-width: 1.5; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #697586; border: 18px solid #e7eaee; border-radius: 50%; background: #fff; }
.chart-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.legend-item { display: grid; grid-template-columns: 12px 1fr auto; gap: 9px; align-items: center; min-height: 55px; border-bottom: 1px solid #e2e6ea; }
.legend-color { width: 12px; height: 12px; border-radius: 2px; }
.legend-label strong, .legend-label small { display: block; }
.legend-label strong { color: #34495e; font-size: 13px; }
.legend-label small { color: #697586; font-size: 11px; }
.legend-value { color: #26384a; text-align: right; font-weight: 600; }
.legend-value small { display: block; color: #697586; font-weight: 400; }
.traffic-filters { display: grid; grid-template-columns: repeat(5, 1fr); }
.traffic-filters label { display: flex; align-items: center; gap: 7px; min-height: 52px; padding: 12px 15px; border-right: 1px solid #e2e6ea; cursor: pointer; }
.traffic-filters label:last-child { border-right: 0; }
.traffic-filters span { margin-left: auto; padding: 1px 7px; color: #526273; background: #edf0f3; border-radius: 10px; font-size: 11px; }
.metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.metric { min-height: 132px; padding: 18px; background: #fff; border: 1px solid #d6dbe1; border-radius: 4px; }
.metric > span { display: block; min-height: 40px; color: #526273; font-size: 12px; }
.metric strong { display: block; margin-top: 8px; color: #1d4f7c; font-size: 24px; font-weight: 600; }
.metric small { color: #697586; }
.country-status { padding: 20px 24px; color: #647180; }
.country-status.error-text { color: #842029; }
.country-table-wrap { max-height: 430px; overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 10px 16px; border-bottom: 1px solid #e2e6ea; text-align: left; }
.data-table th { position: sticky; top: 0; z-index: 1; color: #526273; background: #f5f7f9; font-size: 12px; font-weight: 600; }
.data-table td:nth-child(n+3), .data-table th:nth-child(n+3) { text-align: right; }
.data-attribution { padding: 10px 16px; color: #697586; background: #fafbfc; border-top: 1px solid #e2e6ea; font-size: 11px; }
.data-attribution a { color: #1d4f7c; }
.summary-card { padding: 20px 24px; }
.summary-card h3 { margin: 0 0 15px; font-size: 15px; }
.summary { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; border: 1px solid #e2e6ea; }
.summary div { padding: 12px 15px; border-right: 1px solid #e2e6ea; }
.summary div:last-child { border-right: 0; }
.summary dt { color: #697586; font-size: 12px; }
.summary dd { margin: 3px 0 0; font-weight: 600; }
footer { padding: 18px 0; color: #697586; background: #e7eaee; border-top: 1px solid #d1d6dc; font-size: 12px; }

@media (max-width: 850px) {
  .chart-layout { grid-template-columns: 1fr; }
  .traffic-filters { grid-template-columns: 1fr 1fr; }
  .traffic-filters label { border-bottom: 1px solid #e2e6ea; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .summary { grid-template-columns: 1fr 1fr; }
  .summary div { border-bottom: 1px solid #e2e6ea; }
}

@media (max-width: 520px) {
  .container { width: min(100% - 20px, 1080px); }
  .form-body, .card-header { padding: 16px; }
  .tabs .tab { flex: 1; padding-inline: 8px; }
  .report-heading { align-items: flex-start; flex-direction: column; }
  .traffic-filters, .metrics, .summary { grid-template-columns: 1fr; }
  .chart-legend { grid-template-columns: 1fr; }
  .input-action { grid-template-columns: 1fr; }
}
