/* jfsync — minimal hand-written stylesheet.
 * No Tailwind compiler, no utility-class explosion. ~3 KB.
 * Modern light theme: pale gray bg, white cards, indigo accent.
 */

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: #111827;
  background: #fafbfc;
  -webkit-font-smoothing: antialiased;
}

a { color: #4f46e5; text-decoration: none; }
a:hover { text-decoration: underline; }

button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

code, pre {
  font-family: "SF Mono", Menlo, Consolas, "Microsoft YaHei Mono", monospace;
  font-size: 0.875em;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.3); }

/* ---------- Layout ---------- */

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: white;
  border-right: 1px solid #e5e7eb;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid #f3f4f6;
}
.sidebar-header .logo {
  font-weight: 600;
  font-size: 16px;
}
.sidebar-header .ver {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
}
.sidebar nav { padding: 10px 8px; flex: 1; }
.sidebar nav a {
  display: block;
  padding: 7px 12px;
  border-radius: 6px;
  color: #4b5563;
  font-size: 14px;
  font-weight: 500;
}
.sidebar nav a:hover { background: #f3f4f6; color: #111827; text-decoration: none; }
.sidebar nav a.active { background: #eef2ff; color: #4338ca; }
.sidebar nav .group { padding: 6px 0; border-bottom: 1px solid #f3f4f6; margin-bottom: 6px; }
.sidebar form { padding: 10px; border-top: 1px solid #f3f4f6; }
.sidebar form button {
  display: block; width: 100%;
  text-align: left;
  padding: 7px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #4b5563;
  font-size: 14px;
  font-weight: 500;
}
.sidebar form button:hover { background: #f3f4f6; color: #111827; }

.main { flex: 1; min-width: 0; padding: 24px 28px; }

.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 20px; gap: 16px;
}
.page-header h1 { font-size: 22px; font-weight: 600; margin: 0; }
.page-header .subtitle { font-size: 13px; color: #6b7280; margin-top: 4px; }
.page-header .actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ---------- Cards / boxes ---------- */

.card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.card-padded { padding: 18px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  text-decoration: none !important;
  white-space: nowrap;
}
.btn-primary { background: #4f46e5; color: white; }
.btn-primary:hover { background: #4338ca; }
.btn-primary:disabled { background: #a5b4fc; cursor: not-allowed; }
.btn-secondary { background: white; color: #374151; border-color: #d1d5db; }
.btn-secondary:hover { background: #f9fafb; }
.btn-danger { background: white; color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; border-color: #fca5a5; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-link {
  background: transparent; border: none; padding: 0;
  color: #4f46e5; cursor: pointer; font-size: inherit;
}
.btn-link:hover { text-decoration: underline; }

/* ---------- Forms ---------- */

.label {
  display: block; font-size: 13px; font-weight: 500;
  color: #374151; margin-bottom: 5px;
}
.input, .select, .textarea {
  width: 100%; padding: 7px 10px;
  border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 14px; background: white;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.help { font-size: 12px; color: #6b7280; margin-top: 4px; }

/* ---------- Tables ---------- */

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl thead {
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}
table.tbl th {
  text-align: left; font-weight: 500; font-size: 11px;
  text-transform: uppercase; color: #6b7280; letter-spacing: 0.05em;
  padding: 8px 14px;
}
table.tbl td { padding: 9px 14px; border-bottom: 1px solid #f3f4f6; }
table.tbl tbody tr.clickable:hover { background: #f9fafb; cursor: pointer; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .muted { color: #9ca3af; font-size: 12px; }
table.tbl .right { text-align: right; }
table.tbl .nowrap { white-space: nowrap; }

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 9999px;
  font-size: 12px; font-weight: 500;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-error { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f3f4f6; color: #4b5563; }

/* ---------- Stats ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 12px; margin-bottom: 20px; }
.stat .label-sm { font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; }
.stat .value { font-size: 26px; font-weight: 600; margin-top: 4px; }
.stat .value-good { color: #059669; }
.stat .value-warn { color: #d97706; }

/* ---------- Misc ---------- */

.flash {
  padding: 10px 14px; border-radius: 8px;
  font-size: 14px; margin-bottom: 14px;
}
.flash-success { background: #dcfce7; color: #14532d; border: 1px solid #bbf7d0; }
.flash-error { background: #fee2e2; color: #7f1d1d; border: 1px solid #fecaca; }
.flash-info { background: #dbeafe; color: #1e3a8a; border: 1px solid #bfdbfe; }

.muted { color: #6b7280; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }
.flex { display: flex; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.flex-1 { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.center { align-items: center; }
.empty {
  padding: 60px 20px; text-align: center;
  color: #9ca3af; font-size: 14px;
}

/* Progress bar (for show/season completion) */
.progress {
  height: 6px;
  background: #f3f4f6;
  border-radius: 3px;
  overflow: hidden;
}
.progress > .progress-fill {
  height: 100%;
  background: #10b981;
  transition: width 0.2s;
}

/* Crumbs */
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: #6b7280; margin-bottom: 16px; flex-wrap: wrap; }
.crumbs a { color: #4f46e5; }
.crumbs .sep { color: #d1d5db; }
.crumbs .current { color: #111827; font-weight: 500; }

/* Login + setup */
.center-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.center-page .card { width: 100%; max-width: 380px; padding: 28px; }
.center-page .card .logo {
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}
.center-page .card .tagline {
  text-align: center;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 22px;
}

/* Page nav (tabs in /library) */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 16px;
}
.tabs a, .tabs button {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover, .tabs button:hover { color: #111827; text-decoration: none; }
.tabs a.active, .tabs button.active {
  color: #4338ca;
  border-bottom-color: #4f46e5;
}

/* Filter bar */
.filter-bar {
  display: flex; gap: 8px; align-items: center;
  padding: 10px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 14px;
}
.filter-bar .input { flex: 1; min-width: 200px; }
.filter-bar .select { width: auto; min-width: 110px; }

/* Pagination */
.pagination {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 18px;
  font-size: 14px;
  color: #6b7280;
}

/* Modal */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 16px;
}
.modal {
  background: white; border-radius: 10px;
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow: auto;
  padding: 24px;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.15);
}

/* Toast */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: #111827; color: white;
  padding: 10px 16px; border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.2);
  z-index: 100;
  max-width: 320px;
}
.toast-success { background: #166534; }
.toast-error { background: #991b1b; }
