.sl-karte {
	--main: #0077b6;
	--main-soft: #e6f2f8;
	--bg: #f8fbfd;
	--card: #ffffff;
	--ink: #1a2433;
	--ink-2: #52606d;
	--ink-3: #8a96a3;
	--line: #e3e9ef;
	--median: #8a8985;
	--good: #0a7d0a;
	--bad: #c0392b;
	--radius: 12px;
}
.sl-karte * { box-sizing: border-box; }
.sl-karte {
	margin: 0 0 32px;
	padding: 4px 0;
	color: var(--ink);
	font-size: 15px;
	line-height: 1.6;
	-webkit-text-size-adjust: 100%;
}

/* 検索 */
.sl-karte .search { position: sticky; top: 0; z-index: 5; padding: 8px 0; background: var(--bg); }
.sl-karte .search__row { display: flex; gap: 8px; }
.sl-karte .search input, .sl-karte .search select {
	font: inherit;
	padding: 10px 12px;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--card);
	color: var(--ink);
	min-width: 0;
}
.sl-karte .search input { flex: 1; font-size: 16px; }
.sl-karte .search select { width: 7.5em; font-size: 14px; }
.sl-karte .suggest {
	list-style: none; margin: 6px 0 0; padding: 0;
	background: var(--card); border: 1px solid var(--line); border-radius: 10px;
	max-height: 55vh; overflow-y: auto;
}
.sl-karte .suggest:empty { display: none; }
.sl-karte .suggest li { border-top: 1px solid var(--line); }
.sl-karte .suggest li:first-child { border-top: 0; }
.sl-karte .suggest a {
	display: block; text-decoration: none; text-align: left; font: inherit; color: inherit;
	padding: 10px 12px; background: none; border: 0; cursor: pointer;
}
.sl-karte .suggest a:hover, .sl-karte .suggest a:focus { background: var(--main-soft); outline: none; }
.sl-karte .suggest small { display: block; color: var(--ink-3); font-size: .75rem; }

/* カルテ本体 */
.sl-karte .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 14px; }
.sl-karte .ent__name { font-size: 1.3rem; font-weight: 700; margin: 0; }
.sl-karte .ent__meta { color: var(--ink-2); font-size: .82rem; margin: 2px 0 12px; }
.sl-karte .tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sl-karte .tile { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.sl-karte .tile__label { font-size: .72rem; color: var(--ink-2); }
.sl-karte .tile__value { font-size: 1rem; font-weight: 700; white-space: nowrap; }
.sl-karte .tile__unit { font-size: .72rem; font-weight: 400; color: var(--ink-2); margin-left: 2px; }

.sl-karte .sec__title { font-size: 1.05rem; margin: 0 0 4px; }
.sl-karte .legend { display: flex; gap: 14px; font-size: .74rem; color: var(--ink-2); margin-bottom: 4px; flex-wrap: wrap; }
.sl-karte .legend span::before { content: ""; display: inline-block; width: 18px; height: 0; margin-right: 5px; vertical-align: middle; border-top: 2px solid var(--c, var(--main)); }
.sl-karte .legend .is-median::before { border-top: 2px dashed var(--median); }

.sl-karte .metric { border-top: 1px solid var(--line); padding: 12px 0 10px; }
.sl-karte .metric:first-of-type { border-top: 0; }
.sl-karte .metric__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sl-karte .metric__label { font-size: .85rem; font-weight: 600; }
.sl-karte .metric__value { font-size: 1.25rem; font-weight: 700; white-space: nowrap; }
.sl-karte .metric__value small { font-size: .75rem; font-weight: 400; color: var(--ink-2); margin-left: 2px; }
.sl-karte .metric__sub { display: flex; justify-content: space-between; gap: 8px; font-size: .76rem; color: var(--ink-2); margin-top: 2px; }
.sl-karte .metric__few { margin: 6px 0 0; font-size: .74rem; color: var(--ink-3); }
.sl-karte .badge { font-weight: 600; white-space: nowrap; }
.sl-karte .badge.is-good { color: var(--good); }
.sl-karte .badge.is-bad { color: var(--bad); }
.sl-karte .spark { position: relative; margin-top: 6px; touch-action: pan-y; }
.sl-karte .spark svg { display: block; width: 100%; height: 56px; overflow: visible; }
.sl-karte .spark__tip {
	position: absolute; top: -6px; transform: translateX(-50%);
	background: var(--ink); color: #fff; font-size: .72rem; line-height: 1.4;
	padding: 3px 7px; border-radius: 6px; white-space: nowrap; pointer-events: none;
}
.sl-karte .spark__axis { display: flex; justify-content: space-between; font-size: .68rem; color: var(--ink-3); }
.sl-karte details.yearly { margin-top: 4px; font-size: .76rem; }
.sl-karte details.yearly summary { color: var(--main); cursor: pointer; }
.sl-karte details.yearly table { border-collapse: collapse; width: 100%; margin-top: 4px; }
.sl-karte details.yearly td, .sl-karte details.yearly th { padding: 3px 6px; border-bottom: 1px solid var(--line); text-align: right; font-weight: 400; }
.sl-karte details.yearly th:first-child { text-align: left; }

.sl-karte .bars { margin-top: 6px; }
.sl-karte .bar { display: grid; grid-template-columns: 6.5em 1fr 3.6em; align-items: center; gap: 8px; font-size: .8rem; padding: 4px 0; }
.sl-karte .bar__track { position: relative; height: 10px; background: var(--bg); border-radius: 5px; }
.sl-karte .bar__fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--main); border-radius: 0 4px 4px 0; }
.sl-karte .bar__median { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--median); }
.sl-karte .bar__val { text-align: right; font-weight: 600; }

