* { box-sizing: border-box; }
body { font: 13px/1.4 -apple-system, system-ui, sans-serif; margin: 0; padding: 16px; color: #222; }
header { margin-bottom: 12px; }
.titlebar { display: flex; align-items: flex-start; gap: 16px; }
.brand { flex: 0 0 auto; display: block; width: 72px; }
.brand img { display: block; width: 100%; height: auto; }
.titlebar-text { flex: 1 1 auto; }
h1 { font-size: 28px; margin: 0; }
.meta { color: #666; font-size: 12px; margin: 4px 0 0 0; }
.intro { color: #333; font-size: 12px; max-width: none; margin: 6px 0 0 0; }
.intro p { margin: 4px 0; }
.intro > p { font-size: 15px; line-height: 1.5; margin: 8px 0; color: #222; }
.intro a { color: #06c; text-decoration: none; }
.intro .optin-swatch { color: #b45; font-weight: 600; }
.intro .rollup-swatch { display: inline-block; padding: 0 4px; background: #ffe9a8; border-radius: 3px; font-size: 11px; color: #6b4a00; font-weight: 600; }
.intro a:hover { text-decoration: underline; }
.intro ul { margin: 4px 0 6px 0; padding-left: 20px; }
.intro ul li { margin: 2px 0; }
.intro .faq { margin-top: 6px; padding: 6px 10px; background: #f5f5f5; border-radius: 4px; }
.intro .faq summary { cursor: pointer; font-weight: 600; color: #444; }
.intro .faq ol, .intro .faq ul { margin: 6px 0 2px 0; padding-left: 22px; }
.intro .faq li { margin: 4px 0; line-height: 1.45; }
.intro .faq a { color: #06c; text-decoration: none; }
.intro .faq a:hover { text-decoration: underline; }

footer { margin-top: 16px; padding-top: 10px; border-top: 1px solid #ddd; color: #666; font-size: 11px; }
footer p { margin: 4px 0; max-width: none; }
footer a { color: #06c; text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer .attribution { color: #333; margin-top: 8px; }

.controls { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.controls-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.controls input[type=search] { padding: 6px 10px; width: 100%; border: 1px solid #ccc; border-radius: 4px; }
.controls label { display: flex; align-items: center; gap: 4px; }
.controls select { padding: 6px; border: 1px solid #ccc; border-radius: 4px; }

#matrix-wrap { overflow-x: hidden; overflow-y: auto; scrollbar-gutter: stable; max-height: calc(100vh - 140px); border: 1px solid #ddd; }
table { border-collapse: separate; border-spacing: 0; font-size: 11px; }
th, td { padding: 3px 6px; border-bottom: 1px solid #eee; border-right: 1px solid #eee; white-space: nowrap; }
td { padding: 2px 3px; }
thead th { position: sticky; top: 0; background: #f5f5f5; z-index: 2; }
tbody th { position: sticky; left: 0; background: #fafafa; text-align: left; z-index: 1; }
thead th:first-child { left: 0; z-index: 3; }

/* Vertical region-code headers — reads bottom-to-top, tilt head left. */
thead th.rot { writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; vertical-align: bottom; height: 130px; padding: 6px 2px; font-weight: 500; }
thead th.rot .rollup { writing-mode: horizontal-tb; transform: rotate(180deg); display: inline-block; margin: 0 0 4px 0; }
thead th:first-child { writing-mode: horizontal-tb; transform: none; height: auto; vertical-align: bottom; text-align: left; font-weight: 600; }
th.optin { color: #b45; }
td.y { background: #d6efd6; text-align: center; }
td.n { background: #fff; text-align: center; color: #ccc; }
td.y { color: #14532d; font-weight: 700; }
td.y::before { content: "✓"; }
td.n::before { content: "·"; }
tr:hover td { background: #eef6ff; }
tr:hover td.y { background: #b6dfb6; }
.cat-tag { display: inline-block; padding: 1px 6px; background: #eee; border-radius: 3px; font-size: 10px; color: #555; margin-top: 2px; }
.svc-name { font-weight: 600; font-size: 12px; line-height: 1.2; }
tbody th { white-space: nowrap; }
.rollup { display: inline-block; margin-left: 4px; padding: 0 4px; background: #ffe9a8; border-radius: 3px; font-size: 10px; color: #6b4a00; font-weight: normal; }
td.y.added { box-shadow: inset 0 0 0 2px #2a7d2a; }
td.n.added { background: #e6ffe6; box-shadow: inset 0 0 0 2px #2a7d2a; }
td.y.removed, td.n.removed { background: #ffd6d6; box-shadow: inset 0 0 0 2px #a33; position: relative; }
td.removed::after { content: "×"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #a33; font-weight: bold; }
