:root {
  color-scheme: dark;
  --bg: #0d0f12;
  --panel: #171a1f;
  --panel-raised: #1e2229;
  --panel-soft: #252a32;
  --text: #f5f7fa;
  --muted: #99a2af;
  --accent: #7c8cff;
  --accent-strong: #6879f5;
  --accent-soft: #252b4a;
  --danger: #f05f6d;
  --danger-soft: #3b2027;
  --success: #5bd49b;
  --success-soft: #18352a;
  --line: #303640;
  --shadow: 0 18px 50px #0007;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: radial-gradient(circle at 50% -20%, #1b2030 0, var(--bg) 36rem); color: var(--text); font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea, select { min-width: 0; font: inherit; color: inherit; }
button, a, input, select, textarea { touch-action: manipulation; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; border: 1px solid transparent; border-radius: 9px; background: var(--accent); padding: .5rem .8rem; cursor: pointer; white-space: nowrap; transition: background .16s, border-color .16s, transform .16s, opacity .16s; }
button:hover { background: var(--accent-strong); }
button:active { transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: .55; }
button.ghost { border-color: var(--line); background: var(--panel-raised); }
button.ghost:hover { border-color: #4a5260; background: var(--panel-soft); }
button.icon { width: 36px; min-height: 36px; border-color: transparent; background: transparent; padding: 0; font-size: 1.25rem; }
.danger { background: var(--danger); }
.danger:hover { background: #d94d5b; }
.hidden { display: none !important; }

header { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; min-height: 58px; border-bottom: 1px solid #ffffff12; padding: 9px 18px; background: #06080a70; -webkit-backdrop-filter: blur(40px); backdrop-filter: blur(40px); }
.brand { z-index: 2; flex: none; color: var(--text); font-size: 20px; font-weight: 780; letter-spacing: -.04em; text-decoration: none; }
.action-viewport { position: relative; flex: 1; height: 38px; min-width: 0; margin-left: 14px; overflow: hidden; }
.action-row { position: absolute; inset: 0; display: none; align-items: center; justify-content: flex-end; gap: 6px; opacity: 0; pointer-events: none; }
.action-row.is-active { display: flex; opacity: 1; pointer-events: auto; animation: action-row-enter .18s ease-out both; }
header[data-mode="normal"] .action-row.is-active { animation-name: action-row-return; }
@keyframes action-row-enter { from { transform: translateY(70%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes action-row-return { from { transform: translateY(-70%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.action-button { min-height: 36px; padding: .42rem .68rem; }
.action-button.icon-only { width: 36px; padding: 0; }
#app-header .action-button { border-color: transparent; background: transparent; color: #f4f6f8; }
#app-header .action-button:hover { background: #ffffff12; color: #fff; }
#app-header .action-button:active { background: #ffffff1f; }
#app-header .action-button:disabled, #app-header .action-button:disabled:hover { background: transparent; color: #7b828c; opacity: .36; cursor: not-allowed; }
.action-icon, .search-icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
#more-button circle { fill: currentColor; stroke: none; }
.selection-count, .selection-count:hover { color: #fff; font-weight: 750; }
#app-header #bulk-delete { color: #ff4058; font-weight: 800; text-shadow: 0 0 14px #ff405844; }
#app-header #bulk-delete:hover, #app-header #bulk-delete:active { background: #ff40581f; color: #ff687a; }
.search-row { right: 0; left: auto; width: min(420px, 100%); border: 1px solid #ffffff20; border-radius: 10px; background: #05060852; padding-left: 10px; transform-origin: right center; }
#search-actions.is-active { animation: search-row-enter .18s cubic-bezier(.2, .72, .25, 1) both; }
@keyframes search-row-enter { from { transform: translateY(-5px) scaleX(.985); opacity: 0; } to { transform: translateY(0) scaleX(1); opacity: 1; } }
.search-row input { width: 100%; height: 36px; flex: 1; border: 0; background: transparent; padding: 0 8px; box-shadow: none; }
.search-row input:focus { border: 0; box-shadow: none; }
.search-row input::-webkit-search-cancel-button { display: none; }
.search-row .icon { flex: none; }
.action-menu { position: fixed; z-index: 30; top: 65px; right: 12px; display: grid; width: 280px; max-height: calc(100dvh - 76px); overflow: auto; border: 1px solid #ffffff14; border-radius: 12px; background: #06080a70; box-shadow: var(--shadow); padding: 5px; -webkit-backdrop-filter: blur(40px); backdrop-filter: blur(40px); }
.menu-item { justify-content: flex-start; border: 0; background: transparent; padding: 9px 10px; text-align: left; }
.menu-item:hover { background: #ffffff12; }
.menu-item:active { background: #ffffff1f; }
.menu-item > span { display: grid; }
.menu-item strong { font-weight: 650; }
.menu-item small { color: var(--muted); font-size: 11px; }
.menu-group { display: grid; }
.menu-chevron { margin-left: auto; color: var(--muted); font-size: 20px; transition: transform .15s; }
#limit-menu-button[aria-expanded="true"] .menu-chevron, #sort-menu-button[aria-expanded="true"] .menu-chevron { transform: rotate(90deg); }
.sort-submenu { display: grid; gap: 2px; padding: 2px 6px 7px 34px; }
.sort-option { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 3px; color: var(--muted); font-size: 12px; }
.sort-option > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sort-option button { min-height: 28px; border: 0; background: transparent; padding: 3px 6px; color: var(--muted); font-size: 11px; }
.sort-option button:hover { background: #ffffff12; color: #fff; }
.sort-option button[aria-checked="true"] { background: #ffffff1c; color: #fff; font-weight: 750; }
.limit-submenu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 2px 6px 7px 34px; }
.limit-option { min-height: 30px; border: 0; background: transparent; padding: 3px; color: var(--muted); font-size: 12px; }
.limit-option:hover { background: #ffffff12; color: #fff; }
.limit-option.active { background: #ffffff1c; color: #fff; font-weight: 750; }
.menu-divider { height: 1px; margin: 5px 7px; background: #ffffff18; }
.tools { display: flex; align-items: center; gap: 10px; padding: 14px 18px; }
input, textarea, select { border: 1px solid var(--line); border-radius: 9px; outline: none; background: var(--panel-raised); padding: .58rem .7rem; transition: border-color .16s, box-shadow .16s; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #7c8cff22; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 32px; border: 1px solid var(--line); border-radius: 999px; background: transparent; padding: .25rem .65rem; }
.chip.active { background-image: none !important; font-weight: inherit; box-shadow: none; }
.chip.active:hover { filter: brightness(1.08); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px; padding: 0 0 2px; }
.card { position: relative; aspect-ratio: 1; overflow: hidden; border: 0; border-radius: 2px; outline: none; background: var(--panel); cursor: pointer; }
.card-loading { cursor: default; background: linear-gradient(105deg, #181b20 20%, #2b3038 38%, #181b20 56%); background-size: 220% 100%; animation: card-loading-wave 1.25s ease-in-out infinite; }
@keyframes card-loading-wave { from { background-position: 100% 0; } to { background-position: -120% 0; } }
.card img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.card:hover img { transform: scale(1.025); }
.card-title { position: absolute; z-index: 2; right: 0; bottom: 0; left: 0; background: linear-gradient(transparent, #000d); padding: 28px 10px 9px; text-align: left; opacity: 0; transition: opacity .2s; }
.card:hover .card-title, .card:focus .card-title { opacity: 1; }
.card.selected { box-shadow: none; }
.card.selected::before { position: absolute; z-index: 1; inset: 0; background: #00000094; content: ""; pointer-events: none; }
.card-check { position: absolute; z-index: 3; top: 7px; right: 7px; width: 25px; min-height: 25px; border: 2px solid #fff; border-radius: 50%; background: #090b0db8; box-shadow: 0 1px 5px #0009; padding: 0; color: transparent; font-size: 14px; opacity: 0; transition: opacity .15s, background .15s, color .15s; }
.card:hover .card-check, .card:focus-within .card-check, .card.selected .card-check { opacity: 1; }
.card.selected .card-check { border-color: var(--accent); background: var(--accent); color: #fff; }
.card-labels { position: absolute; z-index: 2; top: 7px; left: 7px; display: flex; max-width: calc(100% - 46px); flex-wrap: wrap; gap: 3px; pointer-events: none; }
.card-label { max-width: 100%; overflow: hidden; border: 1px solid #ffffff38; border-radius: 25px; box-shadow: 0 1px 4px #0009; padding: 1px 5px; font-size: 10px; font-weight: 650; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.placeholder { display: grid; height: 100%; place-items: center; color: var(--muted); font-size: 42px; }
#sentinel { width: 100%; height: 1px; }
.media-end { display: grid; min-height: 150px; place-items: center; align-content: center; gap: 3px; color: var(--muted); text-align: center; }
.end-mark { display: grid; width: 34px; height: 34px; margin-bottom: 3px; place-items: center; border: 1px solid #ffffff18; border-radius: 10px; background: #ffffff08; color: #dce0e5; font-weight: 800; }
.media-end strong { color: #dce0e5; font-size: 13px; letter-spacing: -.02em; }
.media-end span:last-child { font-size: 11px; }

.notice, .dialog-notice { position: fixed; z-index: 10000; top: 72px; left: 50%; width: max-content; max-width: min(520px, calc(100vw - 48px)); margin: 0; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 11px; background: #20252df5; box-shadow: var(--shadow); padding: 11px 14px; overflow-wrap: anywhere; }
.notice-error { border-color: var(--danger) !important; background: #382027f5 !important; }
.notice-success { border-color: var(--success) !important; background: #193429f5 !important; }

html.login-open, html.login-open body { width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
html.modal-open { overflow: hidden; overscroll-behavior: none; }
body.modal-open { position: fixed; width: 100%; overflow: hidden; overscroll-behavior: none; }
.login { position: fixed; z-index: 50; inset: 0; display: grid; width: 100%; height: 100dvh; min-height: 0; overflow: hidden; place-items: center; padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); background: radial-gradient(circle at 50% 0, #202636 0, #0d0f12 52%); }
.login::before { position: absolute; inset: 0; background: linear-gradient(135deg, #ffffff03, transparent 42%); content: ""; pointer-events: none; }
.panel { position: relative; display: grid; width: min(380px, 100%); max-height: 100%; gap: 12px; border: 1px solid #ffffff18; border-radius: 16px; background: #06080a80; box-shadow: 0 22px 70px #0008; padding: 24px; -webkit-backdrop-filter: blur(40px); backdrop-filter: blur(40px); }
.panel label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 650; }
.panel input { min-height: 42px; border-color: #ffffff1c; background: #111419b8; }
.login-brand { display: flex; align-items: center; gap: 11px; }
.panel h1 { margin: -2px 0 0; font-size: 25px; font-weight: 780; letter-spacing: -.04em; line-height: 1.05; }
.mark { display: grid; width: 40px; height: 40px; flex: none; place-items: center; border: 1px solid #ffffff1a; border-radius: 11px; background: #ffffff08; color: #e8ebef; font-size: 19px; font-weight: 800; }
.login-submit { min-height: 42px; border-color: #ffffff20; background: #eef1f5; color: #101216; font-weight: 750; }
.login-submit:hover { border-color: #fff; background: #fff; }
.error { min-height: 1.5em; margin: 0; color: #ff9097; font-size: 12px; }

dialog { width: min(680px, calc(100vw - 28px)); max-height: 90vh; overflow: auto; border: 1px solid #ffffff1c; border-radius: 15px; background: #111417ed; box-shadow: 0 24px 70px #000a; color: var(--text); padding: 18px; -webkit-backdrop-filter: blur(28px); backdrop-filter: blur(28px); }
dialog::backdrop { background: #050608bd; -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); }
dialog[open]:not(#detail-dialog) { animation: modal-dialog-open .18s cubic-bezier(.2, .72, .25, 1) both; }
dialog[open]:not(#detail-dialog)::backdrop { animation: modal-backdrop-open .18s ease-out both; }
@keyframes modal-dialog-open { from { transform: translateY(7px) scale(.985); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes modal-backdrop-open { from { opacity: 0; } to { opacity: 1; } }
.dialog-head, dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-head h2 { margin: 0; font-size: 1.3rem; }
.workspace-dialog { overflow-x: hidden; overscroll-behavior: contain; padding: 0; isolation: isolate; }
.workspace-dialog > .dialog-head { position: sticky; z-index: 20; top: -1px; margin-top: -1px; border-bottom: 1px solid #ffffff12; border-radius: 14px 14px 0 0; background: #0d1013fa; box-shadow: 0 -8px 0 #0d1013; padding: 14px 16px; -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); }
.compact-dialog { width: min(440px, calc(100vw - 28px)); }
.warning-dialog { padding: 20px; }
.warning-dialog p { margin: 14px 0 20px; color: #cbd0d7; line-height: 1.65; }
.warning-dialog footer { justify-content: flex-end; }
.file-input-hidden { position: fixed; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; }

#upload-dialog { width: min(920px, calc(100vw - 28px)); padding: 0; }
.upload-tools { display: grid; gap: 9px; border-bottom: 1px solid #ffffff10; padding: 11px 14px; background: #0b0e117d; }
.upload-tools-row { display: flex; min-width: 0; align-items: center; gap: 9px; }
.upload-add-button { display: inline-flex; min-height: 34px; align-items: center; justify-content: center; gap: 5px; border: 1px solid #ffffff1c; border-radius: 9px; background: #ffffff0b; padding: 5px 10px; color: #eef1f5; cursor: pointer; white-space: nowrap; }
.upload-add-button:hover { background: #ffffff13; }
.upload-drop-hint { flex: 1; color: var(--muted); font-size: 11px; }
.upload-sort-controls { display: flex; align-items: end; gap: 5px; }
.upload-sort-controls label { display: grid; gap: 2px; color: var(--muted); font-size: 10px; }
.upload-sort-controls select { min-height: 32px; padding: 4px 27px 4px 8px; font-size: 12px; }
.upload-batch-editor { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 10px; align-items: center; border-radius: 10px; background: #ffffff08; padding: 8px 10px; }
.upload-batch-editor > strong { color: #dfe3e8; font-size: 11px; }
.upload-batch-fields { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(110px, 1fr) auto; gap: 6px; }
.upload-batch-fields input { min-height: 32px; padding: 5px 8px; font-size: 12px; }
.upload-batch-fields button { min-height: 32px; padding: 4px 10px; }
.upload-bulk-labels { grid-column: 2; min-height: 0 !important; }
.upload-list { display: grid; gap: 5px; padding: 9px 14px 14px; }
.upload-row { position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr) 28px; gap: 8px; align-items: center; border: 1px solid #ffffff12; border-radius: 9px; background: #ffffff04; padding: 7px; transition: border-color .16s, background .16s; }
.upload-row:focus-within { z-index: 4; }
.upload-row.is-uploading { border-color: var(--accent); background: var(--accent-soft); }
.upload-row.is-success { border-color: #347d60; background: var(--success-soft); }
.upload-row.is-error { border-color: var(--danger); background: var(--danger-soft); }
.upload-preview { width: 48px; height: 48px; border-radius: 6px; background: #090a0c; object-fit: cover; }
.upload-fields { display: grid; min-width: 0; gap: 4px; }
.upload-file-meta { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.upload-fields-main { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.upload-fields-main input { min-height: 31px; padding: 4px 7px; font-size: 12px; }
.upload-label-editor { position: relative; min-width: 0; }
.upload-label-control { display: flex; min-height: 30px; align-items: center; gap: 4px; border: 1px solid #ffffff17; border-radius: 8px; background: #111419b8; padding: 3px 6px; }
.upload-label-editor:focus-within .upload-label-control { border-color: var(--accent); box-shadow: 0 0 0 3px #7c8cff18; }
.upload-label-chips { display: contents; }
.upload-label-chip { min-height: 21px; border: 1px solid #ffffff2b; border-radius: 999px; background: #ffffff0b; padding: 1px 6px; color: #d6dbe2; font-size: 10px; }
.upload-label-chip:hover { background: #ffffff15; }
.upload-label-chip span { margin-left: 3px; color: var(--muted); font-size: 12px; }
.upload-label-search { width: 110px; min-height: 22px; flex: 1; border: 0; background: transparent; padding: 1px 3px; box-shadow: none; font-size: 11px; }
.upload-label-search:focus { border: 0; box-shadow: none; }
.upload-label-menu { position: absolute; z-index: 12; top: calc(100% + 4px); right: 0; left: 0; display: grid; max-height: 190px; overflow: auto; border: 1px solid #ffffff20; border-radius: 9px; background: #15191ef5; box-shadow: 0 16px 36px #000b; padding: 4px; -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px); }
.upload-label-menu.opens-up { top: auto; bottom: calc(100% + 4px); }
.upload-label-option { gap: 7px; }
.upload-label-option[aria-selected="true"]::before { order: 3; margin-left: auto; }
.label-swatch { width: 7px; height: 7px; flex: none; border-radius: 50%; background: currentColor; }
.upload-status { display: flex; align-items: center; gap: 5px; min-height: 16px; color: var(--muted); font-size: 10px; }
.upload-remove { width: 26px; min-height: 26px; border: 0; background: transparent; padding: 0; color: var(--muted); font-size: 17px; }
.upload-remove:hover { background: #ffffff10; color: #fff; }
.upload-row.is-uploading .upload-status { color: #b9c0ff; }
.upload-row.is-success .upload-status { color: var(--success); }
.upload-row.is-error .upload-status { color: #ff9ba4; }
.upload-progress { position: sticky; z-index: 3; top: 74px; display: grid; gap: 5px; border-bottom: 1px solid var(--line); background: #171a1ff2; padding: 10px 17px; backdrop-filter: blur(12px); }
.upload-progress > div { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.upload-progress progress { width: 100%; height: 7px; border: 0; border-radius: 999px; overflow: hidden; background: var(--panel-soft); }
.upload-progress progress::-webkit-progress-bar { background: var(--panel-soft); }
.upload-progress progress::-webkit-progress-value { border-radius: 999px; background: var(--accent); }
.upload-progress progress::-moz-progress-bar { border-radius: 999px; background: var(--accent); }
#upload-dialog .upload-footer { position: sticky; z-index: 10; bottom: 0; border-top: 1px solid #ffffff12; background: #0d1013e8; padding: 10px 14px; -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); }
.upload-batch-editor:focus-within, .upload-row:focus-within { z-index: 30; }
.upload-batch-editor:focus-within { position: relative; }

html.detail-open { overflow: hidden; }
body.detail-open { position: fixed; width: 100%; overflow: hidden; }
#detail-dialog { position: fixed; inset: 0; width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; overflow: hidden; overscroll-behavior: none; touch-action: pan-y; border: 0; border-radius: 0; outline: none; background: #02030445; padding: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
#detail-dialog::backdrop { background: #050608c4; -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px); }
#detail-dialog[open] { animation: detail-dialog-open .18s ease-out both; }
#detail-dialog[open]::backdrop { animation: detail-backdrop-open .18s ease-out both; }
#detail-dialog.is-closing { animation: detail-dialog-close .16s ease-in both; }
#detail-dialog.is-closing::backdrop { animation: detail-backdrop-close .16s ease-in both; }
@keyframes detail-dialog-open { from { opacity: 0; } to { opacity: 1; } }
@keyframes detail-dialog-close { from { opacity: 1; } to { opacity: 0; } }
@keyframes detail-backdrop-open { from { background: #05060800; backdrop-filter: blur(0); } to { background: #050608c4; backdrop-filter: blur(22px); } }
@keyframes detail-backdrop-close { from { background: #050608c4; backdrop-filter: blur(22px); } to { background: #05060800; backdrop-filter: blur(0); } }
.detail-close { position: fixed; z-index: 9; top: 20px; left: 20px; width: 38px; min-height: 38px; border: 1px solid transparent; border-radius: 9px; background: transparent; padding: 0; color: #f2f4f7; }
.detail-close:hover, .detail-close:focus-visible { border-color: #ffffff21; background: #07090b6b; }
.detail-close svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.detail-actions { position: fixed; z-index: 8; top: 20px; left: 50%; display: flex; align-items: center; gap: 2px; transform: translateX(-50%); border: 1px solid #a7adb680; border-radius: 11px; background: #07090b26; padding: 2px; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.detail-action { display: inline-grid; width: 36px; min-height: 34px; place-items: center; border: 0; border-radius: 8px; background: transparent; padding: 0; color: #f2f4f7; text-decoration: none; }
.detail-action:hover, .detail-action:focus-visible { background: #ffffff17; color: #fff; }
.detail-action:active { background: #ffffff24; }
.detail-action svg, .detail-nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.detail-action-danger { color: #ff5266; }
.detail-action-danger:hover, .detail-action-danger:focus-visible { background: #ff40581f; color: #ff687a; }
.detail-nav { position: fixed; z-index: 7; top: 50%; width: 48px; min-height: 70px; transform: translateY(-50%); border: 0; background: transparent; color: #e9edf2; opacity: 0; padding: 0; transition: opacity .16s, background .16s; }
.detail-nav:hover, .detail-nav:focus-visible, #detail-dialog:hover .detail-nav { background: #07090b52; opacity: 1; }
.detail-nav:active { transform: translateY(calc(-50% + 1px)); }
.detail-nav:disabled { visibility: hidden; }
.detail-prev { left: 14px; }
.detail-next { right: 14px; }
.detail-content { display: grid; width: min(86vw, 1500px); height: 100dvh; min-height: 0; margin: 0 auto; overflow: hidden; place-items: center; align-content: center; padding: 82px 64px 72px; }
.detail-content:not(.has-description) { padding-top: 0; padding-bottom: 0; }
.detail-presentation { position: relative; display: grid; width: fit-content; max-width: 100%; justify-items: stretch; }
.detail-media { display: grid; width: 100%; min-height: calc(100dvh - 164px); max-width: 100%; place-items: center; transform: translateX(var(--detail-drag-x, 0)); touch-action: pan-y; will-change: transform; }
.detail-media.is-dragging { cursor: grabbing; transition: none; }
.detail-media.is-settling { transition: transform .18s ease-out; }
.detail-image-frame { position: relative; display: grid; width: 100%; max-width: 100%; place-items: center; }
.detail-media img { display: block; width: 100%; height: auto; max-width: 100%; max-height: calc(100dvh - 164px); border-radius: 4px; background: #07080a; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.detail-image-loading { position: absolute; z-index: 2; top: 9px; right: 9px; display: grid; width: 25px; height: 25px; place-items: center; border: 1px solid #ffffff26; border-radius: 50%; background: #050608a8; color: #fff; pointer-events: none; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.detail-image-loading > span { width: 11px; height: 11px; border: 1.5px solid #ffffff4d; border-top-color: currentColor; border-radius: 50%; animation: detail-loading-spin .7s linear infinite; }
@keyframes detail-loading-spin { to { transform: rotate(360deg); } }
.detail-slide-viewport { width: 100vw; margin-inline: calc((100% - 100vw) / 2); overflow: hidden; }
.detail-slide-track { display: flex; width: max-content; gap: 0; will-change: transform; }
.detail-slide-track .detail-media { width: 100vw; max-width: none; flex: 0 0 100vw; padding: 0; }
.detail-slide-track .detail-image-frame { width: var(--detail-slide-image-width); max-width: 100%; }
.detail-slide-track .detail-media img { width: 100%; max-width: 100%; }
.detail-slide-track .detail-media-empty { visibility: hidden; }
.detail-description { position: absolute; z-index: 5; top: 0; right: 0; bottom: -72px; left: 0; width: 100%; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; margin: 0; scrollbar-width: thin; scrollbar-color: #ffffff36 transparent; touch-action: pan-y; will-change: opacity; }
.detail-description-surface { display: grid; width: 100%; gap: 10px; margin-top: var(--detail-description-start, 100%); background: #080a0ce8; padding: 10px 14px 14px; -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.detail-description.is-overlaid .detail-description-surface { background: linear-gradient(to bottom, #080a0c00 0, #080a0cb8 44px, #080a0ce8 78px); -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000b 34px, #000 64px); mask-image: linear-gradient(to bottom, transparent 0, #000b 34px, #000 64px); }
.detail-text-block { position: relative; z-index: 1; border-top: 1px solid #ffffff17; padding: 10px 38px 0 0; color: #c2c7ce; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-text-block:first-child { border-top: 0; padding-top: 0; }
.detail-text-label { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.detail-copy-text, .detail-info-copy { position: absolute; top: 6px; right: 0; width: 30px; min-height: 30px; border: 0; background: transparent; padding: 0; color: #c9ced6; }
.detail-text-block:first-child .detail-copy-text { top: -4px; }
.detail-copy-text:hover, .detail-info-copy:hover { background: #ffffff12; color: #fff; }
.detail-copy-text svg, .detail-info-copy svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.detail-content.is-switching .detail-description { animation: detail-description-out .14s ease-in both; }
.detail-content.is-entering-description .detail-description { animation: detail-description-in .2s ease-out both; }
.detail-content.is-fading-media-out .detail-media { animation: detail-media-fade-out .08s ease-out both; }
.detail-content.is-fading-media-in .detail-media { animation: detail-media-fade-in .16s ease-in both; }
@keyframes detail-description-out { to { opacity: 0; } }
@keyframes detail-description-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes detail-media-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes detail-media-fade-in { from { opacity: 0; } to { opacity: 1; } }
.detail-info-panel { position: fixed; z-index: 10; top: 84px; left: 24px; display: grid; width: min(370px, calc(100vw - 48px)); max-height: calc(100dvh - 108px); grid-template-rows: auto minmax(0, 1fr); overflow: hidden; border: 1px solid #ffffff20; border-radius: 13px; background: #111417c7; box-shadow: 0 20px 60px #0009; -webkit-backdrop-filter: blur(28px); backdrop-filter: blur(28px); animation: detail-info-open .22s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes detail-info-open { from { transform: scale(.97); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.detail-info-panel.is-closing { animation: detail-info-close .2s cubic-bezier(.7, 0, .84, 0) both; }
@keyframes detail-info-close { from { transform: scale(1); opacity: 1; } to { transform: scale(.97); opacity: 0; } }
.detail-info-head { position: static; display: grid; min-height: 0; grid-template-columns: 34px 1fr 34px; align-items: center; border: 0; background: transparent; cursor: move; touch-action: none; padding: 5px; text-align: center; user-select: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.detail-info-head h2 { margin: 0; font-size: 15px; }
.detail-info-close { width: 30px; min-height: 30px; border: 0; background: transparent; padding: 0; color: #d8dce2; font-size: 19px; }
.detail-info-close:hover { background: #ffffff12; }
.detail-info-content { display: grid; gap: 8px; overflow: auto; overscroll-behavior: contain; padding: 4px 11px 13px; }
.detail-info-summary { display: grid; gap: 7px; }
.detail-info-primary { display: grid; gap: 2px; border-radius: 10px; background: #ffffff14; padding: 10px 12px; }
.detail-info-primary small, .detail-info-key { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.detail-info-primary strong { overflow-wrap: anywhere; }
.detail-inline-title, .detail-inline-comment { width: 100%; border: 1px solid transparent; background: transparent; padding: 3px 4px; color: #f2f4f7; }
.detail-inline-title { margin: 0 -4px; font-size: 14px; font-weight: 700; }
.detail-inline-comment { min-height: 72px; resize: vertical; line-height: 1.5; }
.detail-info-row .detail-inline-comment { grid-column: 2 / -1; }
.detail-inline-title:hover, .detail-inline-comment:hover { border-color: #ffffff18; background: #ffffff08; }
.detail-inline-title:focus, .detail-inline-comment:focus { border-color: #7c8cff80; background: #090b0d7d; box-shadow: 0 0 0 3px #7c8cff18; }
.detail-label-editor { position: relative; display: grid; gap: 5px; }
.detail-label-control { display: flex; min-height: 43px; flex-wrap: wrap; gap: 5px; align-items: center; border: 1px solid transparent; border-radius: 10px; background: #ffffff14; padding: 7px 8px; }
.detail-label-editor:focus-within .detail-label-control { border-color: #7c8cff80; box-shadow: 0 0 0 3px #7c8cff18; }
.detail-label-search { width: 105px; min-height: 27px; flex: 1; border: 0; background: transparent; padding: 2px 4px; box-shadow: none; font-size: 12px; }
.detail-label-search:focus { border: 0; box-shadow: none; }
.detail-label-chip { min-height: 27px; border: 1px solid #ffffff2b; border-radius: 999px; background: #ffffff12; padding: 2px 7px; font-size: 11px; font-weight: 650; }
.detail-label-chip:hover { filter: brightness(1.1); }
.detail-label-chip span { margin-left: 4px; font-size: 14px; opacity: .8; }
.detail-label-menu { position: absolute; z-index: 3; top: calc(100% + 4px); right: 0; left: 0; display: grid; max-height: 210px; overflow: auto; border: 1px solid #ffffff20; border-radius: 10px; background: #15191ee8; box-shadow: 0 16px 36px #0009; padding: 4px; -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px); }
.detail-label-option { justify-content: flex-start; min-height: 34px; border: 0; background: transparent; padding: 6px 8px; color: #dce1e7; text-align: left; }
.detail-label-option:hover, .detail-label-option[aria-selected="true"]:hover { background: #ffffff12; }
.detail-label-option[aria-selected="true"] { background: transparent; }
.detail-label-option[aria-selected="true"]::before { content: "✓"; color: #aeb7ff; }
.detail-label-empty { padding: 9px; color: var(--muted); text-align: center; }
.detail-info-labels { display: flex; flex-wrap: wrap; gap: 5px; min-height: 40px; align-items: center; border-radius: 10px; background: #ffffff14; padding: 8px 10px; }
.detail-info-label { border: 1px solid #ffffff2b; border-radius: 999px; padding: 2px 7px; font-size: 11px; font-weight: 650; }
.detail-info-table { display: grid; border-radius: 10px; background: #ffffff12; padding: 5px 10px; }
.detail-info-row { position: relative; display: grid; grid-template-columns: minmax(90px, .38fr) minmax(0, 1fr) 28px; gap: 8px; align-items: start; border-top: 1px solid #ffffff0d; padding: 8px 0; }
.detail-info-row:first-child { border-top: 0; }
.detail-info-value { min-width: 0; color: #eef1f5; overflow-wrap: anywhere; white-space: pre-wrap; }
.detail-info-copy { position: static; width: 28px; min-height: 28px; margin-top: -4px; }
.detail-info-section-title { margin: 7px 0 0; color: #d9dde3; font-size: 12px; }
.detail-info-exif-group { border-top: 1px solid #ffffff10; padding-top: 4px; }
.detail-info-exif-group summary { color: var(--muted); cursor: pointer; font-size: 11px; }
.detail-info-empty { padding: 9px; color: var(--muted); text-align: center; }
.labels-dialog { width: min(720px, calc(100vw - 28px)); }
.label-create { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(280px, 1.4fr) auto; gap: 7px; margin: 12px 14px 7px; }
.label-create > input, .label-create > button { min-height: 34px; }
.label-order-hint { margin: 0 14px 8px; color: var(--muted); font-size: 10px; }
.labels-list { display: grid; gap: 4px; padding: 0 14px 14px; }
.label-row { position: relative; display: grid; grid-template-columns: 26px minmax(120px, 1fr) minmax(260px, 1.5fr) auto; gap: 7px; align-items: center; border: 1px solid #ffffff10; border-radius: 9px; background: #ffffff04; padding: 6px; }
.label-row.is-dragging { opacity: .45; }
.label-row::after { position: absolute; right: 5px; bottom: -3px; left: 5px; height: 2px; border-radius: 2px; background: transparent; content: ""; }
.label-row.drop-after::after { background: var(--accent); }
.label-drag-handle { display: grid; width: 24px; height: 30px; place-items: center; color: #7f8792; cursor: grab; font-weight: 800; letter-spacing: -3px; touch-action: none; user-select: none; }
.label-drag-handle:active { cursor: grabbing; }
.label-drag-handle:focus-visible { border-radius: 6px; outline: 2px solid var(--accent); }
.label-row > input { min-height: 32px; padding: 4px 7px; font-size: 12px; }
.label-color-editor { display: grid; grid-template-columns: 32px 78px minmax(0, 1fr); gap: 5px; align-items: center; }
.label-color-editor input[type="color"] { width: 32px; height: 30px; border: 0; background: transparent; padding: 1px; }
.label-color-text { min-height: 30px; padding: 3px 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; text-transform: uppercase; }
.color-palette { display: flex; min-width: 0; flex-wrap: wrap; gap: 3px; }
.color-swatch { width: 16px; min-height: 16px; border: 1px solid #ffffff40; border-radius: 50%; padding: 0; }
.color-swatch:hover { border-color: #fff; transform: scale(1.08); }
.label-row-actions { display: flex; gap: 3px; }
.label-row-actions button { min-height: 30px; padding: 3px 7px; font-size: 11px; }
.label-delete { border: 0; background: transparent; color: #ff687a; font-weight: 750; }
.label-delete:hover { background: #ff40581f; }
.bulk-label-dialog > p { margin: 12px 0 9px; color: var(--muted); font-size: 12px; }
.bulk-mode-control { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; border-radius: 9px; background: #ffffff08; padding: 3px; }
.bulk-mode-control button { min-height: 31px; border: 0; background: transparent; color: var(--muted); padding: 4px 8px; }
.bulk-mode-control button.is-active { background: #ffffff14; color: #fff; font-weight: 700; }
.bulk-label-editor { display: grid; gap: 4px; margin-top: 8px; }
.bulk-label-editor > input { min-height: 36px; }
.bulk-label-options { display: grid; max-height: 230px; overflow: auto; border: 1px solid #ffffff12; border-radius: 10px; background: #090b0d7d; padding: 4px; }
.bulk-label-option { gap: 7px; }
.bulk-label-option[aria-selected="true"]::before { order: 3; margin-left: auto; }
.bulk-progress { min-height: 20px; margin: 6px 0; color: var(--muted); font-size: 11px; }
.bulk-label-dialog footer { justify-content: flex-end; }

.drop-overlay { position: fixed; z-index: 9999; inset: 0; display: grid; border: 4px solid var(--accent); background: #0d0f12de; place-items: center; pointer-events: none; backdrop-filter: blur(8px); }
.drop-overlay > div { display: grid; gap: 7px; place-items: center; color: var(--muted); }
.drop-overlay span { display: grid; width: 64px; height: 64px; place-items: center; border-radius: 50%; background: var(--accent); color: white; font-size: 36px; }
.drop-overlay strong { color: var(--text); font-size: 20px; }

@media (max-width: 700px) {
  .login { padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  .login .panel { width: min(360px, 100%); gap: 10px; padding: 20px; }
  .login .panel input { font-size: 16px; }
  header { min-height: 54px; padding: 7px 9px 7px 13px; }
  .brand { font-size: 19px; }
  .action-viewport { height: 38px; margin-left: 8px; }
  .action-row { gap: 3px; }
  .action-button { min-height: 36px; padding: 0 8px; border-radius: 9px; }
  .action-button.icon-only { width: 36px; padding: 0; }
  .action-button .button-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .selection-count { padding: 0 8px; font-size: 12px; }
  .action-menu { top: 58px; right: 7px; }
  .tools { align-items: stretch; flex-wrap: wrap; gap: 8px; padding: 10px; }
  .chips { order: 3; width: 100%; }
  .limit { margin-left: 0; }
  input, textarea, select { font-size: 16px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-title { display: none; }
  .card:hover img { transform: none; }
  .card-check { display: none; }
  .selection-mode .card-check { display: inline-flex; opacity: 1; }
  dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); padding: 14px; }
  #upload-dialog { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); }
  .compact-dialog { width: min(440px, calc(100vw - 16px)); }
  .workspace-dialog { padding: 0; }
  .upload-tools { padding: 9px; }
  .upload-tools-row { align-items: stretch; flex-wrap: wrap; }
  .upload-add-button { font-size: 12px; }
  .upload-drop-hint { display: none; }
  .upload-sort-controls { flex: 1; justify-content: flex-end; }
  .upload-sort-controls select { font-size: 16px; }
  .upload-batch-editor { grid-template-columns: 1fr; }
  .upload-batch-fields { grid-template-columns: 1fr; }
  .upload-bulk-labels { grid-column: 1; }
  .upload-list { padding: 7px 9px 9px; }
  .upload-row { grid-template-columns: 42px minmax(0, 1fr) 26px; gap: 6px; padding: 6px; }
  .upload-preview { width: 42px; height: 42px; }
  .upload-fields-main { grid-template-columns: 1fr; }
  .detail-actions { top: max(10px, env(safe-area-inset-top)); }
  .detail-close { top: max(10px, env(safe-area-inset-top)); left: 8px; }
  .detail-content { width: 100%; padding: 66px 0 max(52px, env(safe-area-inset-bottom)); }
  .detail-content:not(.has-description) { padding-top: 0; padding-bottom: 0; }
  .detail-presentation { width: 100%; }
  .detail-media { width: 100%; min-height: calc(100dvh - 132px); }
  .detail-media img { width: 100%; max-height: calc(100dvh - 132px); border-radius: 0; }
  .detail-slide-track .detail-media { padding: 0; }
  .detail-slide-track .detail-image-frame { width: var(--detail-slide-image-width); max-width: 100%; }
  .detail-slide-track .detail-media img { width: 100%; max-width: 100%; }
  .detail-description { width: 100%; bottom: -52px; }
  .detail-description-surface { padding: 10px 14px max(14px, env(safe-area-inset-bottom)); }
  .detail-nav { display: none; }
  .detail-info-panel { inset: 0; width: 100%; max-height: none; height: 100dvh; border: 0; border-radius: 0; background: #090b0df5; animation: detail-info-mobile-open .28s cubic-bezier(.16, 1, .3, 1) both; }
  @keyframes detail-info-mobile-open { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .detail-info-panel.is-closing { animation: detail-info-mobile-close .24s cubic-bezier(.7, 0, .84, 0) both; }
  @keyframes detail-info-mobile-close { from { transform: translateY(0); } to { transform: translateY(100%); } }
  .detail-info-head { padding-top: max(8px, env(safe-area-inset-top)); cursor: default; touch-action: auto; }
  .detail-info-content { padding: 5px 12px max(18px, env(safe-area-inset-bottom)); }
  .detail-info-row { grid-template-columns: minmax(82px, .34fr) minmax(0, 1fr) 28px; }
  .detail-inline-title, .detail-inline-comment, .detail-label-search { font-size: 16px; }
  .labels-dialog { width: calc(100vw - 16px); }
  .label-create { grid-template-columns: 1fr; margin: 10px; }
  .label-color-editor { grid-template-columns: 36px 88px minmax(0, 1fr); }
  .label-order-hint { margin: 0 10px 7px; }
  .labels-list { padding: 0 10px 10px; }
  .label-row { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .label-row .label-color-editor { grid-column: 2 / -1; }
  .label-row-actions { grid-column: 2 / -1; justify-content: flex-end; }
}

@media (max-height: 620px) {
  .login .panel { gap: 8px; padding: 14px 18px; }
  .login-brand { gap: 9px; }
  .login .mark { width: 34px; height: 34px; border-radius: 9px; font-size: 16px; }
  .login .panel h1 { font-size: 22px; }
  .login .panel input, .login-submit { min-height: 36px; padding-top: .42rem; padding-bottom: .42rem; }
  .login .error { min-height: 1.2em; line-height: 1.2; }
}

@media (max-height: 520px) and (min-width: 540px) {
  .login .panel { width: min(680px, 100%); grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 10px; }
  .login-brand, .login-submit, .login .error { grid-column: 1 / -1; }
}

@media (max-width: 390px) {
  header { padding-right: 6px; padding-left: 9px; }
  .action-row { gap: 2px; }
  .action-button { min-height: 34px; padding: 0 6px; font-size: 12px; }
  .action-button.icon-only { width: 32px; }
  .action-icon, .search-icon { width: 16px; height: 16px; }
  .selection-count { padding: 0 6px; font-size: 11px; }
  .brand { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
