/* yng4check-corp design (after the demo screens: warm off-white, white rounded cards, deep red accent, serif figures).
   No external fonts or CDNs (strict CSP): system Japanese fonts only. */
:root {
  --bg: #f7f2ef; --surface: #fff; --surface-2: #faf6f4; --soft: #f5ebe7; --line: #e8ddd8; --line-2: #f0e7e3;
  --text: #2a2321; --muted: #7b6e69; --faint: #a3958f;
  --accent: #b83a2d; --accent-hover: #9e3125; --accent-soft: #f7e6e2; --accent-ink: #fff;
  --teal: #2aa3b3; --teal-hover: #218c9a; --teal-soft: #e9f6f8;
  --ok: #1f8a4c; --ok-bg: #e4f5ea; --ok-line: #9fd8b3; --warn: #9a6400; --warn-bg: #fff4cc; --warn-line: #f0d27a;
  --bad: #c0392b; --bad-bg: #fde4e1; --info: #2f5fd0; --info-bg: #e8eefc; --purple: #7c3aed; --purple-bg: #f1e9ff;
  --radius: 16px; --radius-sm: 10px; --shadow: 0 1px 2px rgba(60, 30, 20, .04), 0 4px 16px rgba(60, 30, 20, .04);
  --sans: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
  --serif: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  font-family: var(--sans); color: var(--text); -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); line-height: 1.65; font-size: 15px; min-height: 100dvh; }
a { color: var(--accent); }
img, svg { display: block; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: inherit; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.brand .co { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .svc { color: var(--muted); font-size: 13px; white-space: nowrap; }
.topbar .who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; white-space: nowrap; }
@media (max-width: 560px) { .brand .svc, .topbar .who .name { display: none; } .topbar { padding: 8px 12px; } }

/* ---------- layout */
.page { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }
.page.wide { max-width: 1280px; }
.page.narrow { max-width: 440px; padding-top: 48px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ---------- type */
h1, h2, h3 { margin: 0; line-height: 1.35; }
h1 { font-family: var(--serif); font-size: 26px; font-weight: 700; letter-spacing: .02em; }
h2 { font-family: var(--serif); font-size: 19px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
.faint { color: var(--faint); font-size: 12px; }
.serif { font-family: var(--serif); }
.num { font-family: var(--serif); font-variant-numeric: tabular-nums; }
.section-title { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 18px; font-weight: 700; }
.section-title::before { content: ""; width: 4px; height: 20px; border-radius: 2px; background: var(--accent); }
.eyebrow { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--accent); }

/* ---------- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.soft { background: var(--surface-2); }
.card.pad-lg { padding: 28px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head .t { display: flex; gap: 12px; align-items: flex-start; }
.icon-box { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.icon-box.teal { background: var(--teal-soft); color: var(--teal); }
.note { background: var(--soft); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: var(--muted); }
.note strong { color: var(--text); }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.outline { background: #fff; color: var(--accent); }
.btn.outline:hover { background: var(--accent-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); font-weight: 600; }
.btn.ghost:hover { background: var(--soft); color: var(--text); }
.btn.quiet { background: var(--surface-2); border-color: var(--line); color: var(--text); font-weight: 600; border-radius: 999px; }
.btn.quiet:hover { background: var(--soft); }
.btn.teal { background: var(--teal); border-color: var(--teal); }
.btn.teal:hover { background: var(--teal-hover); border-color: var(--teal-hover); }
.btn.teal-outline { background: var(--teal-soft); border: 2px solid var(--teal); color: var(--teal-hover); border-radius: 999px; }
.btn.sm { min-height: 34px; padding: 4px 12px; font-size: 13px; border-radius: 8px; }
.btn.xs { min-height: 28px; padding: 2px 10px; font-size: 12px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn.hero { min-height: 64px; font-size: 18px; border-radius: 999px; width: 100%; }
.btn.danger { background: #fff; color: var(--bad); border-color: #f0b8b0; }
.btn.danger:hover { background: var(--bad-bg); }
.btn:disabled, .btn[aria-disabled=true] { opacity: .45; cursor: default; pointer-events: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid #ecaaa0; outline-offset: 2px; }

/* ---------- forms */
label.f { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin: 12px 0 6px; }
input[type=email], input[type=password], input[type=text], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 15px; background: #fff; color: var(--text); }
input::placeholder { color: var(--faint); }
.input-icon { position: relative; } .input-icon svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); } .input-icon input { padding-left: 36px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.chips-select { display: flex; gap: 6px; flex-wrap: wrap; }
.chips-select label { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 14px; background: #fff; }
.chips-select input { position: absolute; opacity: 0; pointer-events: none; }
.chips-select input:checked + span { color: var(--accent); font-weight: 700; }
.chips-select label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; min-height: 32px; }
.seg button[aria-pressed=true] { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 14px 20px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.filters > * { flex: 0 1 auto; }
.filters input, .filters select { min-height: 38px; font-size: 14px; width: auto; }

/* ---------- messages / pills */
.msg { padding: 12px 14px; border-radius: 12px; background: var(--soft); font-size: 14px; }
.msg.ok { background: var(--ok-bg); color: var(--ok); } .msg.err { background: var(--bad-bg); color: var(--bad); }
.msg.warn { background: var(--warn-bg); color: var(--warn); } .msg.info { background: var(--info-bg); color: var(--info); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--soft); color: var(--muted); white-space: nowrap; line-height: 1.7; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); } .pill.info { background: var(--info-bg); color: var(--info); }
.pill.purple { background: var(--purple-bg); color: var(--purple); } .pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 11px; font-weight: 700; }
.count.hot { background: #e5483a; color: #fff; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 1px 7px; border-radius: 6px; }

/* ---------- stat cards */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-family: var(--serif); font-size: 30px; font-weight: 700; color: var(--accent); line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 18px; }
.stat .sub { color: var(--muted); font-size: 12px; }

