:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #1c1f26;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --success-bg: #ecfdf5;
  --success-text: #065f46;
  --error-bg: #fef2f2;
  --error-text: #991b1b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

body.centered {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.auth-card h1 { margin-top: 0; font-size: 1.25rem; }

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
}
.topbar .brand { font-weight: 700; text-decoration: none; color: var(--text); }
.topbar nav { display: flex; gap: 16px; flex: 1; }
.topbar nav a { color: var(--muted); text-decoration: none; }
.topbar nav a:hover { color: var(--text); }
.logout-form { margin: 0; }

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

h1 { font-size: 1.4rem; margin-bottom: 16px; }

.hint { color: var(--muted); font-size: 0.9rem; }
.hint-inline { color: var(--muted); font-weight: 400; font-size: 0.85em; }

.flash {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.flash-success { background: var(--success-bg); color: var(--success-text); }
.flash-error { background: var(--error-bg); color: var(--error-text); }

.actions-row { display: flex; gap: 12px; margin: 16px 0; }

.button, button, input[type="submit"] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
}
.button:hover, button:hover { background: var(--accent-hover); }
.button-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.button-secondary:hover { background: var(--bg); }

.link-button {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  font-size: inherit;
}
.link-button:hover { background: none; color: var(--accent-hover); }
.link-button.danger { color: var(--danger); }
.link-button:disabled { color: var(--muted); cursor: not-allowed; text-decoration: none; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.data-table th, .data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  font-size: 0.9rem;
}
.data-table th { background: var(--bg); font-weight: 600; }
.data-table tr:last-child td { border-bottom: none; }
.data-table input[type="text"] { width: 100%; }
.row-actions { display: flex; gap: 12px; white-space: nowrap; }

.thumb { width: 80px; height: 45px; object-fit: cover; border-radius: 4px; background: var(--bg); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-video { background: #dbeafe; color: #1e40af; }
.badge-reel { background: #fce7f3; color: #9d174d; }

fieldset {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}
legend { font-weight: 600; padding: 0 6px; }

label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.9rem;
  font-weight: 500;
}
label input, label textarea, label select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.json-import {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
}
.json-import summary { cursor: pointer; font-weight: 600; }
.json-import textarea {
  width: 100%;
  margin: 10px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.thumb-preview { display: flex; gap: 16px; align-items: flex-start; margin-top: 8px; }
.thumb-preview img { max-width: 220px; border-radius: 6px; border: 1px solid var(--border); }

.hidden-form { display: none; }
