/* MURATA infirmary dashboard
   Visual language from the monthly infographic (data/image.png):
   sky-blue header band, blue→teal section ribbons, big icon KPIs,
   coloured rank circles, pink % cells, donut shares. Light theme only. */

:root {
  color-scheme: light;
  /* LKM brand */
  --lkm-orange: #ff8f48;
  --lkm-navy: #003463;
  /* infographic palette */
  --navy: #0d3b78;           /* titles */
  --blue: #1f6fc0;           /* ribbon start, icons */
  --sky: #2a8fd6;
  --teal: #22a7b8;           /* ribbon end */
  --page: #eef6fc;           /* light sky page */
  --surface: #ffffff;
  --surface-2: #f5f9fd;
  --border: #d5e5f2;
  --ink: #1e293b;
  --ink-2: #475569;
  --muted: #64748b;
  --grid: #e8eff6;
  --track: #edf3f9;
  --pink-bg: #fde7ee;        /* % cells */
  --pink-ink: #b4234d;
  /* data colours */
  --bar: #1f6fc0;
  --bar-top: #ff8f48;
  --bar-soft: #c4d3e2;
  --male: #2a78d6;
  --female: #e0457b;
  /* zones = infographic tabs: blue / green / orange (validated all-pairs) */
  --z1: #2a78d6;
  --z2: #1baf7a;
  --z3: #eb6834;
  /* rank circles 1–5 (infographic) */
  --rk1: #e5484d;
  --rk2: #f28c28;
  --rk3: #f2b705;
  --rk4: #2fa84f;
  --rk5: #2a78d6;
  /* status */
  --ok: #0ca30c;
  --warn: #fab219;
  --crit: #d03b3b;
  /* shape */
  --r-card: 1.1rem;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 14px 30px -26px rgba(13, 59, 120, 0.55);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Kanit, "Sarabun", "Noto Sans Thai", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
}
h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 600; color: var(--navy); }
b { font-weight: 600; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 999px; z-index: 10; }
.skip:focus { left: 16px; }
.wrap { max-width: 80rem; margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .wrap { padding: 0 24px; } }

