:root {
    --paper: #efe8d6;
    --ink: #2a2418;
    --muted: #7a705f;
    --line: rgba(42, 36, 24, 0.1);
    --note: #f6e27a;
    --shadow: 0 8px 24px rgba(60, 40, 10, 0.08);
    --bar: rgba(239, 232, 214, 0.86);
    --accent: #2a2418;
    --danger: #9a3b2f;
    --sans: "Avenir Next", "Segoe UI", system-ui, sans-serif;
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --mono: "IBM Plex Mono", ui-monospace, monospace;
    --hand: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
    font-family: var(--sans);
    color: var(--ink);
    background: var(--paper);
    overflow: hidden;
}
body.is-plain { overflow: auto; }

a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

#app { height: 100%; position: relative; }

.topbar {
    position: absolute;
    top: 0; left: 0; right: 0;
    /* Above board-look / #view-toolbar / titlebar; below sheets, modals, toasts. */
    z-index: 28;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.mark {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.08em;
    font-size: 13px;
}
.mark-note {
    width: 16px; height: 16px;
    background: var(--note);
    box-shadow: 1px 1px 0 rgba(0,0,0,.12);
    transform: rotate(-4deg);
}
.mark-word { opacity: 0.8; }

.crumbs {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 13px;
    color: var(--muted);
}
.crumbs a, .crumbs button {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    text-decoration: none;
}
.crumbs a:hover, .crumbs button:hover { color: var(--ink); }
.crumbs .sep { opacity: 0.4; }
.crumbs .current { color: var(--ink); font-weight: 600; }
.crumb-more { position: relative; }
.crumb-menu {
    position: absolute;
    top: 120%;
    left: 0;
    background: #fffaf0;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 6px 0;
    min-width: 180px;
    z-index: 30;
}
.crumb-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 12px;
    background: none;
    border: 0;
}

.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn, .text-btn, .avatar {
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: var(--ink);
}
.icon-btn {
    width: 34px; height: 34px;
    position: relative;
    display: grid;
    place-items: center;
}
.icon-btn:hover, .text-btn:hover, .avatar:hover { background: rgba(42,36,24,.06); }
.text-btn { padding: 4px 10px; font-size: 13px; }
a.text-btn { text-decoration: none; display: inline-block; }
.avatar {
    width: 32px; height: 32px;
    background: #f6e27a;
    font-size: 13px;
    font-weight: 700;
}
.badge {
    position: absolute;
    top: 2px; right: 2px;
    background: var(--ink);
    color: var(--paper);
    border-radius: 8px;
    font-size: 10px;
    min-width: 14px;
    padding: 0 4px;
    line-height: 14px;
}
.hidden { display: none !important; }

.profile-wrap { position: relative; }
.menu {
    position: absolute;
    right: 0; top: 40px;
    background: #fffaf0;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    min-width: 200px;
    padding: 8px 0;
    z-index: 40;
}
.menu button, .menu a {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    padding: 8px 14px;
    text-decoration: none;
    font-size: 13px;
}
.menu button:hover, .menu a:hover { background: rgba(42,36,24,.05); }
.menu .profile-version {
    padding: 8px 14px 4px;
    font-size: 11px;
    line-height: 1.3;
    pointer-events: none;
    user-select: none;
}

.board-titlebar {
    position: absolute;
    top: 52px; left: 16px; right: 16px;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    pointer-events: none;
}
.board-titlebar > * { pointer-events: auto; }
.nav-cluster, .zoom-cluster {
    display: flex;
    align-items: center;
    gap: 2px;
    color: var(--muted);
    font-size: 12px;
}
#zoom-label { min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }

.canvas {
    position: absolute;
    inset: 0;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
    background-color: var(--paper);
    background-image: radial-gradient(rgba(42,36,24,.07) 1px, transparent 1px);
    background-size: 28px 28px;
}
.canvas.is-panning { cursor: grabbing; }
.canvas.is-dropping { cursor: copy; }
.world {
    position: absolute;
    left: 0; top: 0;
    z-index: 1;
    transform-origin: 0 0;
    will-change: transform;
}
.board-watermark {
    position: absolute;
    left: 50%;
    top: 46%;
    z-index: 0;
    margin: 0;
    max-width: 70%;
    transform: translate(-50%, -50%);
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(28px, 5vw, 56px);
    letter-spacing: -0.03em;
    line-height: 1.15;
    text-align: center;
    color: var(--ink);
    opacity: 0.12;
    pointer-events: none;
    user-select: none;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
.create-chip {
    position: absolute;
    z-index: 18;
    transform: translate(-50%, -50%);
    border: 1px solid var(--line);
    background: #fffaf0;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    box-shadow: var(--shadow);
    white-space: nowrap;
}
.create-chip:hover { background: #fff; }

.hint {
    position: absolute;
    left: 50%;
    top: 62%;
    z-index: 1;
    transform: translate(-50%, -50%);
    color: var(--muted);
    font-family: var(--serif);
    font-size: 20px;
    pointer-events: none;
    opacity: 0.7;
}

.canvas-wallpaper {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.18;
    pointer-events: none;
}
.canvas.has-wallpaper {
    background-image: none;
}
.note {
    position: absolute;
    background: var(--note);
    color: var(--ink);
    padding: 12px 14px 16px;
    box-shadow: 1px 2px 0 rgba(255,255,255,.35) inset, 2px 6px 16px rgba(60,40,10,.12);
    border-radius: 1px;
    overflow: hidden;
    user-select: none;
    cursor: grab;
    background-image: linear-gradient(180deg, rgba(255,255,255,.22), transparent 28%);
}
.note-bg, .note-wash {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}
.note-bg {
    background-size: cover;
    background-position: center;
}
.note-wash { opacity: 0.72; }
.note.has-bg {
    background-image: none;
}
.note.has-bg .note-caption { z-index: 1; }
.note.is-image { padding: 0; background: #f3ead0; }
.note.is-image img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}
.note-caption { position: relative; }
.note.is-image .note-caption {
    position: absolute;
    left: 8px; right: 8px; bottom: 8px;
    background: rgba(246,226,122,.9);
    padding: 4px 6px;
}
.note.has-owner .note-caption {
    padding-top: 16px;
}
.note.is-image.has-owner .note-caption {
    padding-top: 16px;
}
.note.selected {
    outline: 2px solid rgba(42,36,24,.55);
    outline-offset: 2px;
    z-index: 8;
}
.note.drop-target {
    outline: 2px dashed #2a2418;
    outline-offset: 4px;
    box-shadow: 0 0 0 6px rgba(246,226,122,.5), 2px 6px 16px rgba(60,40,10,.12);
}
.note-owner {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font-family: var(--serif);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.2;
    color: var(--ink);
    opacity: 0.2;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.note-marks {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-end;
    pointer-events: none;
}
.note-mark,
.note-share,
.note-attach {
    position: relative;
    top: auto;
    right: auto;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 4px 6px 0 0;
    border: 0;
    border-radius: 0;
    background: none;
    -webkit-appearance: none;
    appearance: none;
    color: var(--ink);
    opacity: 0.2;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: none;
}
.note-mark svg,
.note-share svg,
.note-attach svg {
    display: block;
    width: 13px;
    height: 13px;
}
.note-mark:hover,
.note-mark:focus-visible,
.note-share:hover,
.note-share:focus-visible,
.note-attach:hover,
.note-attach:focus-visible {
    opacity: 0.35;
    background: none;
}
.note-mark:focus-visible,
.note-share:focus-visible,
.note-attach:focus-visible {
    outline: 1px solid rgba(42, 36, 24, 0.25);
    outline-offset: 1px;
}
.note-face {
    position: relative;
    z-index: 1;
    white-space: pre-wrap;
    word-break: break-word;
    pointer-events: none;
}
.note textarea.face-edit {
    position: absolute;
    inset: 8px;
    z-index: 2;
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    border: 0;
    resize: none;
    background: transparent;
    outline: none;
    padding: 0;
}
.note.has-owner textarea.face-edit {
    padding-top: 20px;
}
.note-door {
    position: absolute;
    right: 6px; bottom: 6px;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(42,36,24,.08);
    padding: 2px 6px;
    color: inherit;
    text-decoration: none;
    pointer-events: auto;
    cursor: pointer;
    z-index: 2;
}
.note-door:hover {
    background: rgba(42,36,24,.16);
    text-decoration: underline;
}
.handle {
    position: absolute;
    width: 10px; height: 10px;
    background: #fff;
    border: 1px solid rgba(42,36,24,.45);
    border-radius: 1px;
}
.handle.se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.move-handle { display: none; }

.guides { position: absolute; inset: 0; pointer-events: none; }
.guide-x, .guide-y {
    position: absolute;
    background: rgba(180, 40, 40, .45);
}
.guide-x { height: 1px; left: 0; right: 0; }
.guide-y { width: 1px; top: 0; bottom: 0; }
.marquee {
    position: absolute;
    border: 1px dashed rgba(42,36,24,.45);
    background: rgba(246,226,122,.15);
    pointer-events: none;
}

.toolbar {
    position: absolute;
    z-index: 25;
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    align-items: center;
    max-width: min(960px, calc(100vw - 24px));
    overflow-x: auto;
    padding: 6px 8px;
    background: #fffaf0;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: 18px;
}
.toolbar button, .toolbar select {
    border: 0;
    background: transparent;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
}
.toolbar button:hover { background: rgba(42,36,24,.06); }
.swatch {
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,.15);
    padding: 0 !important;
}

.panel, .sheet {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: min(380px, 100%);
    background: #fffaf0;
    border-left: 1px solid var(--line);
    box-shadow: var(--shadow);
    z-index: 30;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sheet { width: min(420px, 100%); }
.panel-head, .sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 8px;
}
.panel-head h2, .sheet-head h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}
.panel-body, .sheet-body {
    padding: 8px 18px 24px;
    overflow: auto;
    flex: 1;
}
.detail-edit {
    min-height: 180px;
    border: 1px solid var(--line);
    padding: 10px;
    background: #fff;
    outline: none;
    font-family: var(--serif);
    line-height: 1.45;
}
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.stack input, .stack textarea, .stack select {
    border: 1px solid var(--line);
    background: #fff;
    padding: 8px 10px;
}
.primary {
    background: var(--ink);
    color: var(--paper);
    border: 0;
    padding: 8px 14px;
    border-radius: 999px;
}
.sheet-actions {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 32px 0 2px;
}
.sheet-action.icon-btn {
    position: relative;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: 999px;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}
.sheet-action.icon-btn::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 6px);
    transform: translateX(-50%);
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--ink);
    color: var(--paper);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.3;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    z-index: 5;
}
.sheet-actions .sheet-action.icon-btn:first-child::after {
    left: 0;
    transform: none;
}
.sheet-actions .sheet-action.icon-btn:last-child::after {
    left: auto;
    right: 0;
    transform: none;
}
.sheet-action.icon-btn:hover::after,
.sheet-action.icon-btn:focus-visible::after,
.sheet-action.icon-btn.is-tip::after {
    opacity: 1;
    visibility: visible;
}
.sheet-action.icon-btn:hover,
.sheet-action.icon-btn:focus-visible,
.sheet-action.icon-btn.is-tip {
    background: rgba(42, 36, 24, 0.08);
}
.sheet-action.icon-btn:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}
a.primary { text-decoration: none; display: inline-block; }
.handoff-actions { margin: 24px 0 28px; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.list { list-style: none; padding: 0; margin: 0; }
.list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}
.inbox-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    cursor: grab;
}
.inbox-item.is-preview { background: rgba(246,226,122,.18); margin: 0 -18px; padding: 12px 18px; }
.inbox-swatch { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 3px; box-shadow: 1px 1px 0 rgba(0,0,0,.12); }
.inbox-preview {
    margin-top: 8px;
    padding: 10px 12px;
    min-height: 72px;
    box-shadow: var(--shadow);
    font-family: var(--serif);
    white-space: pre-wrap;
}
.inbox-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.inbox-dest {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 10px;
    font-size: 13px;
}
.inbox-dest-select { min-height: 36px; }
.inbox-card-body { flex: 1; min-width: 0; }
.share-modes { display: grid; gap: 8px; }
.share-mode {
    display: block;
    text-align: left;
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    padding: 10px 12px;
    border-radius: 2px;
}
.share-mode strong { display: block; font-size: 14px; }
.share-mode span { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.4; }
.share-mode.is-on { outline: 2px solid var(--ink); background: #fff6d2; }
.people-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
}
.comment, .activity-row { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.role-pill {
    display: inline-block;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 1px 6px;
    border-radius: 999px;
}
.modal {
    position: absolute;
    inset: 0;
    background: rgba(42,36,24,.18);
    z-index: 50;
    display: grid;
    place-items: center;
}
.dialog {
    background: #fffaf0;
    padding: 22px 24px;
    width: min(440px, calc(100% - 32px));
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
}
.dialog h2 { margin: 0 0 8px; font-size: 18px; font-family: var(--serif); font-weight: 500; }
.dialog p { margin: 0 0 16px; color: var(--muted); }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }

