:root {
  --bg: #fafafa;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --line: #e2e2e5;
  --accent: #2563eb;
  --danger: #c0392b;
  --row: #fff;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161618; --fg: #ececf0; --muted: #9a9aa2; --line: #2c2c31; --accent: #6b9bff; --danger: #ff6b5e; --row: #1e1e21; }
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.45 system-ui, sans-serif; }
main { max-width: 960px; margin: 0 auto; padding: 16px; }
h1 { margin: 0 0 16px; font-size: 1.4rem; }
h2 { font-size: 1.1rem; margin-top: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

#login-form { max-width: 320px; margin: 15vh auto 0; display: grid; gap: 12px; }
label { display: grid; gap: 4px; color: var(--muted); font-size: .9rem; }
input { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--row); color: var(--fg); }

button, .button {
  font: inherit; font-size: .9rem; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--row); color: var(--fg); cursor: pointer; display: inline-block;
}
button:hover, .button:hover { border-color: var(--accent); }
button.link { border: 0; background: none; padding: 2px 6px; color: var(--accent); }
button.danger { color: var(--danger); }

header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
#breadcrumb { font-weight: 600; overflow-wrap: anywhere; }
#breadcrumb span { color: var(--muted); margin: 0 4px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: .85rem; border-bottom: 1px solid var(--line); padding: 6px 8px; }
td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.date { color: var(--muted); white-space: nowrap; }
td.row-actions { text-align: right; white-space: nowrap; }
.dir::before { content: "📁 "; }
.file::before { content: "📄 "; }

#uploads { display: grid; gap: 6px; margin-bottom: 12px; }
.upload { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: .9rem; }
.upload progress { grid-column: 1 / -1; width: 100%; }

.error { color: var(--danger); min-height: 1.2em; margin: 0; }
#status { color: var(--muted); min-height: 1.2em; }
body.dragging main { outline: 2px dashed var(--accent); outline-offset: 4px; }

dialog { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); width: min(640px, calc(100vw - 32px)); }
dialog form { margin-top: 12px; text-align: right; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }
label.inline { display: flex; gap: 6px; align-items: center; }
#conflict-name { font-weight: 600; overflow-wrap: anywhere; }

@media (max-width: 600px) {
  td.date, th:nth-child(3) { display: none; }
}
