@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&display=swap");

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #1f2933;
  --ink-soft: #52606d;
  --line: #dde2e8;
  --brand: #1d4e89;
  --brand-dark: #153a66;
  --brand-pale: #e8f0fa;
  --accent: #0f8a7e;
  --accent-pale: #e3f4f2;
  --warn: #b54708;
  --warn-pale: #fef0e6;
  --danger: #b42318;
  --danger-pale: #fdecea;
  --ok: #1b7a3d;
  --ok-pale: #e6f4ea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  font-size: 16px; line-height: 1.75; overflow-x: hidden;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
h1, h2, h3 { line-height: 1.4; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: clamp(1.45rem, 3vw, 1.9rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }
.muted { color: var(--ink-soft); }
.small { font-size: .875rem; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 6px 12px; z-index: 100; }
.skip:focus { left: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== レイアウト ===== */
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 860px; }
.page { padding: 28px 16px 48px; }
.section { padding: 36px 0; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-5 { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.breadcrumb { font-size: .875rem; color: var(--ink-soft); margin-bottom: 8px; }
.breadcrumb a { color: var(--ink-soft); }

/* ===== ヘッダー ===== */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--brand); color: #fff; box-shadow: 0 1px 0 rgba(0, 0, 0, .1); }
.bar { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 10px; color: #fff; text-decoration: none; margin-right: auto; }
.brand:hover { color: #fff; }
.brand-mark { font-weight: 700; font-size: 1.4rem; letter-spacing: .04em; }
.brand-sub { font-size: .8rem; opacity: .85; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.site-nav a { display: block; padding: 8px 14px; border-radius: 6px; color: #fff; text-decoration: none; font-size: .95rem; font-weight: 500; }
.site-nav a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.site-nav a[aria-current="page"] { background: rgba(255, 255, 255, .2); }
.site-nav .nav-admin, .site-nav .nav-user { border: 1px solid rgba(255, 255, 255, .5); }
.nav-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; }
.nav-button { display: none; width: 40px; height: 40px; border-radius: 6px; cursor: pointer; position: relative; }
.nav-button span, .nav-button span::before, .nav-button span::after {
  position: absolute; left: 10px; width: 20px; height: 2px; background: #fff; content: "";
}
.nav-button span { top: 19px; }
.nav-button span::before { top: -6px; left: 0; }
.nav-button span::after { top: 6px; left: 0; }
.nav-toggle:focus-visible + .nav-button { outline: 3px solid #f2b705; }
@media (max-width: 780px) {
  .brand-sub { display: none; }
  .nav-button { display: block; }
  .site-nav { display: none; width: 100%; padding-bottom: 10px; }
  .nav-toggle:checked ~ .site-nav { display: block; }
  .site-nav ul { flex-direction: column; }
}

/* ===== ボタン ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; line-height: 1.4;
}
.btn:hover { background: #f0f2f5; color: var(--ink); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #0b6f65; color: #fff; }
.btn-danger { background: var(--danger-pale); border-color: #f5c2bd; color: var(--danger); }
.btn-danger:hover { background: #fbd9d5; color: var(--danger); }
.btn-sm { padding: 5px 12px; font-size: .875rem; }
.btn-lg { padding: 13px 26px; font-size: 1.05rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ===== トップ ===== */
.hero { background: linear-gradient(135deg, var(--brand) 0%, #2a6db5 100%); color: #fff; padding: 48px 0 56px; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin-bottom: .3em; }
.hero p { opacity: .92; max-width: 46em; }
.hero .btn { border-color: transparent; }
.hero-search { display: flex; gap: 8px; max-width: 560px; margin: 20px 0 16px; }
.hero-search input { flex: 1; padding: 12px 14px; border-radius: 8px; border: 0; font: inherit; }
.stats { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 18px; font-size: .9rem; }
.stats strong { font-size: 1.5rem; display: block; line-height: 1.2; }
.tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--brand); transform: translateY(-2px); color: var(--ink); }
.tile img { width: 100%; max-width: 160px; aspect-ratio: 1; object-fit: contain; }
.tile .count { color: var(--ink-soft); font-size: .85rem; }
.tile-text { display: flex; align-items: center; justify-content: center; width: 100%; max-width: 160px; aspect-ratio: 1; padding: 12px;
  border-radius: 10px; background: linear-gradient(135deg, #e8eef7, #dff3ee); color: var(--brand); font-weight: 700; font-size: 1.05rem; line-height: 1.4; word-break: break-word; }
.new-material { margin-top: 10px; }
.new-material input { max-width: 420px; }
.inline-form select { max-width: 180px; margin-right: 6px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.about { display: grid; grid-template-columns: 160px 1fr; gap: 24px; align-items: start; }
.about img { border-radius: 50%; width: 160px; height: 160px; object-fit: cover; }
@media (max-width: 640px) { .about { grid-template-columns: 1fr; } .about img { margin: 0 auto; } }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; padding-left: 40px; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 2px; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-pale); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: .9rem; }

/* ===== 一覧・検索 ===== */
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 10px; align-items: end; }
.filters label { display: block; font-size: .8rem; color: var(--ink-soft); font-weight: 500; margin-bottom: 2px; }
@media (max-width: 860px) { .filters { grid-template-columns: 1fr 1fr; } .filters .wide { grid-column: 1 / -1; } }
.result-meta { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin: 18px 0 10px; color: var(--ink-soft); font-size: .9rem; }
.program-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.program-card { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; }
.program-card h3 { margin: 0; font-size: 1.1rem; }
.program-card h3 a { text-decoration: none; }
.program-card h3 a:hover { text-decoration: underline; }
.program-card .facts { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--ink-soft); font-size: .9rem; margin: 0; }
.program-card .side { text-align: right; font-size: .85rem; color: var(--ink-soft); white-space: nowrap; }
@media (max-width: 640px) { .program-card { grid-template-columns: 1fr; } .program-card .side { text-align: left; } }
.tag { display: inline-block; padding: 1px 10px; border-radius: 999px; background: var(--brand-pale); color: var(--brand); font-size: .8rem; font-weight: 500; }
.tag-accent { background: var(--accent-pale); color: var(--accent); }
.pos-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.pos-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px 2px 4px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: .8rem; color: var(--ink); text-decoration: none; }
.pos-badge:hover { border-color: var(--brand); color: var(--brand); }
.pos-badge img { width: 22px; height: 22px; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-soft); }

/* ===== 詳細 ===== */
.detail-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.facts-table { width: 100%; border-collapse: collapse; }
.facts-table th, .facts-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.facts-table th { width: 9em; color: var(--ink-soft); font-weight: 500; white-space: nowrap; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.timeline > li { display: grid; grid-template-columns: 72px 1fr; gap: 16px; }
.timeline .time { text-align: center; }
.timeline .time .num { display: grid; place-items: center; width: 36px; height: 36px; margin: 0 auto 4px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; }
.timeline .time small { color: var(--ink-soft); }
.memo { background: var(--warn-pale); border-left: 4px solid #f79009; padding: 10px 14px; border-radius: 0 8px 8px 0; margin-top: 10px; font-size: .95rem; }
.memo strong { display: block; color: var(--warn); font-size: .85rem; }
@media (max-width: 560px) { .timeline > li { grid-template-columns: 1fr; } .timeline .time { text-align: left; display: flex; gap: 10px; align-items: center; } .timeline .time .num { margin: 0; } }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.file-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.comment { border-top: 1px solid var(--line); padding: 14px 0; }
.comment:first-child { border-top: 0; }
.comment .who { font-weight: 700; }
.comment .when { color: var(--ink-soft); font-size: .85rem; }
.comment details { margin-top: 6px; font-size: .875rem; }
.comment details summary { cursor: pointer; color: var(--ink-soft); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.inline-form input { flex: 1; min-width: 160px; }

/* ===== フォーム ===== */
.form { display: grid; gap: 16px; }
.field label, .field .label { display: block; font-weight: 500; margin-bottom: 4px; }
.field .hint { font-size: .85rem; color: var(--ink-soft); margin: 2px 0 0; }
.req { color: var(--danger); font-size: .8rem; margin-left: 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #c4cdd6; border-radius: 8px; background: #fff; color: var(--ink); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
textarea { min-height: 96px; resize: vertical; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 640px) { .cols-2, .cols-3 { grid-template-columns: 1fr; } }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; }
.pos-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.pos-checks label { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-weight: 400; cursor: pointer; background: #fff; }
.pos-checks img { width: 32px; height: 32px; }
.pos-checks label:has(input:checked) { border-color: var(--brand); background: var(--brand-pale); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 18px; margin: 0; background: var(--surface); }
legend { font-weight: 700; padding: 0 6px; }
.repeat-item { border: 1px dashed #b8c2cc; border-radius: 8px; padding: 14px; display: grid; gap: 12px; background: #fbfcfd; }
.repeat-item .item-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.repeat-list { display: grid; gap: 12px; margin-bottom: 12px; }
.alert { border-radius: 8px; padding: 12px 16px; margin: 0 0 16px; }
.alert ul { margin: 0; padding-left: 1.2em; }
.alert-ok { background: var(--ok-pale); color: var(--ok); }
.alert-ng { background: var(--danger-pale); color: var(--danger); }
.alert-info { background: var(--brand-pale); color: var(--brand-dark); }

/* ===== 表（管理） ===== */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { background: #f0f3f7; font-weight: 500; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .actions { white-space: nowrap; }
.table .actions form { display: inline; }

/* ===== フッター ===== */
.site-footer { margin-top: 40px; background: #1f2933; color: #cbd2d9; padding: 28px 0; font-size: .875rem; }
.site-footer a { color: #fff; margin-right: 12px; }
.site-footer p { margin: 0 0 .4em; }
.site-footer .copy { color: #9aa5b1; }
