/* Hallmark v2 | custom | signature: a paper-stack drop zone framed in gray glass. */
/* Critique: light rims indicate raised controls; the file table keeps a quiet reading surface. */
:root {
    --ground: #e4e6e8;
    --sidebar: #edf0f2;
    --surface: #fcfcfc;
    --wash: #f2f2f2;
    --selected: #dedede;
    --ink: #222;
    --muted: #5d5d5d;
    --soft-ink: #676767;
    --line: #d7d7d7;
    --edge: #818181;
    --dash: #aaa;
    --inverse: #fff;
    --focus: #424242;
    --scrim: #2228;
    --shadow: #2221;
    --glass: #ffffff9e;
    --glass-solid: #ffffffe0;
    --glass-tint: #e9ecef91;
    --glass-rim: #ffffffc9;
    --glass-low: #333c4b26;
    --glass-light: #fff;
    --glass-inset: #fff9;
    --canvas-mid: #d6dade;
    --canvas-low: #cbd0d5;
    --dark-light: #4a4b50;
    --dark-solid: #242529;
    --glass-radius: 1.3rem;
    --glass-shadow: 0 1px 0 var(--glass-inset) inset, 0 0 0 1px var(--glass-low), 0 13px 36px var(--shadow);
    --lens-shadow: 0 1px 1px var(--glass-light) inset, 0 -1px 1px var(--glass-low) inset, 0 2px 6px var(--shadow);
    --glass-hover-fill: radial-gradient(ellipse at 35% -25%, var(--glass-light), transparent 75%),
        linear-gradient(155deg, var(--glass-solid), var(--glass-tint));
    --glass-hover-shadow: 0 1px 1px var(--glass-light) inset, 0 -1px 1px var(--glass-low) inset,
        0 0 0 1px var(--glass-rim), 0 4px 12px var(--shadow);
    --ease-spring: cubic-bezier(.2, 1.4, .45, 1);
    --ease-out: cubic-bezier(.2, .75, .25, 1);
    --font-body: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --font-display: "Bahnschrift", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --sidebar-width: 16.25rem;
    --content-max: 68rem;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 1rem/1.5 var(--font-body); }
