:root {
  --bg: #f7f5f0;
  --card: #ffffff;
  --ink: #1d2327;
  --muted: #6b7075;
  --line: #e6e2d9;
  --accent: #0f5c63;
  --A: #1f8a4c; --A-bg: #e5f4ea;
  --B: #6a9a1f; --B-bg: #eef5df;
  --C: #c98a00; --C-bg: #fbf1d6;
  --D: #d35f1c; --D-bg: #fbe6d8;
  --F: #c0262d; --F-bg: #f9dfe0;
  --N: #8a8f94; --N-bg: #eceeef;
  --radius: 14px;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5; font-size: 16px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 34px; margin: 0 0 8px; }
h2 { font-size: 22px; margin: 36px 0 12px; }
h3 { font-size: 17px; margin: 0 0 6px; }

/* header */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.brand { font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 10px; font-size: 18px; }
.brand:hover { text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { font-size: 12px; font-weight: 500; color: var(--muted); }
.brand-badge { width: 30px; height: 30px; border-radius: 8px; background: var(--A); color: #fff; display: grid; place-items: center; font-weight: 800; }
nav { display: flex; gap: 18px; font-size: 15px; }
nav a { color: var(--ink); }
@media (max-width: 560px) { nav { gap: 12px; font-size: 14px; } .brand-text small { display: none; } }

/* hero + search */
.hero { padding: 48px 0 12px; text-align: center; }
.hero p { color: var(--muted); font-size: 18px; margin: 0 auto 24px; max-width: 560px; }
.search { position: relative; max-width: 620px; margin: 0 auto; }
.search input {
  width: 100%; font-size: 18px; padding: 16px 20px 16px 48px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); outline: none; box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(15,92,99,.12); }
.search svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0 0; }
.chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 12px;
  font-size: 14px; cursor: pointer; color: var(--ink);
}
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* grade badge */
.grade {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  font-weight: 800; font-size: 22px; color: #fff; flex: none;
}
.grade.lg { width: 96px; height: 96px; border-radius: 22px; font-size: 54px; }
.grade.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 15px; }
.grade.A { background: var(--A); } .grade.B { background: var(--B); } .grade.C { background: var(--C); }
.grade.D { background: var(--D); } .grade.F { background: var(--F); }
.grade.N { background: var(--N); font-size: 13px; }
.grade.lg.N { font-size: 22px; }

/* lists */
.list { list-style: none; padding: 0; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list li + li { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; color: var(--ink); }
.row:hover { background: #fbfaf7; text-decoration: none; }
.row-body { flex: 1; min-width: 0; }
.row .name { font-weight: 600; line-height: 1.3; }
.row .sub { color: var(--muted); font-size: 14px; }
.row .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.row .when { font-size: 13px; color: var(--muted); }
.row .chev { flex: none; color: #c4bfb4; }
.row:hover .chev { color: var(--accent); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; line-height: 1.5; }
.tag.closed { background: var(--F-bg); color: var(--F); }
.tag.warn { background: var(--C-bg); color: #8a5d00; }
.tag.low { background: var(--N-bg); color: var(--muted); }
.more { display: block; text-align: center; padding: 12px; }

/* home sections */
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.section-head { display: flex; align-items: baseline; justify-content: space-between; }
.section-head h2 { margin-bottom: 12px; }
.section-head a { white-space: nowrap; }
.section-head a { font-size: 14px; }

.dist { display: flex; height: 14px; border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.dist span { display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 14px; color: var(--muted); }
.legend b { color: var(--ink); }

/* establishment page */
.est-head { display: flex; gap: 22px; align-items: center; margin: 32px 0 8px; }
.est-head h1 { font-size: 28px; margin: 0; }
.est-head .addr { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.summary { font-size: 18px; margin: 0 0 6px; }
.reasons { margin: 8px 0 0; padding-left: 20px; }
.reasons li { margin: 3px 0; }
.banner { border-radius: var(--radius); padding: 14px 18px; margin: 16px 0; font-weight: 500; }
.banner.closed { background: var(--F-bg); color: #8f1b20; }
.banner.warn { background: var(--C-bg); color: #6e4b00; }
.banner.info { background: var(--N-bg); color: var(--ink); }

.calc { width: 100%; border-collapse: collapse; font-size: 15px; }
.calc td, .calc th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.calc th { font-weight: 600; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
.calc td.num, .calc th.num { text-align: right; font-variant-numeric: tabular-nums; }
.calc tr.total td { font-weight: 700; border-bottom: none; }
.scale { display: flex; gap: 4px; margin: 14px 0 4px; }
.scale div { flex: 1; text-align: center; border-radius: 8px; padding: 6px 0; font-size: 13px; color: #fff; font-weight: 600; opacity: .35; }
.scale div.on { opacity: 1; outline: 3px solid var(--ink); outline-offset: 1px; }

.insp { border-left: 3px solid var(--line); padding: 2px 0 2px 18px; margin: 0 0 24px 8px; position: relative; }
.insp::before { content: ""; position: absolute; left: -8px; top: 6px; width: 13px; height: 13px; border-radius: 50%; background: var(--card); border: 3px solid var(--line); }
.insp.clean::before { border-color: var(--A); }
.insp.bad::before { border-color: var(--D); }
.insp.unknown::before { border-color: var(--N); border-style: dashed; }
.insp .date { font-weight: 700; }
.insp .old { opacity: .6; }
.def { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 8px 0; }
.def .cat { font-weight: 600; }
.def .remedy { margin: 4px 0 0; }
.def details { margin-top: 6px; font-size: 14px; color: var(--muted); }
.def summary { cursor: pointer; }
.status { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.status.out { background: var(--D-bg); color: #9a3f0d; }
.status.fixed { background: var(--A-bg); color: var(--A); }
.status.nc { background: var(--N-bg); color: var(--muted); }
.status.warn { background: var(--F-bg); color: var(--F); }
.def-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.pts { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* how page */
.prose { max-width: 700px; }
.prose p, .prose li { font-size: 17px; }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps > li { counter-increment: s; position: relative; padding: 0 0 18px 48px; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.ptable { border-collapse: collapse; margin: 10px 0; }
.ptable td, .ptable th { padding: 6px 14px 6px 0; text-align: left; border-bottom: 1px solid var(--line); }
.bands { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 12px 0; }
.bands > div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.bands .grade { margin: 0 auto 6px; }
@media (max-width: 560px) { .bands { grid-template-columns: repeat(3, 1fr); } }

.foot { border-top: 1px solid var(--line); margin-top: 64px; padding: 24px 0 40px; font-size: 14px; color: var(--ink); }
.loading { padding: 60px 0; text-align: center; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* small screens */
.est-head > div, .row > div { min-width: 0; }
.def-top { flex-wrap: wrap; }
.row .name, .est-head h1 { overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .wrap { padding: 0 14px; }
  .top-inner { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 6px; }
  nav { width: 100%; justify-content: space-between; }
  h1 { font-size: 27px; }
  .hero { padding-top: 28px; }
  .est-head { gap: 14px; align-items: flex-start; }
  .est-head h1 { font-size: 22px; }
  .grade.lg { width: 68px; height: 68px; font-size: 38px; border-radius: 16px; }
  .row { gap: 10px; padding: 10px 12px; }
  .card { padding: 16px; }
  .ptable td { padding-right: 8px; }
}

.group-title { font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 4px 0 8px; }
.group-title ~ .group-title { margin-top: 18px; }
