:root {
  --bg: #f6f6f7;
  --panel: #ffffff;
  --text: #1c1c1e;
  --muted: #6b6b70;
  --line: #e3e3e6;
  --accent: #f5960a;
  --accent-text: #281e0f;
  --danger: #c62828;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e;
    --panel: #2c2c2e;
    --text: #f2f2f4;
    --muted: #a1a1a6;
    --line: #3a3a3c;
    --danger: #ff6b6b;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: inherit; }

.bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; }
.brand { font-weight: 700; text-decoration: none; }
.crumbs { display: flex; gap: 8px; color: var(--muted); min-width: 0; }
.crumbs .here { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signout { margin-left: auto; color: var(--muted); font-size: 14px; }

main { max-width: 860px; margin: 0 auto; padding: 16px; }

.row { display: flex; gap: 8px; }
input[type=text], input[type=password] { flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); }
button, .btn { font: inherit; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap; }
button[type=submit], .btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.btn.danger, button.danger { color: var(--danger); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; }
button.link.danger { color: var(--danger); margin-top: 16px; }

.msg { color: var(--danger); min-height: 1em; margin: 8px 0; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }

.list { list-style: none; margin: 8px 0 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.list:empty { display: none; }
.list li + li { border-top: 1px solid var(--line); }
.item { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; text-decoration: none; }
.item:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.name { font-weight: 600; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 13px; white-space: nowrap; }

.file { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px; }
.file .info { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; }
.file .name { text-decoration: none; }
.file .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.file .btn, .file button { padding: 6px 10px; font-size: 14px; }

.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 16px; border: 2px dashed var(--line); border-radius: 12px; background: var(--panel); text-align: center; cursor: pointer; }
.drop span { color: var(--muted); font-size: 13px; }
.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }

.uploads { list-style: none; padding: 0; margin: 10px 0 0; }
.uploads li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 0; font-size: 14px; }
.uploads progress { flex: 1 1 120px; }
.uploads .status { color: var(--muted); }
.uploads .failed .status { color: var(--danger); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; transition: .2s; background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; pointer-events: none; }
.toast.shown { opacity: 1; transform: translateX(-50%); }

body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-box { width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.login-box h1 { margin: 0 0 16px; font-size: 20px; }
.login-box form { display: flex; flex-direction: column; gap: 10px; }
.login-box label { color: var(--muted); font-size: 14px; }
.login-box .err { color: var(--danger); margin: 0; min-height: 1em; }

@media (max-width: 520px) {
  .row { flex-direction: column; }
}