/* ================= header ================= */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(40rem 18rem at 85% 0%, rgba(42, 143, 214, 0.18), transparent 70%),
    radial-gradient(30rem 16rem at 0% 100%, rgba(47, 168, 79, 0.10), transparent 70%),
    linear-gradient(180deg, #ffffff 0%, #e6f3fc 100%);
  border-bottom: 1px solid var(--border);
  padding: 22px 0 58px;
}
.hero-deco { position: absolute; pointer-events: none; }
.hero-deco.leaves { left: -20px; bottom: 0; width: 180px; fill: #7cc68f; opacity: 0.35; }
.hero-deco.cross { right: 28%; top: 14px; width: 64px; fill: #2a8fd6; opacity: 0.08; }
.hero-inner { position: relative; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.logo { height: 64px; width: auto; flex: none; }
.hero-text { flex: 1 1 360px; min-width: 0; }
.hero h1 { display: flex; flex-direction: column; color: var(--navy); }
.h1-top { font-size: clamp(1.25rem, 2.6vw, 1.75rem); font-weight: 600; line-height: 1.25; }
.h1-main {
  font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 800; line-height: 1.15;
  display: inline-flex; align-items: center; gap: 10px;
}
.heart { width: 0.85em; height: 0.85em; fill: #e5484d; flex: none; }
.company { margin: 4px 0 10px; color: var(--navy); font-weight: 500; }
.month-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(90deg, var(--blue), var(--teal));
  color: #fff; font-weight: 600; padding: 6px 18px 6px 14px; border-radius: 999px;
  box-shadow: 0 10px 22px -14px rgba(31, 111, 192, 0.9);
}
.month-pill svg { width: 18px; height: 18px; }
.hero-side {
  flex: 0 0 auto; text-align: right; padding: 12px 18px;
  background: rgba(255, 255, 255, 0.7); border: 1px solid var(--border); border-radius: 1rem;
}
.hero-side p { margin: 0; }
.hero-side-k { font-size: 0.75rem; color: var(--muted); }
.hero-side-v { font-weight: 600; color: var(--navy); font-size: 0.92rem; margin-bottom: 4px !important; }
@media (max-width: 760px) { .hero-side { display: none; } .logo { height: 52px; } }

/* ================= filters ================= */
.filters { position: relative; z-index: 5; margin-top: -34px; }
.filters-inner {
  background: var(--surface); border: 1px solid var(--border); border-radius: 1.25rem;
  box-shadow: 0 18px 40px -26px rgba(13, 59, 120, 0.6);
}
.filters-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 28px; padding: 12px 18px; }
.filter { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.filter-label { display: flex; align-items: baseline; gap: 6px; color: var(--navy); font-size: 0.8rem; font-weight: 600; white-space: nowrap; padding-left: 4px; }
.filter-hint { color: var(--muted); font-weight: 400; font-size: 0.74rem; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.seg button {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 0.88rem; color: var(--ink-2); background: transparent; border: 0;
  border-radius: 999px; padding: 3px 12px; min-height: 34px; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.seg button:hover { background: var(--track); }
.seg button[aria-pressed="true"] { background: linear-gradient(90deg, var(--blue), var(--sky)); color: #fff; font-weight: 500; }
.seg .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.seg button[aria-pressed="true"] .dot { background: #fff !important; }
.seg-n {
  font-size: 0.74rem; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.6;
  color: var(--ink-2); background: var(--track); border-radius: 999px; padding: 0 7px; min-width: 2.4em; text-align: center;
}
.seg button:hover:not([aria-pressed="true"]) .seg-n { background: var(--surface); }
.seg button[aria-pressed="true"] .seg-n { background: rgba(255, 255, 255, 0.24); color: #fff; }
.seg.small { margin-bottom: 12px; }
.seg.small button { font-size: 0.82rem; padding: 2px 10px; min-height: 28px; }

.stepper { align-self: flex-start; display: inline-flex; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.stepper button {
  width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 50%;
  font: inherit; font-size: 1.15rem; line-height: 1; color: var(--blue); background: transparent; cursor: pointer;
}
.stepper button:hover:not(:disabled) { background: var(--track); }
.stepper button:disabled { color: #a9b8c8; cursor: not-allowed; }
.stepper input {
  width: 2.4ch; font: inherit; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink);
  text-align: right; border: 0; background: transparent; padding: 0; -moz-appearance: textfield; appearance: textfield;
}
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input[aria-invalid="true"] { color: var(--pink-ink); }
.stepper .unit { font-size: 0.85rem; color: var(--ink-2); padding: 0 4px 0 5px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; min-height: 36px; cursor: pointer; font-size: 0.85rem; color: var(--ink-2); padding: 0 6px; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; flex: none; width: 38px; height: 22px; border-radius: 999px; background: #7b8ca1; transition: background 0.2s; }
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(13, 59, 120, 0.35); transition: transform 0.2s;
}
.switch input:checked + .switch-track { background: var(--blue); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--lkm-orange); outline-offset: 2px; }

.filters-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 7px 10px 7px 18px;
  background: var(--surface-2); border-top: 1px solid var(--grid); border-radius: 0 0 1.25rem 1.25rem;
}
.scope { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 0.86rem; color: var(--ink-2); }
.scope b { color: var(--navy); font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.scope .chip { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 10px; font-size: 0.8rem; line-height: 1.75; }
.scope .chip.on { border-color: var(--blue); color: var(--blue); font-weight: 500; }
.filter-actions { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.foot-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 0.88rem; font-weight: 500; cursor: pointer; border: 0; border-radius: 999px;
  background: var(--lkm-orange); color: #1b1006; padding: 6px 16px; min-height: 36px;
  box-shadow: 0 6px 14px -10px rgba(255, 143, 72, 0.9);
}
.btn:hover { filter: brightness(1.04); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 0.86rem; color: var(--blue); background: transparent; border: 0;
  border-radius: 999px; padding: 6px 12px; min-height: 36px; cursor: pointer;
}
.btn-ghost:hover { background: var(--track); }
.btn-ghost[hidden] { display: none; }
.btn [data-icon], .btn-ghost [data-icon] { display: inline-flex; }
.btn svg, .btn-ghost svg { width: 16px; height: 16px; }
.btn:focus-visible, .btn-ghost:focus-visible, .seg button:focus-visible, .stepper button:focus-visible,
input:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--lkm-orange); outline-offset: 2px;
}
.print-only { display: none; }

@media (max-width: 560px) {
  .filters { position: relative; }
  .filters-row { gap: 12px 18px; padding: 12px 14px; }
  .filters-foot { padding: 8px 10px 8px 14px; }
  .filter-hint { display: none; }
  .filters .filter { flex: 1 1 100%; }
  .filters .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
  .filters #fZone { grid-auto-flow: row; grid-template-columns: 1fr 1fr; border-radius: 1.2rem; }
  .filters .seg button { justify-content: center; }
  .filter-actions { margin-left: 0; width: 100%; }
  .foot-sep { display: none; }
  .btn { margin-left: auto; }
}

/* ================= layout ================= */
main { padding-top: 18px; padding-bottom: 48px; }
.scope-note { margin: 0 0 14px; color: var(--muted); font-size: 0.86rem; }
.grid { display: grid; gap: 18px; margin-bottom: 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) {
  .g-2-3 { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
  .g-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--shadow); overflow: hidden; min-width: 0; display: flex; flex-direction: column;
}
main > .card { margin-bottom: 18px; }
.card-b { padding: 16px 18px 18px; flex: 1; min-width: 0; }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.band-title {
  margin: 30px 0 14px; font-size: 1.15rem; display: flex; align-items: center; gap: 12px;
}
.band-title::after { content: ""; flex: 1; height: 2px; background: linear-gradient(90deg, var(--border), transparent); }

/* ribbon header */
.rib {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px 9px 10px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--sky) 55%, #4cb8e0 100%);
  color: #fff;
}
.rib.teal { background: linear-gradient(90deg, #138a9b 0%, var(--teal) 55%, #4cc6cf 100%); }
.rib h2 { color: #fff; font-size: 1rem; font-weight: 600; }
.rib h2 small { font-weight: 400; font-size: 0.8rem; color: #dff1fb; margin-left: 4px; }
.rib-ic {
  width: 32px; height: 32px; border-radius: 999px; background: #fff; color: var(--blue);
  display: grid; place-items: center; flex: none; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.rib.teal .rib-ic { color: #138a9b; }
.rib-ic svg { width: 18px; height: 18px; }

/* ================= KPI strip ================= */
.kpi-strip {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--shadow); margin: 12px 0 28px; overflow: hidden;
}
@media (min-width: 760px) { .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1150px) { .kpi-strip { grid-template-columns: 1.5fr 1fr 1fr 1.1fr 1fr 1fr; } }
.kc {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px; min-width: 0;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.kc-ic { flex: none; display: grid; place-items: center; }
.kc-ic svg { width: 44px; height: 44px; }
.kc-total .kc-ic svg { width: 60px; height: 60px; }
.kc-body { display: flex; flex-direction: column; min-width: 0; }
.kc-label { font-size: 0.85rem; color: var(--ink-2); line-height: 1.35; }
.kc-val { font-size: 1.9rem; font-weight: 700; color: var(--navy); line-height: 1.15; white-space: nowrap; }
.kc-total .kc-val { font-size: 2.6rem; }
.kc-val small { font-size: 0.95rem; font-weight: 500; color: var(--ink-2); margin-left: 4px; }
.kc-sub { font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
.kc-total { background: linear-gradient(135deg, #f1f8fe, #ffffff); }

/* ================= zones ================= */
.zones { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .zones { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.zone { border: 1px solid var(--border); border-radius: 0.9rem; overflow: hidden; background: var(--surface); transition: opacity 0.2s; }
.zone.dim { opacity: 0.4; }
.zone-tab { color: #fff; font-weight: 600; text-align: center; padding: 4px 8px; line-height: 1.3; text-wrap: balance; }
.zone-main { display: flex; align-items: center; gap: 10px; padding: 12px 12px 6px; }
.zone-main svg { width: 46px; height: 46px; flex: none; color: #8fb3d6; }
.zone-n { font-size: 1.7rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.zone-n small { font-size: 0.85rem; font-weight: 500; color: var(--ink-2); margin-left: 3px; }
.zone-p { font-size: 0.8rem; color: var(--muted); }
.zone-sex { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 6px 10px 12px; }
.sx { display: flex; align-items: center; gap: 4px; min-width: 0; }
.sx svg { width: 26px; height: 26px; flex: none; }
.sx-t { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sx-t span { font-size: 0.72rem; color: var(--muted); }
.sx-t b { font-size: 0.95rem; color: var(--ink); white-space: nowrap; }

/* ================= donut ================= */
.donut { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; height: 100%; }
.donut svg { width: 210px; height: 210px; flex: none; }
.donut .slice { stroke: #fff; stroke-width: 2; transition: opacity 0.15s; }
.donut .slice:hover { opacity: 0.85; }
.donut .pl { font-size: 13px; font-weight: 600; fill: #fff; pointer-events: none; font-family: inherit; }
.donut .pl.dark { fill: #1b1b1b; }
.donut .center-n { font-size: 26px; font-weight: 700; fill: var(--navy); font-family: inherit; }
.donut .center-l { font-size: 12px; fill: var(--muted); font-family: inherit; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 160px; flex: 1 1 160px; max-width: 280px; }
.legend li { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; font-size: 0.86rem; line-height: 1.35; }
.legend .dot { width: 12px; height: 12px; border-radius: 999px; }
.legend .lv { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ================= rank list (top-5 / disease) ================= */
.rank-list { display: grid; gap: 4px; }
.rank-head, .rank-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) 84px 76px; gap: 10px; align-items: center; }
.rank-list.with-bar .rank-head, .rank-list.with-bar .rank-row { grid-template-columns: 30px minmax(0, 1.3fr) minmax(60px, 1fr) 84px 76px; }
.rank-head { font-size: 0.74rem; color: var(--muted); padding: 0 6px 2px; }
.rank-head span:nth-last-child(-n+2) { text-align: right; }
.rank-row { padding: 6px; border-radius: 10px; }
.rank-row:hover { background: var(--surface-2); }
.rk {
  width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 0.85rem; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}
.rk.dark { color: #1b1b1b; }
.rk-name { font-size: 0.9rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-name .code { margin-left: 4px; }
.rk-bar { height: 16px; border-radius: 0 5px 5px 0; min-width: 3px; transition: width 0.35s ease; }
.rk-n { text-align: right; font-weight: 600; color: var(--navy); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rk-n small { font-weight: 400; color: var(--muted); margin-left: 3px; }
.rk-p {
  text-align: right; background: var(--pink-bg); color: var(--pink-ink); font-weight: 600;
  border-radius: 8px; padding: 2px 8px; font-size: 0.84rem; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.rank-row.other .rk-name { color: var(--ink-2); }

/* ================= generic bar list ================= */
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(84px, 34%) 1fr auto; gap: 10px; align-items: center; padding: 3px 6px; border-radius: 8px; }
.bar-row:hover { background: var(--surface-2); }
.bar-label { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 14px; background: var(--track); border-radius: 0 4px 4px 0; }
.bar-fill { height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 2px; transition: width 0.35s ease; }
.bar-row.muted .bar-fill { background: var(--bar-soft); }
.bar-val { font-size: 0.88rem; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 92px; }
.bar-val small { color: var(--muted); margin-left: 6px; }
.supp { color: var(--muted); font-style: normal; }
.split { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--border); display: grid; gap: 6px; }
.split-title { font-size: 0.84rem; color: var(--muted); }

/* ================= column charts ================= */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: #b9cadb; stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .vlabel { fill: var(--navy); font-weight: 600; font-size: 11px; font-family: inherit; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
.chart .vlabel.ref { fill: #c2530f; }
.chart .col { fill: var(--bar); transition: opacity 0.15s; }
.chart .col.muted { fill: var(--bar-soft); }
.chart .col.top { fill: var(--bar-top); }
.chart .hit { fill: transparent; }
.chart g.c:hover .col { opacity: 0.8; }
.scroll-x { overflow-x: auto; }
.min-560 { min-width: 560px; }

/* ================= service icon row ================= */
.svc-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
@media (min-width: 560px) { .svc-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1150px) { #services.svc-row { grid-template-columns: repeat(6, minmax(0, 1fr)); } #stay.svc-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.svc { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 10px 6px; border-right: 1px dashed var(--border); }
.svc:last-child { border-right: 0; }
.svc-ic { color: var(--blue); }
.svc-ic svg { width: 40px; height: 40px; }
.svc-ic.pink { color: var(--female); }
.svc-ic.orange { color: var(--lkm-orange); }
.svc-l { font-size: 0.8rem; color: var(--ink-2); line-height: 1.3; min-height: 2.1em; display: flex; align-items: center; }
.svc-v { font-size: 1.6rem; font-weight: 700; color: var(--navy); line-height: 1.15; }
.svc-v small { font-size: 0.85rem; font-weight: 500; color: var(--ink-2); margin-left: 3px; }
.svc-s { font-size: 0.74rem; color: var(--muted); }

.occ-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.occ { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 0.9rem; background: var(--surface-2); border: 1px solid var(--border); }
.occ.red { background: #fff1f1; border-color: #f7d4d4; }
.occ-ic { width: 54px; height: 54px; border-radius: 999px; display: grid; place-items: center; flex: none; color: #fff; background: var(--blue); }
.occ.red .occ-ic { background: #e5484d; }
.occ-ic svg { width: 30px; height: 30px; }
.occ-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.occ-t span { font-size: 0.82rem; color: var(--ink-2); }
.occ-t b { font-size: 1.8rem; color: var(--navy); line-height: 1.15; }
.occ-t b small { font-size: 0.9rem; font-weight: 500; color: var(--ink-2); margin-left: 3px; }
.occ-t em { font-style: normal; font-size: 0.74rem; color: var(--muted); }

/* ================= tables ================= */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--grid); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 0.78rem; white-space: nowrap; background: var(--surface-2); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
.inline-bar { display: inline-block; height: 8px; background: var(--bar); border-radius: 0 3px 3px 0; vertical-align: middle; margin-right: 8px; min-width: 2px; }
.pill { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 0.74rem; white-space: nowrap; background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2); }
.code { font-family: ui-monospace, "JetBrains Mono", Menlo, monospace; font-size: 0.76rem; color: var(--muted); }
.items-scroll { max-height: 520px; overflow: auto; border: 1px solid var(--grid); border-radius: 10px; }
.items-scroll th { position: sticky; top: 0; z-index: 1; }
.table-view { margin-top: 8px; }
.table-view summary { cursor: pointer; color: var(--muted); font-size: 0.82rem; }
.table-view table { margin-top: 8px; }

/* ---- record completeness ---- */
.cq { --cq-1: #f2b705; --cq-2: #eb6834; display: grid; grid-template-columns: minmax(260px, 330px) minmax(0, 1fr); gap: 28px; align-items: start; }
.cq-sum { display: grid; gap: 16px; padding-right: 28px; border-right: 1px solid var(--grid); }
.cq-ring { position: relative; width: 148px; height: 148px; justify-self: center; }
.cq-ring svg { width: 100%; height: 100%; display: block; }
.cq-ring .ring-track { stroke: var(--track); }
.cq-ring .ring-fill { stroke: var(--ok); transition: stroke-dasharray 0.5s ease; }
.cq-ring-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.15; }
.cq-ring-c b { font-size: 1.75rem; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.cq-ring-c span { font-size: 0.78rem; color: var(--muted); }
.cq-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cq-stat { display: grid; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); border-left-width: 4px; line-height: 1.3; }
.cq-stat.ok { border-left-color: var(--ok); }
.cq-stat.gap { border-left-color: var(--crit); }
.cq-stat span { font-size: 0.78rem; color: var(--ink-2); }
.cq-stat b { font-size: 1.35rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.cq-stat small { font-size: 0.72rem; color: var(--muted); }
.cq-sub { font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.cq-stack { display: flex; gap: 2px; height: 12px; border-radius: 999px; overflow: hidden; background: var(--track); }
.cq-stack span { min-width: 3px; }
.cq-legend { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; font-size: 0.78rem; color: var(--ink-2); }
.cq-legend li { display: flex; align-items: center; gap: 6px; }
.cq-legend i, .cq-key i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.cq-legend b { margin-left: auto; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.cq-fields { min-width: 0; }
.cq-head, .cq-row { display: grid; grid-template-columns: minmax(120px, 210px) minmax(60px, 1fr) 64px 72px; gap: 14px; align-items: center; }
.cq-head { padding: 0 10px 6px; font-size: 0.76rem; color: var(--muted); border-bottom: 1px solid var(--grid); }
.cq-head span:nth-child(n+3) { text-align: right; }
.cq-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; }
.cq-row { padding: 7px 10px; border-radius: 10px; outline: none; }
.cq-row:hover, .cq-row:focus-visible { background: var(--surface-2); }
.cq-row:focus-visible { box-shadow: 0 0 0 2px var(--sky); }
.cq-name { font-size: 0.9rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cq-track { height: 10px; border-radius: 999px; background: var(--track); overflow: hidden; }
.cq-fill { display: block; height: 100%; border-radius: 999px; transition: width 0.35s ease; }
.cq-pct { text-align: right; font-size: 0.95rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.cq-n { text-align: right; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sev-hi .cq-fill, .cq-key .hi { background: var(--crit); }
.sev-mid .cq-fill, .cq-key .mid { background: #e08a00; }
.sev-lo .cq-fill, .cq-key .lo { background: var(--bar-soft); }
.sev-hi .cq-pct { color: var(--crit); }
.sev-lo .cq-name, .sev-lo .cq-pct { color: var(--ink-2); font-weight: 500; }
.cq-insight { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 0; padding: 10px 14px; border-radius: 12px; background: #eaf7ea; border: 1px solid #c7e8c7; font-size: 0.86rem; color: var(--ink-2); line-height: 1.55; }
.cq-insight-ic { width: 18px; height: 18px; flex: none; margin-top: 2px; color: #087a08; }
.cq-insight b { color: var(--ink); font-weight: 600; }
.cq-insight b.up { color: #087a08; }
.cq-insight small { color: var(--muted); }
.cq-key { list-style: none; margin: 10px 0 0; padding: 0 10px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.74rem; color: var(--muted); }
.cq-key li { display: flex; align-items: center; gap: 6px; }
.cq-empty { margin: 0; padding: 18px; border-radius: 12px; background: #eaf7ea; color: #087a08; text-align: center; }
@media (max-width: 860px) {
  .cq { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .cq-sum { padding: 0 0 18px; border-right: 0; border-bottom: 1px solid var(--grid); }
}
@media (max-width: 560px) {
  .cq-head { display: block; padding: 0 0 6px; }
  .cq-head span:not(:first-child) { display: none; }
  .cq-row { grid-template-columns: minmax(0, 1fr) auto auto; row-gap: 4px; gap: 4px 10px; }
  .cq-track { grid-column: 1 / -1; grid-row: 2; }
}

.big-ring { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; }
.big-ring svg { width: 96px; height: 96px; flex: none; }
.big-ring .ring-track { stroke: var(--track); }
.big-ring .ring-fill { stroke: var(--ok); }
.big-ring b { display: block; font-size: 1.7rem; color: var(--navy); line-height: 1.2; }
.big-ring span { color: var(--ink-2); font-size: 0.85rem; }

/* ================= notes / tooltip ================= */
.notes { margin-top: 8px; padding: 18px 20px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--border); }
.notes h2 { margin-bottom: 8px; font-size: 1rem; }
.notes ul { margin: 0; padding-left: 20px; color: var(--ink-2); font-size: 0.86rem; }
.notes li { margin: 4px 0; }
.source { margin: 12px 0 0; color: var(--muted); font-size: 0.8rem; }
.tip {
  position: fixed; z-index: 20; pointer-events: none; max-width: 260px;
  background: var(--navy); color: #fff; border-radius: 10px; padding: 8px 12px;
  font-size: 0.82rem; line-height: 1.5; box-shadow: 0 18px 40px -20px rgba(13, 59, 120, 0.7);
}
.tip b { font-weight: 600; }

/* ================= phones ================= */
@media (max-width: 560px) {
  .card-b { padding: 14px; }
  .bar-row { grid-template-columns: 1fr auto; row-gap: 2px; }
  .bar-label { grid-column: 1 / -1; white-space: normal; }
  .bar-val { min-width: 0; }
  .rank-list.with-bar .rank-head, .rank-list.with-bar .rank-row { grid-template-columns: 28px minmax(0, 1fr) 74px 66px; }
  .rank-list.with-bar .rk-bar-wrap { display: none; }
  .rank-head, .rank-row { grid-template-columns: 28px minmax(0, 1fr) 74px 66px; }
  .kc-total { grid-column: 1 / -1; }
  .occ-row { grid-template-columns: minmax(0, 1fr); }
  .rk-name { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ================= print (A4) ================= */
@media print {
  @page { size: A4; margin: 8mm; }
  body { background: #fff; font-size: 10.5px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .filters, .skip, .table-view, .tip, .hero-deco { display: none !important; }
  .print-only { display: block !important; }
  .hero { padding: 10px 0 12px; }
  .card, .kpi-strip, .notes { box-shadow: none; break-inside: avoid; }
  .grid { break-inside: avoid; }
  .items-scroll { max-height: none; overflow: visible; }
  main { padding-top: 10px; }
}
