/* ===== Tokens ===== */
:root {
  --bg: #EEF1F4; --surface: #FFFFFF; --ink: #1C2733; --muted: #6B7785; --line: #D5DBE2;
  --accent: #2F5BD3; --accent-soft: #DCE5FA; --other: #B7C0CB; --danger: #C2412D; --ok: #2E8A57;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161C24; --surface: #1F2731; --ink: #E3E8EE; --muted: #8B97A5; --line: #2E3946;
    --accent: #6E93F0; --accent-soft: #25324A; --other: #45505E; --danger: #E06A55; --ok: #5CBF85;
  }
}

/* ===== Base ===== */
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font: inherit; cursor: pointer; }

/* ===== Connexion ===== */
body.login { min-height: 100vh; display: grid; place-items: center; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 2rem; width: min(340px, 90vw); }
.login-card h1 { font-size: 1.25rem; font-weight: 600; margin: 0 0 1.25rem; }
.login-card input { width: 100%; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font: inherit; }
.login-card button { margin-top: 1rem; width: 100%; padding: .65rem; border: 0; border-radius: 6px; background: var(--accent); color: #fff; font-weight: 500; }
.login-error { color: var(--danger); font-size: .9rem; margin: .75rem 0 0; }

/* ===== Mise en page ===== */
main { max-width: 980px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
header { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1.5rem; }
header h1 { font-size: 1.5rem; font-weight: 600; margin: 0; letter-spacing: -.01em; }
header a { color: var(--muted); text-decoration: none; font-size: .9rem; }
header a:hover { color: var(--ink); }

/* ===== Jauge de stockage ===== */
.storage { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem 1.25rem 1rem; }
.gauge { display: flex; height: 28px; border-radius: 5px; overflow: hidden; background: var(--bg); }
.gauge span { height: 100%; }
.gauge .f { background: var(--accent); border-right: 1px solid var(--surface); }
.gauge .f:nth-child(even) { opacity: .78; }
.gauge .f:hover, .gauge .f.hl { opacity: 1; background: var(--ink); }
.gauge .o { background: var(--other); }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; margin-top: .75rem; font-size: .9rem; color: var(--muted); }
.legend b { color: var(--ink); font-weight: 500; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .4rem; vertical-align: -1px; }
.legend .sw-files { background: var(--accent); }
.legend .sw-other { background: var(--other); }
.legend .sw-free  { background: var(--bg); outline: 1px solid var(--line); }

/* ===== Dépôt et file d'envoi ===== */
.drop { margin-top: 1rem; border: 1.5px dashed var(--line); border-radius: 10px; padding: 1.5rem; text-align: center; color: var(--muted); transition: background .15s, border-color .15s; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.drop label { color: var(--accent); font-weight: 500; cursor: pointer; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop small { display: block; margin-top: .25rem; font-size: .82rem; }

.queue { margin-top: .75rem; display: grid; gap: .5rem; }
.job { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .85rem; }
.job .row { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; }
.job .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job .st { color: var(--muted); white-space: nowrap; }
.job.done .st { color: var(--ok); }
.job.err .st { color: var(--danger); }
.bar { height: 4px; background: var(--bg); border-radius: 2px; margin-top: .45rem; overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.job.done .bar div { background: var(--ok); }

/* ===== Liste des fichiers ===== */
.list { margin-top: 2rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--line); }
.toolbar h2 { font-size: 1rem; font-weight: 600; margin: 0; }
.toolbar input { padding: .45rem .7rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font: inherit; width: min(260px, 50%); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; font-size: .82rem; color: var(--muted); padding: .6rem 1.25rem; border-bottom: 1px solid var(--line); }
td { padding: .6rem 1.25rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg); }
td.n { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.n a { color: var(--ink); text-decoration: none; }
td.n a:hover { color: var(--accent); text-decoration: underline; }
td.s, td.d { white-space: nowrap; color: var(--muted); font-size: .9rem; }
td.a { white-space: nowrap; text-align: right; }
.btn { border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 6px; padding: .3rem .7rem; font-size: .85rem; text-decoration: none; display: inline-block; }
.btn:hover { border-color: var(--muted); }
.btn.del { color: var(--danger); }
.btn.del.confirm { background: var(--danger); border-color: var(--danger); color: #fff; }
.empty { padding: 2.5rem 1.25rem; text-align: center; color: var(--muted); }
.partial { margin-top: 1.25rem; }
.partial .toolbar h2 { color: var(--muted); font-weight: 500; }

/* ===== Notification ===== */
.toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: .6rem 1rem; border-radius: 8px; font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.show { opacity: 1; }

/* ===== Responsive et accessibilité ===== */
@media (max-width: 640px) {
  .hide-sm { display: none; }
  td, th { padding-left: .85rem; padding-right: .85rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