.sl-karte .empty { text-align: center; color: var(--ink-2); padding: 40px 8px; }
.sl-karte .note { font-size: .74rem; color: var(--ink-3); margin-top: 16px; }
.sl-karte .note a { color: var(--main); }
.sl-karte .pill { font: inherit; font-size: .8rem; color: var(--main); background: none; border: 1px solid var(--main); border-radius: 999px; padding: 4px 12px; cursor: pointer; }

.sl-karte h2.sec__title { background: none; border: 0; padding: 0; margin: 0 0 4px; color: var(--ink); font-size: 1.05rem; box-shadow: none; }
.sl-karte h2.sec__title::before, .sl-karte h2.sec__title::after, .sl-karte li::before { content: none; display: none; }
.sl-karte ul.suggest, .sl-karte ul.suggest li { margin: 0; padding: 0; list-style: none; }
.sl-karte ul.suggest { margin-top: 6px; }
.sl-karte details.yearly table { margin: 4px 0 0; font-size: inherit; }
.sl-karte details.yearly td, .sl-karte details.yearly th { border-width: 0 0 1px; background: none; }
.sl-karte p { margin-bottom: 0; }
.sl-karte .search { position: static; }


/* 事業体の操作ボタン */
.sl-karte .ent__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.sl-karte .pill:disabled { color: var(--ink-3); border-color: var(--line); cursor: default; }
.sl-karte .ent__meta.is-warn { color: var(--bad); }
.sl-karte .spark__tip b { font-weight: 700; }

/* 年度ごとの表は横にスクロールできるように */
.sl-karte .yearly__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sl-karte .yearly__scroll table { min-width: 100%; white-space: nowrap; }