.toast {
    position: absolute;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    background: var(--ink);
    color: var(--paper);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    z-index: 60;
}

.live-hint {
    position: absolute;
    left: 16px;
    bottom: 16px;
    font-size: 12px;
    color: var(--muted);
    z-index: 21;
    pointer-events: none;
}

.auth-card {
    position: absolute;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    background: #fffaf0;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 12px 14px;
    z-index: 22;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    width: min(520px, calc(100% - 24px));
}
.auth-card input { flex: 1 1 160px; border: 1px solid var(--line); padding: 7px 10px; background: #fff; }
.auth-card p { margin: 0; font-size: 13px; flex: 1 1 100%; }
.auth-card .muted { color: var(--muted); }
.plain h2 { font-size: 18px; font-family: var(--serif); font-weight: 500; margin: 28px 0 8px; }
.plain.privacy p { margin: 0 0 12px; line-height: 1.5; }
.plain.privacy ul { margin: 0 0 14px; padding-left: 1.25em; line-height: 1.5; }
.plain.privacy li { margin: 0 0 6px; }
.plain .muted { color: var(--muted); font-size: 13px; }
.plain .stack { display: grid; gap: 10px; max-width: 420px; }
.plain label { display: grid; gap: 4px; font-size: 13px; }
.plain input, .plain textarea, .plain select {
    border: 1px solid var(--line);
    padding: 7px 10px;
    background: #fff;
}
.admin-nav { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0 20px; font-size: 14px; }
.admin-nav a { text-decoration: none; color: var(--muted); }
.admin-nav a.is-on { color: var(--ink); font-weight: 600; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-page { max-width: 840px; }
.plain.admin-page { max-width: 840px; }
.plain.admin-page.is-wide { max-width: 1100px; }
.admin-table-wrap { overflow-x: auto; }
.admin-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 28px;
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
}
.admin-stats li { font-size: 13px; min-width: 7rem; }
.admin-stats strong { display: block; font-size: 20px; font-weight: 600; line-height: 1.2; }
.admin-stats .muted { display: block; font-size: 12px; }
.admin-flash {
    background: #fff;
    border: 1px solid var(--line);
    padding: 8px 12px;
    font-size: 14px;
    margin: 0 0 16px;
}
.mail-template { margin: 28px 0 0; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.mail-template h3 { margin: 0 0 6px; font-size: 16px; font-family: var(--serif); font-weight: 500; }
.mail-template h3 code { font-size: 12px; font-weight: 400; color: var(--muted); }
.mail-template .tokens { font-size: 12px; color: var(--muted); margin: 0 0 10px; }
.mail-template .tokens code { margin-right: 6px; }
.mail-form { display: grid; gap: 10px; }
.mail-form textarea {
    width: 100%;
    min-height: 180px;
    font-family: var(--mono);
    font-size: 13px;
    resize: vertical;
}
.mail-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.mail-preview { margin: 12px 0 16px; font-size: 13px; }
.mail-preview pre {
    white-space: pre-wrap;
    background: #fff;
    border: 1px solid var(--line);
    padding: 10px;
    font-size: 13px;
}

.plain { max-width: 680px; margin: 40px auto; padding: 0 20px 60px; }
.plain-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.lede { color: var(--muted); font-size: 16px; }
.sessions, .mail-list { list-style: none; padding: 0; }
.sessions li, .mail-list li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.sessions li.is-revoked { opacity: 0.55; }
.mail-list pre {
    white-space: pre-wrap;
    font-size: 13px;
    background: #fff;
    padding: 10px;
    border: 1px solid var(--line);
}

.font-georgia { font-family: var(--serif); }
.font-system { font-family: var(--sans); }
.font-serif { font-family: "Times New Roman", Times, serif; }
.font-mono { font-family: var(--mono); }
.font-hand { font-family: var(--hand); }

.compat-banner { display: none !important; }
.view-toolbar, .actions-sheet { display: none; }
@media (max-width: 720px) {
    .board-watermark { font-size: 28px; }
}

.panel-image {
    display: block;
    width: 100%;
    max-height: 240px;
    object-fit: contain;
    background: #f3ead0;
    border: 1px solid var(--line);
}

.save-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: transparent;
    margin-left: 8px;
}
.save-dot.busy { background: #c9a227; }
.save-dot.ok { background: #6a8f4e; }
.save-dot.err { background: var(--danger); }

.remind-pop {
    position: absolute;
    z-index: 35;
    width: min(320px, calc(100vw - 24px));
    background: #fffaf0;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 12px 14px;
    border-radius: 8px;
}
.remind-form { margin-top: 8px; }
.remind-row, .history-row, .deleted-item, .archived-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}
.deleted-item, .archived-item { align-items: center; }
.version-preview {
    min-height: 120px;
    padding: 12px 14px;
    margin: 0 0 16px;
    box-shadow: var(--shadow);
    font-family: var(--serif);
    white-space: pre-wrap;
    max-height: 280px;
    overflow: auto;
}
.attach-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}
.attach-row:last-child { border-bottom: 0; }
.attach-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}
.attach-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
    flex: 0 0 auto;
}
.attach-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.attach-name {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}
.attach-name:hover,
.attach-name:focus-visible { text-decoration: underline; }
.attach-size,
.attach-bg-label { display: block; line-height: 1.35; }
.attach-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    align-items: center;
}
.attach-actions .text-btn {
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 4px 8px;
}
.attach-actions a.text-btn { text-decoration: underline; }
.file-form {
    position: relative;
    margin: 4px 0 0;
}
.file-form .file-input-hidden,
#file-form input[type="file"] {
    display: none !important;
}
.dialog.attach-dialog { width: min(720px, calc(100% - 32px)); }
.attach-preview {
    display: block;
    max-width: 100%;
    max-height: min(70vh, 560px);
    margin: 0 0 16px;
    background: #fff;
}
.attach-preview-frame {
    width: 100%;
    height: min(70vh, 560px);
    border: 1px solid var(--line);
}
.attach-preview-text {
    max-height: min(70vh, 560px);
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--line);
    font-size: 13px;
    white-space: pre-wrap;
    margin: 0 0 16px;
}
.mail-list { display: block; }
.mail-list li { display: block; }

