:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #68778a;
  --line: #d7e0ea;
  --panel: #ffffff;
  --canvas: #edf2f6;
  --blue: #178ce5;
  --blue-dark: #0869b4;
  --green: #26a947;
  --amber: #f1b72b;
  --red: #d94b52;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.reports-shell { width: min(1500px, 100%); margin: 0 auto; padding: 22px 24px 70px; }
.reports-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; margin-bottom: 18px; padding: 18px 22px; background: #151b24; color: white; border-radius: 20px; box-shadow: 0 12px 30px rgba(28, 39, 52, .15); }
.reports-brand { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 15px; background: #242c38; }
.reports-brand img { width: 44px; height: 44px; object-fit: contain; }
.reports-header h1 { margin: 2px 0; font-size: clamp(1.55rem, 3vw, 2.2rem); }
.reports-header p, .reports-header small { margin: 0; color: #aeb9c7; }
.reports-header-actions { display: flex; align-items: center; gap: 10px; }
.scope-badge, .back-link { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; padding: 0 14px; text-decoration: none; }
.scope-badge { color: #c8e6ff; background: #143856; border: 1px solid #2a6692; font-size: .88rem; }
.back-link { color: white; background: #303a48; font-weight: 700; }

.reports-message { margin: 0 0 16px; min-height: 22px; color: var(--muted); }
.reports-message.error { padding: 14px 16px; border-radius: 12px; background: #fff1f1; color: #9f242b; border: 1px solid #f2b7ba; }

.report-refresh-panel { margin: 0 0 10px; padding: 0; overflow: hidden; border: 1px solid #bcdcf3; border-radius: 14px; background: linear-gradient(135deg, #f8fcff, #eaf6ff); box-shadow: 0 5px 16px rgba(30, 92, 137, .06); }
.report-refresh-summary { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 42px 8px 14px; position: relative; list-style: none; cursor: pointer; }
.report-refresh-summary::-webkit-details-marker { display: none; }
.report-refresh-summary::after { content: "⌄"; position: absolute; right: 15px; top: 50%; translate: 0 -53%; color: var(--blue-dark); font-size: 1.25rem; font-weight: 900; transition: transform 180ms ease; }
.report-refresh-panel[open] .report-refresh-summary { border-bottom: 1px solid #d3e8f7; }
.report-refresh-panel[open] .report-refresh-summary::after { transform: rotate(180deg); }
.report-refresh-summary > span { display: grid; gap: 1px; }
.report-refresh-summary small { color: var(--blue-dark); font-size: .63rem; font-weight: 850; text-transform: uppercase; letter-spacing: .07em; }
.report-refresh-summary span > strong { font-size: .9rem; }
.report-refresh-summary span > strong b { font-weight: 850; }
.report-refresh-summary > strong { color: var(--blue-dark); font-size: .8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-refresh-body { padding: 11px 14px 12px; }
.report-refresh-heading, .report-refresh-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.report-refresh-heading > span { color: var(--muted); font-size: .78rem; }
.report-refresh-heading button { min-height: 40px; padding: 0 15px; border: 1px solid #87bee4; border-radius: 11px; background: white; color: var(--blue-dark); font-weight: 800; cursor: pointer; }
.report-refresh-heading button:disabled { opacity: .58; cursor: wait; }
.report-refresh-slider { display: grid; gap: 7px; margin-top: 12px; color: var(--muted); font-size: .84rem; }
.report-refresh-slider > span strong { color: var(--ink); }
.report-refresh-slider input { width: 100%; min-height: 22px; accent-color: var(--blue); cursor: pointer; }
.report-refresh-marks { display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 2px; color: #677c90; font-size: .7rem; font-weight: 750; }
.report-refresh-marks span { text-align: center; }
.report-refresh-marks span:first-child { text-align: left; }
.report-refresh-marks span:last-child { text-align: right; }
.report-refresh-meta { margin-top: 8px; padding-top: 8px; border-top: 1px solid #d3e8f7; font-size: .76rem; }
.report-refresh-meta span { color: var(--muted); }

.limited-report, .report-section, .report-filters, .definitions { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 8px 24px rgba(54, 72, 91, .07); }
.limited-report { max-width: 760px; margin: 6vh auto 0; padding: clamp(22px, 5vw, 42px); }
.limited-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.limited-heading small, .section-heading small { color: var(--blue-dark); text-transform: uppercase; font-weight: 800; letter-spacing: .08em; }
.limited-heading h2 { margin: 5px 0; font-size: clamp(1.8rem, 6vw, 3rem); }
.limited-heading p { margin: 0; color: var(--muted); }
.privacy-lock { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: #e7f4ff; font-size: 1.5rem; }
.limited-period-filter { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, .7fr); align-items: center; gap: 7px 14px; margin-top: 22px; padding: 14px 16px; border: 1px solid #cfe1ef; border-radius: 14px; background: #f5faff; }
.limited-period-filter > span { color: var(--blue-dark); font-weight: 800; }
.limited-period-filter select { width: 100%; min-height: 44px; padding: 0 11px; border: 1px solid #b7cfe1; border-radius: 11px; background: white; color: var(--ink); }
.limited-period-filter small { grid-column: 1 / -1; color: var(--muted); line-height: 1.35; }
.limited-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 28px 0 14px; }
.limited-kpis article { min-height: 170px; display: flex; flex-direction: column; justify-content: center; padding: 22px; border-radius: 18px; background: linear-gradient(145deg, #087fd2, #1d9bef); color: white; }
.limited-kpis article:nth-child(2) { background: linear-gradient(145deg, #168c3b, #2db052); }
.limited-kpis span { font-weight: 750; }
.limited-kpis strong { font-size: clamp(3rem, 13vw, 5rem); line-height: 1; margin: 12px 0 7px; }
.limited-kpis small { opacity: .82; }
.limited-breakdown { padding: 15px 18px; margin: 0; border-radius: 13px; background: #f5f8fb; color: #526174; }
.permission-note { margin-top: 18px; padding: 16px; color: #4d6073; border-left: 4px solid var(--blue); background: #eef7ff; border-radius: 4px 12px 12px 4px; line-height: 1.5; }

.report-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 10px; padding: 16px; margin-bottom: 16px; }
.report-filters label { display: grid; gap: 6px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.report-filters select, .report-filters input, .report-filters button { width: 100%; min-height: 44px; border-radius: 11px; border: 1px solid #cbd6e2; background: white; padding: 0 11px; color: var(--ink); }
.report-filters button { align-self: end; padding: 0 18px; color: white; background: var(--blue); border-color: var(--blue); font-weight: 800; cursor: pointer; }

.report-section { padding: 16px; margin-bottom: 12px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 11px; }
.section-heading h2 { margin: 3px 0 0; font-size: 1.35rem; }
.section-heading > span { color: var(--muted); font-size: .88rem; }
.kpi-summary-section { padding: 13px 15px; }
.kpi-summary-section .section-heading { margin-bottom: 8px; }
.kpi-summary-section .section-heading small { font-size: .67rem; }
.kpi-summary-section .section-heading h2 { font-size: 1.1rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.kpi-grid article { min-height: 78px; display: flex; flex-direction: column; justify-content: center; padding: 10px 12px; background: #f5f8fb; border: 1px solid #e3e9f0; border-radius: 11px; }
.kpi-grid article:nth-child(3), .kpi-grid article:nth-child(4) { background: #edf8ff; border-color: #c5e5f9; }
.kpi-grid article:nth-child(5) { background: #fff8dc; border-color: #f2dc8a; }
.kpi-grid span, .current-grid span { color: var(--muted); font-size: .76rem; font-weight: 700; }
.kpi-grid strong { margin-top: 4px; font-size: 1.55rem; line-height: 1; }
.kpi-grid small { color: var(--muted); margin-top: 3px; font-size: .68rem; }

.project-overview-report { margin-top: 16px; }
.project-progress-section { padding: 15px; }
.progress-intro { margin: -1px 0 11px; color: var(--muted); line-height: 1.45; font-size: .86rem; }
.progress-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 12px; color: #526174; font-size: .78rem; font-weight: 750; }
.progress-legend span { display: inline-flex; align-items: center; gap: 7px; }
.progress-swatch { display: inline-block; width: 13px; height: 13px; border-radius: 4px; background: #e7ebef; border: 1px solid #cbd3dc; }
.progress-swatch.clean { background: var(--green); border-color: #168b34; }
.progress-swatch.exception { background: #202833; border-color: #111720; }
.overall-project-progress { margin-bottom: 12px; }
.overall-progress-card { padding: 16px; border: 2px solid #9fcceb; border-radius: 17px; background: linear-gradient(135deg, #f8fcff, #eaf6ff); box-shadow: 0 8px 22px rgba(26, 116, 177, .09); }
.overall-progress-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.overall-progress-title strong { font-size: 1.22rem; }
.overall-progress-title span { padding: 5px 9px; border-radius: 999px; background: #d9efff; color: var(--blue-dark); font-size: .76rem; font-weight: 850; }
.overall-progress-title span.closed { background: #dff5e5; color: #14752d; }
.overall-progress-card .progress-visual { grid-template-columns: 86px minmax(0, 1fr); }
.overall-progress-card .progress-donut { width: 84px; }
.overall-progress-card .progress-donut strong { font-size: 1.12rem; }
.zone-progress-list { display: grid; gap: 9px; }
.zone-progress-card { overflow: hidden; border: 1px solid #d6e0e9; border-radius: 15px; background: #f9fbfd; }
.zone-progress-card > summary { position: relative; display: grid; grid-template-columns: minmax(110px, .28fr) minmax(0, 1fr); align-items: center; gap: 12px 18px; padding: 13px 42px 13px 14px; list-style: none; cursor: pointer; }
.zone-progress-card > summary::-webkit-details-marker { display: none; }
.zone-progress-card > summary::after { content: "⌄"; position: absolute; right: 16px; top: 50%; translate: 0 -50%; color: var(--blue-dark); font-size: 1.35rem; font-weight: 900; transition: transform 180ms ease; }
.zone-progress-card[open] > summary::after { transform: rotate(180deg); }
.zone-progress-card[open] > summary { border-bottom: 1px solid #dbe4ec; background: white; }
.zone-progress-title { display: grid; align-content: center; gap: 5px; }
.zone-progress-title strong { font-size: 1.65rem; line-height: 1; }
.zone-progress-title span, .sector-progress-title span { width: fit-content; padding: 3px 7px; border-radius: 999px; background: #edf1f5; color: #526174; font-size: .7rem; font-weight: 850; }
.zone-progress-title span.closed, .sector-progress-title span.closed { background: #dff5e5; color: #14752d; }
.zone-expand-label { grid-column: 1 / -1; color: var(--blue-dark); font-size: .72rem; font-weight: 750; }
.progress-visual { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 12px; min-width: 0; }
.progress-donut { --clean-angle: 0deg; --closed-angle: 0deg; position: relative; isolation: isolate; width: 70px; aspect-ratio: 1; display: grid; place-content: center; border-radius: 50%; background: conic-gradient(var(--green) 0 var(--clean-angle), #202833 var(--clean-angle) var(--closed-angle), #e5e9ee var(--closed-angle) 360deg); text-align: center; }
.progress-donut::after { content: ""; position: absolute; inset: 10px; z-index: -1; border-radius: 50%; background: white; box-shadow: inset 0 0 0 1px #dce3ea; }
.progress-donut strong { font-size: .94rem; line-height: 1; }
.progress-donut small { margin-top: 3px; color: var(--muted); font-size: .61rem; }
.progress-bar-area { min-width: 0; }
.progress-track { height: 22px; display: flex; overflow: hidden; border: 1px solid #cbd4dd; border-radius: 8px; background: #e7ebef; box-shadow: inset 0 1px 2px rgba(31, 41, 55, .08); }
.progress-segment { display: block; min-width: 0; height: 100%; }
.progress-segment.clean { background: linear-gradient(180deg, #35b754, #22983f); }
.progress-segment.exception { background: linear-gradient(180deg, #303b48, #171e27); }
.progress-counts { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 5px; font-size: .68rem; }
.progress-counts span { display: inline-flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.progress-counts .clean { color: #157d30; }
.progress-counts .exception { color: #202833; }
.progress-counts .open { color: #6d7988; }
.progress-detail { display: block; margin-top: 3px; color: var(--muted); font-size: .65rem; line-height: 1.25; }
.progress-detail.exception { color: #303b48; }
.sector-progress-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; background: #eef3f7; }
.sector-progress-card { min-width: 0; padding: 10px; border: 1px solid #d6dfe8; border-radius: 12px; background: white; }
.sector-progress-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.sector-progress-title strong { font-size: .96rem; }
.sector-progress-link { color: var(--blue-dark); font-size: .96rem; font-weight: 900; text-decoration: none; border-radius: 7px; padding: 3px 5px; margin: -3px -5px; }
.sector-progress-link:hover, .sector-progress-link:focus-visible { color: #0567b8; background: #e5f3ff; outline: 2px solid #8bc7f5; outline-offset: 1px; }
.progress-visual.compact { grid-template-columns: 54px minmax(0, 1fr); gap: 9px; }
.progress-visual.compact .progress-donut { width: 54px; }
.progress-visual.compact .progress-donut::after { inset: 8px; }
.progress-visual.compact .progress-donut strong { font-size: .76rem; }
.progress-visual.compact .progress-donut small { font-size: .54rem; }
.progress-visual.compact .progress-track { height: 17px; }
.progress-empty { grid-column: 1 / -1; margin: 4px; color: var(--muted); text-align: center; }

.report-columns { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, .8fr); gap: 16px; }
.daily-chart { min-height: 205px; display: flex; align-items: end; gap: 7px; padding: 12px 5px 0; overflow-x: auto; border-top: 1px solid #e5ebf2; }
.chart-day { min-width: 46px; flex: 1 0 46px; display: grid; grid-template-rows: 1fr auto; height: 174px; gap: 5px; text-align: center; color: var(--muted); font-size: .68rem; }
.chart-bars { align-self: end; display: flex; align-items: end; justify-content: center; gap: 3px; height: 145px; }
.chart-bar { width: min(18px, 40%); min-height: 2px; border-radius: 6px 6px 2px 2px; background: var(--green); }
.chart-bar.blocked { background: var(--amber); }
.chart-empty { width: 100%; align-self: center; color: var(--muted); text-align: center; }
.average-list { margin: 0; display: grid; gap: 6px; }
.average-list div { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 9px 12px; border-radius: 10px; background: #f5f8fb; }
.average-list dt { color: var(--muted); }
.average-list dd { margin: 0; font-size: 1.3rem; font-weight: 850; }

.current-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.current-grid div { padding: 14px; background: #f5f8fb; border-radius: 12px; }
.current-grid strong { display: block; margin-top: 6px; font-size: 1.55rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 9px 8px; text-align: right; border-bottom: 1px solid #e5ebf2; }
th:first-child, td:first-child, th:last-child, td:last-child { text-align: left; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.date-filter-button { border: 0; background: transparent; color: var(--blue-dark); font-weight: 800; cursor: pointer; padding: 0; }
.source-links { display: flex; flex-wrap: wrap; gap: 4px; max-width: 320px; }
.source-links a { color: var(--blue-dark); background: #edf7ff; border-radius: 7px; padding: 3px 6px; text-decoration: none; font-size: .78rem; }
.empty-row td { text-align: center !important; color: var(--muted); padding: 30px; }
.definitions { margin-top: 16px; padding: 0 20px; }
.definitions summary { padding: 17px 0; font-weight: 800; cursor: pointer; }
.definitions div { padding: 0 0 16px; color: #536477; line-height: 1.5; }
.definitions p { margin: 9px 0; }
.reports-version { position: fixed; right: 16px; bottom: 10px; color: #738196; font-size: .82rem; pointer-events: none; }

@media (max-width: 1100px) {
  .report-filters { grid-template-columns: repeat(3, 1fr); }
  .current-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 720px) {
  .reports-shell { padding: max(12px, env(safe-area-inset-top)) 12px 64px; }
  .reports-header { grid-template-columns: auto 1fr; padding: 14px; border-radius: 16px; gap: 12px; }
  .reports-brand { width: 50px; height: 50px; }
  .reports-brand img { width: 35px; height: 35px; }
  .reports-header-actions { grid-column: 1 / -1; justify-content: space-between; }
  .report-refresh-summary { min-height: 48px; padding-left: 12px; }
  .report-refresh-summary > strong { font-size: .72rem; }
  .report-refresh-body { padding: 10px 12px 11px; }
  .report-refresh-heading { align-items: flex-start; }
  .report-refresh-meta { align-items: flex-start; flex-direction: column; gap: 4px; }
  .report-refresh-meta span { text-align: left; }
  .limited-report { margin-top: 12px; }
  .limited-period-filter { grid-template-columns: 1fr; }
  .limited-period-filter small { grid-column: auto; }
  .limited-kpis { grid-template-columns: 1fr; }
  .limited-kpis article { min-height: 145px; }
  .report-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 13px; }
  .report-filters button { grid-column: 1 / -1; }
  .report-section { padding: 15px; border-radius: 16px; }
  .report-columns { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .current-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .zone-progress-card > summary { grid-template-columns: 76px minmax(0, 1fr); gap: 10px; padding-left: 12px; }
  .zone-progress-title strong { font-size: 1.35rem; }
  .sector-progress-list { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  .report-filters, .kpi-grid { grid-template-columns: 1fr; }
  .limited-kpis strong { font-size: 4rem; }
  .zone-progress-card > summary { grid-template-columns: 1fr; }
  .zone-expand-label { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
