/* arKive — feuille de style unique, sobre et dense. Thème sombre par défaut,
   respect de prefers-color-scheme, police système, aucune dépendance externe. */

:root {
  --bg: #14171c;
  --panel: #1c2027;
  --panel-2: #232833;
  --border: #313846;
  --text: #e6e9ef;
  --muted: #8b93a3;
  --accent: #4f8cff;
  --accent-text: #ffffff;
  --danger: #e5484d;
  --ok: #3fb950;
  --radius: 8px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6fa;
    --panel: #ffffff;
    --panel-2: #f0f2f7;
    --border: #d7dce5;
    --text: #1a1d23;
    --muted: #667085;
    --accent: #2563eb;
    --accent-text: #ffffff;
    --danger: #d92d20;
    --ok: #12813f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.2rem; background: var(--panel); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); }
.topbar nav { display: flex; align-items: center; gap: 1rem; }
.who { color: var(--muted); }
.langmenu { position: relative; }
.langmenu summary {
  cursor: pointer; color: var(--muted); font-size: .85rem; list-style: none; user-select: none;
}
.langmenu summary::-webkit-details-marker { display: none; }
.langmenu[open] summary { color: var(--text); }
.langmenu-list {
  position: absolute; right: 0; top: 1.7rem; z-index: 60;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  min-width: 140px; padding: .3rem; display: flex; flex-direction: column; gap: .1rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
}
.langmenu-list a { color: var(--text); padding: .35rem .55rem; border-radius: 4px; text-decoration: none; font-size: .85rem; }
.langmenu-list a:hover { background: var(--panel-2); text-decoration: none; }
.langmenu-list a.cur { font-weight: 700; color: var(--accent); }

main { max-width: 900px; margin: 1.5rem auto; padding: 0 1rem; }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.2rem 0 .6rem; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.center { text-align: center; }

.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem; margin-bottom: 1.2rem;
}
.auth-card { max-width: 360px; margin: 3rem auto; }
.session-card .meta { display: grid; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); gap: .6rem; }
.meta dt { color: var(--muted); font-size: .8rem; }
.meta dd { margin: 0; }

label { display: block; margin: .6rem 0; }
input[type=text], input[type=password], input[type=number] {
  width: 100%; padding: .5rem .6rem; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 6px; color: var(--text);
}
input[type=number] { width: auto; }

button, .btn {
  display: inline-block; cursor: pointer; padding: .5rem .8rem;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; font-size: .9rem;
}
button:hover, .btn:hover { border-color: var(--accent); }
.primary {
  background: var(--accent); color: var(--accent-text); border-color: var(--accent);
  font-weight: 600;
}
.primary.block { display: block; text-align: center; margin: 1rem 0; padding: .7rem; }
.danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn.danger { border-color: var(--border); }
.link { background: none; border: none; color: var(--accent); padding: 0; cursor: pointer; }
.inline { display: inline; }
.chk { display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem; }

.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 2rem; text-align: center; transition: border-color .15s, background .15s;
}
.dropzone.drag { border-color: var(--accent); background: var(--panel-2); }
.browse-row { display: flex; gap: .6rem; justify-content: center; margin: .6rem 0; flex-wrap: wrap; }

.queue { margin-top: 1rem; }
.queue-head { display: flex; justify-content: space-between; align-items: center; }
.queue ul { list-style: none; padding: 0; margin: .6rem 0; max-height: 320px; overflow: auto; }
.queue li {
  display: flex; align-items: center; gap: .6rem; padding: .3rem .4rem;
  border-bottom: 1px solid var(--border); font-size: .88rem;
}
.queue li .path { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue li .size { color: var(--muted); min-width: 5rem; text-align: right; }
.queue li.conflict { color: var(--danger); }
.queue li .mini { flex-basis: 100%; }

.progress-wrap { margin-top: 1rem; }
.progress { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.bar { height: 100%; width: 0; background: var(--accent); transition: width .15s; }

.result .link-row, .link-row {
  display: flex; gap: .5rem; align-items: center; margin: .5rem 0; flex-wrap: wrap;
}
.link-row label { margin: 0; min-width: 4.5rem; }
.link-row input { flex: 1; min-width: 12rem; }

.row-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.howto { margin: .6rem 0; padding-left: 1.2rem; }
.howto li { margin-bottom: .8rem; }
.howto .step { display: block; margin-bottom: .3rem; }
.howto input, .howto-more code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.howto-more summary { cursor: pointer; color: var(--accent); }
.howto-more ul { margin: .5rem 0; padding-left: 1.2rem; }
.howto-more li { margin-bottom: .3rem; }

table.grid { width: 100%; border-collapse: collapse; font-size: .85rem; }
.grid th, .grid td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.grid th { color: var(--muted); font-weight: 600; }
.actions form { margin-bottom: .3rem; }
.keycell input { width: 9rem; font-family: ui-monospace, monospace; font-size: .8rem; }
.keycell { white-space: nowrap; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.section-head h2 { margin: 0; }

/* Modales (créer / éditer un utilisateur) */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .6);
  display: none; align-items: flex-start; justify-content: center;
  padding: 6vh 1rem; overflow: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem 1.4rem; max-width: 520px; width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 0 .3rem; }
.modal-close:hover { color: var(--text); }
.modal hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.modal-actions { display: flex; gap: .5rem; justify-content: space-between; align-items: center; margin-top: 1rem; }

.tree { font-size: .9rem; }
.tree details { margin-left: .4rem; }
.tree summary.dir { cursor: pointer; font-weight: 600; padding: .15rem 0; }
.tree-children { border-left: 1px solid var(--border); margin-left: .4rem; padding-left: .6rem; }
.tree-file { display: flex; justify-content: space-between; padding: .15rem 0; }
.tree-file .size { margin-left: 1rem; }

@media (max-width: 600px) {
  .row-form { flex-direction: column; align-items: stretch; }
  table.grid { display: block; overflow-x: auto; }
}
