.toast-layer {
    display: contents;
}

.toast-stack {
    position: fixed;
    left: 50%;
    bottom: calc(24px + var(--dock-clear, 0px) + env(safe-area-inset-bottom, 0px));
    z-index: 70;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: min(440px, calc(100vw - 32px));
    transform: translateX(-50%);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 100%;
    padding: 12px 18px 12px 14px;
    border: 1px solid var(--hairline);
    border-top-color: rgb(var(--sun-rgb) / 0.32);
    border-radius: var(--r-2);
    background: rgb(var(--deep-rgb) / 0.97);
    box-shadow: var(--shadow-2);
    color: var(--ink);
    font-size: var(--step-0);
    line-height: 1.45;
    overflow-wrap: anywhere;
    animation: toast-in 0.26s var(--ease-out);
}

.toast-ico {
    display: inline-flex;
    flex: none;
    padding-top: 2px;
    color: var(--ink);
}

.toast-bad {
    border-color: rgb(var(--alert-rgb) / 0.55);
}

.toast-bad .toast-ico {
    color: var(--alert);
}

.confirm-veil {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgb(var(--deep-rgb) / 0.66);
    animation: veil-in 0.18s ease;
}

.confirm-card {
    width: min(440px, 100%);
    max-height: calc(100dvh - 40px);
    padding: 26px 24px 20px;
    overflow-y: auto;
    border: 1px solid var(--hairline);
    border-top-color: rgb(var(--sun-rgb) / 0.32);
    border-radius: var(--r-3);
    background: rgb(var(--deep-rgb) / 0.97);
    box-shadow: var(--shadow-2);
    animation: confirm-in 0.26s var(--ease-out);
}

