:root {
  --ink: #182d40;
  --muted: #526375;
  --navy: #142c40;
  --line: #dce1e4;
  --paper: #fbfbf8;
  --brass: #d4ac74;
  --font: "Source Han Sans", "源ノ角ゴシック", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, system-ui, sans-serif;
  font-family: var(--font);
  font-size: 100%;
  color: var(--ink);
  background: var(--paper);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, input, select, textarea { color: inherit; font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
button { -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .55; cursor: wait; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #a66624; outline-offset: 3px; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; z-index: 20; top: .65rem; left: .65rem; padding: .65rem; background: white; }
.shell { min-height: 100vh; display: grid; grid-template-columns: clamp(13.75rem, 18.4vw, 17.75rem) minmax(0, 1fr); }
.rail { min-width: 0; position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: #f3f4ef; border-right: 1px solid #dce1da; }
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; min-width: 0; }
.rail > .brand { padding: 0 clamp(.9rem, 1.9vw, 2rem); min-height: 5.5rem; }
.brand-type { display: flex; flex-direction: column; gap: .12rem; }
.brand-type strong { font: 750 clamp(.91rem, 1.13vw, 1.15rem)/1.1 "Segoe UI", Arial, sans-serif; letter-spacing: .047em; white-space: nowrap; }
.brand-type > span { color: #667260; font-size: .74rem; font-weight: 600; letter-spacing: .095em; }
.brand-mark { width: 2.4rem; height: 2.4rem; display: flex; align-items: center; justify-content: center; gap: .125rem; flex: 0 0 auto; border-radius: .45rem; background: var(--navy); }
.brand-mark i { display: block; width: .23rem; background: #f4eee2; height: 1.05rem; transform: skewY(-15deg); }
.brand-mark i:first-child { height: .85rem; margin-top: .22rem; }
.brand-mark i:last-child { height: 1.17rem; background: var(--brass); margin-top: -.15rem; }
.rail-content { display: flex; flex-direction: column; padding: 1.95rem clamp(.75rem, 1.3vw, 1.5rem) 0; flex: 1; min-height: 0; }
.rail-content nav { flex: 1; overflow: auto; min-height: 0; }
.rail-heading { font-size: .76rem; line-height: 1.3; font-weight: 650; color: #647161; letter-spacing: .08em; margin: 0 .75rem .65rem; }
.categories-heading { margin-top: 2rem; }
.nav-item { border: 0; background: transparent; width: 100%; display: flex; gap: .8rem; align-items: center; text-align: left; padding: .73rem .8rem; min-height: 2.8rem; font-size: .91rem; line-height: 1.4; font-weight: 560; border-radius: .43rem; color: #41504e; }
.nav-item .icon { font-size: 1.06rem; color: #657069; }
.nav-item { text-decoration: none; }
.nav-item:hover { background: #e8ece4; }
.nav-item.active { color: var(--ink); background: #e0e7dc; font-weight: 700; }
.nav-item.active .icon { color: #344f41; }
.nav-count { margin-left: auto; color: #4c5c4c; font: 600 .75rem "Segoe UI", Arial, sans-serif; }
.account { margin-top: 1rem; border-top: 1px solid #d8ddd5; padding: 1.2rem 0 1.35rem; display: flex; align-items: center; gap: .58rem; }
.avatar, .login-icon { display: grid; place-items: center; border-radius: 50%; color: #4b6758; background: #dee8dd; }
.avatar { width: 2.35rem; height: 2.35rem; flex: 0 0 auto; font-weight: 600; }
.account-copy { display: flex; flex-direction: column; min-width: 0; gap: .15rem; }
.account-copy strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .875rem; }
.account-copy > span { color: var(--muted); font-size: .76rem; }
.signout { margin-left: auto; }
.icon-button { display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--muted); border-radius: .38rem; font-size: 1.1rem; min-width: 2.45rem; min-height: 2.45rem; }
.icon-button:hover { background: #e4e9e6; color: var(--ink); }
.mobile-toggle { display: none; }
#main { min-width: 0; }
.topbar { min-height: 4.4rem; border-bottom: 1px solid var(--line); background: #fff; display: flex; align-items: center; justify-content: space-between; padding: .7rem clamp(1.35rem, 3.6vw, 4.25rem); gap: .7rem; }
.breadcrumbs, .access-tag { display: flex; align-items: center; }
.breadcrumbs { gap: .85rem; color: #63707a; font-size: .85rem; }
.breadcrumbs > span:nth-child(2) { color: #a0a9aa; }
.breadcrumbs strong { color: var(--ink); font-weight: 580; }
.breadcrumbs a { text-decoration: none; color: var(--ink); }
.breadcrumbs a:hover, .return-home:hover { text-decoration: underline; text-underline-offset: .22em; }
.breadcrumbs { flex-wrap: wrap; }
.access-tag { gap: .4rem; color: #526257; font-size: .78rem; font-weight: 600; }
.page-content { max-width: 100rem; padding: clamp(1.4rem, 2.3vw, 2.65rem) clamp(1.35rem, 3.6vw, 4.25rem) 4rem; margin: auto; }
.hero { isolation: isolate; position: relative; overflow: hidden; display: flex; align-items: center; min-height: clamp(16.8rem, 22vw, 22.2rem); background: var(--navy); color: white; border-radius: .9rem; }
.hero-picture, .hero::after { position: absolute; inset: 0; z-index: -1; }
.hero-picture { background: var(--navy) url("assets/archive.webp") center 53% / cover no-repeat; }
.hero::after { content: ""; background: linear-gradient(90deg, #132a3df5 0%, #142c40f2 23%, #142b3fe5 37%, #162c40a6 56%, #15273926 78%, #17293912 100%); }
.hero-copy { width: 100%; padding: clamp(1.7rem, 3.3vw, 3.7rem); }
.hero-rule { width: 2.45rem; height: .19rem; border-radius: .1rem; background: #d8ad70; margin-bottom: 1.12rem; }
.hero h1, .login-visual h1 { color: #fff; font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", "MS PMincho", Georgia, serif; font-weight: 600; font-size: clamp(2.15rem, 3.4vw, 3.75rem); line-height: 1.3; letter-spacing: .035em; margin: 0; }
.hero p, .login-visual-copy p { color: #eff2f2; font-size: .93rem; line-height: 1.8; margin: .65rem 0 0; }
.search-box { display: flex; align-items: center; max-width: min(29.5rem, 67%); background: #fff; padding: .31rem; border: 1px solid #ecece7; border-radius: .45rem; margin-top: 1.35rem; color: var(--ink); box-shadow: 0 2px 9px #0000000c; }
.search-box > .icon { margin-inline: .6rem .55rem; font-size: 1.1rem; }
.search-box input { flex: 1; min-width: 0; padding: .55rem 0; border: 0; background: transparent; font-size: .92rem; outline: none; }
.search-box:focus-within { outline: 2px solid var(--brass); outline-offset: 2px; }
.search-box input:focus-visible { outline: 0; }
.search-box input::placeholder { color: #64717b; opacity: 1; }
.search-box button { border: 0; background: #e7ece6; color: #223e34; border-radius: .25rem; padding: .52rem 1.12rem; font-weight: 650; font-size: .88rem; }
.search-box button:hover { background: #d6e0d5; }
.library { margin-top: clamp(1.8rem, 2.8vw, 3.15rem); }
.category-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; }
.category-card { display: flex; align-items: center; gap: .85rem; position: relative; min-height: 6.35rem; padding: 1.1rem; background: white; border: 1px solid #d8dfd8; border-radius: .57rem; color: var(--ink); text-decoration: none; }
.category-card:hover { background: #f6f8f3; border-color: #7b907e; }
.card-glyph { width: 2.7rem; height: 2.7rem; border-radius: .58rem; flex: 0 0 auto; font-size: 1.2rem; }
.card-glyph:not(.cat-0,.cat-1,.cat-2,.cat-3,.cat-4) { color: #546169; background: #e9edec; }
.card-copy { display: grid; min-width: 0; gap: .28rem; }
.card-name { font-size: 1rem; font-weight: 675; line-height: 1.4; overflow-wrap: anywhere; }
.card-count { font-size: .82rem; color: var(--muted); }
.return-home { display: inline-flex; align-items: center; gap: .4rem; text-decoration: none; color: #3e5c4f; font-size: .85rem; font-weight: 600; padding-block: .3rem; margin-bottom: .65rem; }
.home-status { color: var(--muted); padding: 1rem; border: 1px solid var(--line); border-radius: .5rem; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1rem; font-size: .87rem; }
.pagination button:disabled { cursor: default; }
.page-content > .feedback { margin-top: 1rem; }
.section-head, .section-title, .list-tools { display: flex; align-items: center; }
.section-head { justify-content: space-between; gap: .75rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.section-title { gap: .65rem; }
.section-title h2 { margin: 0; font-size: clamp(1.3rem, 1.8vw, 1.85rem); line-height: 1.45; letter-spacing: .025em; font-weight: 700; }
.result-count { font-size: .85rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.list-tools { gap: .55rem; }
.sort-control { display: inline-flex; align-items: center; position: relative; font-size: .84rem; }
.sort-control > .icon { position: absolute; pointer-events: none; }
.sort-control > .icon:first-child { left: .65rem; }
.sort-control > .icon:last-child { right: .65rem; font-size: .68rem; }
.sort-control select { border: 1px solid #ccd4d6; border-radius: .4rem; padding: .56rem 1.88rem .56rem 1.9rem; background: white; appearance: none; }
.button { border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border-radius: .42rem; font-size: .94rem; line-height: 1.45; font-weight: 650; text-decoration: none; padding: .65rem 1rem; min-height: 2.68rem; }
.button.primary { background: var(--navy); color: #fff; }
.button.primary:hover { background: #234963; }
.button.secondary { background: #fff; border-color: #cbd4d5; }
.button.secondary:hover { background: #eef1ed; }
.button.compact { font-size: .84rem; min-height: 0; padding: .55rem .78rem; }
.active-filter { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; font-size: .86rem; margin-bottom: .9rem; overflow-wrap: anywhere; }
.active-filter button, .text-button { border: 0; background: transparent; color: #315c56; cursor: pointer; text-decoration: underline; text-underline-offset: .19em; font-weight: 650; }
.feedback { color: #23583f; padding: .7rem .9rem; border: 1px solid #bbcfc0; background: #eef5ee; margin-bottom: .8rem; border-radius: .4rem; }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: .65rem; overflow: hidden; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { background: #eff2ed; color: #5a685e; font-size: .78rem; font-weight: 600; letter-spacing: .045em; text-align: left; padding: .78rem .75rem; }
th:first-child, td:first-child { padding-left: clamp(.85rem, 1.45vw, 1.65rem); }
th.col-category { width: 20%; }
th.col-updated { width: 7.3rem; }
th.col-open { width: 3.4rem; }
td { padding: .93rem .75rem; border-top: 1px solid #e5e8e4; vertical-align: middle; }
tbody tr:hover, tbody tr:focus-within { background: #fafbf8; }
.doc-cell { display: flex; align-items: center; gap: .85rem; }
.file-icon { width: 2.45rem; height: 2.8rem; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #eadfd2; background: #f8f3ec; color: #8b6550; border-radius: .46rem; font-size: 1.28rem; }
.doc-copy { min-width: 0; }
.doc-name { text-align: left; padding: 0; line-height: 1.5; font-size: 1rem; font-weight: 675; border: 0; background: none; overflow-wrap: anywhere; }
.doc-name:hover { text-decoration: underline; text-underline-offset: .18em; }
.doc-meta { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: .55rem; margin-top: .19rem; line-height: 1.45; font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }
.doc-meta span + span { padding-left: .55rem; border-left: 1px solid #d1d9da; }
.category-pill { display: inline-block; border-radius: .28rem; padding: .23rem .47rem; font-size: .76rem; font-weight: 600; line-height: 1.45; color: #425568; background: #e9eef2; }
.cat-0 { background: #e6eee4; color: #385842; }
.cat-1 { background: #e4ecee; color: #3e5b67; }
.cat-2 { background: #f2e9d8; color: #705729; }
.cat-3 { background: #e8edf8; color: #435879; }
.cat-4 { background: #eee8f2; color: #674d74; }
.date-cell { font: 500 .84rem/1.5 "Segoe UI", var(--font); font-variant-numeric: tabular-nums; color: #506170; }
.open-link { width: 2.2rem; min-height: 2.2rem; display: inline-grid; place-items: center; color: #68776c; border-radius: .35rem; text-decoration: none; }
.open-link:hover { background: #e8eee7; color: var(--navy); }
.mobile-date { display: none; }
.empty-state { padding: 3.4rem 1rem; display: flex; align-items: center; flex-direction: column; gap: .6rem; text-align: center; }
.state-icon { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: .65rem; color: #54665a; background: #e9eee7; font-size: 1.35rem; }
.empty-state strong { font-size: 1.06rem; margin-top: .1rem; }
.empty-state p { margin: 0; color: var(--muted); font-size: .91rem; }
.empty-state p:empty { display: none; }
.empty-state .button { margin-top: .3rem; }
dialog { width: min(32rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); margin: auto; border: 1px solid #c9d1ce; border-radius: .8rem; padding: clamp(1.2rem, 3vw, 2rem); color: var(--ink); box-shadow: 0 1.8rem 5rem #0c182747; }
dialog::backdrop { background: #13263495; }
body:has(dialog[open]) { overflow: hidden; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.dialog-kicker { font-size: .8rem; font-weight: 650; color: #5b6b5c; }
dialog h2 { margin: .42rem 0 1.25rem; font-size: 1.55rem; line-height: 1.45; overflow-wrap: anywhere; }
.detail-description { white-space: pre-wrap; color: var(--muted); font-size: .95rem; line-height: 1.8; overflow-wrap: anywhere; }
.metadata { margin: 1rem 0 1.5rem; }
.metadata > div { border-top: 1px solid var(--line); display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: .65rem; padding: .62rem 0; font-size: .9rem; }
.metadata dt { color: var(--muted); }
.metadata dd { margin: 0; overflow-wrap: anywhere; }
.dialog-actions, .text-button { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.revision-actions { border-top: 1px solid var(--line); margin-top: 1.2rem; padding-top: .9rem; }
.text-button { font-size: .9rem; padding: .35rem 0; }
#edit-form, #new-fields { display: grid; gap: .85rem; }
#new-fields { border: 0; margin: 0; padding: 0; min-width: 0; }
#edit-form label { display: block; font-size: .91rem; font-weight: 650; min-width: 0; }
#edit-form input, #edit-form textarea, #edit-form select { display: block; width: 100%; padding: .55rem .65rem; border: 1px solid #b9c5c6; border-radius: .35rem; background: white; font-weight: 450; font-size: 1rem; margin-top: .3rem; }
#edit-form textarea { resize: vertical; }
#edit-form small { color: var(--muted); font-weight: 450; font-size: .78rem; }
#edit-form input[type=file] { padding: .5rem; font-size: .87rem; }
.form-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.form-error { margin: 0; font-size: .92rem; color: #922c1d; background: #fff2eb; padding: .7rem; border-radius: .35rem; }
.login-layout { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 54% 46%; }
.login-visual { position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; padding: clamp(2rem, 4.5vw, 5.5rem); background: #142c40 url("assets/archive.webp") 77% center / cover; color: white; }
.login-visual::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, #102638f9, #132b3a76 64%, #132a3bc9); }
.login-brand .brand-mark { background: #e3e8df; }
.login-brand .brand-mark i { background: #183647; }
.login-brand .brand-mark i:last-child { background: #977038; }
.login-brand .brand-type > span { color: #e2e9e4; }
.login-visual-copy { margin: 3rem 0 1.5rem; }
.login-visual h1 { font-size: clamp(2rem, 3.55vw, 4.25rem); }
.login-panel { display: grid; place-items: center; padding: 2rem; }
.login-card { max-width: 23.5rem; width: 100%; }
.login-icon { width: 3.4rem; height: 3.4rem; border-radius: .85rem; font-size: 1.55rem; }
.login-card h2 { font-size: clamp(1.8rem, 2.5vw, 2.7rem); margin: 1.25rem 0 .65rem; }
.login-card p { color: var(--muted); margin: 0; line-height: 1.85; }
.login-card #login-error { margin-top: 1rem; padding: .75rem .9rem; color: #922c1d; background: #fff1e9; border-left: .2rem solid #b96541; font-size: .91rem; }
.login-action { margin: 2rem 0 1rem; width: 100%; min-height: 3.2rem; }
.login-note { display: flex; align-items: center; justify-content: center; gap: .4rem; font-size: .82rem; color: var(--muted); }
@media (min-width: 110rem) { .rail > .brand { min-height: 6rem; } .hero { min-height: 22rem; } }
@media (max-width: 67rem) {
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shell { grid-template-columns: 12.7rem minmax(0,1fr); }
  th.col-updated { width: 6.2rem; } th.col-open { width: 2.8rem; }
  .page-content { padding-inline: 1.55rem; } .topbar { padding-inline: 1.55rem; }
  .search-box { max-width: min(27rem, 79%); }
  td, th { padding-inline: .5rem; }
}
@media (max-width: 51rem) {
  .shell { display: block; }
  .rail { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail > .brand { min-height: 4.1rem; padding: 0 1.3rem; align-self: flex-start; }
  .brand-type strong { font-size: 1rem; }
  .mobile-toggle { position: absolute; display: grid; right: 1rem; top: .82rem; font-size: 1.32rem; }
  .rail-content { display: none; padding: .8rem 1.15rem .1rem; border-top: 1px solid var(--line); }
  .rail.expanded .rail-content { display: flex; }
  .rail-heading { margin-top: .35rem; } .categories-heading { margin-top: 1.15rem; }
  .account { padding: .65rem .75rem; margin-top: .7rem; }
  .topbar { min-height: 3.3rem; }
  .page-content { padding-top: 1.2rem; }
  .hero { min-height: 16rem; }
  .hero-copy { padding: 2rem; }
  .hero h1 { font-size: clamp(2.1rem, 6vw, 3rem); }
}
@media (max-width: 36rem) {
  .category-grid { gap: .55rem; }
  .category-card { flex-direction: column; align-items: flex-start; justify-content: flex-start; min-height: 7.1rem; padding: .85rem; gap: .55rem; }
  .card-glyph { width: 2.05rem; height: 2.05rem; font-size: 1rem; }
  .card-name { font-size: .94rem; }
  .card-copy { gap: .18rem; }
  .page-content { padding: 1rem .9rem 2.5rem; }
  .topbar { padding: .6rem 1rem; } .breadcrumbs { gap: .5rem; font-size: .78rem; }
  .rail > .brand { padding-inline: 1rem; }
  .hero { min-height: 14.4rem; border-radius: .62rem; }
  .hero::after { background: linear-gradient(90deg, #112a3df5, #142b3fe8 33%, #152b3e83 75%, #152b3e52); }
  .hero-copy { padding: 1.55rem 1.15rem; }
  .hero-rule { margin-bottom: .85rem; }
  .hero h1 { font-size: clamp(1.55rem, 6.8vw, 2.2rem); }
  .hero p { font-size: .86rem; max-width: 19rem; }
  .search-box { max-width: 100%; margin-top: 1.1rem; }
  .search-box input { font-size: 1rem; } .search-box button { padding-inline: .85rem; }
  .library { margin-top: 1.6rem; }
  .section-head { align-items: flex-start; row-gap: .72rem; }
  .section-title h2 { font-size: 1.25rem; }
  .section-title { gap: .4rem; } .result-count { font-size: .78rem; }
  .list-tools { flex-wrap: wrap; }
  .sort-control select { font-size: .78rem; }
  .col-category, .col-updated, .cat-cell, .date-cell { display: none; }
  th.col-open { width: 2.8rem; }
  .doc-cell { gap: .6rem; } .doc-name { font-size: .98rem; }
  .mobile-date { display: inline; }
  .doc-meta { font-size: .75rem; }
  .file-icon { width: 2.12rem; height: 2.5rem; }
  .login-layout { display: flex; flex-direction: column; }
  .login-visual { min-height: 32vh; padding: 1.4rem; }
  .login-visual-copy { margin: 2.1rem 0 0; }
  .login-visual h1 { font-size: 2rem; }
  .login-panel { padding: 2rem 1.45rem; flex: 1; }
}
@media (max-width: 23rem) { .form-pair { grid-template-columns: 1fr; } .access-tag { gap: .2rem; } .list-tools { width: 100%; } }
@media (max-width: 20rem) { .category-grid { grid-template-columns: 1fr; } .category-card { flex-direction: row; align-items: center; min-height: 4rem; } }
@media (prefers-reduced-motion: no-preference) { button, a { transition: background-color .14s ease, color .14s ease; } }