/* 比較リスト（画面下に固定） */
.sl-karte .tray {
	position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50;
	display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
	max-width: 736px; margin: 0 auto; padding: 10px 40px 10px 12px;
	background: var(--ink); color: #fff; border-radius: 12px; font-size: .8rem;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
}
.sl-karte .tray[hidden] { display: none; }
.sl-karte .tray__label { font-weight: 700; }
.sl-karte .tray__names { flex: 1; min-width: 8em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-karte .tray__go { background: #fff; color: var(--main); font-weight: 700; padding: 6px 14px; border-radius: 999px; text-decoration: none; }
.sl-karte .tray__hint { color: #c9d3dd; }
.sl-karte .tray__clear { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); background: none; border: 0; color: #fff; font-size: 1.1rem; padding: 4px 8px; cursor: pointer; }

/* 比較 */
.sl-karte .cmp__lead { font-weight: 700; margin: 0 0 8px; }
.sl-karte .cmp__hint { font-size: .78rem; color: var(--ink-2); margin: 8px 0 0; }
.sl-karte .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sl-karte .chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; background: var(--bg); }
.sl-karte .chip i, .sl-karte .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.sl-karte .chip button { border: 0; background: none; color: var(--ink-2); font-size: 1rem; line-height: 1; padding: 2px 6px; cursor: pointer; }
.sl-karte .legend .is-series::before { border-top-color: var(--c); }
.sl-karte .cmp__vals { list-style: none; margin: 6px 0 0; padding: 0; }
.sl-karte .cmp__vals li { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-size: .85rem; }
.sl-karte .cmp__vals span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-karte .cmp__vals b { white-space: nowrap; }
.sl-karte .cmp__vals small { font-weight: 400; color: var(--ink-2); margin-left: 2px; }
.sl-karte .cmp__table { border-collapse: collapse; width: 100%; font-size: .82rem; }
.sl-karte .cmp__table th, .sl-karte .cmp__table td { padding: 6px 8px; border: 0; border-bottom: 1px solid var(--line); text-align: left; background: none; font-weight: 400; }
.sl-karte .cmp__table th { color: var(--ink-2); }
.sl-karte .cmp__table .dot { margin-right: 6px; vertical-align: -1px; }
.sl-karte .cmp__link { display: inline-block; margin: 10px 12px 0 0; font-size: .82rem; color: var(--main); }

/* 事業体ページ・一覧ページ（サーバー側で出力する部分） */
.sl-karte-page__summary { background: #fff; border: 1px solid #e3e9ef; border-radius: 12px; padding: 14px 16px; margin: 0 0 8px; font-size: .92rem; }
.sl-karte-page__summary p { margin: 0 0 6px; }
.sl-karte-page__summary p:last-child { margin-bottom: 0; }
.sl-karte-page__links { margin-top: 24px; }
.sl-karte-page__links h2 { font-size: 1.05rem; }
.sl-karte-page__links ul, .sl-karte-index ul { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; margin: 8px 0 0; padding: 0; font-size: .88rem; }
.sl-karte-page__links li::before, .sl-karte-index li::before { content: none; display: none; }
.sl-karte-index details { border-top: 1px solid #e3e9ef; padding: 10px 0; }
.sl-karte-index summary { cursor: pointer; font-weight: 700; }
.sl-karte-index small { color: #8a96a3; }

@media (max-width: 599px) {
	/* 右下の「ページ上部へ」ボタンと重ならないよう、右側をあける */
	.sl-karte .tray { left: 8px; right: 64px; bottom: 8px; }
}

/* 比較リストの説明（カーソルを合わせる、またはキーボードで選ぶと出る） */
.sl-karte .has-tip { position: relative; display: inline-flex; }
.sl-karte .tip {
	position: absolute; right: 0; bottom: calc(100% + 10px); z-index: 60;
	width: 260px; max-width: calc(100vw - 32px);
	padding: 10px 12px; border-radius: 8px;
	background: var(--ink); color: #fff; font-size: .78rem; font-weight: 400; line-height: 1.6; text-align: left; white-space: normal;
	box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
	opacity: 0; visibility: hidden; transform: translateY(4px);
	transition: opacity .15s, transform .15s, visibility .15s;
	pointer-events: none;
}
.sl-karte .tip::after {
	content: ""; position: absolute; right: 24px; top: 100%;
	border: 6px solid transparent; border-top-color: var(--ink);
}
.sl-karte .tray .tip { left: 0; right: auto; background: #fff; color: var(--ink); }
.sl-karte .tray .tip::after { left: 24px; right: auto; border-top-color: #fff; }
/* クリック後は消し、キーボードで選んだときだけ出し続ける */
.sl-karte .has-tip:hover .tip,
.sl-karte .has-tip:has(:focus-visible) .tip,
.sl-karte .has-tip:focus-visible .tip { opacity: 1; visibility: visible; transform: translateY(0); }
.sl-karte .tray__label { cursor: help; align-items: center; gap: 6px; outline-offset: 2px; }
.sl-karte .tray__q {
	display: inline-flex; align-items: center; justify-content: center;
	width: 16px; height: 16px; border-radius: 50%;
	border: 1px solid currentColor; font-size: .68rem; font-weight: 700; line-height: 1;
}
.sl-karte .pill.is-primary { background: var(--main); color: #fff; border-color: var(--main); }
.sl-karte .pill.is-primary:disabled { background: none; color: var(--ink-3); border-color: var(--line); }
.sl-karte .ent__hint { margin: 8px 0 0; font-size: .74rem; color: var(--ink-2); text-align: right; }

/* タッチ操作の端末ではカーソルを合わせられないので、説明は一行の案内で代える */
@media (hover: none) {
	.sl-karte .has-tip:hover .tip { opacity: 0; visibility: hidden; }
	/* タッチ端末では「比較リスト ?」をタップすると説明が出る */
	.sl-karte .tray__label:focus .tip { opacity: 1; visibility: visible; transform: translateY(0); }
}
@media (max-width: 599px) {
	.sl-karte .ent__hint { text-align: left; }
}

/* 年度ごとの表：SWELLの表の見出し（白い文字＋色つき背景）を打ち消して、年度が見えるようにする */
.sl-karte table th,
.sl-karte table td {
	color: var(--ink) !important;
	background: none !important;
	border-color: var(--line) !important;
}
.sl-karte table th { color: var(--ink-2) !important; font-weight: 600 !important; }
.sl-karte details.yearly tr:first-child td { color: var(--ink-2) !important; font-weight: 600; }

/* 推移グラフの最新年度の点 */
.sl-karte .spark__plot { position: relative; }
.sl-karte .spark__dot {
	position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px;
	border: 2px solid #fff; border-radius: 50%; box-sizing: border-box; pointer-events: none;
}

/* 推移を描けない％の指標：0〜100%の水準バー */
.sl-karte .level { margin-top: 8px; }
.sl-karte .level__row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.sl-karte .level__name { flex: 0 0 6.5em; font-size: .76rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-karte .level__track { position: relative; flex: 1; height: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.sl-karte .level__fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px 4px 4px 6px; }
.sl-karte .level__median { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: var(--ink-2); }
.sl-karte .level__scale { display: flex; justify-content: space-between; font-size: .68rem; color: var(--ink-3); }
.sl-karte .level__row + .level__scale { margin-top: -2px; }
.sl-karte .level:has(.level__name) .level__scale { margin-left: calc(6.5em + 8px); }

/* ==========================================================================
   報告書（PDFで保存）
   画面では隠し、印刷するときだけ報告書の形にする。A4縦。
   ========================================================================== */
.rp-only { display: none; }
.sl-karte .rp-table { border-collapse: collapse; width: 100%; font-size: .8rem; }
.sl-karte .rp-table th, .sl-karte .rp-table td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.sl-karte .rp-table .num { text-align: right; white-space: nowrap; }
.sl-karte .rp-note { font-size: .72rem; color: var(--ink-2); margin: 6px 0 0; }

@page { size: A4 portrait; margin: 12mm 12mm 14mm; }

@media print {
	html, body { background: #fff !important; }
	/* SWELLの印刷用CSSは section ごとに改ページするので、カルテの中では打ち消す */
	.sl-karte section, .sl-karte-page__links { page-break-before: auto !important; break-before: auto !important; }
	.sl-karte, .sl-karte * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

	/* サイトの枠（ヘッダー・フッター・パンくず・固定ボタン・メニュー）は出さない */
	.l-header, .l-fixHeader, .l-footer, .p-breadcrumb, .p-fixBtnWrap, .p-spMenu, .c-modal, .c-overlay,
	.sl-header-shortcuts, #sidebar, .l-sidebar, .p-mainVisual,
	.sl-karte-route .c-pageTitle, .sl-karte-page__links,
	.post_content > p:not(.note), .post_content > h2, .sl-gov-dashboard, .sl-stats-source { display: none !important; }
	.l-content, .l-mainContent, .l-mainContent__inner, .post_content { margin: 0 !important; padding: 0 !important; max-width: none !important; width: 100% !important; }

	/* 操作するための部品は出さない */
	.sl-karte .search, .sl-karte .tray, .sl-karte .ent__actions, .sl-karte .ent__hint,
	.sl-karte details.yearly, .sl-karte .chip button, .sl-karte .cmp__hint, .sl-karte .cmp__link,
	.sl-karte .spark__tip, .sl-karte .cross { display: none !important; }

	.sl-karte { font-size: 10.5pt; color: #000; margin: 0; padding: 0; }
	.rp-only { display: block; }

	/* 表紙代わりの見出し */
	.rp-head { border-bottom: 2px solid #0077b6; padding-bottom: 6px; margin-bottom: 10px; }
	.rp-head p { margin: 0 !important; padding: 0 !important; line-height: 1.5 !important; }
	.rp-site { margin: 0; font-size: 9pt; color: #0077b6; font-weight: 700; letter-spacing: .05em; }
	.rp-title { margin: 2px 0; font-size: 17pt; font-weight: 700; color: #000; }
	.rp-meta { margin: 0; font-size: 8pt; color: #52606d; word-break: break-all; }

	/* 要約（事業体ページの冒頭の文章） */
	.sl-karte-page__summary { border: 1px solid var(--line, #e3e9ef); font-size: 9.5pt; padding: 8px 10px; margin: 0 0 8px; break-inside: avoid; }

	.sl-karte .card { border: 1px solid #d5dde5; border-radius: 6px; padding: 10px 12px; margin-top: 8px; break-inside: auto; box-shadow: none; }
	.sl-karte .tiles { break-inside: avoid; }
	.sl-karte .sec__title, .sl-karte .legend { break-inside: avoid; break-after: avoid; }
	/* 事業体名は報告書の見出しと重なるので、印刷では出さない */
	.sl-karte .ent__name { display: none; }
	.sl-karte .card:first-of-type .ent__name { font-size: 13pt; }
	.sl-karte .sec__title { font-size: 11pt !important; }
	.sl-karte .rp-table { font-size: 8.5pt; }
	.sl-karte .rp-table tr { break-inside: avoid; }

	/* 指標は2列に並べ、1つの指標がページをまたがないようにする */
	.sl-karte section.card:not(.rp-summary) > .metric {
		display: inline-block; vertical-align: top; width: calc(50% - 8px); margin-right: 8px;
		border-top: 1px solid var(--line); padding: 6px 0; break-inside: avoid;
	}
	.sl-karte .metric__value { font-size: 12pt; }
	.sl-karte .spark svg { height: 42px; }
	.sl-karte .legend { font-size: 8pt; }
	.sl-karte .bars { columns: 2; column-gap: 16px; }
	.sl-karte .bar { break-inside: avoid; }
	.sl-karte .note { font-size: 7.5pt; margin-top: 8px; }
}
