/* Libraries' Fabspace/Makerspace Group — design tokens & components */
:root {
  --paper: #f5f2ec;
  --surface: #fffdf9;
  --surface-2: #faf7f1;
  --ink: #1d2a2e;
  --ink-2: #44525a;
  --muted: #7a858a;
  --rule: #e6e0d4;
  --rule-strong: #d3cbba;
  --teal: #0f5a5c;
  --teal-ink: #0a4345;
  --teal-wash: #e5f0ee;
  --copper: #b85a28;
  --copper-wash: #f8e9df;
  --danger: #a3302b;
  --danger-wash: #f9e5e3;
  --ok: #2c6e49;
  --ok-wash: #e4f1e8;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(29, 42, 46, .04), 0 6px 24px -12px rgba(29, 42, 46, .12);
  --serif: "Newsreader", "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --sans: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.75 var(--sans); letter-spacing: .01em;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
  display: flex; flex-direction: column;
}
main { flex: 1; }
a { color: var(--teal); text-decoration-color: color-mix(in srgb, var(--teal) 35%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--teal-ink); text-decoration-color: currentColor; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.35; letter-spacing: .005em; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: 1.85rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 3px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.container { width: min(1080px, 100% - 40px); margin-inline: auto; }
.container.narrow { width: min(720px, 100% - 40px); }
.container.reading { width: min(820px, 100% - 40px); }
.page { padding: 40px 0 72px; }

/* ---- Header ---- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 20; }
.site-header .inner { display: flex; align-items: center; gap: 28px; min-height: 66px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.nb { display: inline-block; }
.brand-sub { font: 600 .8rem/1 var(--sans); letter-spacing: .04em; color: var(--copper); margin-top: 5px; }
.brand-name { font: 600 1.12rem/1.1 var(--serif); letter-spacing: .01em; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { padding: 8px 12px; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: .92rem; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--teal-ink); background: var(--teal-wash); }
.header-search { margin-left: auto; position: relative; }
.header-search input[type=search] { width: 220px; padding: 8px 12px 8px 34px; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); font: inherit; font-size: .88rem; transition: width .2s, border-color .2s, background .2s; }
.header-search input[type=search]:focus { width: 280px; outline: none; border-color: var(--teal); background: var(--surface); }
.header-search svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 15px; height: 15px; color: var(--muted); pointer-events: none; z-index: 1; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 999px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--surface-2); }
.user-menu-panel { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; }
.user-menu-panel .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--rule); margin-bottom: 6px; }
.user-menu-panel .who strong { display: block; font-weight: 600; }
.user-menu-panel a, .user-menu-panel button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: var(--radius-sm); font: inherit; font-size: .9rem; color: var(--ink-2); text-decoration: none; cursor: pointer; }
.user-menu-panel a:hover, .user-menu-panel button:hover { background: var(--surface-2); color: var(--ink); }
.header-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--teal); color: #fff; display: inline-grid; place-items: center; font: 600 .85rem/1 var(--serif); flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: .75rem; }
.avatar.lg { width: 40px; height: 40px; font-size: 1rem; }
.avatar.alt { background: var(--copper); }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 18px; border-radius: 999px; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink); font: 500 .92rem/1.4 var(--sans); text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .05s; }
.btn:hover { background: var(--surface-2); border-color: var(--ink-2); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-ink); border-color: var(--teal-ink); color: #fff; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--rule)); }
.btn.danger:hover { background: var(--danger-wash); border-color: var(--danger); color: var(--danger); }
.btn.sm { padding: 5px 12px; font-size: .82rem; }
.btn.lg { padding: 13px 28px; font-size: 1rem; }
.btn[disabled], .htmx-request.btn { opacity: .6; pointer-events: none; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: .84rem; color: var(--muted); cursor: pointer; text-decoration: none; }
.link-btn:hover { color: var(--teal); text-decoration: underline; }
.link-btn.danger:hover { color: var(--danger); }

/* ---- Messages ---- */
.messages { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 8px; }
.messages li { padding: 11px 16px; border-radius: var(--radius-sm); border: 1px solid var(--rule); background: var(--surface); font-size: .92rem; }
.messages .success { background: var(--ok-wash); border-color: color-mix(in srgb, var(--ok) 30%, white); color: #1e4d33; }
.messages .error { background: var(--danger-wash); border-color: color-mix(in srgb, var(--danger) 30%, white); color: var(--danger); }
.messages .warning { background: var(--copper-wash); border-color: color-mix(in srgb, var(--copper) 30%, white); color: #7a3a15; }

/* ---- Landing ---- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--rule); background:
  radial-gradient(circle at 1px 1px, rgba(15, 90, 92, .16) 1px, transparent 1.2px) 0 0 / 22px 22px, var(--paper); }
.hero::after { content: ""; position: absolute; inset: auto -10% -60% 40%; height: 120%; background: radial-gradient(closest-side, rgba(184, 90, 40, .10), transparent); pointer-events: none; }
.hero .inner { position: relative; z-index: 1; padding: 96px 0 88px; max-width: 760px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font: 600 .72rem/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--copper); margin-bottom: 22px; }
.eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; }
.hero h1 { font-size: clamp(2.2rem, 5.2vw, 3.6rem); line-height: 1.12; letter-spacing: -.01em; margin-bottom: 22px; font-weight: 500; }
.hero h1 em { font-style: italic; color: var(--teal); font-weight: 500; }
.hero .title-ja { font: 600 clamp(1.25rem, 2.6vw, 1.75rem)/1.5 var(--serif); letter-spacing: .05em; color: var(--copper); margin: -4px 0 24px; }
.hero .lede { font-size: 1.08rem; color: var(--ink-2); max-width: 36em; margin-bottom: 32px; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; }
.building { display: inline-flex; align-items: center; gap: 10px; margin: 22px 0 0; padding: 9px 16px; border: 1px solid color-mix(in srgb, var(--copper) 35%, white); background: var(--copper-wash); color: #7a3a15; border-radius: 999px; font-size: .9rem; font-weight: 500; }
.building .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--copper); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .building .dot { animation: none; } }
.section { padding: 64px 0; }
.section + .section { border-top: 1px solid var(--rule); }
.section-head { margin-bottom: 32px; }
.section-head .eyebrow { margin-bottom: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 26px 24px; }
.feature .num { font: italic 500 1.6rem/1 var(--serif); color: var(--copper); display: block; margin-bottom: 14px; }
.feature h3 { margin-bottom: 8px; }
.feature p { color: var(--ink-2); font-size: .92rem; margin: 0; }
.rules { counter-reset: r; list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; max-width: 720px; }
.rules li { padding-left: 22px; position: relative; color: var(--ink-2); }
.rules li::before { content: ""; position: absolute; left: 0; top: .8em; width: 10px; height: 1px; background: var(--copper); }
.band { background: var(--teal); color: #e8f1f0; border-radius: var(--radius); padding: 40px 44px; display: flex; align-items: center; gap: 24px; justify-content: space-between; flex-wrap: wrap; }
.band h2 { color: #fff; margin: 0 0 6px; }
.band p { margin: 0; color: #c7dcda; }
.band .btn { background: #fff; color: var(--teal-ink); border-color: #fff; }
.band .btn:hover { background: var(--teal-wash); }

/* ---- Cards / lists ---- */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.card.pad { padding: 28px 30px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--teal); }
.crumbs .sep { opacity: .5; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 44px; }
.cat-card { display: block; padding: 22px 24px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s; }
.cat-card:hover { border-color: var(--teal); box-shadow: var(--shadow); transform: translateY(-2px); color: var(--ink); }
.cat-card h3 { margin: 0 0 6px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cat-card .n { font: 500 .85rem var(--sans); color: var(--muted); white-space: nowrap; }
.cat-card p { margin: 0; font-size: .88rem; color: var(--ink-2); }

.list-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.list-head h2 { margin: 0; }
.topic-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.topic-row { display: grid; grid-template-columns: 14px 1fr auto; gap: 14px; align-items: start; padding: 18px 22px; border-bottom: 1px solid var(--rule); position: relative; transition: background .12s; }
.topic-row:last-child { border-bottom: 0; }
.topic-row:hover { background: var(--surface-2); }
.topic-row .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 11px; background: transparent; }
.topic-row.unread .dot { background: var(--copper); }
.topic-row.updated .dot { background: var(--teal); }
.topic-row h3 { margin: 0 0 3px; font-size: 1.04rem; font-family: var(--sans); font-weight: 600; }
.topic-row h3 a { color: var(--ink); text-decoration: none; }
.topic-row h3 a::after { content: ""; position: absolute; inset: 0; }
.topic-row.unread h3 a { color: var(--ink); }
.topic-row .meta { font-size: .8rem; color: var(--muted); display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: center; }
.topic-row .snippet { font-size: .88rem; color: var(--ink-2); margin: 4px 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.topic-row .stats { display: flex; gap: 14px; font-size: .82rem; color: var(--muted); align-items: center; white-space: nowrap; }
.stat { display: inline-flex; align-items: center; gap: 5px; }
.stat svg { width: 15px; height: 15px; }
.tag { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .72rem; font-weight: 600; letter-spacing: .02em; background: var(--teal-wash); color: var(--teal-ink); text-decoration: none; position: relative; z-index: 1; }
a.tag:hover { background: color-mix(in srgb, var(--teal-wash) 70%, var(--teal)); color: var(--teal-ink); }
.tag.pin { background: var(--copper-wash); color: #8a4119; }
.tag.new { background: var(--copper); color: #fff; }
.tag.staff { background: var(--ink); color: #fff; }
.empty { padding: 56px 24px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--rule-strong); border-radius: var(--radius); }

/* 画像つきパネル（ホームの最近の動き） */
.panel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.panel { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; transition: border-color .15s, box-shadow .2s, transform .2s; }
.panel:hover { border-color: var(--rule-strong); box-shadow: var(--shadow); transform: translateY(-3px); }
.panel .cover { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); }
.panel .cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.panel:hover .cover img { transform: scale(1.04); }
.panel .cover-empty { height: 100%; display: grid; place-items: center; padding: 20px; text-align: center; background:
  radial-gradient(circle at 1px 1px, rgba(15, 90, 92, .18) 1px, transparent 1.2px) 0 0 / 16px 16px, linear-gradient(135deg, var(--teal-wash), #f3ece0); }
.panel .cover-empty span { font: italic 500 1.25rem/1.4 var(--serif); color: var(--teal-ink); opacity: .75; }
.cover-badges { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px; z-index: 1; }
.cover-badges .tag { box-shadow: 0 1px 4px rgba(0, 0, 0, .18); }
.panel-body { padding: 16px 18px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.panel-body > .tag { align-self: flex-start; }
.panel h3 { margin: 4px 0 0; font: 600 1.02rem/1.5 var(--sans); }
.panel h3 a { color: var(--ink); text-decoration: none; }
.panel h3 a::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.panel .snippet { font-size: .85rem; color: var(--ink-2); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.panel-meta { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 12px; font-size: .78rem; color: var(--muted); }
.panel-meta .who { color: var(--ink-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 9em; }
.panel-meta .spacer { flex: 1; }
.side { display: flex; align-items: center; gap: 18px; }
.thumb { width: 112px; height: 74px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--rule); background: var(--surface-2); display: block; }

.pager { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 28px; font-size: .9rem; color: var(--muted); }

/* ---- Topic detail ---- */
.topic-head h1 { font-size: 1.9rem; margin: 6px 0 14px; }
.byline { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.byline .name { font-weight: 600; line-height: 1.3; }
.byline .sub { font-size: .8rem; color: var(--muted); }
.topic-body { margin-top: 24px; }
.prose { overflow-wrap: anywhere; }
.prose > :last-child { margin-bottom: 0; }
.prose h3, .prose h4, .prose h5 { font-family: var(--sans); font-weight: 700; margin: 1.4em 0 .5em; }
.prose blockquote { margin: 1em 0; padding: .3em 1em; border-left: 3px solid var(--rule-strong); color: var(--ink-2); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.prose code { font: .88em var(--mono); background: var(--surface-2); border: 1px solid var(--rule); padding: .1em .4em; border-radius: 4px; }
.prose pre { background: var(--ink); color: #e9efee; padding: 14px 16px; border-radius: var(--radius-sm); overflow-x: auto; }
.prose pre code { background: none; border: 0; color: inherit; padding: 0; }
.prose table { border-collapse: collapse; margin: 1em 0; font-size: .92rem; }
.prose th, .prose td { border: 1px solid var(--rule-strong); padding: 6px 12px; }
.prose th { background: var(--surface-2); }
.prose ul, .prose ol { padding-left: 1.5em; }

.attachments { margin-top: 18px; display: grid; gap: 12px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumbs a { display: block; border: 1px solid var(--rule); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); line-height: 0; }
.thumbs img { height: 150px; width: auto; max-width: 280px; object-fit: cover; display: block; transition: opacity .15s; }
.thumbs a:hover img { opacity: .88; }
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface-2); text-decoration: none; color: var(--ink); font-size: .86rem; }
.file-chip:hover { border-color: var(--teal); color: var(--teal-ink); }
.file-chip svg { width: 16px; height: 16px; color: var(--copper); flex: none; }
.file-chip small { color: var(--muted); }

.actions { display: flex; align-items: center; gap: 16px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--rule); flex-wrap: wrap; }
.actions form { display: inline; }
.actions .spacer { flex: 1; }
.react-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 13px; border-radius: 999px; border: 1px solid var(--rule-strong); background: var(--surface); font: 500 .84rem var(--sans); color: var(--ink-2); cursor: pointer; transition: all .15s; }
.react-btn:hover { border-color: var(--teal); color: var(--teal-ink); }
.react-btn[aria-pressed="true"] { background: var(--teal-wash); border-color: var(--teal); color: var(--teal-ink); }
.react-btn svg { width: 15px; height: 15px; }

.comments { margin-top: 44px; }
.comments > h2 { display: flex; align-items: baseline; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--rule-strong); margin-bottom: 0; }
.comments > h2 .count { font: 500 .9rem var(--sans); color: var(--muted); }
.comment { display: grid; grid-template-columns: 36px 1fr; gap: 14px; padding: 22px 0; border-bottom: 1px solid var(--rule); scroll-margin-top: 90px; }
.comment:target { background: linear-gradient(90deg, var(--copper-wash), transparent 70%); margin-inline: -16px; padding-inline: 16px; }
.comment.is-new { box-shadow: -3px 0 0 var(--copper); padding-left: 12px; margin-left: -15px; }
.comment-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.comment-head .name { font-weight: 600; }
.comment-head .when { font-size: .8rem; color: var(--muted); }
.comment.is-deleted { opacity: .6; }
.quote { display: block; margin: 4px 0 10px; padding: 7px 12px; border-left: 3px solid var(--rule-strong); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: .84rem; color: var(--ink-2); text-decoration: none; }
.quote strong { color: var(--ink); margin-right: 6px; }
.quote:hover { border-left-color: var(--teal); color: var(--ink); }
.comment .actions { margin-top: 10px; padding-top: 0; border-top: 0; gap: 14px; }

.composer { margin-top: 32px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.composer h3 { font-family: var(--sans); font-size: .95rem; margin-bottom: 10px; }
.reply-bar { display: none; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 10px; border-left: 3px solid var(--copper); background: var(--copper-wash); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: .85rem; }
.reply-bar.on { display: flex; }
.reply-bar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.new-banner { margin: 20px 0 0; padding: 9px 14px; background: var(--copper-wash); color: #7a3a15; border-radius: var(--radius-sm); font-size: .88rem; }

/* ---- Forms ---- */
.field { margin-bottom: 20px; }
.field > label, .field > .label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: var(--ink); }
.req { color: var(--copper); margin-left: 4px; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm);
  background: var(--surface); font: inherit; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.7; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 16%, transparent); }
.help { font-size: .8rem; color: var(--muted); margin-top: 5px; }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--danger); font-size: .84rem; }
.form-error { padding: 11px 16px; border-radius: var(--radius-sm); background: var(--danger-wash); color: var(--danger); margin-bottom: 20px; font-size: .9rem; }
.form-error .errorlist { margin: 0; }
.checkline { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.checkline input { margin-top: 6px; accent-color: var(--teal); }
.radio-cards, #id_notify_mode { display: grid; gap: 10px; list-style: none; padding: 0; margin: 0; }
#id_notify_mode label, .radio-cards label { display: flex; gap: 10px; align-items: center; padding: 11px 14px; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-weight: 500; font-size: .92rem; }
#id_notify_mode label:has(input:checked), .radio-cards label:has(input:checked) { border-color: var(--teal); background: var(--teal-wash); }
#id_notify_mode input, .radio-cards input { accent-color: var(--teal); }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 28px; }
.auth-wrap { max-width: 440px; margin: 40px auto 0; }
.auth-wrap h1 { text-align: center; margin-bottom: 6px; }
.auth-wrap .lede { text-align: center; color: var(--muted); margin-bottom: 28px; }
.auth-links { text-align: center; font-size: .88rem; margin-top: 22px; color: var(--muted); display: grid; gap: 6px; }

/* uploader */
.dropzone { margin-top: 12px; border: 1.5px dashed var(--rule-strong); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: .84rem; background: var(--surface-2); transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--teal); background: var(--teal-wash); color: var(--teal-ink); }
.dropzone input[type=file] { display: none; }
.previews { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.previews:empty { display: none; }
.preview { position: relative; display: flex; align-items: center; gap: 8px; padding: 4px 30px 4px 4px; border: 1px solid var(--rule); background: var(--surface); border-radius: var(--radius-sm); font-size: .8rem; color: var(--ink-2); max-width: 240px; }
.preview img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; }
.preview .ico { width: 40px; height: 40px; display: grid; place-items: center; background: var(--surface-2); border-radius: 4px; color: var(--copper); }
.preview .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview button { position: absolute; right: 4px; top: 50%; translate: 0 -50%; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--surface-2); cursor: pointer; color: var(--muted); line-height: 1; }
.preview button:hover { background: var(--danger-wash); color: var(--danger); }
.existing-files { display: grid; gap: 6px; margin-top: 10px; }
.existing-files label { display: flex; gap: 8px; align-items: center; font-size: .86rem; }

/* ---- Manage ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule-strong); margin-bottom: 24px; }
.tabs a { padding: 10px 16px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--teal-ink); border-bottom-color: var(--teal); }
.tabs .n { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--rule); font-size: .74rem; text-align: center; }
.app-card { padding: 22px 26px; margin-bottom: 14px; }
.app-card header { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; margin-bottom: 10px; flex-wrap: wrap; }
.app-card h3 { margin: 0; }
.kv { display: grid; grid-template-columns: 8em 1fr; gap: 6px 16px; font-size: .9rem; margin: 0 0 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.app-actions { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--rule); }
.reject-form { display: none; width: 100%; margin-top: 8px; }
.reject-form.on { display: block; }

/* ---- Legal ---- */
.legal h2 { font-size: 1.12rem; margin-top: 2em; padding-top: 1em; border-top: 1px solid var(--rule); }
.legal h2:first-of-type { border-top: 0; margin-top: 1em; }
.legal ol, .legal ul { padding-left: 1.4em; color: var(--ink-2); }
.draft-note { padding: 10px 14px; background: var(--copper-wash); border-radius: var(--radius-sm); color: #7a3a15; font-size: .86rem; }

/* ---- Footer ---- */
.site-footer { border-top: 1px solid var(--rule); padding: 28px 0 36px; color: var(--muted); font-size: .82rem; background: var(--surface); }
.site-footer .inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }
.site-footer .operator { display: inline-block; margin-top: 4px; }
.site-footer nav { display: flex; gap: 18px; }

@media (max-width: 820px) {
  .grid-3 { grid-template-columns: 1fr; }
  .site-header .inner { gap: 12px; flex-wrap: wrap; padding: 10px 0; }
  .header-search { order: 5; width: 100%; margin-left: 0; }
  .header-search input[type=search], .header-search input[type=search]:focus { width: 100%; }
  .nav { order: 4; width: 100%; margin: 0; overflow-x: auto; }
  .user-menu { margin-left: auto; }
  .hero .inner { padding: 64px 0; }
  .topic-row { grid-template-columns: 12px 1fr; padding: 16px; }
  .topic-row .side { grid-column: 2; justify-content: space-between; flex-direction: row-reverse; }
  .band { padding: 28px; }
  .card.pad { padding: 22px 18px; }
  .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: 8px; }
}
@media print { .site-header, .site-footer, .actions, .composer { display: none; } body { background: #fff; } }