/* ---------- tabs */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.tabs { display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.tabs a, .tabs button { display: inline-flex; align-items: center; gap: 8px; padding: 14px 14px 12px; border: 0; border-bottom: 3px solid transparent; background: none; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; cursor: pointer; white-space: nowrap; flex: none; }
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs [aria-current=page], .tabs [aria-selected=true] { color: var(--accent); border-bottom-color: var(--accent); }
.panel-body { padding: 20px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px; flex-wrap: wrap; }

/* ---------- tables */
.table-wrap { overflow-x: auto; }
.table-wrap.boxed { border: 1px solid var(--line); border-radius: 12px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; white-space: nowrap; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: #fdfaf9; }
table.t .r { text-align: right; }
table.t .stackv { display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.table-foot { padding: 10px 20px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* ---------- drawer (detail panel) and dialog */
.drawer-back { position: fixed; inset: 0; background: rgba(40, 20, 15, .28); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: #fff; z-index: 41; display: flex; flex-direction: column; box-shadow: -8px 0 32px rgba(0, 0, 0, .12); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.drawer-body { overflow-y: auto; padding: 0 20px 32px; flex: 1; }
.kv { display: grid; grid-template-columns: auto 1fr; font-size: 14px; }
.kv > div { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.kv > div:nth-child(odd) { color: var(--muted); padding-right: 16px; }
.kv > div:nth-child(even) { text-align: right; font-weight: 600; }
.kv-title { font-size: 13px; font-weight: 700; color: var(--muted); margin: 20px 0 4px; }
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .2); }
dialog::backdrop { background: rgba(40, 20, 15, .3); }
dialog .d-head { padding: 18px 20px 0; } dialog .d-body { padding: 8px 20px 4px; } dialog .d-foot { padding: 16px 20px 20px; display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- home / check */
.hero-card { text-align: left; }
.hero-card h1 { font-size: 28px; }
.steps { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 16px 18px; }
.steps h3 { font-size: 14px; margin-bottom: 10px; }
.steps ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.steps li .n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; font-family: var(--serif); }
.week { display: flex; gap: 14px; align-items: center; }
.week .ring { width: 54px; height: 54px; flex: none; }
.disclaimer { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 12px; }
.disclaimer svg { flex: none; margin-top: 2px; }
.link-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.tile { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-decoration: none; color: var(--text); font-weight: 600; font-size: 14px; }
.tile:hover { border-color: var(--accent); }
.tile svg { color: var(--accent); flex: none; }
#check-area { width: 100%; max-width: 460px; margin: 0 auto; }

/* ---------- compare & trends (after the demo result screen) */
.compare { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.compare .when { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.compare .when b { display: block; color: var(--text); font-weight: 600; font-size: 13px; }
.cmp-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 14px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.cmp-row:last-child { border-bottom: 0; }
.cmp-row .now { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; } .cmp-row .now small { font-weight: 400; color: var(--muted); margin-left: 2px; }
.cmp-row .d { font-size: 13px; min-width: 58px; text-align: right; font-variant-numeric: tabular-nums; }
.cmp-row .d.up { color: var(--ok); } .cmp-row .d.down { color: var(--bad); } .cmp-row .d.same { color: var(--faint); }
.cmp-row .prev { color: var(--faint); font-size: 13px; min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.trends { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
@media (max-width: 560px) { .trends { grid-template-columns: 1fr; gap: 10px; } .trend { padding: 12px 12px 6px; } .bars { height: 120px; } .tabs .long { display: none; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; } .stat { padding: 12px; } .stat .icon-box { display: none; } .stat .value { font-size: 24px; } }
@media (min-width: 561px) { .tabs .short { display: none; } }
.trend { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 10px; }
.trend h3 { font-family: var(--serif); font-size: 15px; margin-bottom: 4px; }
.trend .unit { text-align: right; color: var(--faint); font-size: 11px; }
.bars { width: 100%; height: 150px; }
.bars text { font-family: var(--sans); }

/* ---------- level distribution chips */
.dist { display: flex; gap: 10px; flex-wrap: wrap; }
.dist .pill { font-size: 13px; padding: 5px 14px; }

/* ---------- misc */
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #2a2321; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 60; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.weekbar { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; align-items: end; height: 120px; }
.weekbar .b { background: var(--accent-soft); border-radius: 6px 6px 0 0; position: relative; min-height: 2px; }
.weekbar .b.cur { background: var(--accent); }
.weekbar-l { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; font-size: 11px; color: var(--muted); text-align: center; margin-top: 4px; }
.health-bar { height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; } .health-bar > span { display: block; height: 100%; background: var(--ok); }
.cmp-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
dialog.dlg { width: min(860px, calc(100vw - 32px)); }

/* Company branding (admin「ロゴと色」): step numbers, check start buttons, header logo. */
.steps li .n, .steps .n { background: var(--step-bg, var(--accent)); color: var(--step-ink, #fff); }
.btn.start:not(.outline) { background: var(--start-bg, var(--teal)); border-color: var(--start-bg, var(--teal)); color: var(--start-ink, #fff); }
.btn.start:not(.outline):hover { background: var(--start-hover, var(--teal-hover, var(--teal))); border-color: var(--start-hover, var(--teal-hover, var(--teal))); }
.btn.start.outline { border: 2px solid var(--start-bg, var(--accent)); color: var(--text); background: #fff; }
.brand .mark.logo { background: transparent; width: auto; min-width: 0; height: 32px; padding: 0; border-radius: 0; }
.brand .mark.logo img { display: block; height: 32px; width: auto; max-width: 160px; object-fit: contain; }
.swatch-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; margin-top: 10px; }
.swatch-row input[type=color] { width: 48px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.brand-preview { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 14px; }
.logo-box { display: flex; align-items: center; justify-content: center; height: 72px; border: 1px dashed var(--line); border-radius: 10px; background: #fff; margin-top: 10px; }
.logo-box img { max-height: 56px; max-width: 220px; object-fit: contain; }
