/*
	cloud.walter.tw — style « Aurore » : fond aux couleurs mouvantes, panneaux en verre dépoli.
	Thème : automatique (prefers-color-scheme) + bouton qui pose data-theme="light|dark" sur <html>.
*/

@font-face {
	font-family: "Sora";
	src: url("../fonts/sora.woff2") format("woff2");
	font-weight: 100 800;
	font-style: normal;
	font-display: swap;
}

/* ---------- Tokens (clair) ---------- */
:root {
	--bg: #EEF1FA;
	--panel: rgba(255, 255, 255, .74);
	--panel-solid: #FFFFFF;
	--side: rgba(255, 255, 255, .56);
	--ink: #1C1A33;
	--muted: #5F5D7A;
	--line: rgba(28, 26, 51, .11);
	--hover: rgba(124, 92, 255, .08);
	--sel: rgba(124, 92, 255, .16);
	--sel-line: #7C5CFF;
	--accent: #6D4DF2;
	--accent-ink: #FFFFFF;
	--danger: #D9364A;
	--success: #138A5E;
	--field: rgba(255, 255, 255, .85);
	--t-folder: #7C5CFF; --t-image: #F2714F; --t-audio: #00989A; --t-video: #E2416F;
	--t-pdf: #D9364A; --t-text: #2F7FD1; --t-archive: #C08A12; --t-doc: #2B6CB0; --t-other: #6E6A8C;
	--a1: #8A6BFF; --a2: #FF8E6B; --a3: #2CC7C7;
	--font: "Sora", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
	--radius: 22px;
	--radius-sm: 14px;
	--shadow: 0 20px 40px -24px rgba(60, 40, 140, .45);
	--side-w: 240px;
	--details-w: 310px;
	color-scheme: light;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #0D0B1A; --panel: rgba(28, 24, 52, .74); --panel-solid: #1A1730; --side: rgba(28, 24, 52, .56);
		--ink: #EDEBFF; --muted: #A9A5C8; --line: rgba(237, 235, 255, .11); --hover: rgba(154, 128, 255, .12);
		--sel: rgba(154, 128, 255, .22); --sel-line: #9A80FF; --accent: #9A80FF; --accent-ink: #0D0B1A;
		--danger: #FF6B7D; --success: #4CD39A; --field: rgba(13, 11, 26, .55);
		--a1: #5B3FD9; --a2: #B2533A; --a3: #148A8A;
		--shadow: 0 20px 40px -24px rgba(0, 0, 0, .9);
		color-scheme: dark;
	}
}
:root[data-theme="dark"] {
	--bg: #0D0B1A; --panel: rgba(28, 24, 52, .74); --panel-solid: #1A1730; --side: rgba(28, 24, 52, .56);
	--ink: #EDEBFF; --muted: #A9A5C8; --line: rgba(237, 235, 255, .11); --hover: rgba(154, 128, 255, .12);
	--sel: rgba(154, 128, 255, .22); --sel-line: #9A80FF; --accent: #9A80FF; --accent-ink: #0D0B1A;
	--danger: #FF6B7D; --success: #4CD39A; --field: rgba(13, 11, 26, .55);
	--a1: #5B3FD9; --a2: #B2533A; --a3: #148A8A;
	--shadow: 0 20px 40px -24px rgba(0, 0, 0, .9);
	color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font);
	font-size: 15px;
	line-height: 1.55;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0 0 1em; }
