:root {
  --bg: #0f1115;
  --surface: #181b22;
  --surface-2: #1f232c;
  --border: #2a2f3a;
  --text: #e6e9ef;
  --muted: #8b93a3;
  --accent: #5b8cff;
  --accent-hover: #6f9bff;
  --danger: #ff5b6b;
  --success: #3ecf8e;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, #1b2030 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}

.centered {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

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

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 22px; margin: 0; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #8a6cff);
  color: white;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(91, 140, 255, 0.35);
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.card + .card { margin-top: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; }
.card h2 { font-size: 16px; margin: 0 0 14px; }
.card-head h2 { margin: 0; }

.login-card { width: 100%; max-width: 360px; }
.login-card .muted { margin: 6px 0 18px; }

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 17, 21, 0.6);
  backdrop-filter: blur(8px);
}
.topbar-right { display: flex; align-items: center; gap: 14px; }

.container { max-width: 880px; margin: 32px auto; padding: 0 24px; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input[type="text"], input[type="password"], .form input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 12px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color .15s;
}
.form input:focus { border-color: var(--accent); }

input[type="file"] {
  color: var(--muted);
  font-size: 14px;
}
input[type="file"]::file-selector-button {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-right: 12px;
  cursor: pointer;
}

.upload-form { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 9px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #262b35; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: transparent; color: white; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn.danger:hover { background: rgba(255, 91, 107, 0.12); }

/* Alerts */
.alert { border-radius: 9px; padding: 11px 14px; font-size: 14px; margin-bottom: 18px; border: 1px solid transparent; }
.alert.error { background: rgba(255, 91, 107, 0.12); border-color: rgba(255, 91, 107, 0.3); color: #ffb3bb; }
.alert.success { background: rgba(62, 207, 142, 0.12); border-color: rgba(62, 207, 142, 0.3); color: #9af0c8; }

/* Files table */
.count {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
  color: var(--muted);
}
table.files { width: 100%; border-collapse: collapse; margin-top: 14px; }
table.files th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 600; padding: 0 12px 10px;
  border-bottom: 1px solid var(--border);
}
table.files td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
table.files tr:last-child td { border-bottom: none; }
td.name { font-weight: 500; word-break: break-all; }
td.actions { display: flex; gap: 8px; justify-content: flex-end; }
td.actions form { margin: 0; }

.empty { text-align: center; padding: 28px 0 12px; }
.empty p { margin: 4px 0; }

@media (max-width: 600px) {
  table.files thead { display: none; }
  table.files, table.files tbody, table.files tr, table.files td { display: block; width: 100%; }
  table.files tr { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; padding: 6px 4px; }
  table.files td { border: none; padding: 6px 12px; }
  td.actions { justify-content: flex-start; }
}