.workspace, .login-page {
    background:
        radial-gradient(ellipse at 74% -18%, var(--glass-light), transparent 59%),
        radial-gradient(ellipse at -5% 74%, var(--canvas-low), transparent 56%),
        linear-gradient(132deg, var(--canvas-mid), var(--ground) 47%, var(--canvas-mid));
}
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
h1, h2 { min-width: 0; overflow-wrap: break-word; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:where(button, a, input, textarea, select, [tabindex]):focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
:where(input, textarea, select):focus-visible { outline-offset: -3px; }
.icon-library { position: absolute; width: 0; height: 0; overflow: clip; }
.icon { width: 1.2rem; height: 1.2rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.workspace { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100dvh; }

.sidebar { position: sticky; top: .9rem; display: flex; flex-direction: column; height: calc(100dvh - 1.8rem); margin: .9rem 0 .9rem .9rem; background: var(--glass); border: 1px solid var(--glass-rim); border-radius: var(--glass-radius); box-shadow: var(--glass-shadow); backdrop-filter: blur(20px); }
.brand { display: flex; align-items: center; height: 4.65rem; padding: 0 1.4rem; font: 650 2rem/1 var(--font-display); letter-spacing: -.067em; width: fit-content; }
.brand-period { color: var(--soft-ink); }
.sidebar-content { padding: .8rem 1rem 1rem; overflow-y: auto; }
.search-wrap { position: relative; margin-bottom: 1.15rem; }
.search-wrap > .icon { position: absolute; left: .65rem; top: .76rem; width: 1rem; height: 1rem; color: var(--muted); pointer-events: none; }
.search-wrap input { appearance: none; width: 100%; min-height: 2.75rem; background: var(--glass-solid); border: 1px solid var(--edge); border-radius: 1rem; padding: .45rem 2.85rem .45rem 2rem; font-size: .9rem; box-shadow: 0 1px 1px var(--glass-light) inset; }
.search-wrap input::-webkit-search-cancel-button { display: none; }
.search-clear { position: absolute; inset: 0 0 0 auto; border-radius: 1rem; }
.search-clear .icon { width: 1.24rem; height: 1.24rem; stroke-width: 2; }
.search-wrap input::placeholder { color: var(--muted); }
.search-wrap kbd { position: absolute; top: .7rem; right: .6rem; width: 1.3rem; text-align: center; border: 1px solid var(--line); border-radius: .2rem; font: .78rem/1.15rem var(--font-body); color: var(--muted); pointer-events: none; }
.search-wrap input:not(:placeholder-shown) + kbd { display: none; }
.nav-link { display: flex; align-items: center; gap: .65rem; min-height: 2.75rem; padding: .45rem .65rem; border-radius: .85rem; font-size: .95rem; transition: background-color .18s var(--ease-out), box-shadow .22s var(--ease-out); }
.nav-link.is-active { background: linear-gradient(165deg, var(--glass-solid), var(--glass-tint)); box-shadow: var(--lens-shadow); font-weight: 650; }
.nav-link .icon { width: 1.1rem; height: 1.1rem; }
.nav-link .nav-name { flex: 1; overflow-wrap: anywhere; min-width: 0; }
.nav-link .count { color: var(--muted); font-size: .83rem; font-variant-numeric: tabular-nums; }
.project-nav { margin-top: 1.3rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.project-nav-head { display: flex; align-items: center; justify-content: space-between; padding-left: .65rem; }
.project-nav-head h2 { font-size: .9rem; font-weight: 680; }
.tree-row { padding-inline-start: calc(var(--folder-depth, 0) * .55rem); display: flex; align-items: center; gap: .1rem; }
.tree-row .nav-link { flex: 1; min-width: 0; }
.tree-row .tree-toggle { min-width: 2.75rem; }
.tree-toggle .icon { width: .95rem; height: .95rem; }
.side-empty { color: var(--muted); font-size: .87rem; padding: .35rem .65rem; }
.logout-form { margin-top: auto; padding: .75rem 1rem 1rem; }
.logout-form .nav-link { width: 100%; background: transparent; border: 0; color: var(--muted); text-align: left; }

.login-page { display: grid; place-items: center; min-height: 100dvh; padding: 1.15rem; }
.login-panel { width: min(100%, 28rem); padding: clamp(1.35rem, 5vw, 2.45rem); background: linear-gradient(150deg, var(--glass-solid), var(--glass)); border: 1px solid var(--glass-rim); border-radius: var(--glass-radius); box-shadow: var(--glass-shadow); backdrop-filter: blur(24px); }
.login-brand { height: auto; margin-bottom: 1.15rem; padding: 0; font-size: 1.45rem; }
.login-panel h1 { margin-bottom: 1.55rem; font: 650 clamp(2rem, 6vw, 2.6rem)/1.07 var(--font-display); letter-spacing: -.05em; }
.login-panel .field { min-height: 2.95rem; border-radius: .75rem; }
.login-panel .field + label { margin-top: .9rem; }
.login-panel .button { width: 100%; margin-top: 1.25rem; }
.login-panel .remember-choice { display: flex; align-items: center; gap: .6rem; width: fit-content; min-height: 2.75rem; margin-bottom: 0; cursor: pointer; }
.account-switch { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem; padding: .2rem; margin-bottom: .95rem; border: 1px solid var(--glass-rim); border-radius: 999px; background: var(--glass-tint); }
.account-switch a { display: grid; place-items: center; min-height: 2.5rem; border-radius: 999px; color: var(--muted); font-weight: 650; }
.account-switch a:hover, .account-switch a[aria-current="page"] { color: var(--ink); background: var(--glass-solid); box-shadow: var(--lens-shadow); }
.account-help, .account-alternative { margin-top: .75rem; color: var(--muted); font-size: .88rem; }
.account-alternative { display: inline-block; text-decoration: underline; text-underline-offset: .15em; }
.remember-choice input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--dark-solid); cursor: pointer; }
.setup-panel { width: min(100%, 38rem); }
.setup-help { margin-bottom: 1rem; color: var(--muted); font-size: .93rem; }
.setup-panel fieldset { margin: 1rem 0 0; padding: .85rem; border: 1px solid var(--line); border-radius: .75rem; min-width: 0; }
.setup-panel legend { padding-inline: .35rem; font-weight: 650; }
.setup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.setup-label { margin-top: .75rem; }

.main { min-width: 0; min-height: 100dvh; }
.mobile-bar, .side-overlay { display: none; }
.content { width: 100%; max-width: var(--content-max); margin-inline: auto; padding: clamp(3.75rem, 7vw, 6.1rem) clamp(1.25rem, 4vw, 3.5rem) 4rem; }
#home-view:not([hidden]), #project-view:not([hidden]) { animation: content-in .32s var(--ease-out) both; }
.intro { margin-bottom: 2rem; }
.intro h1, .project-intro h1 { font-family: var(--font-display); font-weight: 650; line-height: 1; letter-spacing: -.063em; font-size: clamp(2.6rem, 5.65vw, 5.35rem); }
.intro p { color: var(--muted); font-size: clamp(1.1rem, 2.1vw, 1.4rem); margin-top: .75rem; }

.composer { background: linear-gradient(150deg, var(--glass-solid), var(--glass) 52%, var(--glass-tint)); border: 1px solid var(--glass-rim); border-radius: var(--glass-radius); box-shadow: var(--glass-shadow); backdrop-filter: blur(24px); }
.composer-head { border-bottom: 1px solid var(--line); padding: .85rem 1.15rem; }
.modes { position: relative; display: inline-grid; grid-template-columns: repeat(2, 1fr); background: var(--glass-tint); border: 1px solid var(--glass-low); border-radius: 2rem; padding: .18rem; gap: .15rem; }
.modes::before { content: ""; position: absolute; inset: .18rem auto .18rem .18rem; width: calc(50% - .255rem); border: 1px solid var(--glass-rim); border-radius: 2rem; background: linear-gradient(155deg, var(--glass-light), var(--glass)); box-shadow: var(--lens-shadow); transition: transform .3s var(--ease-spring); }
.modes:has(#text-tab[aria-selected="true"])::before { transform: translateX(calc(100% + .15rem)); }
.mode { position: relative; min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; gap: .48rem; padding: .35rem .85rem; border: 1px solid transparent; border-radius: 2rem; background: transparent; color: var(--muted); font-size: .91rem; font-weight: 600; transition: color .18s var(--ease-out), box-shadow .22s var(--ease-out); }
.mode[aria-selected="true"] { color: var(--ink); }
.mode .icon { width: 1rem; }
.composer-body { padding: 1.15rem; }
#files-pane:not([hidden]) .drop-area, .text-fields:not([hidden]) { animation: content-in .22s var(--ease-out) both; }
/* Interaction patterns adapted from uiarc.dev/components/file-dropzone. */
.drop-area { display: grid; width: 100%; justify-items: center; align-content: center; min-height: 15.4rem; padding: 1.25rem .8rem; text-align: center; background: radial-gradient(ellipse at 50% 20%, var(--glass-light), transparent 66%), var(--glass-tint); border: 1px dashed var(--dash); border-radius: .95rem; transition: background-color .2s var(--ease-out), border-color .2s var(--ease-out), box-shadow .2s var(--ease-out); }
.drop-area.is-dragging { background: var(--glass-hover-fill); border-color: var(--ink); box-shadow: var(--glass-hover-shadow); }
.drop-area:disabled { opacity: .7; cursor: not-allowed; }
.drop-title { display: grid; align-items: center; justify-items: center; }
.drop-title strong { grid-area: 1 / 1; font-size: 1.05rem; font-weight: 680; transition: opacity .16s var(--ease-out), transform .23s var(--ease-out); }
.drop-title strong:last-child, .drop-area.is-dragging .drop-title strong:first-child { opacity: 0; transform: translateY(3px); }
.drop-area.is-dragging .drop-title strong:last-child { opacity: 1; transform: translateY(0); }
.drop-detail { color: var(--muted); font-size: .9rem; margin: .2rem 0 .85rem; }
.paper-stack { position: relative; width: 4.45rem; height: 3.45rem; margin-bottom: .67rem; transition: transform .3s var(--ease-spring); }
.paper-stack span { display: grid; place-items: center; position: absolute; width: 2.55rem; height: 2.9rem; left: .94rem; bottom: .1rem; background: var(--surface); border: 1px solid var(--dash); border-radius: .32rem; box-shadow: 0 2px 5px var(--shadow); transition: transform .32s var(--ease-spring); }
.paper-stack span:first-child { transform: translateX(-.72rem) rotate(-17deg); background: var(--selected); }
.paper-stack span:nth-child(2) { transform: translateX(.72rem) rotate(17deg); background: var(--sidebar); }
.paper-stack span:last-child { transform: translateY(-.1rem); }
.drop-area.is-dragging .paper-stack { transform: translateY(-.32rem) scale(1.07); }
.drop-area.is-dragging .paper-stack span:first-child { transform: translateX(-1rem) rotate(-23deg); }
.drop-area.is-dragging .paper-stack span:nth-child(2) { transform: translateX(1rem) rotate(23deg); }
.paper-stack .icon { width: 1.3rem; height: 1.3rem; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.15rem; border-top: 1px solid var(--line); }
.composer-foot p { color: var(--muted); font-size: .87rem; }
.composer-foot .button { min-width: 6.7rem; }
/* Interaction patterns adapted from uiarc.dev/components/button. */
.button, .icon-button, .plain-button { border: 1px solid transparent; border-radius: 1rem; background: transparent; transition: background-color .16s var(--ease-out), color .16s var(--ease-out), border-color .16s var(--ease-out), box-shadow .22s var(--ease-out), filter .16s var(--ease-out), transform .23s var(--ease-spring); }
.button { display: inline-flex; justify-content: center; align-items: center; gap: .46rem; min-height: 2.75rem; padding: .42rem .85rem; font-size: .9rem; font-weight: 650; text-align: center; line-height: 1.25; }
.button-primary { background: linear-gradient(155deg, var(--dark-light), var(--dark-solid) 72%); color: var(--inverse); box-shadow: 0 1px 1px var(--glass-low) inset, 0 3px 8px var(--shadow); }
.button-outline { border-color: var(--glass-rim); background: linear-gradient(155deg, var(--glass-solid), var(--glass-tint)); box-shadow: var(--lens-shadow); }
.button:disabled, .icon-button:disabled, .plain-button:disabled { opacity: .55; cursor: not-allowed; }
.button[aria-busy="true"] { cursor: progress; }
:where(button, a).button:active:not(:disabled, [aria-disabled="true"]), .plain-button:active:not(:disabled), .drop-area:active .drop-cta { transform: scale(.97); transition-timing-function: var(--ease-out); }
.icon-button:active:not(:disabled) { transform: scale(.92); transition-timing-function: var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
    .button-primary:hover:not(:disabled, [aria-disabled="true"]) { filter: brightness(1.12); box-shadow: 0 1px 1px var(--glass-inset) inset, 0 5px 13px var(--shadow); }
    .button-outline:hover:not(:disabled), .plain-button:hover:not(:disabled), .icon-button:hover:not(:disabled),
    .entry-open:hover, .nav-link:hover, .mode:hover:not([aria-selected="true"]) {
        background: var(--glass-hover-fill);
        box-shadow: var(--glass-hover-shadow);
        color: var(--ink);
    }
    .search-wrap input:hover:not(:disabled), .field:hover:not(:disabled) {
        background: var(--glass-solid);
        box-shadow: var(--lens-shadow);
    }
    .drop-area:hover:not(.is-dragging, :disabled) {
        background: var(--glass-hover-fill);
        border-color: var(--edge);
        box-shadow: var(--glass-hover-shadow);
    }
    .drop-area:hover:not(.is-dragging, :disabled) .paper-stack { transform: translateY(-.18rem); }
    .drop-area:hover:not(:disabled) .drop-cta { background: var(--glass-hover-fill); box-shadow: var(--glass-hover-shadow); }
    tbody tr:hover { background: var(--glass-tint); }
}
#save-button, .save-button { display: inline-grid; }
.button-label, .button-loading { grid-area: 1 / 1; justify-self: center; white-space: nowrap; transition: opacity .16s var(--ease-out), transform .23s var(--ease-out), filter .16s var(--ease-out); }
.button-loading { display: inline-flex; align-items: center; gap: .45rem; opacity: 0; transform: translateY(3px); filter: blur(2px); }
[aria-busy="true"] > .button-label { opacity: 0; transform: translateY(-3px); filter: blur(2px); }
[aria-busy="true"] > .button-loading { opacity: 1; transform: translateY(0); filter: blur(0); }
.button-spinner { width: .84rem; height: .84rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; }
[aria-busy="true"] .button-spinner { animation: spin .7s linear infinite; }
.icon-button { min-width: 2.75rem; min-height: 2.75rem; display: inline-grid; place-items: center; padding: .3rem; flex: none; }
.plain-button { min-height: 2.75rem; padding: .3rem .1rem; text-decoration: underline; text-underline-offset: .15em; font-size: .9rem; }
.field { display: block; width: 100%; min-height: 2.75rem; background: var(--surface); border: 1px solid var(--edge); border-radius: .38rem; padding: .48rem .7rem; }
.field::placeholder { color: var(--muted); }
.field[aria-invalid="true"] { outline: 2px solid var(--ink); outline-offset: -2px; }
textarea.field { resize: vertical; min-height: 7rem; }
label { display: block; font-size: .9rem; font-weight: 650; margin-bottom: .3rem; }
label span { color: var(--muted); font-weight: 400; }
.text-fields > label:not(:first-child) { margin-top: .9rem; }
.file-drafts { margin-top: .9rem; container-type: inline-size; }
.file-draft {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 2.75rem;
    grid-template-areas: "source remove" "title title" "note note";
    align-items: end;
    gap: .7rem;
    border-top: 1px solid var(--line);
    padding: .8rem 0;
}
.file-draft:last-child { padding-bottom: 0; }
.file-draft.is-new { animation: content-in .28s var(--ease-out) both; }
.file-draft.is-new:nth-child(3n + 2) { animation-delay: .025s; }
.file-draft.is-new:nth-child(3n) { animation-delay: .05s; }
.draft-file-info { grid-area: source; align-self: center; display: flex; min-width: 0; align-items: center; gap: .6rem; }
.draft-file-meta { flex: 1; min-width: 0; }
.draft-file-info .original { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .87rem; font-weight: 650; }
.original-size { color: var(--muted); font-size: .8rem; }
.draft-title { grid-area: title; min-width: 0; }
.draft-note { grid-area: note; min-width: 0; }
.remove-draft { grid-area: remove; align-self: center; }
.filename-field { display: flex; align-items: center; gap: .3rem; }
.filename-field .field { min-width: 0; }
.filename-field span { flex: none; color: var(--muted); font-size: .84rem; }
@container (min-width: 31rem) {
    .file-draft {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 2.75rem;
        grid-template-areas: "source source remove" "title note note";
    }
}
@container (min-width: 48rem) {
    .file-draft {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr) 2.75rem;
        grid-template-areas: "source title note remove";
    }
    .remove-draft { align-self: end; }
}

.records { margin-top: 2rem; }
.project-filter { margin-bottom: .85rem; }
.project-filter .search-wrap { max-width: 29rem; margin-bottom: .3rem; }
.search-status { color: var(--muted); font-size: .86rem; }
.table-wrap { background: var(--glass-solid); border: 1px solid var(--glass-rim); border-radius: var(--glass-radius); box-shadow: var(--glass-shadow); overflow: auto; }
.table-empty { display: flex; align-items: center; gap: .65rem; padding: 1.05rem 1.15rem; color: var(--muted); font-size: .94rem; }
.table-empty .icon { width: 1.13rem; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .91rem; table-layout: fixed; }
th, td { padding: .72rem .95rem; overflow-wrap: anywhere; }
th { font-weight: 650; color: var(--muted); background: var(--glass-tint); }
td { border-top: 1px solid var(--line); }
th.name-column { width: 49%; }
.selection-column { width: 3rem; padding: 0 .25rem; text-align: center; }
.entry-checkbox { width: 1.65rem; height: 1.65rem; margin: 0; vertical-align: middle; accent-color: var(--dark-solid); cursor: pointer; }
tr.is-selected > td { background: var(--glass-tint); }
.batch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-bottom: .65rem; }
#batch-count { padding: .25rem .4rem; font-weight: 650; }
th.date-column { width: 7rem; }
td time { white-space: nowrap; color: var(--muted); }
.entry-name { display: flex; align-items: center; gap: .25rem; min-width: 0; }
.entry-open { display: flex; align-items: center; gap: .55rem; min-width: 0; min-height: 2.75rem; padding: .3rem .5rem; border: 0; border-radius: .65rem; background: transparent; text-align: left; color: var(--ink); font-weight: 650; transition: box-shadow .22s var(--ease-out); }
.entry-open > span { min-width: 0; overflow-wrap: anywhere; }
.entry-open .icon, .entry-pin .icon { color: var(--muted); width: 1.08rem; }
.entry-pin { flex: none; display: inline-flex; align-items: center; }
.entry-type { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }
.project-intro { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.project-intro h1 { font-size: clamp(2.6rem, 6vw, 4.65rem); }
.project-intro p { margin-top: .7rem; color: var(--muted); }
.project-intro .button { flex: none; }
.project-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.project-quick-add { display: flex; flex-wrap: wrap; gap: .5rem; }
.project-drop-overlay {
    position: fixed;
    z-index: 4;
    inset: .9rem .9rem .9rem calc(var(--sidebar-width) + .9rem);
    display: grid;
    place-items: center;
    padding: 1rem;
    pointer-events: none;
    border: 2px dashed var(--edge);
    border-radius: var(--glass-radius);
    background: var(--glass-hover-fill);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(12px);
    animation: content-in .16s var(--ease-out) both;
}
.project-drop-message { display: grid; justify-items: center; gap: .5rem; min-width: 0; max-width: 100%; text-align: center; overflow-wrap: anywhere; }
.project-drop-message .icon { width: 2.25rem; height: 2.25rem; }
.project-drop-message strong { font-size: clamp(1.35rem, 3vw, 2rem); }
.project-drop-message span { color: var(--muted); }
.project-intro > div:first-child { min-width: 0; }
#delete-project-message { margin-bottom: .85rem; overflow-wrap: anywhere; }
.notice, .form-error { color: var(--ink); font-size: .94rem; font-weight: 600; overflow-wrap: anywhere; }
.notice { background: var(--selected); border: 1px solid var(--edge); border-radius: .43rem; padding: .75rem .9rem; margin-bottom: 1rem; }
.notice.success { background: var(--surface); }
.notice:not([hidden]), .form-error:not([hidden]) { animation: content-in .2s var(--ease-out) both; }
.form-error { margin-top: .65rem; }
.composer-error { margin: 0 1.15rem .85rem; }

/* Interaction patterns adapted from uiarc.dev/components/dialog. */
dialog { color: var(--ink); background: var(--glass-solid); border: 1px solid var(--glass-rim); border-radius: var(--glass-radius); width: min(32rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; box-shadow: var(--glass-shadow), 0 1rem 3.5rem var(--shadow); backdrop-filter: blur(28px); opacity: 0; transform: translateY(8px) scale(.96); transition: opacity .14s var(--ease-out), transform .14s var(--ease-out), display .14s allow-discrete, overlay .14s allow-discrete; }
dialog[open] { opacity: 1; transform: translateY(0) scale(1); transition-duration: .2s, .3s, .3s, .3s; transition-timing-function: var(--ease-out), var(--ease-spring), ease, ease; }
dialog::backdrop { background: var(--scrim); opacity: 0; transition: opacity .18s var(--ease-out), display .18s allow-discrete, overlay .18s allow-discrete; }
dialog[open]::backdrop { opacity: 1; }
@starting-style {
    dialog[open] { opacity: 0; transform: translateY(8px) scale(.96); }
    dialog[open]::backdrop { opacity: 0; }
}
#existing-wrap:not([hidden]), #new-wrap:not([hidden]) { animation: content-in .22s var(--ease-out) both; }
.dialog-head, .dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .8rem 1.15rem; }
.dialog-head { border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 1.32rem; letter-spacing: -.025em; overflow-wrap: anywhere; }
.dialog-head p { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.dialog-head [data-close] { width: 3rem; height: 3rem; color: var(--ink); background: var(--glass-hover-fill); box-shadow: var(--lens-shadow); }
.dialog-head [data-close] .icon { width: 1.4rem; height: 1.4rem; stroke-width: 1.9; }
.dialog-body { padding: 1.05rem 1.15rem; }
#assignment-summary, #entry-move-message { color: var(--muted); margin-bottom: .85rem; overflow-wrap: anywhere; }
.new-choice, #show-existing { margin-top: .6rem; }
.assignment-search { margin-bottom: .85rem; }
.project-options select { padding: .23rem; font-size: .94rem; }
.project-options option { border-radius: .24rem; padding: .36rem .5rem; }
.project-options option:checked { background: var(--selected); color: var(--ink); }
.options-empty { padding: .65rem .7rem; border: 1px solid var(--line); border-radius: .38rem; color: var(--muted); font-size: .9rem; }
.dialog-actions { justify-content: flex-end; border-top: 1px solid var(--line); background: var(--glass-tint); }
.preview-dialog { width: min(62rem, calc(100% - 2rem)); }
.direct-composer-dialog { width: min(56rem, calc(100% - 2rem)); }
.direct-composer-dialog .composer { border: 0; border-radius: 0; box-shadow: none; background: transparent; backdrop-filter: none; }
.preview-body { padding: 1.1rem; min-height: 5rem; }
.preview-body pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.preview-body img { display: block; width: auto; max-width: 100%; max-height: 65dvh; margin-inline: auto; }
.mail-preview h3 { margin: 0 0 .6rem; overflow-wrap: anywhere; }
.mail-details { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .2rem .75rem; margin: 0 0 1rem; padding-bottom: .85rem; border-bottom: 1px solid var(--line); font-size: .93rem; }
.mail-details dt { font-weight: 650; }
.mail-details dd { margin: 0; overflow-wrap: anywhere; }
.preview-actions { flex-wrap: wrap; }
.preview-actions [aria-pressed="true"] { color: var(--inverse); background: var(--dark-solid); border-color: var(--dark-solid); box-shadow: none; }
.preview-actions #delete-preview { margin-right: auto; }
.preview-status { padding: 0 1.15rem .7rem; font-size: .9rem; color: var(--muted); }
#entry-text-fields > label:not(:first-child), #entry-note-fields > label:not(:first-child) { margin-top: .9rem; }
.pdf-tools, .pdf-paging { display: flex; align-items: center; gap: .45rem; }
.pdf-tools { justify-content: space-between; flex-wrap: wrap; margin-bottom: .7rem; }
.pdf-status { min-width: 7rem; text-align: center; color: var(--muted); font-size: .88rem; }
.pdf-sheet { overflow: auto; max-height: 57dvh; min-height: 4rem; padding: .5rem; border: 1px solid var(--line); border-radius: .4rem; background: var(--wash); }
.pdf-sheet canvas { display: block; margin-inline: auto; box-shadow: 0 1px 5px var(--shadow); }

@keyframes content-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes sidebar-in {
    from { transform: translateX(-1.25rem); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes spin { to { transform: rotate(1turn); } }

@media (max-width: 850px) {
    :root { --sidebar-width: 13.75rem; }
    .content { padding-top: 2.65rem; }
    table { min-width: 36rem; }
}
@media (max-width: 650px) {
    .workspace { display: block; }
    .mobile-bar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: .45rem; min-height: 3.9rem; padding-inline: .65rem; background: var(--glass); border-bottom: 1px solid var(--glass-rim); backdrop-filter: blur(16px); }
    .mobile-bar .brand { height: auto; padding: .3rem .1rem; font-size: 1.55rem; }
    .sidebar { display: none; position: fixed; inset: 0 auto 0 0; width: min(17rem, 84%); height: 100dvh; margin: 0; border-radius: 0 var(--glass-radius) var(--glass-radius) 0; z-index: 3; }
    .sidebar.is-open { display: flex; animation: sidebar-in .23s var(--ease-out) both; }
    .side-overlay:not([hidden]) { display: block !important; position: fixed; inset: 0; z-index: 2; background: var(--scrim); border: 0; }
    .content { padding-inline: .85rem; padding-top: 2.1rem; padding-bottom: 2rem; }
    .intro, .project-intro { padding-inline: .2rem; }
    .intro { margin-bottom: 1.45rem; }
    .composer-head, .composer-foot { padding-inline: .75rem; }
    .composer-body { padding: .75rem; }
    .project-intro { align-items: flex-start; flex-direction: column; }
    .project-actions { justify-content: flex-start; }
    .project-drop-overlay { inset: .55rem; }
    table { min-width: 17rem; font-size: .84rem; }
    th, td { padding: .55rem .4rem; }
    th.name-column { width: 55%; }
    .date-column { display: none; }
    .entry-name { gap: .3rem; }
    .entry-open { padding-inline: .2rem; gap: .35rem; }
    .entry-open .icon { width: .9rem; }
    .dialog-head, .dialog-body, .dialog-actions { padding-inline: .85rem; }
    .preview-actions { justify-content: flex-start; }
    .preview-actions #delete-preview { margin-right: 0; }
    .pdf-status { min-width: 5.4rem; }
}
@media (max-width: 420px) {
    .setup-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-transparency: reduce) {
    :root {
        --glass: var(--sidebar);
        --glass-solid: var(--surface);
        --glass-tint: var(--wash);
    }
    .sidebar, .composer, .mobile-bar, .login-panel, .project-drop-overlay, dialog { backdrop-filter: none; }
    .workspace, .login-page { background: var(--ground); }
}

.public-page {
    min-height: 100dvh;
    background: radial-gradient(ellipse at 82% 13%, var(--glass-inset), transparent 42%),
        radial-gradient(ellipse at 10% 62%, var(--glass-solid), transparent 55%), var(--ground);
}
.public-header, .public-main, .public-footer { width: min(91%, 75rem); margin-inline: auto; }
.public-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: 1.25rem;
    padding: .5rem .65rem .5rem 1.2rem;
    border: 1px solid var(--glass-rim);
    border-radius: 999px;
    background: var(--glass);
    box-shadow: var(--glisse-rim);
    backdrop-filter: blur(18px) saturate(1.35);
}
.public-brand { height: auto; padding: 0; font-size: clamp(1.35rem, 3.3vw, 1.85rem); }
.public-nav, .public-footer nav, .workspace-legal { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem 1.1rem; }
.public-nav { justify-content: center; }
.public-nav a { display: flex; align-items: center; min-height: 2.75rem; white-space: nowrap; }
.public-nav a, .public-footer a, .workspace-legal a { color: var(--muted); font-size: .88rem; }
.public-nav a:hover, .public-footer a:hover, .workspace-legal a:hover { color: var(--ink); text-decoration: underline; }
.workspace-legal { margin: .55rem 0 0; }
.workspace-account { padding: .25rem .55rem; font-size: .79rem; color: var(--muted); overflow-wrap: anywhere; }
.legacy-login { margin-top: 1.1rem; }
.legacy-login summary { cursor: pointer; color: var(--muted); }
.legacy-login form { margin-top: .75rem; }
.public-login { position: fixed; inset: 0; margin: auto; width: min(28rem, calc(100% - 2rem)); padding: 0; }
.public-login-body { padding: .95rem 1.15rem 1.25rem; }
.public-login-body > p { color: var(--muted); }
.public-login-body > div > .button { margin-top: .55rem; }
.public-login-body form { margin-top: .45rem; }
.provider-help { margin-top: .9rem; color: var(--muted); }
.provider-help summary { cursor: pointer; }
.provider-help li { margin-bottom: .45rem; }
.provider-help code { overflow-wrap: anywhere; }
.public-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, .95fr);
    align-items: center;
    gap: clamp(1.35rem, 4vw, 4rem);
    padding: clamp(3.2rem, 9.5vw, 9rem) 0 clamp(3rem, 7vw, 6rem);
    animation: content-in .45s var(--ease-out) both;
}
.public-hero h1 {
    max-width: 13ch;
    font: 650 clamp(2.85rem, 6.7vw, 6.1rem)/.97 var(--font-display);
    letter-spacing: -.075em;
    text-wrap: balance;
}
.public-hero h1 span { color: var(--soft-ink); }
.public-hero-copy p { margin: 1.4rem 0 1.55rem; max-width: 39ch; color: var(--muted); font-size: clamp(1rem, 1.55vw, 1.19rem); line-height: 1.55; }
.public-hero-copy .button { padding-inline: 1.1rem; }
.public-hero-copy small { display: block; margin-top: .8rem; color: var(--muted); }
.public-example, .public-features article, .public-steps, .public-security, .public-faq, .legal-panel, .admin-panel {
    border: 1px solid var(--glass-rim);
    background: linear-gradient(145deg, var(--glass-solid), var(--glass));
    box-shadow: var(--glass-shadow);
    border-radius: var(--glass-radius);
    backdrop-filter: blur(18px) saturate(1.4);
}
.public-example { display: grid; grid-template-columns: minmax(6.75rem, .45fr) minmax(0, 1fr); overflow: hidden; }
.public-example-side { display: flex; flex-direction: column; gap: .4rem; border-right: 1px solid var(--glass-rim); padding: 1rem .7rem; color: var(--muted); font-size: .82rem; }
.public-example-side > * { padding: .5rem .4rem; overflow-wrap: anywhere; }
.public-example-side strong { color: var(--ink); border: 1px solid var(--glass-rim); border-radius: .65rem; background: var(--glass-solid); box-shadow: var(--glisse-rim); }
.public-example-content { padding: clamp(.85rem, 2.4vw, 1.7rem); min-width: 0; }
.public-example-heading p, .public-example-content small { color: var(--muted); font-size: .78rem; }
.public-example-heading h2 { font: 650 clamp(1.4rem, 3vw, 2.3rem)/1.1 var(--font-display); letter-spacing: -.055em; }
.public-example-search { padding: .52rem .72rem; margin: .85rem 0 .4rem; border: 1px solid var(--glass-rim); border-radius: 2rem; background: var(--glass-tint); color: var(--muted); font-size: .8rem; }
.public-example-content ul { list-style: none; padding: 0; margin: 0; }
.public-example-content li { display: flex; align-items: center; gap: .55rem; padding: .68rem 0; border-top: 1px solid var(--line); font-size: .86rem; }
.public-example-content li:first-child { border-top: 0; }
.public-example-content small { display: block; margin-top: .1rem; }
.public-example { animation: example-in .62s var(--ease-out) .1s both; }
.public-example-content li { animation: example-row-in .4s var(--ease-out) .42s both; }
.public-example-content li:nth-child(2) { animation-delay: .52s; }
.public-example-content li:nth-child(3) { animation-delay: .62s; }
.public-example-search { animation: example-search-in .65s var(--ease-out) .18s both; }
@keyframes example-in {
    from { opacity: 0; transform: translateY(14px) scale(.975); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes example-row-in {
    from { opacity: 0; transform: translateX(8px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes example-search-in {
    from { opacity: .35; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.example-format { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; color: var(--muted); border: 1px solid var(--glass-rim); border-radius: .55rem; background: var(--glass-solid); font-size: .58rem; font-weight: 700; }
.public-section { margin: 0 0 clamp(2.1rem, 5vw, 4.5rem); scroll-margin-top: 1rem; }
.public-section h2, .admin-main h1, .legal-panel h1 { font: 650 clamp(1.9rem, 4vw, 3.8rem)/1.05 var(--font-display); letter-spacing: -.055em; text-wrap: balance; }
.public-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; margin-top: 1.1rem; }
.public-features article, .public-security, .legal-panel, .admin-panel { padding: clamp(1.15rem, 3vw, 2.2rem); }
.public-features h3 { margin-bottom: .55rem; font-size: 1.06rem; }
.public-features p, .public-steps p, .public-security p, .public-faq p, .legal-panel p, .admin-panel p { color: var(--muted); line-height: 1.6; }
.public-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem 2rem; margin: 1.1rem 0 0; padding: 1.3rem 1.4rem 1.3rem 2.5rem; }
.public-steps li::marker { font-weight: 700; color: var(--muted); }
.public-steps h3 { margin: 0 0 .4rem; font-size: 1.06rem; }
.public-faq { margin-top: 1.1rem; padding: .2rem clamp(1.15rem, 3vw, 2.2rem); }
.public-faq details + details { border-top: 1px solid var(--line); }
.public-faq summary { padding: .8rem 0; font-weight: 650; cursor: pointer; }
.public-faq p { padding-bottom: .85rem; max-width: 65ch; }
.public-security p { max-width: 65ch; margin: .85rem 0; }
.public-security a, .legal-panel a, .admin-panel p a { text-decoration: underline; text-underline-offset: .16em; }
.public-footer { display: flex; justify-content: space-between; gap: .6rem; padding: 1rem 0 1.8rem; border-top: 1px solid var(--glass-rim); }
.legal-main { max-width: 49rem; margin-block: 2.1rem; }
.legal-panel h2 { margin: 1.35rem 0 .5rem; font-size: 1.16rem; }
.legal-panel address { font-style: normal; line-height: 1.55; }
.legal-panel p + p { margin-top: .8rem; }
.admin-main { margin-block: 2rem; }
.admin-main > * + * { margin-top: 1rem; }
.admin-panel h2 { margin-bottom: .75rem; font-size: 1.25rem; }
.admin-panel form { margin-top: 1rem; max-width: 34rem; }
.admin-panel form .field + label { margin-top: .75rem; }
.admin-panel form .field + p, .admin-panel form p + label { margin-top: .65rem; }
.admin-panel form .button { margin-top: 1rem; }
.admin-panel .table-wrap { min-width: 0; }
.admin-panel table { min-width: 38rem; }
.admin-table-action { display: inline-block; padding-block: .35rem; text-decoration: underline; text-underline-offset: .15em; }
.quota-field + .quota-field, .quota-custom { margin-top: .75rem; }
@supports selector(:has(option:checked)) {
    .quota-field:not(:has(option[value="custom"]:checked)) .quota-custom { display: none; }
}
.admin-panel .table-wrap + p { margin-top: .7rem; }
@media (max-width: 740px) {
    .public-header { flex-wrap: wrap; border-radius: var(--glass-radius); }
    .public-nav { order: 1; flex-basis: 100%; gap: 0 .85rem; border-top: 1px solid var(--line); }
    .public-hero { grid-template-columns: 1fr; }
    .public-hero h1 { max-width: 16ch; }
    .public-features, .public-steps { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    .public-hero, .public-example, .public-example-content li, .public-example-search { animation: none; }
}
@media (prefers-reduced-transparency: reduce) {
    .public-header, .public-example, .public-features article, .public-steps, .public-security, .public-faq, .legal-panel, .admin-panel { backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after, *::backdrop { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
    :where(button, a).button:active:not(:disabled, [aria-disabled="true"]), .plain-button:active:not(:disabled), .icon-button:active:not(:disabled), .drop-area:active .drop-cta,
    .drop-area:hover .paper-stack, .drop-area.is-dragging .paper-stack { transform: none; }
}

/* Glissé by Kelvin Zhang, MIT. Glass material and pointer illumination adapted
   from https://github.com/0kzh/glisse/blob/main/src/styles.css. */
:root {
    --glisse-face: rgb(252 252 252 / .52);
    --glisse-shine: rgb(255 255 255 / .42);
    --glisse-lip: rgb(71 77 86 / .14);
    --glisse-rim: inset 0 1px 1px var(--glass-light), inset 0 -1px 2px var(--glass-inset),
        0 0 0 .5px var(--glisse-lip), 0 2px 6px var(--shadow);
    --glisse-light: radial-gradient(circle 150px at var(--glisse-x, 50%) var(--glisse-y, 0%),
        var(--glisse-shine), transparent 80%);
}

.sidebar, .composer, .table-wrap, .login-panel, dialog {
    backdrop-filter: blur(16px) saturate(1.5);
}
.direct-composer-dialog .composer { backdrop-filter: none; }
.button, .icon-button { border-radius: 999px; }
.button-outline, .nav-link.is-active, .modes::before {
    background: linear-gradient(170deg, var(--glass-inset), transparent 56%, var(--glass-inset)), var(--glisse-face);
    box-shadow: var(--glisse-rim);
}
.button-outline { backdrop-filter: blur(3px) saturate(1.5); }
:is(.button, .icon-button, .nav-link, .mode, .entry-open):active:not(:disabled) {
    background-image: var(--glisse-light);
}
.button-primary:active:not(:disabled) {
    background-image: var(--glisse-light), linear-gradient(155deg, var(--dark-light), var(--dark-solid) 72%);
}
@media (hover: hover) and (pointer: fine) {
    :is(.button-outline, .icon-button, .nav-link, .mode, .drop-area, .entry-open):hover:not(:disabled) {
        background-image: var(--glisse-light), var(--glass-hover-fill);
        box-shadow: var(--glisse-rim);
    }
    .button-primary:hover:not(:disabled) {
        background-image: var(--glisse-light), linear-gradient(155deg, var(--dark-light), var(--dark-solid) 72%);
    }
}
@media (prefers-reduced-transparency: reduce) {
    :root { --glisse-face: var(--surface); }
    .sidebar, .composer, .table-wrap, .login-panel, dialog, .button-outline { backdrop-filter: none; }
}

.preview-body .text-link { text-decoration: underline; text-underline-offset: .16em; }
.upload-progress {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .45rem .7rem;
    padding: .8rem 1.15rem;
    color: var(--ink);
    font-size: .9rem;
}
.upload-percent { font-weight: 650; font-variant-numeric: tabular-nums; align-self: start; }
.upload-progress progress { grid-column: 1 / -1; width: 100%; height: .7rem; accent-color: var(--dark-solid); }
