:root {
  --bg: #0a0a0a;
  --bg-card: #14141a;
  --bg-card-2: #1c1c24;
  --border: rgba(255,255,255,0.08);
  --text: #eee;
  --text-muted: #888;
  --gold: #f7c948;
  --gold-light: #ffd700;
  --red: #ef4444;
  --green: #22c55e;
  --blue: #3b82f6;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }

.topnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,14,0.85);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 100;
}
.topnav .brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; }
.topnav .brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: #1a1a2e;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.85rem;
}
.brand-text { font-size: 0.95rem; }
.topnav-right { display: flex; align-items: center; gap: 18px; }
.topnav-right a { color: var(--text); font-size: 0.9rem; }

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

.hero { padding: 60px 24px 50px; text-align: center; background: radial-gradient(ellipse at top, rgba(247,201,72,0.08), transparent); }
.hero-inner { max-width: 640px; margin: 0 auto; }
.logo-mark {
  display: inline-grid; place-items: center;
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: #1a1a2e;
  border-radius: 20px;
  font-weight: 800;
  font-size: 2rem;
  margin-bottom: 24px;
}
.hero h1 {
  font-size: 2.4rem;
  margin: 0 0 12px;
  background: linear-gradient(90deg, var(--gold-light), var(--gold), var(--gold-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero .tagline { font-size: 1.1rem; color: #ccc; margin-bottom: 28px; }
.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; padding: 0 24px 40px; max-width: 1000px; margin: 0 auto; }
.feat { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 22px 20px; }
.feat .fi { font-size: 2rem; margin-bottom: 10px; }
.feat h3 { margin: 0 0 6px; font-size: 1.05rem; }
.feat p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }

.footer-note { text-align: center; padding: 24px; color: var(--text-muted); font-size: 0.85rem; }

.btn, .btn-mini {
  display: inline-block; padding: 10px 18px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-card-2); color: var(--text);
  cursor: pointer; text-decoration: none; font-size: 0.93rem;
  transition: transform 0.05s, background 0.1s;
}
.btn:hover { background: #252530; text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn-mini { padding: 6px 12px; font-size: 0.85rem; }
.btn.primary, .btn-mini.primary { background: linear-gradient(90deg, var(--gold), var(--gold-light)); color: #1a1a2e; border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.block { display: block; width: 100%; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 18px;
}
.auth-card { max-width: 440px; margin: 32px auto; }
.auth-card h1 { margin-top: 0; }
.empty-state { text-align: center; padding: 60px 24px; }
.empty-state .big-icon { font-size: 4rem; margin-bottom: 12px; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.93rem; }
.alert.err { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert.ok { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }

label { display: block; margin-bottom: 14px; font-size: 0.9rem; }
label small { display: block; margin-top: 2px; font-size: 0.8rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[name="username"], input[name="title"], input[name="composer"], input[name="song_key"], input[name="category"], input[name="display_name"], input[name="identifier"] {
  width: 100%;
  padding: 10px 12px;
  margin-top: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  font-family: inherit;
}
input:focus { border-color: var(--gold); background: rgba(255,255,255,0.06); }
input[type="file"] { padding: 6px; }

.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 1.4rem; }
.page-head .btn.ghost { font-size: 1.2rem; padding: 6px 12px; }

.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.search-input { flex: 1; max-width: 440px; }
.meta-count { color: var(--text-muted); font-size: 0.85rem; }

.sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.sheet-tile {
  display: flex; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; color: var(--text); transition: transform 0.08s, border-color 0.1s;
}
.sheet-tile:hover { border-color: rgba(247,201,72,0.3); text-decoration: none; transform: translateY(-1px); }
.tile-mark {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(247,201,72,0.25), rgba(247,201,72,0.05));
  color: var(--gold-light);
  border-radius: 8px;
  font-weight: 700;
  flex-shrink: 0;
}
.tile-body { min-width: 0; flex: 1; }
.tile-title { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sub { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 4px; }
.tag { display: inline-block; padding: 2px 7px; border-radius: 4px; background: rgba(247,201,72,0.15); color: var(--gold-light); font-size: 0.72rem; margin-right: 4px; }
.tag.muted { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.tag.good { background: rgba(34,197,94,0.15); color: #86efac; }

.viewer-frame { background: #fff; border-radius: 8px; overflow: hidden; }

.site-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap; gap: 12px;
}

@media (max-width: 600px) {
  .topnav { padding: 12px 14px; }
  .brand-text { display: none; }
  .topnav-right { gap: 12px; }
  .container { padding: 22px 14px; }
  .hero { padding: 40px 16px 30px; }
  .hero h1 { font-size: 1.8rem; }
  .sheet-grid { grid-template-columns: 1fr; }
}

/* Preview banner — visible at top of every page */
.preview-banner {
  background: linear-gradient(90deg, #f59e0b, #f97316);
  color: #1a1a1a;
  text-align: center;
  padding: 7px 14px;
  font-size: 0.78rem;
  letter-spacing: 0.2px;
  position: sticky; top: 0; z-index: 101;
}
.preview-banner strong { font-weight: 700; }
.preview-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: #dc2626;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Preview callout on landing */
.preview-callout {
  margin: 0 auto 24px;
  max-width: 540px;
  padding: 14px 18px;
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 8px;
  color: #fbbf24;
  font-size: 0.9rem;
  text-align: left;
}
.preview-callout strong { color: #fcd34d; }

/* If topnav is below banner, don't sticky-top it the same way */
@media (max-width: 600px) {
  .preview-banner { font-size: 0.72rem; padding: 6px 10px; }
}

/* Click-through agreement row */
.check-row { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0; padding: 10px 12px; background: rgba(247,201,72,0.06); border: 1px solid rgba(247,201,72,0.2); border-radius: 8px; cursor: pointer; }
.check-row input[type="checkbox"] { margin: 3px 0 0; min-width: 16px; min-height: 16px; cursor: pointer; accent-color: var(--gold); }
.check-row span { font-size: 0.85rem; color: #ddd; line-height: 1.45; }
.check-row a { color: var(--gold); }

/* Legal pages */
.legal { line-height: 1.6; }
.legal h3 { margin: 22px 0 8px; color: var(--gold-light); font-size: 1.05rem; }
.legal p { margin: 0 0 12px; color: #ccc; }
.legal p.muted { color: var(--text-muted); }

.page-actions { display:flex; gap:10px; align-items:center; }
.btn.live-btn { background: linear-gradient(90deg, #22c55e, #16a34a); border-color: transparent; color: #fff; font-weight: 600; }
.btn.live-btn:hover { filter: brightness(1.1); }
@media (max-width: 600px) {
  .page-actions { flex-direction:column; align-items:stretch; }
  .page-actions .btn { text-align: center; }
}

/* Quota bar */
.quota-bar { margin: 12px 0 18px; padding: 12px 14px; background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: 8px; }
.quota-label { font-size: 0.88rem; margin-bottom: 6px; color: #ccc; }
.quota-track { width: 100%; height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; }
.quota-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); transition: width 0.3s; }
.quota-fill[style*="width: 9"], .quota-fill[style*="width: 10"] { background: linear-gradient(90deg, #f59e0b, #ef4444); }

/* Sheet meta strip under viewer title */
.sheet-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: -8px 0 16px; padding: 0 4px; }

/* Danger zone */
.danger-zone { border-color: rgba(220,38,38,0.3); background: rgba(220,38,38,0.04); }
.danger-zone h3 { color: #fca5a5; margin-top: 0; }
.btn.danger { background: rgba(220,38,38,0.2); border-color: rgba(220,38,38,0.4); color: #fca5a5; }
.btn.danger:hover { background: rgba(220,38,38,0.3); color: #fff; }

/* Inline forms in account page */
.inline-form { display: flex; gap: 10px; align-items: flex-end; margin-top: 12px; flex-wrap: wrap; }
.inline-form label { flex: 1; min-width: 220px; margin: 0; }

/* Code element */
code { background: rgba(247,201,72,0.15); color: var(--gold-light); padding: 2px 6px; border-radius: 3px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.88em; }

/* Setlists */
.setlist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.setlist-card { display: block; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; color: var(--text); }
.setlist-card:hover { border-color: rgba(247,201,72,0.3); text-decoration: none; }
.setlist-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.setlist-head h3 { margin: 0 0 4px; font-size: 1rem; color: var(--gold-light); }
.gig-date { background: rgba(34,197,94,0.18); color: #86efac; font-size: 0.75rem; }
.setlist-desc { margin: 6px 0 0; }

/* Setlist items */
.setlist-items { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 6px; }
.setlist-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 8px; cursor: grab; }
.setlist-item.dragging { opacity: 0.5; cursor: grabbing; }
.item-handle { color: var(--text-muted); font-size: 1.1rem; }
.item-num { color: var(--gold); font-weight: 600; min-width: 24px; }
.item-title { flex: 1; }
.item-x { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; padding: 4px 8px; }
.item-x:hover { color: #fca5a5; }

.add-sheets-list { list-style: none; padding: 0; margin: 12px 0 0; max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.add-sheet { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: rgba(255,255,255,0.03); border-radius: 6px; }
.add-title { flex: 1; font-size: 0.92rem; }

/* Upload file list preview */
.file-list-preview { margin: 12px 0; padding: 10px 12px; background: rgba(247,201,72,0.06); border: 1px solid rgba(247,201,72,0.2); border-radius: 6px; font-size: 0.88rem; }
.file-list-preview ul { margin: 8px 0 0; padding-left: 18px; }

/* Upload results */
.upload-results { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.upload-results li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; }
.upload-results li.ok { background: rgba(34,197,94,0.06); }
.upload-results li.err { background: rgba(220,38,38,0.06); }
.r-name { flex: 1; font-size: 0.9rem; word-break: break-word; }

/* Admin stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; text-align: center; }
.stat-num { display: block; font-size: 1.6rem; font-weight: 700; color: var(--gold-light); }
.stat-label { display: block; font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

/* Admin table */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.admin-table th, .admin-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; }
.admin-table.small td, .admin-table.small th { font-size: 0.82rem; padding: 5px 8px; }
.admin-table .tag.err { background: rgba(220,38,38,0.18); color: #fca5a5; }
.btn-mini.danger { background: rgba(220,38,38,0.18); color: #fca5a5; }

/* Sort select */
.toolbar select { padding: 8px 10px; background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 0.88rem; font-family: inherit; }

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-table { font-size: 0.78rem; }
  .admin-table th, .admin-table td { padding: 5px 6px; }
}

/* Welcome card for empty state */
.welcome-card { text-align: center; padding: 40px 28px 32px; background: linear-gradient(135deg, rgba(247,201,72,0.08), rgba(255,215,0,0.02)); border: 1px solid rgba(247,201,72,0.2); border-radius: 16px; margin-bottom: 22px; }
.welcome-icon { font-size: 3.5rem; margin-bottom: 8px; }
.welcome-card h2 { margin: 0 0 8px; font-size: 1.6rem; background: linear-gradient(90deg, #ffd700, #f7c948); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.welcome-tag { color: #ccc; margin: 0 0 22px; font-size: 1rem; }
.btn.big { padding: 14px 28px; font-size: 1rem; }

/* Onboarding steps */
.onboarding-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 0 0 18px; }
.onboard-step { display: flex; gap: 12px; padding: 16px 18px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; }
.onb-num { width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center; background: rgba(247,201,72,0.18); color: var(--gold-light); border-radius: 50%; font-weight: 700; }
.onb-body strong { display: block; margin-bottom: 4px; font-size: 0.95rem; }
.onb-body p { margin: 0; }

/* Dashboard meta strip */
.dashboard-meta { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 10px 14px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; font-size: 0.85rem; flex-wrap: wrap; }
.dm-storage { flex: 1; min-width: 200px; }
.dm-storage .quota-track { max-width: 200px; }

@media (max-width: 600px) {
  .welcome-card { padding: 28px 18px 24px; }
  .welcome-card h2 { font-size: 1.4rem; }
  .onboarding-grid { grid-template-columns: 1fr; }
  .dashboard-meta { flex-direction: column; align-items: stretch; }
  .dm-storage .quota-track { max-width: none; }
}
