:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #283228;
  background: #f7f6ee;
  --ink: #283228;
  --forest: #203f34;
  --soft: #e6eee7;
  --yellow: #f7be69;
  --line: #dcded2;
  --muted: #58645a;
  --surface: #fffef9;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #ba6b19; outline-offset: 3px; }
.top { min-height: 70px; padding: .85rem clamp(1rem,3vw,3rem); background: var(--forest); color: white; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.identity, .session { display: flex; gap: .7rem; align-items: center; }
.identity-mark { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: .65rem; background: var(--yellow); color: var(--forest); font-weight: 850; }
.identity strong { font-size: 1.13rem; }
.identity small { display: block; color: #e3eae2; }
.session label { display: flex; align-items: center; gap: .5rem; }
.session select { padding: .4rem .65rem; }
.login { display: grid; justify-content: center; padding: 12vh 1rem 2rem; }
.login .panel { width: min(25rem, calc(100vw - 2rem)); padding: 1.6rem; }
.login label { margin-block: .95rem; }
.kicker { font-weight: 700; color: #79501f; margin: 0 0 .5rem; }
.workspace { display: grid; grid-template-columns: minmax(12rem, 17vw) minmax(0, 1fr); min-height: calc(100dvh - 70px); }
aside { background: #efefe5; padding: 1.2rem .85rem; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; }
nav { display: grid; gap: .3rem; }
nav button { border: 0; background: transparent; color: var(--ink); padding: .65rem .75rem; text-align: left; border-radius: .5rem; }
nav button[aria-current="page"] { font-weight: 720; color: #1c362a; background: #dbe7dc; }
.stage { font-size: .8rem; color: var(--muted); padding: 1rem .75rem 0; }
main { padding: 1.5rem clamp(1rem, 3vw, 2.4rem); }
.page-header { display: flex; flex-wrap: wrap; gap: .9rem; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
h1 { font-size: clamp(1.55rem, 3.3vw, 2.4rem); line-height: 1.18; margin: 0; letter-spacing: -.035em; }
h2 { font-size: 1.23rem; margin: 0; }
.primary, .secondary { color: var(--ink); border: 1px solid transparent; border-radius: .48rem; background: var(--yellow); padding: .55rem .8rem; min-height: 2.45rem; font-weight: 650; }
.secondary { background: var(--surface); border-color: var(--line); }
.primary:hover, .secondary:hover { border-color: #819182; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .9rem; }
.metric, .panel { border: 1px solid var(--line); background: var(--surface); border-radius: .68rem; padding: .9rem 1rem; }
.metric small { display: block; color: var(--muted); margin-bottom: .35rem; }
.metric strong { font-size: 2rem; }
section { margin-top: 1rem; }
section h2 { margin-bottom: .7rem; }
.table-frame { background: var(--surface); border: 1px solid var(--line); border-radius: .65rem; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead { background: var(--soft); }
td, th { text-align: left; padding: .72rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
td .actions { min-width: 9rem; }
td button { font-size: .82rem; min-height: 2rem !important; }
td small { display: block; color: var(--muted); margin-top: .35rem; }
.empty { color: var(--muted); margin: 0; padding: .85rem; }
#notice { border: 1px solid #b6cbbb; background: var(--soft); border-radius: .45rem; padding: .7rem; }
.error { color: #a62222; }
.error:empty { display: none; }
label { display: grid; gap: .26rem; font-size: .88rem; font-weight: 650; }
input, select { min-width: 0; width: 100%; padding: .53rem .6rem; min-height: 2.35rem; border: 1px solid #c4cbbb; background: white; color: var(--ink); border-radius: .4rem; }
input[type=checkbox] { width: 1.15rem; min-height: 1.15rem; }
.checkbox { display: flex; align-items: center; gap: .45rem; }
dialog { width: min(44rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); border: 1px solid var(--line); border-radius: .8rem; background: var(--surface); color: var(--ink); padding: 1.1rem; }
dialog::backdrop { background: #172b23a0; }
.dialog-head, .dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.dialog-actions { justify-content: flex-end; margin-top: .9rem; }
#editor-fields { display: grid; gap: .8rem; margin-block: .9rem; }
fieldset { border: 1px solid var(--line); border-radius: .45rem; margin: 0; min-width: 0; }
.editor-row { display: grid; grid-template-columns: repeat(auto-fit,minmax(8rem,1fr)); gap: .65rem; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.editor-row + button { margin-top: .6rem; }
.doc-detail { max-width: 34rem; overflow-wrap: anywhere; }
.doc-detail dl { display: grid; grid-template-columns: minmax(7rem,auto) 1fr; gap: .4rem; margin: .55rem 0; }
.doc-detail dd { margin: 0; }
@media (max-width: 760px) {
  .workspace { grid-template-columns: 1fr; }
  aside { border-right: 0; padding: .5rem; overflow-x: auto; }
  nav { display: flex; width: max-content; }
  nav button { white-space: nowrap; }
  .stage { display: none; }
  .session label { font-size: 0; }
  .session select { font-size: .81rem; }
}
@media (max-width: 435px) {
  .identity small { display: none; }
  .top { padding-inline: .55rem; gap: .4rem; }
  .identity { gap: .3rem; }
  .session { gap: .3rem; }
  .session select { max-width: 8rem; }
}
