/* Shared page layouts. Keep page structure here instead of inside Blade templates. */
.settings-shell,
.shares-shell,
.trash-shell,
.versions-shell {
    width: min(100%, 1040px);
    min-height: 100vh;
    margin: auto;
    padding: 32px 20px 64px;
}

.settings-header,
.shares-header,
.trash-header,
.versions-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
    padding: 0 4px 22px;
    border-bottom: 1px solid var(--line);
}
.settings-header > div,
.shares-header > div,
.trash-header > div,
.versions-header > div { min-width: 0; }
.settings-header h1,
.shares-header h1,
.trash-header h1,
.versions-header h1 {
    margin: 8px 0 3px;
    font-size: clamp(25px, 4vw, 32px);
    font-weight: 550;
    letter-spacing: -.025em;
}
.settings-header p,
.shares-header p,
.trash-header p,
.versions-header p {
    margin: 0;
    color: var(--muted);
    overflow-wrap: anywhere;
}

/* Settings remain cards because they are independent groups of controls. */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.settings-card {
    min-width: 0;
    padding: 21px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
    box-shadow: none;
}
.settings-card-wide { grid-column: 1 / -1; }
.settings-card h2 { margin: 0 0 3px; font-size: 19px; font-weight: 550; letter-spacing: -.02em; }
.settings-card > p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.settings-card form { max-width: 440px; }
.settings-card .button { margin-top: 17px; }
.storage-details { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-top: 15px; }
.storage-details strong { font-size: 23px; letter-spacing: -.035em; }
.storage-details span { color: var(--muted); font-size: 13px; }
.storage-bar { height: 7px; overflow: hidden; border-radius: 99px; background: var(--line); }
.storage-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.code-form { padding-top: 2px; }
.code-form input[name="code"] { max-width: 180px; letter-spacing: .18em; font-weight: 750; }
.api-token { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.api-token:first-of-type { margin-top: 16px; }
.api-token strong, .api-token span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.api-token span { color: var(--muted); font-size: 12px; }
.api-token form { margin: 0; }
.api-token .button { margin: 0; }
.api-secret { margin: 15px 0; padding: 12px; border: 0; border-radius: 10px; background: var(--accent-soft); }
.api-secret strong { display: block; margin-bottom: 4px; }
.api-secret code { display: block; overflow: auto; padding: 8px; border-radius: 6px; background: var(--paper); color: var(--ink); font-size: 12px; white-space: nowrap; }
.api-help { margin-top: 14px !important; overflow-wrap: anywhere; }
.api-help a { color: var(--accent); font-weight: 600; }
.danger-card { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.danger-card h2 { color: var(--danger); }

/* Data collections use flat rows and dividers. */
.share-list,
.version-list,
.trash-list { display: block; border-bottom: 1px solid var(--line); }
.share-card,
.version-card,
.trash-card {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.share-card + .share-card,
.version-card + .version-card,
.trash-card + .trash-card { border-top: 1px solid var(--line); }
.share-card { padding: 20px 4px; }
.share-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.share-card h2 { margin: 0; overflow-wrap: anywhere; font-size: 17px; font-weight: 550; }
.share-card h2 a:hover { color: var(--accent); }
.share-state { flex: none; border-radius: 999px; padding: 3px 9px; background: var(--accent-soft); color: var(--ink); font-size: 12px; font-weight: 600; }
.share-state.expired { background: var(--soft-danger); color: var(--danger); }
.share-details { margin: 4px 0 15px; color: var(--muted); font-size: 13px; }
.share-url-row { display: flex; gap: 7px; }
.share-url-row input { min-width: 0; padding: 8px 9px; font-size: 13px; }
.share-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 15px; margin-top: 14px; }
.share-duration { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin: 0; padding: 0; border: 0; }
.share-duration legend { grid-column: 1 / -1; margin: 0 0 1px; font-size: 13px; font-weight: 600; }
.share-duration label { position: relative; margin: 0; cursor: pointer; }
.share-duration input { position: absolute; opacity: 0; pointer-events: none; }
.share-duration span { display: block; border: 1px solid var(--line); border-radius: 999px; padding: 7px 6px; color: var(--muted); font-size: 12px; text-align: center; }
.share-duration input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.share-duration input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.share-form-footer { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.revoke-link { color: var(--danger); padding: 8px 4px; font-size: 13px; font-weight: 600; }
.revoke-link:hover { text-decoration: underline; }
.expired-shares { margin-top: 18px; }
.expired-shares > summary { display: flex; min-height: 62px; align-items: center; gap: 13px; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; list-style: none; }
.expired-shares > summary::-webkit-details-marker { display: none; }
.expired-shares > summary:hover { background: var(--hover); }
.expired-shares-title { min-width: 0; flex: 1; }
.expired-shares-title strong, .expired-shares-title small { display: block; }
.expired-shares-title small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.expired-shares-count { display: grid; min-width: 28px; height: 28px; place-items: center; border-radius: 999px; background: var(--soft-danger); color: var(--danger); font-size: 12px; font-weight: 700; }
.expired-shares-chevron { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .16s ease; }
.expired-shares[open] .expired-shares-chevron { transform: rotate(180deg); }
.expired-share-list { margin-top: 0; }

.version-card { display: flex; min-height: 76px; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 4px; }
.version-card h2 { margin: 0 0 2px; font-size: 16px; font-weight: 550; }
.version-card p { margin: 0; color: var(--muted); font-size: 13px; }
.version-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.version-actions a { display: inline-flex; align-items: center; }

.trash-card { display: flex; min-height: 82px; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 4px; }
.trash-card-info { min-width: 0; }
.trash-card h2 { margin: 0; overflow-wrap: anywhere; font-size: 15px; font-weight: 550; }
.trash-card p { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.trash-type { margin: 0; padding: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 400; text-transform: none; }
.trash-type::after { content: "·"; margin-left: 6px; }
.trash-actions { display: flex; flex: none; align-items: center; gap: 3px; }
.trash-actions .button { min-height: 36px; border: 0; border-radius: 6px; padding: 7px 10px; background: transparent; box-shadow: none; }
.trash-actions .button.secondary { color: var(--accent); }
.trash-actions .button.danger { color: var(--danger); }
.trash-actions .button:hover, .trash-actions .button:focus-visible { background: var(--hover); }

.empty-shares,
.empty-versions,
.empty-trash { padding: 52px 20px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--muted); text-align: center; }
.empty-shares h2, .empty-versions h2, .empty-trash h2 { margin: 0 0 7px; color: var(--ink); font-size: 18px; font-weight: 550; }

/* Shared modal and snackbar primitives for pages outside the workspace. */
.modal { display: none; position: fixed; z-index: 70; inset: 0; place-items: center; padding: 18px; background: rgba(32, 33, 36, .52); }
.modal:target { display: grid; }
.modal-card { width: min(100%, 390px); padding: 22px; border: 0; border-radius: 16px; background: var(--paper); box-shadow: 0 8px 12px 6px rgba(60,64,67,.15), 0 4px 4px rgba(60,64,67,.3); }
.modal-card h2 { margin: 0 0 8px; font-size: 20px; font-weight: 550; }
.modal-card p { margin: 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.modal-footer { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 18px; }
.modal-footer form { margin: 0; }
.modal-footer a { padding: 9px 12px; color: var(--accent); font-weight: 600; }
.history-modal { width: min(100%, 760px); max-height: calc(100dvh - 36px); overflow: auto; }
.pdf-viewer-modal { width: min(1180px, calc(100vw - 36px)); height: min(900px, calc(100dvh - 36px)); max-height: calc(100dvh - 36px); padding: 18px; }
.toast {
    position: fixed;
    z-index: 80;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: min(360px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    padding: 11px 10px 11px 14px;
    border: 0;
    border-left: 4px solid #81c995;
    border-radius: 8px;
    background: #303134;
    color: #fff;
    box-shadow: 0 3px 5px -1px rgba(0,0,0,.2), 0 6px 10px rgba(0,0,0,.14);
    transform: translateX(-50%);
    transition: opacity .2s, transform .2s;
}
.toast.error, .toast[role="alert"] { border-left-color: #f28b82; }
.toast.hiding { opacity: 0; transform: translate(-50%, 12px); }
.toast button { display: grid; width: 36px; height: 36px; flex: none; margin-left: auto; place-items: center; border: 0; border-radius: 50%; padding: 0; background: transparent; color: #fff; }
.toast button:hover, .toast button:focus-visible { background: rgba(255,255,255,.12); }
.trash-header .back-to-notes { white-space: nowrap; flex-shrink: 0; }
.auth-split-layout { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: clamp(32px, 7vw, 88px); align-items: center; padding-inline: max(24px, calc((100vw - 940px) / 2)); }
.auth-split-layout .auth-card { width: 100%; }
.auth-intro { max-width: 430px; }
.auth-intro-label { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.auth-intro h2 { margin: 16px 0; font-size: clamp(32px, 4vw, 48px); line-height: 1.12; letter-spacing: -.035em; font-weight: 600; }
.auth-intro > p { color: var(--muted); line-height: 1.6; }
.auth-intro-items { margin: 28px 0; padding-top: 12px; border-top: 1px solid var(--line); }
.auth-intro-items p { display: flex; align-items: center; gap: 12px; margin: 13px 0; font-size: 14px; }
.auth-intro-items svg { width: 19px; height: 19px; color: var(--accent); flex: none; }
.auth-intro > a { color: var(--accent); font-weight: 600; }
.auth-card .auth-notice { padding: 10px 12px; border-radius: 8px; background: var(--md-surface-container-high); color: var(--ink); }
.auth-card input[aria-invalid="true"] { border-color: var(--danger); }
.auth-verify-card #code { text-align: center; letter-spacing: .25em; font-variant-numeric: tabular-nums; }
.auth-verify-card .button { width: 100%; align-self: stretch; margin-top: 12px; }
.auth-verify-card .auth-secondary-form { margin-top: 0; }
.auth-text-button { border: 0; padding: 8px 0; color: var(--accent); background: transparent; cursor: pointer; }
.auth-registration-toast { width: min(460px, calc(100vw - 32px)); }
.auth-toast-copy { min-width: 0; max-height: min(240px, 40vh); overflow: auto; }
.auth-toast-copy p { margin: 0; font-size: 14px; line-height: 1.4; }
.auth-toast-copy p + p { margin-top: 5px; }
.auth-registration-toast.is-entering { animation: auth-toast-in .26s cubic-bezier(.2,.8,.2,1) both; }
@keyframes auth-toast-in { from { opacity: 0; transform: translate(-50%, 14px) scale(.98); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@media (max-width: 760px) {
    .auth-split-layout { display: flex; flex-direction: column-reverse; gap: 28px; }
    .auth-intro { width: 100%; max-width: 420px; }
    .auth-intro h2 { font-size: 28px; }
    .auth-intro-items { margin: 18px 0; }
}
@media (max-width: 600px) { .auth-split-layout .auth-intro { padding: 0 24px 32px; } }
@media (prefers-reduced-motion: reduce) { .auth-registration-toast.is-entering { animation: none; } }

/* Public document pages and archived note views. */
.shared-shell { min-height: 100vh; padding: 26px clamp(18px, 8vw, 180px) 60px; background: var(--canvas); }
.shared-header, .shared-note { width: 100%; max-width: 1440px; margin: auto; }
.shared-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 2px 20px; color: var(--muted); font-size: 13px; }
.shared-header-right { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; }
.shared-note { padding: clamp(22px, 4vw, 50px); border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: none; }
.shared-note h1 { margin: 0; font-size: clamp(27px, 5vw, 39px); letter-spacing: -.035em; }
.shared-note-expiration { width: 100%; max-width: 1440px; margin: 16px auto 0; padding: 0 4px; color: var(--muted); font-size: 13px; }
.shared-theme { position: relative; }
.shared-theme summary { display: inline-flex; min-height: 40px; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; color: var(--accent); background: var(--paper); cursor: pointer; list-style: none; }
.shared-theme summary::-webkit-details-marker { display: none; }
.shared-theme-menu { position: absolute; z-index: 2; right: 0; top: calc(100% + 7px); width: 176px; padding: 6px; border: 0; border-radius: 12px; background: var(--paper); box-shadow: 0 4px 8px 3px rgba(60,64,67,.15), 0 1px 3px rgba(60,64,67,.3); }
.shared-theme-menu button { display: flex; width: 100%; min-height: 40px; align-items: center; gap: 8px; border: 0; border-radius: 8px; padding: 7px 8px; background: transparent; color: var(--ink); text-align: left; font-size: 13px; }
.shared-theme-menu button:hover, .shared-theme-menu button.selected { background: var(--hover); }
.shared-copy { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 9px 18px; background: var(--accent); color: var(--md-on-accent); cursor: pointer; font-weight: 600; }

.version-view-shell, .trash-note-shell { min-height: 100vh; padding: 28px 20px 64px; }
.version-view-header, .version-view-note, .trash-note-header, .trash-note-content { width: min(100%, 1120px); margin-inline: auto; }
.version-view-header, .trash-note-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 0 2px 20px; }
.version-view-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.version-view-note, .trash-note-content { padding: clamp(22px, 4vw, 50px); border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: none; }
.version-view-note h1, .trash-note-header h1 { margin: 0; overflow-wrap: anywhere; font-size: clamp(27px, 5vw, 38px); font-weight: 550; letter-spacing: -.035em; }
.version-view-meta, .trash-note-header p { margin: 7px 0 28px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

.docs-shell { width: min(1160px, calc(100% - 64px)); min-height: 100vh; margin: auto; padding: 32px 0 70px; }
.docs-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.docs-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.docs-content { width: 100%; margin: 42px auto 0; }
.docs-content h1 { font-size: clamp(32px, 5vw, 48px); line-height: 1.1; }
.docs-content h2 { margin-top: 42px; font-size: 25px; }

/* Markdown is rendered through the same visual contract everywhere. */
.markdown-body {
    color: var(--ink);
    font-size: 16px;
    line-height: 1.75;
    overflow-wrap: anywhere;
}
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    color: var(--ink);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -.025em;
}
.markdown-body h2, .markdown-body h3, .markdown-body h4 { margin-top: 1.7em; }
.markdown-body p, .markdown-body ul, .markdown-body ol { margin: 1em 0; }
.markdown-body a:not(.image-download) {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
}
.markdown-body pre {
    max-width: 100%;
    overflow: auto;
    padding: 14px;
    border: 0;
    border-radius: 8px;
    background: var(--preview);
}
.markdown-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.markdown-body :not(pre) > code {
    display: inline-block;
    padding: .12em .38em;
    border: 1px solid color-mix(in srgb, var(--line) 80%, var(--ink));
    border-radius: 5px;
    background: var(--preview);
    color: var(--ink);
    font-size: .88em;
    font-weight: 600;
    line-height: 1.35;
}
.markdown-body img { display: block; max-width: 100%; height: auto; }
.note-image { position: relative; display: inline-block; max-width: 100%; margin: .35em 0; vertical-align: top; }
.image-download {
    position: absolute;
    z-index: 1;
    top: 9px;
    right: 9px;
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 5px 14px #10182835;
    opacity: 0;
    transform: translateY(-3px);
    transition: opacity .16s ease, transform .16s ease;
}
.note-image:hover .image-download, .image-download:focus-visible { opacity: 1; transform: translateY(0); }
.image-download:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.markdown-body table { display: block; width: max-content; max-width: 100%; overflow-x: auto; border-collapse: collapse; overflow-wrap: normal; word-break: normal; }
.markdown-body th, .markdown-body td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; min-width: 8ch; }
.markdown-body th { background: var(--preview); font-weight: 600; white-space: nowrap; }
.markdown-body .markdown-fallback { padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--preview); color: var(--muted); }
.markdown-body caption { padding-bottom: 8px; font-weight: 600; text-align: left; }
.markdown-body [align="center"] { text-align: center; }
.markdown-body [align="right"] { text-align: right; }
.markdown-body details { margin: 1em 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; }
.markdown-body summary { cursor: pointer; font-weight: 600; }
.markdown-body details[open] > summary { margin-bottom: 10px; }
.markdown-body kbd { padding: .1em .35em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--preview); font: .85em ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.markdown-body blockquote { margin-inline: 0; padding-left: 16px; border-left: 3px solid var(--accent); color: var(--muted); }
.markdown-body li > input[type="checkbox"] { vertical-align: -.12em; transform: none; }

/* A restrained radius scale keeps the interface consistent across surfaces. */
.auth-card { border-radius: 16px; }
.app-preview { border-radius: 16px; }
.feature { border-radius: 14px; }
.start-section { border-radius: 16px; }

@media (prefers-reduced-motion: reduce) {
    .expired-shares-chevron, .toast { transition: none; }
}

@media (hover: none) {
    .image-download { opacity: 1; transform: translateY(0); }
}

@media (max-width: 680px) {
    .settings-shell, .shares-shell, .trash-shell, .versions-shell { padding: 24px 16px 48px; }
    .settings-header, .shares-header, .trash-header, .versions-header { flex-direction: row; align-items: flex-start; gap: 10px; padding-inline: 0; }
    .settings-header > div, .shares-header > div, .trash-header > div, .versions-header > div { min-width: 0; flex: 1; }
    .settings-header > .button, .shares-header > .button, .trash-header > .button, .versions-header > .button { flex: none; margin-left: auto; }
    .settings-grid { grid-template-columns: 1fr; }
    .settings-card-wide { grid-column: auto; }
    .api-token { grid-template-columns: 1fr; }
    .share-actions { grid-template-columns: 1fr; }
    .share-duration { grid-template-columns: 1fr 1fr; }
    .share-url-row { flex-wrap: wrap; }
    .share-url-row input { flex: 1 1 100%; }
    .version-card, .trash-card { align-items: flex-start; flex-direction: column; }
    .version-actions, .trash-actions { width: 100%; justify-content: flex-start; }
    .shared-shell { padding: 20px 16px 42px; background: var(--paper); }
    .shared-header { flex-direction: column; gap: 12px; text-align: center; }
    .shared-header-right { width: 100%; justify-content: center; gap: 10px; }
    .shared-label { display: none; }
    .shared-note { border: 0; border-radius: 0; padding: 18px 0 40px; }
    .version-view-header, .trash-note-header { flex-direction: column; }
    .version-view-note, .trash-note-content { padding: 24px 18px; }
    .pdf-viewer-modal { width: calc(100vw - 16px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); padding: 12px; }
    .docs-shell { width: calc(100% - 32px); }
    .docs-content { margin-top: 30px; }
}

@media (max-width: 780px), (max-width: 1024px) and (pointer: coarse) {
    .root-drop-target { display: none; }
    .note-search-button kbd { display: none; }
}
