:root {
	color-scheme: light dark;
	--bg: #fff; --fg: #1f1f1f; --muted: #5f6368; --line: #e0e3e7; --panel: #f3f6fc; --hover: #e8eefb;
	--accent: #1a73e8; --accent-fg: #fff; --danger: #d93025;
}
@media (prefers-color-scheme: dark) {
	:root { --bg: #131314; --fg: #e3e3e3; --muted: #9aa0a6; --line: #3c4043; --panel: #1e1f20; --hover: #2a2c2f; --accent: #8ab4f8; --accent-fg: #062e6f; --danger: #f28b82; }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--fg); }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }

.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 18px; background: transparent; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.primary { border-color: var(--accent); background: var(--accent); color: var(--accent-fg); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.brand { display: flex; align-items: center; gap: 10px; margin-right: 8px; color: inherit; font-size: 1.25rem; text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.search { flex: 1; min-width: 80px; height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.search:focus { border-color: var(--accent); outline: none; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 12px 16px 4px; font-size: 1.05rem; }
.crumbs a { padding: 4px 8px; border-radius: 8px; color: inherit; text-decoration: none; }
.crumbs a:hover, .crumbs a.over { background: var(--hover); }
.crumbs a:last-child { font-weight: 600; }
.crumbs span { color: var(--muted); }

.actions { position: sticky; top: 57px; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 16px; padding: 8px 12px; border-radius: 12px; background: var(--panel); }
.actions span { margin-right: 8px; font-weight: 600; }

main { padding: 0 16px 90px; }
.files { width: 100%; border-collapse: collapse; }
.files th { padding: 8px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .85rem; font-weight: 500; text-align: left; }
.files td { padding: 0 8px; height: 46px; border-bottom: 1px solid var(--line); }
.files tr.row { cursor: pointer; }
.files tr.row:hover, .files tr.over { background: var(--hover); }
.files tr.picked { background: var(--panel); }
.files .pick { width: 36px; }
.files .size { width: 110px; color: var(--muted); white-space: nowrap; }
.files .when { width: 160px; color: var(--muted); white-space: nowrap; }
.files .name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.files .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .name small { color: var(--muted); }
.files svg { flex: none; width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.files .is-folder svg { fill: var(--accent); stroke: var(--accent); }
.empty { margin: 60px 0; color: var(--muted); text-align: center; }

.viewer { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; background: #000; color: #f1f3f4; color-scheme: dark;
	--line: rgba(255, 255, 255, .3); --hover: rgba(255, 255, 255, .14); }
.viewer header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; }
.viewer header span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer a.btn { color: inherit; text-decoration: none; }
.viewer-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 8px 8px; }
.viewer-body video, .viewer-body img { max-width: 100%; max-height: 100%; outline: none; }
.viewer-body audio { width: min(560px, 100%); }
.viewer-body p { max-width: 460px; color: #c4c7c5; text-align: center; line-height: 1.5; }
.viewer-seek { display: flex; align-items: center; gap: 12px; padding: 4px 16px 14px; font-size: .9rem; font-variant-numeric: tabular-nums; }
.viewer-seek input { flex: 1; accent-color: #8ab4f8; }
.viewer-note { color: #9aa0a6; font-size: .8rem; }
.drop { position: fixed; inset: 12px; z-index: 20; display: flex; align-items: center; justify-content: center; border: 3px dashed var(--accent); border-radius: 20px; background: color-mix(in srgb, var(--bg) 85%, transparent); color: var(--accent); font-size: 1.4rem; pointer-events: none; }
.uploads { position: fixed; right: 16px; bottom: 48px; z-index: 10; width: min(360px, calc(100vw - 32px)); max-height: 40vh; overflow: auto; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }
.uploads div { margin: 6px 0; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploads progress { display: block; width: 100%; height: 6px; margin-top: 3px; }
.uploads .failed { color: var(--danger); }
.space { position: fixed; left: 0; right: 0; bottom: 0; padding: 8px 16px; border-top: 1px solid var(--line); background: var(--bg); color: var(--muted); font-size: .85rem; }

dialog { width: min(420px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); color: var(--fg); }
dialog::backdrop { background: rgba(0, 0, 0, .5); }
dialog h2 { margin: 0 0 14px; font-size: 1.15rem; font-weight: 500; }
dialog input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.ask-list { max-height: 45vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.ask-list button { display: block; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.ask-list button:hover, .ask-list button.chosen { background: var(--hover); }
.ask-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toast { position: fixed; left: 50%; bottom: 56px; z-index: 30; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 10px 18px; border-radius: 10px; background: #323232; color: #fff; }

body.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; padding: 16px;
	background: #000 url("/login-bg.jpg") center / cover no-repeat fixed; color: #f1f3f4; color-scheme: dark;
	--fg: #f1f3f4; --muted: #c4c7c5; --line: rgba(255, 255, 255, .28); --accent: #8ab4f8; --accent-fg: #062e6f; --danger: #f28b82; --hover: rgba(255, 255, 255, .12); }
.login { width: 100%; max-width: 360px; padding: 32px 28px 28px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 20px;
	background: rgba(8, 10, 14, .58); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 20px 60px rgba(0, 0, 0, .6); text-align: center; }
.login img { display: block; width: 96px; height: 96px; margin: 0 auto 16px; border-radius: 22px; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); }
.login h1 { margin: 0 0 24px; font-size: 1.6rem; font-weight: 400; }
.login label { display: block; margin-bottom: 14px; color: var(--muted); font-size: .9rem; text-align: left; }
.login input { display: block; width: 100%; height: 44px; margin-top: 6px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0, 0, 0, .45); color: #f1f3f4; }
.login input:focus { border-color: var(--accent); outline: none; }
.login .btn { width: 100%; height: 44px; justify-content: center; margin-top: 8px; }
.login .msg { min-height: 1.4em; margin: 14px 0 0; color: var(--danger); font-size: .9rem; }

@media (max-width: 760px) {
	.top { flex-wrap: wrap; }
	.brand span { display: none; }
	.search { order: 5; flex-basis: 100%; }
	.files .when { display: none; }
	.files .size { width: 80px; }
	.actions { top: 103px; }
}
