/* ✹✺ File Explorer — follows the site's dark / light choice (html[data-theme]) or the device setting. */
.osb-files {
	--f-bg: #0b0d14;
	--f-card: #131623;
	--f-card-hover: #1a1e2e;
	--f-line: rgba(180, 190, 220, .16);
	--f-line-strong: rgba(180, 190, 220, .3);
	--f-text: #dfe2ec;
	--f-muted: #8a90a4;
	--f-accent: #8cc8ff;
	--f-danger: #ff8a8a;
	--f-pdf: #e06c6c;
	--f-png: #6fcf97;
	--f-jpg: #e8a25a;
	--f-gif: #b49bff;
	--f-shadow: 0 18px 50px rgba(0, 0, 0, .5);
	position: relative;
	box-sizing: border-box;
	max-width: 1200px;
	margin: 2em auto;
	padding: 20px;
	border: 1px solid var(--f-line);
	border-radius: 18px;
	background: var(--f-bg);
	color: var(--f-text);
	font: 15px/1.45 "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="light"] .osb-files {
	--f-bg: #ffffff; --f-card: #f4f5f9; --f-card-hover: #eceef5; --f-line: rgba(20, 30, 60, .12); --f-line-strong: rgba(20, 30, 60, .24);
	--f-text: #171a24; --f-muted: #5d6478; --f-accent: #2864d8; --f-danger: #c62f2f; --f-shadow: 0 18px 50px rgba(20, 30, 60, .18);
}
@media (prefers-color-scheme: light) {
	:root:not([data-theme="dark"]) .osb-files.osbf-auto {
		--f-bg: #ffffff; --f-card: #f4f5f9; --f-card-hover: #eceef5; --f-line: rgba(20, 30, 60, .12); --f-line-strong: rgba(20, 30, 60, .24);
		--f-text: #171a24; --f-muted: #5d6478; --f-accent: #2864d8; --f-danger: #c62f2f; --f-shadow: 0 18px 50px rgba(20, 30, 60, .18);
	}
}
.osb-files *, .osb-files *::before, .osb-files *::after { box-sizing: border-box; }
.osb-files button, .osb-files input, .osb-files select { font: inherit; color: inherit; }
.osb-files svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.osb-files.is-loading .osbf-items { opacity: .55; transition: opacity .15s; }

.osbf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.osbf-title { margin: 0; font-size: 1.5em; font-weight: 600; letter-spacing: -.01em; }
.osbf-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.osbf-btn {
	display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px;
	border: 1px solid var(--f-line-strong); border-radius: 10px; background: transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.osbf-btn:hover { background: var(--f-card-hover); }
.osbf-btn-primary { border-color: transparent; background: var(--f-accent); color: #fff !important; }
.osbf-btn-primary:hover { background: var(--f-accent); filter: brightness(1.1); }
:root:not([data-theme="light"]) .osbf-btn-primary { color: #06101c !important; }
.osbf-btn[hidden] { display: none; }
.osbf-iconbtn { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--f-line-strong); border-radius: 10px; background: transparent; cursor: pointer; }
.osbf-iconbtn:hover { background: var(--f-card-hover); }
.osb-files :focus-visible, .osbf-modal :focus-visible, .osbf-picker :focus-visible { outline: 2px solid var(--f-accent); outline-offset: 2px; }

.osbf-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin: 14px 0 10px; }
.osbf-crumb { padding: 4px 8px; border: 0; border-radius: 8px; background: none; color: var(--f-muted); cursor: pointer; }
.osbf-crumb:hover, .osbf-crumb.is-target { background: var(--f-card-hover); color: var(--f-text); }
.osbf-crumb.is-current { color: var(--f-text); font-weight: 600; }
.osbf-sep { color: var(--f-muted); }

.osbf-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.osbf-search { flex: 1 1 220px; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--f-line-strong); border-radius: 10px; color: var(--f-muted); }
.osbf-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--f-text); }
.osbf-chips { display: flex; border: 1px solid var(--f-line-strong); border-radius: 10px; overflow: hidden; }
.osbf-chip { height: 36px; padding: 0 12px; border: 0; background: none; cursor: pointer; color: var(--f-muted); }
.osbf-chip + .osbf-chip { border-left: 1px solid var(--f-line); }
.osbf-chip.is-on { background: var(--f-card-hover); color: var(--f-text); font-weight: 600; }
.osbf-sort { height: 38px; padding: 0 10px; border: 1px solid var(--f-line-strong); border-radius: 10px; background: var(--f-bg); }
.osbf-status { min-height: 1.2em; margin-bottom: 8px; color: var(--f-muted); font-size: .9em; }

