* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
       background: #f5f5f7; color: #222; line-height: 1.4; }
header { padding: 14px 14px 8px; background: #fff; border-bottom: 1px solid #ddd; }
header h1 { margin: 0; font-size: 1.4em; font-weight: 600; }
header .sub { margin: 4px 0 0; color: #666; font-size: .85em; }

nav.anchors { display: flex; gap: 8px; padding: 8px 14px; background: #fff; border-bottom: 1px solid #ddd;
              overflow-x: auto; white-space: nowrap; font-size: .85em; }
nav.anchors a { color: #0a84ff; text-decoration: none; padding: 4px 8px; border-radius: 14px; background: #f0f4f8; }

section { padding: 14px; margin-bottom: 8px; }
section h2 { font-size: 1.05em; margin: 0 0 10px; color: #333; }
section .hint { font-size: .85em; color: #666; margin: 0 0 8px; }
section .caveat { font-size: .8em; color: #888; margin-top: 10px; font-style: italic; }

.hero-status { padding: 8px 10px; border-radius: 6px; background: #fff3bf; color: #5c3d00;
               font-size: .85em; margin-bottom: 12px; display: none; }
.hero-status.show { display: block; }

.kpi-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
.kpi { background: #fff; border-radius: 12px; padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.kpi.small { padding: 12px; }
.kpi .lbl { color: #666; font-size: .8em; }
.kpi .val { font-size: 1.8em; font-weight: 600; margin: 4px 0; }
.kpi.small .val { font-size: 1.3em; }
.kpi .ci { color: #888; font-size: .8em; min-height: 1.1em; }
.kpi .meta { color: #999; font-size: .72em; margin-top: 4px; }
.kpi .badge { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 10px; font-size: .72em;
              font-weight: 500; }
.badge.green { background: #d8f3dc; color: #1b4332; }
.badge.yellow { background: #fff3bf; color: #5c3d00; }
.badge.gray { background: #e0e0e0; color: #555; }

@media (min-width: 640px) {
  #per-piano .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden;
        font-size: .9em; }
th, td { padding: 6px 10px; text-align: right; border-bottom: 1px solid #eee; vertical-align: top; }
th:first-child, td:first-child { text-align: left; }
thead th { background: #f0f4f8; font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }

.rt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { background: #fff; border-radius: 10px; padding: 10px; text-align: center; }
.tile .lbl { color: #666; font-size: .72em; }
.tile .val { font-size: 1.15em; font-weight: 600; margin-top: 2px; }

#chartMain { background: #fff; border-radius: 10px; padding: 10px; max-height: 360px; }

.legend { font-size: .78em; color: #666; margin-bottom: 8px; }
.legend .pin { display: inline-block; padding: 2px 8px; border-radius: 10px; margin-right: 6px; }
.legend .pin.treated { background: #d8f3dc; color: #1b4332; }
.legend .pin.control { background: #e6f0ff; color: #003a99; }

#splits-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.split-card { background: #fff; border-radius: 8px; padding: 8px; font-size: .85em; border-left: 3px solid #ddd; }
.split-card .name { font-weight: 600; margin-bottom: 2px; display: flex; justify-content: space-between; align-items: center; }
.split-card .piano { font-size: .7em; color: #888; background: #f0f0f0; padding: 1px 5px; border-radius: 8px; }
.split-card .status { font-size: .75em; color: #666; }
.split-card.on { border-top: 3px solid #34c759; }
.split-card.off { border-top: 3px solid #ccc; }
.split-card.treated { background: #f6fcf7; }
.split-card.control { background: #f4f8fd; }

details { background: #fff; border-radius: 8px; padding: 10px; }
summary { cursor: pointer; font-weight: 500; }
#diag-content { margin-top: 10px; font-size: .85em; }

footer { text-align: center; padding: 14px; color: #888; font-size: .78em; }
footer a { color: #0a84ff; text-decoration: none; }

#gas-summary .gas-headline { background: #d8f3dc; padding: 10px; border-radius: 8px; margin-bottom: 10px; font-size: .95em; }
#gas-summary .gas-headline .badge { margin-left: 6px; }
#gas-table { font-size: .82em; }
#gas-table .badge { padding: 1px 6px; }

.badge.red { background: #ffd6d6; color: #7a0000; }

#comfort-summary .drift-headline { background: #eef5ff; padding: 8px 12px; border-radius: 8px; margin-bottom: 8px; font-size: .9em; }
#comfort-summary .drift-headline .meta { color: #555; margin-left: 8px; font-size: .85em; }
.drift-table { font-size: .8em; width: 100%; border-collapse: collapse; margin-top: 6px; }
.drift-table th, .drift-table td { padding: 4px 6px; border-bottom: 1px solid #eee; text-align: left; }
.drift-table .row-post td { background: #f4faf4; }
.drift-table .pin { font-size: .85em; padding: 1px 6px; border-radius: 10px; }
.drift-table .pin.treated { background: #fde68a; color: #5c3d00; }
.drift-table .pin.control { background: #d6e4ff; color: #1e3a8a; }

#evening-summary .drift-headline { background: #fff5d6; padding: 8px 12px; border-radius: 8px; margin-bottom: 8px; font-size: .92em; }
#evening-summary .drift-headline.pending { background: #f4f4f4; color: #555; }
.evening-table { font-size: .8em; width: 100%; border-collapse: collapse; margin-top: 6px; }
.evening-table th, .evening-table td { padding: 4px 6px; border-bottom: 1px solid #eee; text-align: left; }
.evening-table .row-post td { background: #fff5d6; }
.evening-table .row-empty td { color: #999; font-style: italic; }
.evening-table .empty { color: #999; }
.evening-table .pin { font-size: .85em; padding: 1px 6px; border-radius: 10px; }
.evening-table .pin.treated { background: #fde68a; color: #5c3d00; }
.evening-table .pin.control { background: #d6e4ff; color: #1e3a8a; }

.verdict { margin: 1rem 0; }
.verdict-text { font-size: 1.05rem; line-height: 1.5; margin-bottom: .75rem; text-align: justify; hyphens: auto; }
.verdict-cards { display: flex; gap: .75rem; flex-wrap: wrap; }
.verdict-card { flex: 1 1 140px; display: flex; align-items: center; gap: .5rem; padding: .6rem .8rem; border: 1px solid #d9e2ec; border-radius: 10px; }
.vc-dot { width: 12px; height: 12px; border-radius: 50%; background: #bbb; flex: 0 0 auto; }
.vc-dot.green { background: #2e7d32; } .vc-dot.yellow { background: #f9a825; } .vc-dot.red { background: #c62828; }
.vc-label { font-weight: 600; } .vc-detail { color: #486581; font-size: .9rem; margin-left: auto; }