.ic { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Fond aurore */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora i { position: absolute; width: 60vmax; aspect-ratio: 1; border-radius: 50%; filter: blur(80px); opacity: .55; animation: drift 26s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { background: var(--a1); left: -15vmax; top: -20vmax; }
.aurora i:nth-child(2) { background: var(--a2); right: -20vmax; top: 10vh; animation-delay: -9s; }
.aurora i:nth-child(3) { background: var(--a3); left: 20vw; bottom: -30vmax; animation-delay: -17s; }
@keyframes drift { to { transform: translate(5vmax, 4vmax) scale(1.08); } }
.glass { background: var(--panel); border: 1px solid var(--line); -webkit-backdrop-filter: blur(22px) saturate(1.3); backdrop-filter: blur(22px) saturate(1.3); }

/* ---------- Boutons et champs ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line);
	background: var(--panel-solid); color: var(--ink); font-weight: 600; white-space: nowrap; text-decoration: none;
	transition: background-color .15s, transform .15s;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn .ic { width: 18px; height: 18px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-solid); display: grid; place-items: center; flex: none; }
.icon-btn:hover { background: var(--hover); }
.icon-btn .ic { width: 18px; height: 18px; }
.field { display: grid; gap: 6px; }
.field label, .label { font-weight: 600; font-size: 14px; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], textarea, select {
	width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
	border: 1px solid var(--line); background: var(--field); color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.notice { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid; font-weight: 600; font-size: 14px; }
.notice.error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.notice.success { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); background: color-mix(in srgb, var(--success) 10%, transparent); }

/* ---------- Pages publiques ---------- */
.site-head {
	display: flex; align-items: center; gap: 12px;
	padding: max(14px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) 14px max(20px, env(safe-area-inset-left, 0px));
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.brand small { display: block; font-weight: 600; font-size: 11px; opacity: .6; letter-spacing: .04em; text-transform: uppercase; }
.brand .mark { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #8A6BFF, #FF8E6B); color: #fff; display: grid; place-items: center; flex: none; }
.brand .mark .logo-cloud { width: 25px; height: auto; margin-top: 1px; }
.site-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.site-nav a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.site-nav a:hover { background: var(--hover); }
.site-nav a[aria-current="page"] { background: var(--sel); color: var(--accent); }
.site-nav .nav-cta { background: var(--accent); color: var(--accent-ink); }
.site-nav .nav-cta:hover { background: var(--accent); filter: brightness(1.08); }
.site-nav .ic { width: 18px; height: 18px; }
.page { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 12px max(20px, env(safe-area-inset-right, 0px)) 40px max(20px, env(safe-area-inset-left, 0px)); }
.site-foot { text-align: center; color: var(--muted); font-size: 13px; padding: 20px 20px calc(24px + env(safe-area-inset-bottom, 0px)); }
.card { border-radius: var(--radius); padding: clamp(22px, 4vw, 36px); box-shadow: var(--shadow); }
.auth { max-width: 440px; margin: 4vh auto 0; }
.auth form { display: grid; gap: 16px; }
.auth .switch { text-align: center; font-size: 14px; color: var(--muted); margin: 6px 0 0; }
.stack { display: grid; gap: 16px; }
@media (max-width: 640px) {
	.site-nav a span { display: none; }
	.site-nav .nav-cta span { display: inline; }
	.site-nav a { padding: 9px 11px; }
}

/* Envoi rapide */
.hero { text-align: center; max-width: 640px; margin: 3vh auto 24px; }
.hero p { color: var(--muted); font-size: 1.05rem; }
.drop {
	position: relative; display: grid; place-items: center; gap: 12px; text-align: center;
	min-height: 280px; padding: 32px; border-radius: var(--radius); align-content: center;
	border: 2px dashed color-mix(in srgb, var(--accent) 45%, transparent);
	cursor: pointer; transition: background-color .15s, border-color .15s, transform .15s;
}
.drop:hover, .drop.over { background: color-mix(in srgb, var(--accent) 10%, var(--panel)); border-color: var(--accent); }
.drop.over { transform: scale(1.01); }
.drop .big-ic { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #8A6BFF, #FF8E6B); color: #fff; }
.drop .big-ic .ic { width: 32px; height: 32px; }
.drop strong { font-size: 1.2rem; }
.drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.progress { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #8A6BFF, #FF8E6B); border-radius: inherit; transition: width .2s; }
.result { display: grid; gap: 14px; }
.result .row { display: flex; gap: 8px; }
.result input { flex: 1; min-width: 0; font-size: 14px; }
.result .qr { display: flex; align-items: center; gap: 14px; }
.result .qr img { width: 112px; height: 112px; border-radius: 12px; background: #fff; padding: 6px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 22px; }
.features > div { border-radius: var(--radius-sm); padding: 18px; font-size: 14px; color: var(--muted); }
.features strong { display: block; color: var(--ink); margin-bottom: 4px; font-size: 15px; }
body.embed { min-height: 0; background: transparent; }
body.embed .aurora { display: none; }
body.embed .page { padding: 8px; }
body.embed .drop { min-height: 180px; }

/* ---------- Explorateur ---------- */
body.app-body { height: 100vh; height: 100dvh; overflow: hidden; }
.app {
	flex: 1; min-height: 0; display: grid; gap: 14px;
	grid-template-columns: var(--side-w) minmax(0, 1fr) var(--details-w);
	padding: max(14px, env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) max(14px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
}
.app.no-details { grid-template-columns: var(--side-w) minmax(0, 1fr); }
.app.no-details .details { display: none; }
.side, .main, .details { border-radius: var(--radius); min-height: 0; }
.side { padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; background: var(--side); }
.side .brand { padding: 4px 8px 18px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); border: 0; background: none; text-align: left; font-weight: 600; width: 100%; color: var(--ink); text-decoration: none; }
.nav-item:hover { background: var(--hover); }
.nav-item[aria-current="page"] { background: var(--sel); color: var(--accent); }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }
.nav-item.drop-target { outline: 2px dashed var(--accent); }
.side .spacer { flex: 1; }
.usage { padding: 12px; border-radius: var(--radius-sm); background: var(--hover); font-size: 13px; }
.usage .bar { height: 6px; border-radius: 99px; background: var(--line); margin: 8px 0 4px; overflow: hidden; }
.usage .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #8A6BFF, #FF8E6B); border-radius: inherit; transition: width .4s; }
.account { display: flex; align-items: center; gap: 10px; padding: 10px 8px 0; font-size: 13px; min-width: 0; color: var(--ink); text-decoration: none; }
.account .av { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #FF8E6B, #8A6BFF); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; text-transform: uppercase; }
.account span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; position: relative; }
.top { display: flex; align-items: center; gap: 10px 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 2px; font-weight: 700; font-size: 18px; min-width: 0; flex: 1 1 160px; overflow: hidden; white-space: nowrap; }
.crumbs button { border: 0; background: none; padding: 4px 6px; border-radius: 8px; font-weight: inherit; min-width: 2.2em; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.crumbs button:last-child { color: var(--ink); flex: none; max-width: 100%; }
.crumbs button:hover { background: var(--hover); }
.crumbs button.drop-target { outline: 2px dashed var(--accent); }
.crumbs .sep { color: var(--muted); flex: none; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--field); color: var(--muted); min-width: 0; flex: 0 1 200px; }
.search input { border: 0; background: none; padding: 9px 0; box-shadow: none !important; min-width: 0; }
.search .ic { width: 16px; height: 16px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--panel-solid); }
.seg button { border: 0; background: none; padding: 6px 9px; border-radius: 999px; color: var(--muted); display: grid; place-items: center; }
.seg button[aria-pressed="true"] { background: var(--sel); color: var(--accent); }
.seg .ic { width: 18px; height: 18px; }
.sortsel { width: auto; padding: 8px 12px; border-radius: 999px; font-size: 13px; background: var(--panel-solid); }
.subbar { display: flex; align-items: center; gap: 8px 10px; padding: 8px 18px; min-height: 48px; color: var(--muted); font-size: 13px; flex-wrap: wrap; border-bottom: 1px solid transparent; }
.subbar .selinfo { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--panel-solid); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { background: var(--hover); }
.chip.danger { color: var(--danger); }
.files { flex: 1; overflow: auto; padding: 4px 18px 28px; position: relative; outline: none; }
.section-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 2px 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.item {
	position: relative; border: 1px solid transparent; border-radius: var(--radius); padding: 10px;
	display: flex; flex-direction: column; gap: 8px; user-select: none; -webkit-user-select: none; min-width: 0;
	background: color-mix(in srgb, var(--panel-solid) 78%, transparent); box-shadow: var(--shadow);
	transition: transform .15s, border-color .15s, background-color .15s; -webkit-touch-callout: none;
}
.item:hover { transform: translateY(-2px); }
.item[aria-selected="true"] { background: var(--sel); border-color: var(--sel-line); }
.item.drop-target { border-color: var(--accent); border-style: dashed; transform: scale(1.03); }
.item.dragging { opacity: .45; }
.item.cut { opacity: .5; }
.thumb {
	aspect-ratio: 4 / 3; border-radius: calc(var(--radius) - 6px); display: grid; place-items: center; overflow: hidden; position: relative;
	background: linear-gradient(140deg, color-mix(in srgb, var(--tc) 30%, transparent), color-mix(in srgb, var(--tc) 8%, transparent)); color: var(--tc);
}
.thumb .ic { width: 40%; height: 40%; stroke-width: 1.6; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb .badge { position: absolute; right: 6px; bottom: 6px; font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 2px 6px; border-radius: 6px; background: var(--tc); color: #fff; text-transform: uppercase; max-width: 70%; overflow: hidden; text-overflow: ellipsis; }
.thumb .shared { position: absolute; left: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%; background: var(--panel-solid); color: var(--accent); display: grid; place-items: center; }
.thumb .shared .ic { width: 14px; height: 14px; }
.name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { font-size: 12px; color: var(--muted); margin-top: -6px; }
.name input { padding: 3px 7px; border-radius: 7px; font-size: 14px; }
.files.list .grid { grid-template-columns: 1fr; gap: 2px; }
.files.list .item { flex-direction: row; align-items: center; gap: 14px; padding: 7px 12px; box-shadow: none; border-radius: var(--radius-sm); background: transparent; }
.files.list .item:hover { transform: none; background: var(--hover); }
.files.list .item[aria-selected="true"] { background: var(--sel); }
.files.list .thumb { width: 40px; aspect-ratio: 1; border-radius: 10px; flex: none; }
.files.list .thumb .badge, .files.list .thumb .shared { display: none; }
.files.list .name { flex: 1; }
.files.list .meta { margin: 0; width: 210px; text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.list-head { display: none; }
.files.list .list-head { display: flex; gap: 14px; padding: 6px 12px 6px 66px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.files.list .list-head span:first-child { flex: 1; }
.files.list .list-head span:last-child { width: 210px; text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 10vh 20px; }
.empty .ic { width: 56px; height: 56px; color: var(--accent); opacity: .6; margin-bottom: 8px; }
.empty strong { display: block; color: var(--ink); font-size: 1.1rem; margin-bottom: 4px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.dropzone { display: none; position: absolute; inset: 10px; border: 2px dashed var(--accent); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 12%, transparent); z-index: 5; place-items: center; text-align: center; color: var(--accent); font-weight: 700; font-size: 20px; pointer-events: none; }
.dropzone.on { display: grid; }
.dropzone .ic { width: 48px; height: 48px; }
.trash-banner { margin: 10px 0 4px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--hover); font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.trash-banner span { flex: 1 1 260px; }

/* Panneau de détails */
.details { overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.details .big { aspect-ratio: 4 / 3; border-radius: var(--radius); display: grid; place-items: center; overflow: hidden; position: relative; background: linear-gradient(140deg, color-mix(in srgb, var(--tc) 30%, transparent), color-mix(in srgb, var(--tc) 8%, transparent)); color: var(--tc); }
.details .big .ic { width: 34%; height: 34%; stroke-width: 1.5; }
.details .big img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: rgba(0,0,0,.04); }
.details h2 { margin: 0; font-size: 17px; word-break: break-word; }
.props { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; margin: 0; }
.props dt { color: var(--muted); }
.props dd { margin: 0; text-align: right; font-weight: 600; word-break: break-word; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions .btn { border-radius: var(--radius-sm); padding: 9px 10px; font-size: 13px; min-width: 0; white-space: normal; text-align: center; line-height: 1.25; }
.actions .btn .ic { width: 16px; height: 16px; }
.actions .wide { grid-column: 1 / -1; }
.share-box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; display: grid; gap: 8px; font-size: 13px; }
.share-box .row { display: flex; gap: 6px; }
.share-box input { flex: 1; min-width: 0; font-size: 12px; padding: 7px 9px; border-radius: 8px; }
.share-box .btn { padding: 7px 10px; border-radius: 8px; font-size: 12px; }
.share-box .qr { display: flex; gap: 12px; align-items: center; color: var(--muted); }
.share-box .qr img { width: 96px; height: 96px; border-radius: 8px; background: #fff; padding: 4px; flex: none; }
.empty-details { color: var(--muted); font-size: 14px; text-align: center; margin: auto; padding: 20px; }
.sheet-close { display: none; }

/* Envois en cours */
.uploads { position: fixed; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); width: min(360px, calc(100vw - 32px)); max-height: 50vh; overflow: auto; border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 12px 14px; z-index: 30; background: var(--panel-solid); border: 1px solid var(--line); }
.uploads header { display: flex; align-items: center; gap: 8px; }
.uploads h3 { margin: 0; font-size: 14px; flex: 1; }
.uploads header button { border: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.up { font-size: 13px; margin-top: 8px; }
.up .row { display: flex; gap: 8px; }
.up .row span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up .row span:last-child { color: var(--muted); flex: none; }
.up.err .row span:last-child { color: var(--danger); }
.up .progress { height: 5px; margin-top: 4px; }

/* Notification */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 160%); visibility: hidden; background: var(--ink); color: var(--bg); padding: 10px 12px 10px 18px; border-radius: 20px; font-weight: 600; font-size: 14px; transition: transform .25s, visibility 0s .25s; z-index: 60; max-width: calc(100% - 32px); display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); }
.toast.on { transform: translate(-50%, 0); visibility: visible; transition: transform .25s; }
.toast.error { background: var(--danger); color: #fff; }
.toast button { border: 0; background: color-mix(in srgb, var(--bg) 20%, transparent); color: inherit; border-radius: 999px; padding: 4px 12px; font-weight: 700; }
.toast:not(:has(button)) { padding-right: 18px; }

/* Aperçu plein écran */
.viewer { position: fixed; inset: 0; z-index: 50; background: rgba(8, 7, 18, .9); display: flex; flex-direction: column; padding: max(14px, env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) max(14px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px)); color: #fff; }
.viewer header { display: flex; align-items: center; gap: 8px; }
.viewer header strong { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.viewer header .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; }
/* Zone d'aperçu à la taille de l'écran : les pistes en minmax(0, 1fr) empêchent le contenu de l'agrandir */
.viewer .stage { flex: 1; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; min-height: 0; padding: 14px 0; position: relative; }
.viewer .stage > * { max-width: 100%; max-height: 100%; }
.viewer img, .viewer video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.viewer audio { width: min(520px, 100%); }
.viewer iframe { width: min(1000px, 100%); height: 100%; border: 0; border-radius: 8px; background: #fff; }
.viewer pre { width: min(900px, 100%); height: 100%; margin: 0; overflow: auto; background: #fff; color: #1d1d1f; border-radius: 10px; padding: 22px 26px; font-family: var(--mono); font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.viewer .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 22px; }
.viewer .nav.prev { left: 4px; }
.viewer .nav.next { right: 4px; }
.viewer .noprev { text-align: center; opacity: .85; }

/* Menu contextuel et boîtes de dialogue */
.ctx { position: fixed; z-index: 55; border-radius: 14px; box-shadow: var(--shadow); padding: 6px; min-width: 210px; background: var(--panel-solid); border: 1px solid var(--line); }
.ctx button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: none; padding: 9px 10px; border-radius: 9px; text-align: left; font-size: 14px; }
.ctx button:hover, .ctx button:focus-visible { background: var(--hover); outline: none; }
.ctx button kbd { margin-left: auto; font-family: inherit; font-size: 12px; color: var(--muted); }
.ctx .ic { width: 17px; height: 17px; color: var(--muted); }
.ctx hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.ctx .danger, .ctx .danger .ic { color: var(--danger); }
dialog { border: 0; padding: 0; background: transparent; color: var(--ink); max-width: min(460px, calc(100vw - 32px)); width: 100%; }
dialog::backdrop { background: rgba(10, 8, 25, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog .card { background: var(--panel-solid); display: grid; gap: 14px; }
dialog h2 { margin: 0; }
dialog .buttons { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.tree { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px; }
.tree button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 7px 8px; border-radius: 8px; text-align: left; font-size: 14px; }
.tree button:hover { background: var(--hover); }
.tree button[aria-pressed="true"] { background: var(--sel); color: var(--accent); font-weight: 600; }
.tree button[disabled] { opacity: .4; cursor: not-allowed; }
.tree .ic { width: 17px; height: 17px; color: var(--t-folder); }

@media (max-width: 1560px) { #b-mkdir .lbl, #b-empty .lbl { display: none; } #b-mkdir, #b-empty { padding: 9px; } }
@media (max-width: 1280px) { .top .sortsel { display: none; } }

/* Barre d'onglets mobile */
.tabbar { display: none; }

@media (max-width: 1120px) {
	.app, .app.no-details { grid-template-columns: 220px minmax(0, 1fr); }
	.app .details { position: fixed; right: 10px; top: 10px; bottom: 10px; width: min(340px, 92vw); z-index: 35; background: var(--panel-solid); box-shadow: var(--shadow); }
	.app.no-details .details { display: none; }
	.sheet-close { display: inline-flex; align-self: flex-end; }
}
@media (max-width: 760px) {
	.app, .app.no-details { grid-template-columns: minmax(0, 1fr); padding: 0; gap: 0; }
	.side { display: none; }
	.main { border-radius: 0; border: 0; }
	.top { padding: max(10px, env(safe-area-inset-top, 0px)) 14px 10px; }
	.top .btn .lbl { display: none; }
	.top .btn { padding: 9px; }
	.top [data-theme-toggle] { display: none; }
	.top .sortsel { display: block; }
	.search { order: 5; flex: 1 1 100%; }
	.files { padding: 4px 14px calc(96px + env(safe-area-inset-bottom, 0px)); }
	.subbar { padding: 6px 14px; }
	.grid { grid-template-columns: repeat(auto-fill, minmax(min(140px, 44vw), 1fr)); gap: 10px; }
	.files.list .meta { width: auto; max-width: 42%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.files.list .list-head { display: none; }
	.app .details { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 85vh; border-radius: var(--radius) var(--radius) 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
	.tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; border-top: 1px solid var(--line); padding: 6px max(10px, env(safe-area-inset-left, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)); justify-content: space-around; align-items: end; background: var(--panel-solid); }
	.tabbar a, .tabbar button { border: 0; background: none; display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 8px; text-decoration: none; }
	.tabbar [aria-current="page"] { color: var(--accent); }
	.tabbar .ic { width: 22px; height: 22px; }
	.tabbar .fab { width: 54px; height: 54px; border-radius: 50%; background: linear-gradient(135deg, #8A6BFF, #FF8E6B); color: #fff; place-items: center; margin-top: -24px; box-shadow: var(--shadow); padding: 0; }
	.uploads { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
	.toast { bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }
}