/* items */
.osbf-items.osbf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.osbf-items.osbf-list { display: flex; flex-direction: column; gap: 4px; }
.osbf-item { position: relative; border: 1px solid var(--f-line); border-radius: 14px; background: var(--f-card); cursor: pointer; transition: background .12s, border-color .12s, transform .12s; outline-offset: 2px; }
.osbf-item:hover { background: var(--f-card-hover); border-color: var(--f-line-strong); }
.osbf-item.is-target { border-color: var(--f-accent); box-shadow: 0 0 0 2px var(--f-accent) inset; }
.osbf-grid .osbf-item { display: flex; flex-direction: column; overflow: hidden; }
.osbf-grid .osbf-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; background: rgba(127, 127, 127, .08); color: var(--f-muted); overflow: hidden; }
.osbf-grid .osbf-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.osbf-grid .osbf-thumb svg { width: 56px; height: 56px; }
.osbf-grid .osbf-folder .osbf-thumb { color: var(--f-accent); aspect-ratio: auto; height: 96px; }
.osbf-grid .osbf-meta { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; min-width: 0; }
.osbf-list .osbf-item { display: flex; align-items: center; gap: 12px; padding: 8px 44px 8px 10px; border-radius: 10px; }
.osbf-list .osbf-thumb { position: relative; display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 8px; overflow: hidden; background: rgba(127, 127, 127, .08); color: var(--f-muted); }
.osbf-list .osbf-thumb img { width: 100%; height: 100%; object-fit: cover; }
.osbf-list .osbf-folder .osbf-thumb { color: var(--f-accent); }
.osbf-list .osbf-meta { display: flex; flex: 1; min-width: 0; align-items: baseline; justify-content: space-between; gap: 12px; }
.osbf-list .osbf-badge { display: none; }
.osbf-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 500; }
.osbf-sub { color: var(--f-muted); font-size: .82em; white-space: nowrap; }
.osbf-badge { position: absolute; left: 8px; top: 8px; padding: 2px 7px; border-radius: 6px; color: #fff; font: 700 10px/1.4 ui-monospace, Menlo, monospace; letter-spacing: .04em; }
.osbf-badge-pdf { background: var(--f-pdf); } .osbf-badge-png { background: var(--f-png); } .osbf-badge-jpg { background: var(--f-jpg); } .osbf-badge-gif { background: var(--f-gif); }
.osbf-thumb-pdf svg { color: var(--f-pdf); }
.osbf-menu-btn { position: absolute; right: 6px; top: 6px; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: rgba(0, 0, 0, .35); color: #fff; cursor: pointer; opacity: 0; transition: opacity .12s; }
.osbf-list .osbf-menu-btn { top: 50%; transform: translateY(-50%); background: none; color: var(--f-muted); opacity: 1; }
.osbf-item:hover .osbf-menu-btn, .osbf-item:focus-within .osbf-menu-btn, .osbf-menu-btn:focus-visible { opacity: 1; }
@media (hover: none) { .osbf-menu-btn { opacity: 1; } }
.osbf-menu { position: absolute; z-index: 20; right: 6px; top: 42px; min-width: 190px; padding: 6px; border: 1px solid var(--f-line-strong); border-radius: 12px; background: var(--f-bg); box-shadow: var(--f-shadow); }
.osbf-list .osbf-menu { top: 100%; }
.osbf-menu-row { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; text-align: left; cursor: pointer; }
.osbf-menu-row:hover { background: var(--f-card-hover); }
.osbf-danger { color: var(--f-danger) !important; }
.osbf-empty { grid-column: 1 / -1; display: grid; gap: 4px; justify-items: center; padding: 48px 16px; border: 1.5px dashed var(--f-line-strong); border-radius: 14px; color: var(--f-muted); text-align: center; }
.osbf-empty b { color: var(--f-text); }
.osbf-more { display: flex; margin: 16px auto 0; }
.osbf-more[hidden] { display: none; }

/* drop + upload queue + toast */
.osbf-drop { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; border: 2px dashed var(--f-accent); border-radius: 18px; background: color-mix(in srgb, var(--f-bg) 88%, transparent); pointer-events: none; }
.osbf-drop[hidden] { display: none; }
.osbf-drop div { display: grid; justify-items: center; gap: 6px; text-align: center; }
.osbf-drop svg { width: 42px; height: 42px; color: var(--f-accent); }
.osbf-drop span { color: var(--f-muted); }
.osbf-queue { margin-top: 16px; padding: 10px 12px; border: 1px solid var(--f-line); border-radius: 12px; }
.osbf-queue[hidden] { display: none; }
.osbf-q-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px 120px; gap: 12px; align-items: center; padding: 5px 0; font-size: .9em; }
.osbf-q-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.osbf-q-bar { height: 6px; border-radius: 6px; background: var(--f-line); overflow: hidden; }
.osbf-q-bar i { display: block; width: 0; height: 100%; background: var(--f-accent); transition: width .15s; }
.osbf-q-state { color: var(--f-muted); text-align: right; }
.osbf-q-row.is-done .osbf-q-state { color: var(--f-png); }
.osbf-q-row.is-error .osbf-q-state { color: var(--f-danger); }
.osbf-q-row.is-error .osbf-q-bar i { background: var(--f-danger); width: 100%; }
.osbf-toast { position: fixed; z-index: 100000; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 10px 16px; border-radius: 10px; background: #171a24; color: #fff; font: 14px/1.3 "Space Grotesk", system-ui, sans-serif; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.osbf-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* preview */
.osbf-modal, .osbf-picker { --f-line-strong: rgba(255, 255, 255, .22); --f-card-hover: rgba(255, 255, 255, .1); --f-accent: #8cc8ff; }
.osbf-lock, .osbf-lock body { overflow: hidden; }
.osbf-modal { position: fixed; inset: 0; z-index: 99995; display: grid; grid-template-columns: 56px 1fr 56px; grid-template-rows: auto 1fr; background: rgba(5, 6, 10, .94); color: #eef0f6; font: 15px/1.4 "Space Grotesk", system-ui, sans-serif; }
.osbf-modal[hidden] { display: none; }
.osbf-m-bar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.osbf-m-title { display: flex; flex-direction: column; min-width: 0; }
.osbf-m-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.osbf-m-sub { color: #9aa0b4; font-size: .85em; }
.osbf-m-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.osbf-modal .osbf-btn, .osbf-modal .osbf-iconbtn { height: 36px; border-color: rgba(255, 255, 255, .2); color: #eef0f6; background: transparent; font: inherit; }
.osbf-modal .osbf-btn:hover, .osbf-modal .osbf-iconbtn:hover { background: rgba(255, 255, 255, .1); }
.osbf-modal .osbf-danger { color: #ff9b9b !important; }
.osbf-modal [hidden] { display: none !important; }
.osbf-view { position: relative; display: grid; place-items: center; min-height: 0; overflow: auto; padding: 16px; }
.osbf-img { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; cursor: zoom-in; transition: transform .2s; transform-origin: center; }
.osbf-img.is-zoomed { cursor: zoom-out; }
.osbf-view.is-pdf { display: flex; flex-direction: column; padding: 0; }
.osbf-pdf { flex: 1; width: 100%; min-height: calc(100vh - 120px); border: 0; background: #fff; }
.osbf-pdf-alt { margin: 6px; color: #9aa0b4; font-size: .85em; text-align: center; }
.osbf-pdf-alt a { color: #8cc8ff; }
.osbf-m-nav { align-self: center; justify-self: center; width: 44px; height: 64px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .08); color: #fff; font-size: 34px; cursor: pointer; }
.osbf-m-nav:hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
.osbf-m-nav:disabled { opacity: .2; cursor: default; }

/* folder picker */
.osbf-picker { position: fixed; inset: 0; z-index: 99996; display: grid; place-items: center; background: rgba(5, 6, 10, .6); }
.osbf-picker-box { width: min(420px, calc(100vw - 32px)); max-height: 70vh; display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 16px; background: #131623; color: #eef0f6; font: 15px/1.4 "Space Grotesk", system-ui, sans-serif; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
:root[data-theme="light"] .osbf-picker-box { background: #fff; color: #171a24; }
.osbf-picker-list { overflow: auto; }
.osbf-picker-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.osbf-picker-row:hover { background: rgba(127, 127, 127, .14); }
.osbf-picker-row svg { width: 18px; height: 18px; fill: #8cc8ff; }
.osbf-picker-foot { display: flex; justify-content: flex-end; }
.osbf-picker .osbf-btn { height: 36px; padding: 0 14px; border: 1px solid rgba(127, 127, 127, .4); border-radius: 10px; background: none; color: inherit; font: inherit; cursor: pointer; }

@media (max-width: 640px) {
	.osb-files { padding: 14px; border-radius: 14px; }
	.osbf-items.osbf-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
	.osbf-btn span { display: none; }
	.osbf-btn { padding: 0 10px; }
	.osbf-actions .osbf-btn:first-child span { display: inline; }
	.osbf-q-row { grid-template-columns: minmax(0, 1fr) 80px; }
	.osbf-q-state { grid-column: 1 / -1; text-align: left; }
	.osbf-modal { grid-template-columns: 0 1fr 0; }
	.osbf-m-nav { display: none; }
	.osbf-list .osbf-meta { flex-direction: column; align-items: flex-start; gap: 0; }
}
@media (prefers-reduced-motion: reduce) { .osbf-item, .osbf-img, .osbf-toast { transition: none; } }
