:root {
    color-scheme: light;
    --paper: #f6f3eb;
    --card: #fffcf5;
    --ink: #243e35;
    --quiet: #536456;
    --line: #c9cfc1;
    --gold: #b79d63;
    --pine: #253f35;
    --wash: #e9ede3;
    --serif: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 1rem/1.55 system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    overflow-wrap: anywhere;
    -webkit-font-smoothing: antialiased;
}
html { scroll-padding-top: 1.5rem; }
a { color: var(--ink); text-underline-offset: .19em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid #926b29; outline-offset: 4px; }
.skip { position: absolute; top: -10rem; left: 1rem; z-index: 4; padding: .7rem 1.1rem; color: var(--ink); background: white; }
.skip:focus { top: .75rem; }
.masthead { border-bottom: 1px solid var(--line); }
.masthead-inner, .workspace { width: min(68rem, calc(100% - 4rem)); margin-inline: auto; }
.masthead-inner { min-height: 5.4rem; display: flex; align-items: center; gap: 1.25rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; font: 1.65rem/1 var(--serif); letter-spacing: -.045em; text-decoration: none; white-space: nowrap; }
.brand img { border-radius: 50%; }
.section-name { padding-left: 1.2rem; border-left: 1px solid var(--line); color: var(--quiet); font-size: .83rem; }
.workspace { padding: clamp(2rem, 5vw, 4.25rem) 0 5rem; }
.workspace > :first-child, .panel > :first-child, .auth-card > :first-child, .book-card > :first-child { margin-top: 0; }
.workspace > :last-child, .panel > :last-child, .auth-card > :last-child, .book-card > :last-child { margin-bottom: 0; }
h1, h2, h3 { margin: 0 0 .6em; font-family: var(--serif); font-weight: 400; line-height: 1.14; text-wrap: balance; }
h1 { font-size: clamp(2.45rem, 6vw, 4.2rem); letter-spacing: -.05em; }
h2 { font-size: clamp(1.55rem, 3vw, 2rem); letter-spacing: -.032em; }
h3 { font-size: 1.35rem; letter-spacing: -.015em; }
.page-heading { margin: 0 0 2.2rem; }
.page-heading h1 { margin-bottom: .22em; }
.page-heading p, .empty p { max-width: 62ch; margin: .5rem 0 0; color: var(--quiet); }
p { margin: .55rem 0 1rem; }
small, .muted { color: var(--quiet); }
.panel, .auth-card, .book-card, .empty {
    background: var(--card); border: 1px solid var(--line); border-radius: .55rem;
    padding: clamp(1.15rem, 3vw, 2rem); margin: 0 0 1.2rem; min-width: 0;
}
.auth-card { max-width: 35rem; border-top: 3px solid var(--gold); }
.book-card { border-top: 3px solid var(--pine); }
.empty { background: transparent; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 1rem; align-items: start; }
.grid > .panel, .grid > .book-card { margin: 0; }
.stack { display: grid; gap: 1rem; }
.row, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.row > *, .grid > *, .actions > * { min-width: 0; }
.field, label { font-size: .94rem; font-weight: 600; }
.field { display: grid; gap: .3rem; }
.field + .field { margin-top: .8rem; }
input, select, textarea, button { font: inherit; }
input:not([type='checkbox']):not([type='radio']):not([type='hidden']):not([type='submit']), select, textarea {
    display: block; width: 100%; max-width: 100%; min-height: 2.8rem; margin: .3rem 0 .9rem;
    border: 1px solid #9ca99a; border-radius: .3rem; padding: .59rem .78rem; color: var(--ink); background: white;
}
textarea { resize: vertical; }
button, .button, input[type='submit'] {
    display: inline-flex; justify-content: center; align-items: center; min-height: 2.75rem; max-width: 100%;
    padding: .65rem 1.05rem; border: 1px solid var(--pine); border-radius: .32rem;
    font: 600 .9rem/1.35 system-ui, sans-serif; text-decoration: none; cursor: pointer;
    color: #fffdf5; background: var(--pine); text-align: center;
}
button:hover, .button:hover, input[type='submit']:hover { background: #385948; }
button.secondary, .button.secondary { color: var(--ink); background: transparent; border-color: #849482; }
button.secondary:hover, .button.secondary:hover { background: var(--wash); }
button:disabled { opacity: .55; cursor: wait; }
.notice { margin: 0 0 1.1rem; padding: .75rem 1rem; background: #e4eddf; border-left: 3px solid #5f805d; }
.notice.error { background: #f8e8df; color: #793d2a; border-color: #9a533a; }
.order-list { list-style: none; padding: 0; margin: 0; }
.order { padding: 1.1rem 0; border-top: 1px solid var(--line); }
.order:last-child { padding-bottom: 0; }
.status { font-size: .79rem; font-weight: 600; background: var(--wash); color: #35513c; padding: .22rem .6rem; border-radius: .3rem; }
details { margin: 1rem 0; }
summary { cursor: pointer; font-weight: 600; }
details[open] > summary { margin-bottom: 1rem; }
pre, code { white-space: pre-wrap; overflow-wrap: anywhere; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
@media (max-width: 40rem) {
    .workspace, .masthead-inner { width: calc(100% - 2rem); }
    .masthead-inner { min-height: 4.5rem; gap: .75rem; }
    .brand { font-size: 1.38rem; gap: .5rem; }
    .brand img { width: 32px; height: 32px; }
    .section-name { padding-left: .7rem; font-size: .73rem; }
    .workspace { padding-top: 2rem; }
    .page-heading { margin-bottom: 1.4rem; }
}
.storybook-banner { display:block; width:100%;height:auto;border-radius:16px; }
form.stack { max-width:42rem; }
label:has(input[type="checkbox"]) { display:flex;align-items:center;gap:.65rem; }
input[type="checkbox"] { width:1.2em;min-height:1.2em; }
.panel code { overflow-wrap:anywhere; }
