:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #666;
  --accent: #2563eb;
  --border: #e5e7eb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318;
    --fg: #e5e7eb;
    --muted: #9ca3af;
    --accent: #60a5fa;
    --border: #2a2e37;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--fg);
  text-decoration: none;
}

main {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem;
}

.category-list {
  list-style: none;
  padding: 0;
}

.category-list li {
  margin-bottom: 0.5rem;
}

.category-list a, .admin-link a {
  color: var(--accent);
  text-decoration: none;
  font-size: 1.05rem;
}

.category-list a:hover, .admin-link a:hover {
  text-decoration: underline;
}

.admin-link {
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.breadcrumbs {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.breadcrumbs a {
  color: var(--muted);
}

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

.file-table th, .file-table td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.file-table a {
  color: var(--accent);
  text-decoration: none;
}

form label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

form input, form select {
  display: block;
  margin-top: 0.35rem;
  padding: 0.5rem;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
}

button {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 0.95rem;
}

.flashes {
  list-style: none;
  padding: 0;
  margin-bottom: 1rem;
}

.flashes li {
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.flashes .success {
  background: #dcfce7;
  color: #166534;
}

.flashes .error {
  background: #fee2e2;
  color: #991b1b;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-nav a {
  margin-left: 1rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.admin-nav a.active {
  font-weight: 600;
  text-decoration: underline;
}

.admin-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 1rem 0 1.5rem;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.inline-form input[type="file"] {
  max-width: 220px;
  padding: 0.3rem;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-end;
  position: relative;
}

.dots-menu {
  position: relative;
}

.dots-btn {
  background: none;
  border: none;
  color: var(--fg);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  line-height: 1;
}

.dots-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 140px;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dots-dropdown.open {
  display: block;
}

.dots-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  color: var(--fg);
  font-size: 0.9rem;
}

.dots-dropdown button:hover {
  background: rgba(37, 99, 235, 0.1);
}
