:root {
  --bg: #f5f6f8;
  --fg: #16181d;
  --muted: #6b7280;
  --card: #ffffff;
  --line: #e3e6ea;
  --accent: #2563eb;
  --error-bg: #fdecec;
  --error-fg: #a01919;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --fg: #e7e9ee;
    --muted: #9aa2af;
    --card: #1c1f25;
    --line: #2b2f37;
    --accent: #6ea8fe;
    --error-bg: #3a1d1d;
    --error-fg: #ffb4b4;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px 16px 48px;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.wrap { max-width: 900px; margin: 0 auto; }

h1 { font-size: 20px; margin: 0 0 4px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.topbar p { margin: 0; }

.logout { display: flex; align-items: center; gap: 10px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.login {
  max-width: 360px;
  margin: 8vh auto 0;
  padding: 24px;
}

.login p { margin: 0 0 20px; }

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

label { font-size: 13px; color: var(--muted); }

input[type="text"], input[type="password"] {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  margin-bottom: 8px;
}

input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  margin-top: 8px;
  padding: 9px 14px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

button.secondary {
  margin: 0;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 500;
}

.error {
  background: var(--error-bg);
  color: var(--error-fg);
  padding: 9px 11px;
  border-radius: 7px;
  margin: 0 0 14px;
  font-size: 14px;
}

table { width: 100%; border-collapse: collapse; }

th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

tbody tr:last-child td { border-bottom: 0; }

th a { color: inherit; text-decoration: none; }
th a:hover, th a.sorted { color: var(--fg); }

.col-name { word-break: break-all; }
.col-size, .col-date { white-space: nowrap; color: var(--muted); }
.col-act { text-align: right; white-space: nowrap; }

a.dl {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

a.dl:hover { text-decoration: underline; }

.empty { padding: 28px 16px; text-align: center; color: var(--muted); margin: 0; }

footer { margin-top: 14px; text-align: right; }

@media (max-width: 560px) {
  .col-date { display: none; }
}
