:root {
  color-scheme: light;
  color: #22251f;
  background: #f5f4ed;
  font-family: system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  --line: #d6d7cb;
  --muted: #50594b;
  --accent: #283e30;
}

* { box-sizing: border-box; }
body { margin: 0; }
.top { border-bottom: 1px solid var(--line); background: #fbfaf6; }
.top-inner {
  max-width: 52rem;
  min-height: 4rem;
  padding: .6rem 1.25rem;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { color: inherit; text-decoration: none; font-family: Georgia, serif; font-size: 1.45rem; font-weight: 700; }
.brand span { color: var(--muted); font-family: system-ui, sans-serif; font-size: .9rem; font-weight: 550; }
main { max-width: 52rem; margin: auto; padding: clamp(1.5rem, 6vw, 3rem) 1.25rem; }
main.login { max-width: 30rem; }
h1, h2 { font-family: Georgia, serif; font-weight: 650; line-height: 1.15; margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: 1.25rem; }
h2 { font-size: 1.4rem; }
p { margin: .6rem 0 0; }
.panel { padding: clamp(1rem, 4vw, 1.5rem); background: #fffefa; border: 1px solid var(--line); border-radius: .65rem; }
.panel + .panel { margin-top: 1rem; }
button, input { font: inherit; }
button, summary { cursor: pointer; }
button {
  min-height: 2.75rem;
  padding: .5rem .9rem;
  border: 1px solid transparent;
  border-radius: .35rem;
  background: var(--accent);
  color: white;
  font-weight: 600;
}
button:hover { background: #365541; }
button.quiet { color: var(--accent); background: transparent; }
button.quiet:hover { background: #eaece2; }
button.danger { background: #7e3029; }
button.danger:hover { background: #62302a; }
:focus-visible { outline: 3px solid #317147; outline-offset: 3px; }
.login-form { display: grid; gap: .5rem; }
.login-form label, .device-editor label { font-weight: 600; }
.login-form input, .device-editor input { width: 100%; min-height: 2.75rem; padding: .45rem .65rem; border: 1px solid #93998a; border-radius: .35rem; background: #fff; }
.login-form input + label { margin-top: .65rem; }
.login-form button { margin-top: .65rem; }
.notice { margin: 0 0 .5rem; color: #7e3029; }
.server-url { margin-bottom: 1rem; overflow-wrap: anywhere; }
.pair-code { border-left: 3px solid var(--accent); background: #ebefe7; padding: .55rem 1rem .8rem; }
.pair-code p { font-size: .9rem; color: var(--muted); }
.pair-code output { display: block; font: 700 clamp(1.15rem, 5vw, 1.65rem) / 1.5 monospace; }
.device-editor { display: grid; gap: .45rem; }
.device-editor button { justify-self: start; }
.pairing-form { max-width: 21rem; }
.pairing-form label span { font-weight: 400; color: var(--muted); }
.devices { list-style: none; margin: .85rem 0 0; padding: 0; }
.devices li { display: grid; gap: .75rem; padding: .9rem 0; border-top: 1px solid var(--line); }
.devices li:last-child { padding-bottom: 0; }
.device-identity h3 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.devices code { overflow-wrap: anywhere; color: #293b2e; }
.devices p { margin-top: .2rem; font-size: .875rem; color: var(--muted); }
.devices button { margin-top: .5rem; }
.devices summary { width: fit-content; min-height: 2rem; color: var(--accent); font-weight: 600; }
.devices summary.danger-label { color: #7e3029; }
.device-identity summary { margin-top: .25rem; font-size: .875rem; }
.device-actions { min-width: 8rem; }
.device-actions details + details { margin-top: .25rem; }

.nav-link { color: inherit; text-underline-offset: .2em; }
.folio-web { background: #f4f4f1; color: #202322; --line: #d8d9d3; --muted: #575d58; }
.folio-web .top { background: #fdfdfa; }
.folio-web .top-inner, .web-library { max-width: 55rem; }
.web-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem clamp(.45rem, 3vw, 1.1rem); }
.web-nav a, .web-nav button { font-size: .9rem; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: .45rem .65rem; margin-bottom: 1rem; color: var(--muted); font-size: .9rem; }
.breadcrumb a { color: inherit; overflow-wrap: anywhere; text-underline-offset: .2em; }
.breadcrumb a + a::before { content: "›"; margin-right: .65rem; display: inline-block; text-decoration: none; }
.library-heading { margin-bottom: 1.25rem; }
.library-heading h1 { margin-bottom: 0; }
.library-meta { color: var(--muted); }
.library-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: .6rem; background: #fdfdfa; }
.library-list li + li { border-top: 1px solid var(--line); }
.library-list a { display: flex; align-items: center; gap: .9rem; padding: .7rem 1rem; min-height: 4rem; color: inherit; text-decoration: none; }
.library-list a:hover { background: #ebede8; }
.row-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row-text strong, .row-text > span { display: block; }
.row-text > span { font-size: .875rem; color: var(--muted); }
.row-symbol { width: 2rem; height: 2.1rem; border: 1px solid #969d94; border-radius: .2rem; display: grid; place-items: center; color: #424a43; font-size: .85rem; flex-shrink: 0; }
.row-symbol.notebooks { border-left-width: .3rem; }
.row-symbol.folders { height: 1.55rem; margin-top: .25rem; position: relative; }
.row-symbol.folders::before { content: ""; position: absolute; width: .85rem; height: .32rem; left: -.06rem; top: -.36rem; border: 1px solid #969d94; border-bottom: 0; border-radius: .2rem .2rem 0 0; }
.row-arrow { color: var(--muted); font-size: 1.4rem; }
.sheet { max-width: 46rem; margin: auto; border: 1px solid var(--line); background: white; }
.sheet img { display: block; width: 100%; height: auto; }
.library-pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .5rem 1.25rem; margin-top: 1rem; color: var(--muted); font-size: .9rem; }
.library-pager a { color: #202322; text-underline-offset: .2em; padding: .5rem 0; }

@media (min-width: 44rem) {
  .devices li { grid-template-columns: minmax(0, 1fr) auto; }
  .devices details[open] { max-width: 14rem; }
}
