:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --text: #1c1c1a;
  --muted: #6b6b66;
  --border: #e2e2dd;
  --accent: #2f6fde;
  --accent-text: #ffffff;
  --danger: #c43c3c;
  --drop: #eef3fd;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514;
    --surface: #1f1f1d;
    --text: #ececea;
    --muted: #9a9a94;
    --border: #33332f;
    --accent: #6c9cf0;
    --accent-text: #0d1320;
    --danger: #e07070;
    --drop: #1d2635;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

h1 { font-size: 22px; margin: 0; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

/* ---------- login ---------- */

#login-view { max-width: 340px; margin: 12vh auto 0; }
#login-view h1 { margin-bottom: 20px; }

form { display: flex; flex-direction: column; gap: 12px; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }

input {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button {
  font: inherit;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}
button:disabled { opacity: .6; cursor: default; }
button.secondary { background: transparent; color: var(--text); border-color: var(--border); padding: 6px 12px; }
button.delete { background: transparent; color: var(--muted); padding: 4px 8px; font-size: 13px; }
button.delete:hover { color: var(--danger); }

/* ---------- upload ---------- */

.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 24px;
  text-align: center;
  font-size: 15px;
  color: var(--muted);
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.dropzone.over { border-color: var(--accent); background: var(--drop); color: var(--text); }
.dropzone.busy { pointer-events: none; opacity: .6; }
/* input визуально скрыт, но клик по label открывает выбор файлов */
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

#upload-status { margin-top: 12px; }
.upload-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
.upload-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
progress { width: 100%; height: 6px; accent-color: var(--accent); }

/* ---------- list ---------- */

#file-list {
  list-style: none;
  padding: 0;
  margin: 20px 0 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
#file-list:empty { display: none; }
#file-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px 10px 16px;
  border-top: 1px solid var(--border);
}
#file-list li:first-child { border-top: 0; }

.file-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-main a { color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.file-main a:hover { color: var(--accent); text-decoration: underline; }

.meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.muted { font-size: 13px; color: var(--muted); }
.error { font-size: 13px; color: var(--danger); margin: 8px 0 0; }