body.is-stage { overflow: auto; height: auto; background: var(--paper); }
body.is-stage #app { height: auto; min-height: 100%; }
body.is-stage .canvas {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: auto;
    cursor: default;
    touch-action: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
body.is-stage .stage-note {
    position: relative;
    left: auto;
    top: auto;
    z-index: 2;
    width: min(440px, calc(100% - 36px));
    height: auto;
    margin: 88px 18px 48px;
    transform: rotate(-1.25deg);
    cursor: default;
    user-select: text;
}
body.is-stage .stage-note .note-caption { position: relative; z-index: 1; }
body.is-stage .stage-note h1,
body.is-stage .stage-note p,
body.is-stage .stage-note a,
body.is-stage .stage-note label,
body.is-stage .stage-note input,
body.is-stage .stage-note textarea,
body.is-stage .stage-note button {
    pointer-events: auto;
    user-select: text;
}
body.is-stage .stage-note h1 {
    margin: 0 0 8px;
    font-family: var(--serif);
    font-weight: 500;
    font-size: 28px;
    letter-spacing: -0.02em;
}
body.is-stage .note-code {
    margin: 0 0 6px;
    font-family: var(--serif);
    font-size: 13px;
    letter-spacing: 0.08em;
    opacity: 0.45;
}
body.is-stage .stage-note p {
    margin: 0 0 12px;
    font-family: var(--serif);
    font-size: 16px;
    line-height: 1.45;
}
body.is-stage .note-form {
    display: grid;
    gap: 12px;
    margin-top: 4px;
}
body.is-stage .note-form label {
    display: grid;
    gap: 4px;
    font-family: var(--sans);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(42, 36, 24, 0.62);
}
body.is-stage .note-form input,
body.is-stage .note-form textarea {
    width: 100%;
    border: 0;
    border-bottom: 1px solid rgba(42, 36, 24, 0.22);
    background: rgba(255, 255, 255, 0.35);
    padding: 8px;
    font-family: var(--serif);
    font-size: 16px;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink);
}
body.is-stage .note-form textarea { min-height: 120px; resize: vertical; }
body.is-stage .note-form .primary { justify-self: start; margin-top: 4px; }
body.is-stage .note-alert {
    color: var(--danger);
    font-family: var(--serif);
    font-size: 15px;
}
body.is-stage .note-hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
body.is-stage .note-actions a { font-family: var(--sans); font-size: 13px; }
