:root {
  --bg: #0f0f10;
  --panel: #17171a;
  --panel-2: #1f1f24;
  --line: #2a2a31;
  --text: #ececf0;
  --dim: #9a9aa6;
  --accent: #e63946;
  --accent-soft: #ffb3bb;
  --ok: #5ecf8a;
  --err: #ff6b6b;
  --me-bg: #241a1c;
  --me-border: #6b1f27;
}

* { box-sizing: border-box; }

html, body { background: var(--bg); color: var(--text); margin: 0; padding: 0; font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 40px 28px 80px; }

.hdr { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 28px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.brand { text-transform: uppercase; letter-spacing: 0.12em; font-size: 11px; color: var(--dim); margin-bottom: 4px; }
.hdr h1 { margin: 0 0 6px; font-size: 32px; letter-spacing: -0.01em; font-weight: 700; }
.subtitle { color: var(--dim); font-size: 14px; }
.hdr-right { display: flex; gap: 8px; flex-shrink: 0; }

.btn { background: var(--panel); color: var(--text); border: 1px solid var(--line); padding: 9px 14px; border-radius: 8px; font: inherit; text-decoration: none; cursor: pointer; transition: background 120ms; }
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; font-weight: 600; }
.btn.primary:hover { background: #d12c38; }

.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); margin-bottom: 6px; }
.stat .v { font-size: 22px; font-weight: 600; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar input, .toolbar select { background: var(--panel); border: 1px solid var(--line); color: var(--text); padding: 9px 12px; border-radius: 8px; font: inherit; }
.toolbar input { flex: 1; min-width: 200px; }
.toolbar .spacer { flex: 1; }
.toolbar .count { color: var(--dim); font-size: 13px; }

.song { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; margin-bottom: 14px; break-inside: avoid; }
.song-hdr { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 12px; }
.song h3 { margin: 0 0 4px; font-size: 18px; letter-spacing: -0.005em; }
.song .meta { color: var(--dim); font-size: 13px; }
.song .meta.right { text-align: right; }

table.writers { width: 100%; border-collapse: collapse; margin-top: 6px; }
.writers th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.writers td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.writers tr:last-child td { border-bottom: none; }
.writers td.pct { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.writers td.dim { color: var(--dim); font-size: 13px; }
.writers tr.me td { background: var(--me-bg); }
.writers tr.me td:first-child { border-left: 3px solid var(--accent); }
.you { display: inline-block; background: var(--accent); color: white; font-size: 10px; padding: 2px 7px; border-radius: 10px; margin-left: 6px; letter-spacing: 0.04em; text-transform: uppercase; vertical-align: middle; }

.empty { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 40px; text-align: center; color: var(--dim); }

.sign { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px 28px; margin-top: 32px; }
.sign h2 { margin: 0 0 6px; font-size: 20px; }
.sign p { color: var(--dim); margin: 0 0 18px; }
#sign-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
#sign-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
#sign-form label.full, #sign-form label.chk { grid-column: 1 / -1; }
#sign-form input[type=text], #sign-form input[type=email], #sign-form input:not([type]), #sign-form textarea { background: var(--bg); border: 1px solid var(--line); color: var(--text); padding: 10px 12px; border-radius: 8px; font: inherit; }
#sign-form textarea { resize: vertical; font: inherit; }
#sign-form label.chk { flex-direction: row; align-items: center; gap: 10px; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); }
#sign-form button { grid-column: 1 / -1; justify-self: start; margin-top: 6px; }
.msg { grid-column: 1 / -1; font-size: 14px; color: var(--dim); }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--err); }

.foot { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--dim); font-size: 12px; }
.foot .uuid { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

@media (max-width: 700px) {
  .wrap { padding: 24px 16px 60px; }
  .hdr { flex-direction: column; align-items: stretch; }
  .summary { grid-template-columns: 1fr; }
  #sign-form { grid-template-columns: 1fr; }
  .writers td.dim { display: none; }
  .writers th:nth-child(3), .writers th:nth-child(4) { display: none; }
}

@media print {
  .no-print { display: none !important; }
  html, body { background: white; color: black; }
  .wrap { max-width: none; padding: 0; }
  .song, .stat, .writers td, .writers th { border-color: #ccc !important; }
  .song { background: white; page-break-inside: avoid; }
  .stat { background: #f7f7f7; }
  .writers tr.me td { background: #fff4f5 !important; }
  .hdr { border-color: #ccc; }
  .brand, .subtitle, .meta, .writers th, .stat .k { color: #666; }
}

/* Admin styles */
.admin { max-width: 1200px; margin: 0 auto; padding: 40px 28px; }
.admin h1 { font-size: 28px; margin: 0 0 20px; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.admin-table th { text-align: left; padding: 14px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); border-bottom: 1px solid var(--line); background: var(--panel-2); font-weight: 500; }
.admin-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table td.artist { font-weight: 600; }
.admin-table a.link { color: var(--accent-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; text-decoration: none; }
.admin-table a.link:hover { color: var(--accent); text-decoration: underline; }
.admin-table .copy { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer; margin-left: 8px; }
.admin-table .copy.copied { background: var(--ok); color: #0f0f10; border-color: var(--ok); }
.admin-search { margin-bottom: 16px; }
.admin-search input { width: 100%; background: var(--panel); border: 1px solid var(--line); color: var(--text); padding: 10px 14px; border-radius: 8px; font: inherit; }
.admin-tip { color: var(--dim); font-size: 13px; margin: 0 0 20px; }
.gate { max-width: 400px; margin: 140px auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 32px; text-align: center; }
.gate input { width: 100%; margin-top: 16px; padding: 10px 14px; background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 8px; font: inherit; text-align: center; }
.gate .err { color: var(--err); margin-top: 10px; font-size: 13px; min-height: 18px; }
