.dialog {
    border: 1px solid #e7ebe2;
    border-radius: 3px;
    padding: 30px;
    background: var(--paper);
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    color: var(--ink);
    box-shadow: 0 24px 100px #16301933;
}
.dialog::backdrop {
    background: #1a302b75;
    backdrop-filter: blur(4px);
}
.dialog-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
}
.dialog-heading h2 {
    font-size: 22px;
    margin-top: 8px;
}
.dialog-heading .close-dialog {
    color: #7e8b75;
    font-weight: 300;
}
.file-drop {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    min-height: 185px;
    border: 1px dashed #acb99c;
    background: #f0f4e9;
    border-radius: 3px;
    gap: 10px;
    cursor: pointer;
}
.file-drop input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.file-drop:focus-within {
    outline: 3px solid #d99755;
    outline-offset: 3px;
}
.file-drop .upload-symbol {
    font-size: 30px;
    color: #84996c;
}
.file-drop strong {
    font-size: 13px;
}
.file-drop > span:not(.upload-symbol) {
    font-size: 10px;
    font-weight: 400;
    color: #94a086;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.form-row label {
    min-width: 0;
}
.form-row input {
    margin-top: 7px;
}
.dialog details {
    font-size: 12px;
    margin: 20px 0;
}
.dialog summary {
    cursor: pointer;
    color: #647c52;
}
.small-dialog {
    max-width: 420px;
}
.detail-dialog {
    width: calc(100vw - 32px);
    max-width: none;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(280px, 24vw, 340px);
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
    height: calc(100dvh - 32px);
    max-height: calc(100dvh - 32px);
}
.detail-dialog:not([open]) {
    display: none;
}
.detail-preview {
    position: relative;
    background: #171d1b;
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
    place-items: center;
}
.detail-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    background: #f4f5ef;
    color: #415238;
}
.detail-navigation[hidden] {
    display: none;
}
.detail-navigation button {
    min-width: 44px;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid #c7d1bc;
    border-radius: 3px;
    background: #fffdf5;
    color: inherit;
    font-size: 12px;
    cursor: pointer;
}
.detail-navigation button:disabled {
    opacity: 0.4;
    cursor: default;
}
.detail-navigation button:focus-visible {
    outline: 2px solid #526c40;
    outline-offset: 2px;
}
.detail-navigation [role="status"] {
    flex-shrink: 0;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.preview-content {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    place-items: center;
    color: #c5cec8;
    font-size: 12px;
}
.preview-content img,
.preview-content video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    width: 100%;
    height: 100%;
}
.detail-video {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    min-width: 0;
}
.detail-video-status {
    padding: 12px 16px;
    text-align: center;
    color: #f3f6f3;
    background: #171d1b;
}
.detail-video-status[hidden] {
    display: none;
}
.detail-video-status p {
    margin: 0 0 8px;
    font-size: 14px;
    overflow-wrap: anywhere;
}
.detail-video-status button {
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid #d1ddcb;
    border-radius: 3px;
    background: #f4f5ef;
    color: #263620;
    font-size: 14px;
    cursor: pointer;
}
.detail-video-status button:disabled {
    opacity: 0.6;
    cursor: wait;
}
.preview-close {
    position: absolute;
    z-index: 2;
    left: 14px;
    top: 14px;
    width: 44px;
    height: 44px;
    background: #fffdf2e6;
    border: 0;
    border-radius: 3px;
    font-size: 24px;
    color: #5f7355;
    box-shadow: 0 2px 12px #233c2314;
}
.detail-info {
    padding: 24px 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    min-width: 0;
    min-height: 0;
}
.detail-info > h2 {
    font-size: 18px;
    margin: 0 0 8px;
    overflow-wrap: anywhere;
}
.detail-info > .muted {
    font-size: 11px;
    line-height: 1.8;
    overflow-wrap: anywhere;
}
.detail-section {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}
.detail-section h3 {
    margin-bottom: 14px;
    font-size: 13px;
}
.detail-section input,
.detail-section textarea {
    font-size: 12px;
}
.detail-section label {
    font-size: 10px;
    color: #819174;
}
.detail-section .button {
    min-height: 35px;
    font-size: 11px;
    padding: 8px 12px;
}
.inline-form {
    display: flex;
    gap: 9px;
    align-items: center;
}
.inline-form input,
.inline-form select {
    min-width: 0;
    flex: 1;
}
.inline-form .button {
    flex-shrink: 0;
}
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    background: #e8eedf;
    border-radius: 3px;
    padding: 5px 9px;
    color: #698055;
}
.tag button {
    background: none;
    border: 0;
    font-size: 16px;
    padding: 0 2px;
    color: #7e926c;
}
.comment {
    border-bottom: 1px solid var(--line);
    padding: 12px 0;
}
.comment p {
    font-size: 12px;
    line-height: 1.8;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.comment-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 7px;
}
.comment time {
    font-size: 9px;
    color: #98a08e;
}
.comment button {
    font-size: 9px;
    padding: 3px;
    color: #8c9a7e;
    border: 0;
    background: transparent;
}
#comment-form {
    margin-top: 18px;
}
#comment-form > .button {
    margin-top: 8px;
}
#comment-count {
    font-size: 10px;
    margin-left: 5px;
}
.settings-section {
    border-bottom: 1px solid var(--line);
    padding-bottom: 24px;
    margin: 25px 0;
}
.settings-section h3 {
    font-size: 14px;
    margin-bottom: 11px;
}
.settings-section > .muted {
    margin-bottom: 15px;
    font-size: 11px;
}
.provider-buttons {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}
.provider-choice {
    min-width: 0;
}
.provider-status {
    margin: 5px 0 3px 12px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}
