:root {
  color-scheme: light;
  --paper: #f7f7f0;
  --white: #fffefa;
  --ink: #172824;
  --muted: #58675d;
  --line: #d8dfd4;
  --accent: #ccec9d;
  --danger: #992d2e;
  font: 16px/1.55 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #427148; outline-offset: 2px;
}
h1, h2, p { margin: 0; }
input, select, textarea {
  width: 100%; min-width: 0; padding: .65rem .8rem; border: 1px solid var(--line);
  border-radius: .55rem; background: var(--white);
}
textarea { resize: vertical; }
label { display: block; margin: .75rem 0 .3rem; font-weight: 600; font-size: .89rem; }
.primary, .secondary {
  border-radius: .55rem; padding: .65rem .95rem; font-weight: 650; white-space: nowrap;
}
.primary { border: 1px solid var(--ink); background: var(--ink); color: var(--white); }
.primary:hover { background: #31483d; }
.secondary { border: 1px solid var(--line); background: var(--white); }
.secondary:hover { background: #eaf0e4; }
.muted { color: var(--muted); font-size: .9rem; }
.message { color: var(--danger); font-size: .87rem; margin-top: .5rem; overflow-wrap: anywhere; }
.message:empty { display: none; }
.input-row { display: flex; gap: .45rem; }
.input-row input { flex: 1; }
.brand { display: flex; align-items: center; gap: .65rem; font-weight: 750; }
.mark { display: inline-grid; place-items: center; width: 2.15rem; height: 2.15rem; border-radius: .65rem; background: var(--accent); }
.mark::after { content: ""; width: .95rem; height: .95rem; border: .18rem solid var(--ink); border-radius: .28rem; transform: rotate(45deg); }
.gate { min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.intro {
  padding: clamp(2rem, 5vw, 5rem); display: flex; flex-direction: column; justify-content: space-between;
  gap: 3rem; color: var(--white); background: radial-gradient(ellipse at top right, #395947, transparent 62%), var(--ink);
}
.intro h1 { font-size: clamp(2.5rem, 5.3vw, 5.5rem); line-height: 1.15; letter-spacing: -.075em; }
.intro p { color: #d1ded0; max-width: 25ch; margin-top: 1.5rem; }
.intro-footer { color: var(--accent); font-size: .9rem; }
.entry { display: grid; place-items: center; padding: 2rem; }
.entry-inner { width: min(100%, 25rem); }
.entry h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: .35rem; }
.switch, .filters { display: flex; flex-wrap: wrap; gap: .3rem; }
.switch { margin-bottom: 1.6rem; }
.switch button, .filters button { background: transparent; border: 1px solid transparent; padding: .45rem .75rem; border-radius: .5rem; }
.switch [aria-pressed="true"], .filters [aria-pressed="true"] { background: #e4eccf; border-color: #cedabb; font-weight: 650; }
.check { display: flex; align-items: center; gap: .45rem; }
.check input { width: 1rem; height: 1rem; accent-color: var(--ink); }
#access-submit { margin-top: 1rem; width: 100%; }
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .8rem clamp(1rem, 4vw, 3.5rem); color: var(--white); background: var(--ink);
}
.toolbar-actions, .detail-actions, .dialog-actions { display: flex; gap: .5rem; }
.toolbar-actions button { background: transparent; color: var(--white); border-color: #7d9282; }
.toolbar-actions button:hover { background: #31483d; }
.vault-layout { max-width: 77rem; margin: 0 auto; display: grid; grid-template-columns: minmax(18rem, 2fr) minmax(0, 3fr); }
.catalog, .detail { padding: clamp(1rem, 3.5vw, 2.75rem); min-width: 0; }
.catalog { border-right: 1px solid var(--line); min-height: calc(100svh - 4.5rem); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.section-heading h1 { font-size: clamp(1.25rem, 3vw, 1.85rem); }
.search { margin: 1.1rem 0 .65rem; }
.items { list-style: none; padding: 0; margin: .9rem 0; display: grid; gap: .4rem; }
.item {
  width: 100%; text-align: left; padding: .7rem .85rem; border: 1px solid var(--line);
  border-radius: .6rem; background: var(--white); overflow-wrap: anywhere;
}
.item[aria-current="true"], .item:hover { background: #eaf0e1; border-color: #a6bc9c; }
.item strong, .item small { display: block; }
.empty { color: var(--muted); padding: 1.2rem 0; }
.detail h2 { font-size: clamp(1.5rem, 4vw, 2.35rem); overflow-wrap: anywhere; }
.detail dt { color: var(--muted); font-size: .88rem; margin-top: 1rem; }
.detail dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail dd button { margin: .35rem .35rem 0 0; padding: .3rem .65rem; }
.detail dd span + button { margin-inline-start: .5rem; }
.detail-actions { margin-top: 1.3rem; }
.danger { color: var(--danger); }
.back { display: none; }
dialog {
  width: min(calc(100% - 1.5rem), 34rem); max-height: calc(100svh - 1.5rem);
  border: 1px solid var(--line); border-radius: .8rem; padding: clamp(1rem, 4vw, 2rem);
  background: var(--paper); color: var(--ink);
}
dialog::backdrop { background: #17282488; }
.dialog-actions { justify-content: flex-end; margin-top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 700px) {
  .gate { display: block; }
  .intro { padding: 1.5rem; gap: 1.5rem; }
  .intro h1 { font-size: 2.25rem; }
  .intro h1 br, .intro-footer { display: none; }
  .intro p { margin-top: .5rem; max-width: 34ch; }
  .entry { padding: 1.5rem 1rem 2.5rem; }
  .vault-layout { display: block; }
  .catalog { min-height: 0; border: 0; }
  .detail, .workspace.show-detail .catalog { display: none; }
  .workspace.show-detail .detail { display: block; }
  .back { display: inline-block; margin-bottom: 1rem; }
  .toolbar .brand { font-size: .9rem; gap: .35rem; }
  .toolbar-actions button { padding: .45rem .55rem; font-size: .85rem; }
}
