:root {
  --bg: #f6f7f9;
  --card: #fff;
  --text: #1d2330;
  --muted: #6b7280;
  --border: #e3e6eb;
  --accent: #2f6fde;
  --danger: #c93a3a;
  --ok: #1f8a4c;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181e;
    --card: #1d2129;
    --text: #e6e8ec;
    --muted: #9aa1ad;
    --border: #2c323d;
    --accent: #5b8ff0;
    --danger: #ec6a6a;
    --ok: #4cc27f;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 1000px; margin: 0 auto; padding: 24px 16px; }

.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--border);
}
.top nav, .me { display: flex; gap: 16px; align-items: center; }
.brand { font-weight: 700; color: var(--text); }
.me form { margin: 0; }

button, .button, input {
  font: inherit; color: inherit;
}
button, .button {
  display: inline-block; padding: 7px 14px; border: 1px solid var(--border);
  background: var(--card); border-radius: 6px; cursor: pointer;
}
button:hover, .button:hover { border-color: var(--accent); text-decoration: none; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.link {
  border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer;
}
button.link.danger { color: var(--danger); }
input:not([type=hidden]):not([type=file]) {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--card);
}

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.card h1 { margin: 0 0 4px; font-size: 1.3rem; }
.card label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.card label input { color: var(--text); }
.login { max-width: 340px; margin: 10vh auto 0; }
.narrow { max-width: 400px; }

.flash { padding: 9px 12px; border-radius: 6px; margin-bottom: 12px; border: 1px solid; }
.flash.error { color: var(--danger); border-color: var(--danger); }
.flash.ok { color: var(--ok); border-color: var(--ok); }

.bar { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.crumbs { font-size: 1.1rem; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs span, .quota, .muted { color: var(--muted); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.actions form { display: flex; gap: 8px; margin: 0; }

.progress { margin-bottom: 14px; }
.progress-text { font-size: 0.9rem; color: var(--muted); margin-bottom: 4px; overflow-wrap: anywhere; }
.progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-bar div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress.failed .progress-text { color: var(--danger); }

.files {
  width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.files th, .files td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.files th { font-weight: 600; color: var(--muted); font-size: 0.85rem; }
.files tr:last-child td { border-bottom: 0; }
.files .num { text-align: right; white-space: nowrap; }
.files .name { overflow-wrap: anywhere; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions > * { margin-left: 10px; }
.row-actions form { display: inline; }
.empty { text-align: center; color: var(--muted); padding: 30px; }

@media (max-width: 640px) {
  .files th:nth-child(3), .files td:nth-child(3) { display: none; }
  .row-actions { white-space: normal; }
}