.confirm-title {
    margin: 0 0 10px;
    font-family: var(--font-text);
    font-size: var(--step-2);
    font-stretch: normal;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.confirm-body {
    margin: 0 0 26px;
    color: var(--ink-2);
    font-size: var(--step-0);
    line-height: 1.55;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.confirm-yes-danger {
    background: var(--alert);
    color: var(--ink-deep);
}

.confirm-yes-danger:hover {
    background: var(--alert-soft);
}

[data-tip] {
    position: relative;
}

[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    z-index: 90;
    padding: 6px 10px;
    border: 1px solid var(--hairline);
    border-top-color: rgb(var(--sun-rgb) / 0.32);
    border-radius: var(--r-1);
    background: rgb(var(--deep-rgb) / 0.97);
    box-shadow: var(--shadow-2);
    color: var(--ink);
    font-family: var(--font-text);
    font-size: var(--step--1);
    font-style: normal;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.4;
    text-transform: none;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, 4px);
    transition: opacity 0.15s ease, transform 0.15s var(--ease-out), visibility 0.15s;
}

[data-tip]:hover::after,
[data-tip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.chip-hash {
    font-family: var(--font-mono);
    font-weight: 400;
    letter-spacing: 0.02em;
    cursor: help;
}

.chip-hash[data-tip]::after {
    font-family: var(--font-mono);
}

.chip-hash[data-tip]::after {
    width: max-content;
    max-width: min(74vw, 380px);
    white-space: normal;
    word-break: break-all;
}

.md {
    color: var(--ink);
    font-size: var(--step-1);
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.md > * {
    max-width: 70ch;
}

.md > pre {
    max-width: none;
}

.md h1,
.md h2,
.md h3,
.md h4,
.md h5,
.md h6 {
    margin: 1.6em 0 0.5em;
    font-family: var(--font-text);
    font-stretch: normal;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.2;
}

.md .md-h1 {
    font-size: var(--step-2);
}

.md .md-h2 {
    font-size: var(--step-1);
}

.md .md-h3 {
    font-size: var(--step-0);
}

.md .md-h4,
.md .md-h5,
.md .md-h6 {
    color: var(--ink-2);
    font-size: var(--step-0);
}

.md p {
    margin: 0.75em 0;
}

.md ul,
.md ol {
    margin: 0.75em 0;
    padding-left: 1.4em;
}

.md li {
    margin: 0.3em 0;
}

.md li::marker {
    color: rgb(var(--sun-rgb) / 0.85);
}

.md strong {
    font-weight: 700;
}

.md a {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: rgb(var(--sun-rgb) / 0.55);
    text-underline-offset: 0.22em;
}

.md a:hover {
    text-decoration-color: rgb(var(--sun-rgb));
}

.md code {
    padding: 0.1em 0.35em;
    border: 1px solid var(--hairline);
    border-radius: var(--r-1);
    background: rgb(var(--deep-rgb) / 0.45);
    font-family: var(--font-mono);
    font-size: 0.88em;
}

.md pre {
    margin: 1em 0;
    padding: 14px 16px;
    overflow-x: auto;
    border: 1px solid var(--hairline);
    border-radius: var(--r-2);
    background: rgb(var(--deep-rgb) / 0.55);
}

.md pre code {
    padding: 0;
    border: 0;
    background: none;
    font-size: var(--step--1);
    line-height: 1.6;
}

.md blockquote {
    margin: 1em 0;
    padding: 0 0 0 16px;
    border-left: 1px solid var(--hairline-strong);
    color: var(--ink-2);
}

.md hr {
    margin: 1.6em 0;
    border: 0;
    border-top: 1px solid var(--hairline);
}

.md > :first-child {
    margin-top: 0;
}

.md > :last-child {
    margin-bottom: 0;
}

.preview-pane {
    overflow: hidden;
    border: 1px solid var(--hairline);
    border-top-color: rgb(var(--sun-rgb) / 0.32);
    border-radius: var(--r-3);
    background: rgb(var(--deep-rgb) / 0.88);
    box-shadow: var(--shadow-2);
    animation: vault-swap 0.26s var(--ease-out) both;
}

.preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 12px;
    min-height: 56px;
    padding: 8px 8px 8px 18px;
    border-bottom: 1px solid var(--hairline);
}

.preview-title {
    min-width: 0;
    overflow: hidden;
    color: var(--ink-2);
    font-size: var(--step--1);
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-name {
    color: var(--ink);
}

.preview-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.preview-note {
    margin: 0;
    padding: 20px 18px;
    color: var(--ink-2);
    font-size: var(--step-0);
}

.preview-text {
    max-height: 480px;
    margin: 0;
    padding: 16px 18px;
    overflow: auto;
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: var(--step--1);
    line-height: 1.6;
    overflow-wrap: anywhere;
    tab-size: 4;
    white-space: pre-wrap;
}

.preview-pdf {
    display: block;
    width: 100%;
    height: min(72vh, 680px);
    border: 0;
    background: rgb(var(--deep-rgb) / 0.6);
}

.preview-pdf-note {
    padding: 10px 18px 14px;
    font-size: var(--step--1);
}

.preview-media {
    display: block;
    width: 100%;
    max-height: min(68vh, 600px);
    object-fit: contain;
    background: rgb(var(--deep-rgb) / 0.6);
}

.preview-audio {
    display: block;
    width: calc(100% - 36px);
    margin: 18px;
}

.preview-pane .md,
.stash-drawer-preview .md {
    max-height: 560px;
    padding: 18px 22px 22px;
    overflow-y: auto;
}

.share-page {
    display: grid;
    grid-template-columns: minmax(0, 620px);
    align-items: start;
    gap: 40px clamp(40px, 5vw, 80px);
    padding-top: clamp(40px, 7vh, 72px);
}

.share-page-peek {
    grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
}

.share-main {
    display: grid;
    gap: 36px;
    min-width: 0;
}

.share-head {
    display: grid;
    gap: 12px;
}

.share-head h1 {
    font-size: var(--step-4);
}

.share-head p {
    max-width: 52ch;
    margin: 0;
    color: var(--ink-2);
    font-size: var(--step-1);
    line-height: 1.6;
}

.share-miss {
    justify-items: start;
    gap: 28px;
}

.share-miss .share-head {
    max-width: 640px;
}

.share-form {
    display: grid;
    gap: 24px;
}

.share-form .form-notice {
    margin: 0;
}

.share-file {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: start;
    gap: 18px;
    padding: 26px 0;
    border-top: 1px solid var(--hairline);
    border-bottom: 1px solid var(--hairline);
}

.share-file .ficon {
    padding-top: 6px;
}

.share-file .ficon svg {
    width: 36px;
    height: 36px;
}

.share-file-text {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.share-name {
    font-size: var(--step-2);
    font-weight: 700;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.share-size {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    color: var(--ink-2);
    font-size: var(--step-1);
}

.share-size .chip {
    margin-left: 0;
}

.share-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.share-field > span {
    color: var(--ink-2);
    font-size: var(--step-0);
    font-weight: 600;
}

.share-field input {
    width: 100%;
    min-height: 44px;
    padding: 8px 2px;
    border: 0;
    border-bottom: 1px solid var(--hairline-strong);
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font-size: var(--step-1);
    transition: border-color 0.2s ease;
}

.share-field input:hover {
    border-bottom-color: rgb(var(--sun-rgb) / 0.75);
}

.share-field input:focus {
    outline: none;
    border-bottom-color: rgb(var(--sun-rgb));
    box-shadow: 0 1px 0 rgb(var(--sun-rgb));
}

.share-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.share-foot {
    margin: 0;
    color: var(--ink-3);
    font-size: var(--step--1);
}

.share-preview {
    min-width: 0;
}

@media (max-width: 860px) {
    .share-page,
    .share-page-peek {
        grid-template-columns: minmax(0, 1fr);
        padding-top: 28px;
    }

    .share-actions .btn {
        flex: 1 1 auto;
    }
}

@media (max-width: 720px) {
    .preview-pane .md,
    .stash-drawer-preview .md {
        max-height: 62vh;
        padding: 16px;
    }

    .preview-text {
        max-height: 62vh;
        padding: 14px;
    }

    .preview-bar {
        padding-left: 14px;
    }
}
