/* ---------- Theme variables (matches personal site on :3000) ---------- */
:root {
  --bg: #0f1117;
  --surface: #181b24;
  --text: #e6e8ee;
  --muted: #9aa1b2;
  --accent: #64d2ff;
  --accent-2: #b78cff;
  --border: #262a36;
  --danger: #ff6b81;
  --success: #4ade80;
  --warn: #fbbf24;
  --radius: 12px;
  --max-width: 1000px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ---------- Header ---------- */
nav {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.brand { color: var(--text); font-weight: 800; font-size: 1.2rem; text-decoration: none; }
.nav-links { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.nav-links a { color: var(--muted); text-decoration: none; transition: color 0.15s ease; }
.nav-links a:hover { color: var(--text); }
.nav-links a.muted { color: var(--muted); opacity: 0.75; }

main { max-width: var(--max-width); margin: 0 auto; padding: 2rem 1.5rem 3rem; width: 100%; }

h1 { font-size: 1.6rem; margin-top: 0; margin-bottom: 0.25rem; }

/* ---------- Cards / forms ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  overflow-x: auto;
}
.card.narrow { max-width: 420px; margin: 2rem auto; }

form label { display: block; margin: 0.9rem 0 0.3rem; font-size: 0.9rem; color: var(--muted); }
input, textarea {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s ease;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
button, .button {
  display: inline-block;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #0b0d12;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s ease, transform 0.1s ease;
}
button:hover, .button:hover { filter: brightness(1.1); }
button:active, .button:active { transform: scale(0.98); }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
tr.done { opacity: 0.65; }

/* ---------- Wide admin layout (book info column, no horizontal scroll) ---------- */
body.admin-wide main { max-width: 1400px; }
body.admin-wide .admin-table { table-layout: fixed; width: 100%; }
body.admin-wide .admin-table th:first-child { width: 30%; }
body.admin-wide .admin-table input[type="date"],
body.admin-wide .admin-table .small-input { width: 100%; max-width: 100%; min-width: 0; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge.green { background: color-mix(in srgb, var(--success) 20%, transparent); color: var(--success); }
.badge.amber { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.badge.blue { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.notes { font-size: 0.9rem; color: var(--accent-2); max-width: 220px; }

.flash { padding: 0.7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.flash.success { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.flash.error { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }

.inline-form { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.3rem; }
.inline-form label.check { display: inline-flex; gap: 0.3rem; align-items: center; font-weight: 400; margin: 0; white-space: nowrap; }
.inline-form input[type="checkbox"] { width: auto; margin: 0; }
.small-input { width: 160px; padding: 0.35rem 0.5rem; font-size: 0.85rem; }
/* Locked (read-only) admin fields look like plain text until unlocked */
.small-input.locked-input:disabled {
  background: transparent;
  border-color: transparent;
  color: inherit;
  -webkit-text-fill-color: currentColor;
  opacity: 1;
  cursor: default;
}

.text-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease;
}
.text-link:hover { color: var(--accent-2); text-decoration: underline; }

.link-button {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font-size: 0.85rem;
  font-weight: 400;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease;
}
.link-button:hover { background: none; color: var(--accent-2); text-decoration: underline; filter: none; transform: none; }
.link-button.danger { color: var(--danger); }
.series { font-size: 0.85rem; color: var(--accent-2); font-style: italic; }

.filter-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filter-bar input, .filter-bar select {
  width: auto;
  margin: 0;
}
.filter-bar input[name="q"] { flex: 1; min-width: 200px; }

/* ---------- Footer ---------- */
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
}
.footer-user { color: var(--accent); font-weight: 600; }