.provider {
    width: 100%;
    justify-content: flex-start;
    background: white;
    border: 1px solid var(--line);
    font-size: 12px;
    font-weight: 500;
}
.provider > span:last-child {
    margin-left: auto;
    color: #95a487;
}
.provider-logo {
    font-size: 18px;
    width: 24px;
    display: grid;
    place-items: center;
}
.google {
    color: #4285f4;
}
.onedrive,
.dropbox {
    color: #0866d9;
}
.storage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    gap: 15px;
    border-bottom: 1px solid var(--line);
}
.storage-row strong {
    font-size: 12px;
}
.storage-row > div {
    min-width: 0;
    overflow-wrap: anywhere;
}
.storage-row .storage-capacity {
    color: var(--ink);
    line-height: 1.8;
}
.storage-capacity-summary {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 3px;
    background: var(--soft);
    font-size: 12px;
    line-height: 1.8;
    overflow-wrap: anywhere;
}
.storage-row p {
    font-size: 10px;
    color: #8b9e79;
    margin-top: 5px;
}
.storage-row .button {
    flex-shrink: 0;
    font-size: 10px;
    padding: 5px 11px;
    min-height: 30px;
}
.settings-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.account-support-links { display: grid; gap: 8px; }
.account-support-link:not([hidden]) { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: white; color: var(--ink); text-decoration: none; transition: background .15s, border-color .15s; }
.account-support-link:hover { background: var(--soft); border-color: #b4c5ad; }
.account-support-icon { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 6px; background: var(--soft); color: var(--green); }
.account-support-icon svg { width: 21px; height: 21px; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.account-support-copy { display: grid; gap: 4px; min-width: 0; }
.account-support-copy strong { font-size: 13px; font-weight: 600; line-height: 1.5; }
.account-support-copy > span { color: var(--muted); font-size: 11px; line-height: 1.5; }
.account-support-badge { display: inline-block; margin-left: 5px; padding: 1px 5px; border-radius: 3px; background: var(--soft); color: var(--green); font-size: 10px; font-weight: 500; vertical-align: middle; }
.account-support-arrow { margin-left: auto; color: var(--green); font-size: 18px; }
@media (max-width: 480px) { .account-support-link:not([hidden]) { gap: 9px; padding: 12px 10px; } .account-support-icon { flex-basis: 30px; height: 30px; } }

.detail-zoom {
    position: absolute;
    top: 14px;
    left: 70px;
    z-index: 2;
    display: flex;
    overflow: hidden;
    background: #fffdf5;
    border: 1px solid #c7d1bc;
    border-radius: 3px;
}
.detail-zoom[hidden] { display: none; }
.detail-zoom button {
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
    border: 0;
    background: transparent;
    color: #415238;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
}
.detail-zoom button:disabled { opacity: 0.4; cursor: default; }
.detail-zoom button:focus-visible { outline: 2px solid #526c40; outline-offset: -3px; }
.preview-content.image-zoomable { touch-action: none; }
.image-zoomable img { user-select: none; }
.image-zoomed { cursor: grab; }
.image-zoomed:active { cursor: grabbing; }

.detail-thumbnails {
    display: flex;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 8px 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    background: #202924;
}
.detail-thumbnails[hidden] { display: none; }
.detail-thumbnail {
    position: relative;
    flex: 0 0 64px;
    width: 64px;
    height: 56px;
    padding: 0;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 3px;
    background: #415238;
    color: #fffdf5;
    cursor: pointer;
}
.detail-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.detail-thumbnail[aria-current="true"] { border-color: #c0d58e; }
.detail-thumbnail:focus-visible { outline: 2px solid #fffdf5; outline-offset: 2px; }
.detail-thumbnail-number {
    position: absolute;
    bottom: 0;
    right: 0;
    padding: 1px 5px;
    background: #17201cdd;
    font-size: 11px;
}

@media (hover: hover) and (pointer: fine) {
    .detail-thumbnails {
        padding: 32px 36px;
    }
    .detail-thumbnail {
        transition: transform 160ms ease, box-shadow 160ms ease;
    }
    .detail-thumbnail:hover,
    .detail-thumbnail:focus-visible {
        z-index: 1;
        transform: scale(2);
        box-shadow: 0 2px 8px #0006;
    }
}
@media (prefers-reduced-motion: reduce) {
    .detail-thumbnail { transition: none; }
}
