*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root,
[data-theme="dark"] {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #242838;
  --border: #2e3346;
  --text: #e1e4ed;
  --muted: #8b8fa3;
  --accent: #6c8aff;
  --danger: #e5534b;
  --warn: #dba12b;
  --radius: 8px;
}
[data-theme="light"] {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface2: #eef0f4;
  --border: #d0d5dd;
  --text: #1a1d27;
  --muted: #6b7280;
  --accent: #4f6ef7;
  --danger: #dc2626;
  --warn: #c47f0e;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* nav */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem;
}
.brand { font-weight: 700; font-size: 1.2rem; color: var(--text) !important; }
.nav-links { display: flex; gap: 1rem; align-items: center; }
.nav-links span { color: var(--muted); font-size: 0.9rem; }

/* theme toggle */
.btn-theme {
  background: none !important; border: 1px solid var(--border) !important;
  padding: 0.3rem 0.5rem !important; border-radius: 4px; cursor: pointer;
  font-size: 1rem; line-height: 1;
}
.btn-theme:hover { filter: none !important; background: var(--surface2) !important; }
.theme-icon { display: inline-block; }

/* main */
.container { max-width: 1100px; margin: 2rem auto; padding: 0 1rem; }
h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 1rem; color: var(--muted); }
.error { color: var(--danger); margin-bottom: 0.75rem; font-size: 0.9rem; }
.empty { color: var(--muted); font-size: 0.9rem; }

/* auth box */
.auth-box {
  max-width: 380px; margin: 4rem auto;
  background: var(--surface); padding: 2rem; border-radius: var(--radius);
  border: 1px solid var(--border);
}
.auth-box h1 { text-align: center; }

/* forms */
form { display: flex; flex-direction: column; gap: 0.75rem; }
label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
input, select {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 4px;
  padding: 0.55rem 0.7rem; color: var(--text); font-size: 0.9rem; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
button, .btn {
  background: var(--accent); color: #fff; border: none; border-radius: 4px;
  padding: 0.55rem 1rem; font-size: 0.85rem; cursor: pointer; display: inline-block;
  text-align: center;
}
button:hover, .btn:hover { filter: brightness(1.15); text-decoration: none; }
.btn-danger { background: var(--danger); }
.btn-warn { background: var(--warn); }
.btn-info { background: var(--surface2); border: 1px solid var(--border); color: var(--text); }
.btn-clear { background: var(--surface2); border: 1px solid var(--border); color: var(--muted); }

/* table */
table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--muted); font-weight: 600; }

/* upload zone */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 3rem 1rem; text-align: center; cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  background: var(--surface);
}
.upload-zone.dragover {
  background: var(--surface2); border-color: var(--accent);
}
.upload-zone p { color: var(--muted); margin-bottom: 1rem; }
.upload-options {
  display: flex; gap: 1.5rem; justify-content: center; align-items: center;
  flex-wrap: wrap;
}
.upload-options label { flex-direction: row; align-items: center; gap: 0.4rem; }
.upload-options input[type=checkbox] { width: auto; }

/* progress */
.upload-progress {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.75rem 1rem; margin-top: 0.75rem; font-size: 0.85rem; color: var(--muted);
}

/* search bar */
.search-bar {
  display: flex; gap: 0.5rem; flex-direction: row; align-items: center;
  margin-bottom: 1rem;
}
.search-bar input { flex: 1; }
.search-bar .btn { flex-shrink: 0; }

/* batch bar */
.batch-bar {
  display: flex; gap: 0.5rem; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.5rem 1rem; margin-bottom: 0.75rem;
}
.batch-count { color: var(--muted); font-size: 0.85rem; flex: 1; }

/* pagination */
.pagination {
  display: flex; gap: 0.75rem; align-items: center; justify-content: center;
  margin: 1.5rem 0;
}
.page-info { color: var(--muted); font-size: 0.85rem; }

/* file grid */
.file-grid { display: grid; gap: 0.75rem; }
.file-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem;
}
.file-check { flex-direction: row; align-items: center; padding: 0; margin: 0; }
.file-check input { width: auto; margin: 0; padding: 0; }
.file-name { flex: 1; min-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.file-meta { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.file-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.badge { background: var(--warn); color: #000; padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.7rem; font-weight: 600; }
.badge-public { background: #2da85a; color: #fff; }
.public-timer {
  margin-top: 0.75rem; text-align: center;
}
.public-timer label {
  display: inline-flex; align-items: center; gap: 0.4rem;
  flex-direction: row;
}
.timer-input {
  width: 4rem; text-align: center;
}
.timer-hint { font-size: 0.75rem; color: var(--muted); }
.countdown { font-variant-numeric: tabular-nums; }