:root {
  color-scheme: light;
  --ink: #24211f;
  --muted: #77716b;
  --line: #e9e4df;
  --paper: #faf9f7;
  --white: #fff;
  --accent: #6f0508;
  --accent-dark: #4c0305;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }

.topbar {
  height: 76px;
  padding: 0 max(5%, calc((100% - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: .08em; }
.brand small { display: block; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-size: 13px;
}

.admin-link, .admin-user a { color: var(--accent); font-size: 13px; font-weight: 700; }
.container { max-width: 1180px; width: 90%; margin: 0 auto; }

.hero {
  position: relative;
  margin: 38px 0 32px;
  padding: 58px;
  border-radius: 22px;
  overflow: hidden;
  color: white;
  background: linear-gradient(120deg, #380306, #780c10 65%, #a13a35);
}

.eyebrow { font-size: 11px; letter-spacing: .2em; font-weight: 800; opacity: .75; }
.hero h1, .admin-heading h1 { margin: 8px 0; font-size: clamp(30px, 4vw, 46px); line-height: 1.15; }
.hero p { color: #f1dfe0; }
.hero-count { margin-top: 25px; display: flex; align-items: baseline; gap: 10px; }
.hero-count strong { font-size: 28px; }
.hero-count span { font-size: 13px; color: #f1dfe0; }

.catalog { padding-bottom: 50px; }
.filters {
  display: flex;
  gap: 10px;
  padding: 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
}
input, select, textarea {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
}
.filters input { flex: 1; }
.filters select { max-width: 250px; }
button, .primary-button {
  border: 0;
  border-radius: 8px;
  padding: 11px 20px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
button:hover, .primary-button:hover { background: var(--accent-dark); }
button:disabled { opacity: .55; cursor: wait; }
.reset-link { align-self: center; color: var(--muted); font-size: 13px; }

.section-heading { display: flex; justify-content: space-between; align-items: center; margin: 32px 0 16px; }
.section-heading h2 { margin: 0; font-size: 21px; }
.section-heading span { color: var(--muted); font-size: 13px; }

.song-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.song-card {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}
.file-icon {
  width: 44px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f8e9e9;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
}
.song-info { min-width: 0; }
.category { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.song-info h3 { margin: 5px 0; font-size: 16px; line-height: 1.4; }
.song-info h3 a:hover { color: var(--accent); }
.song-info p { margin: 3px 0; color: var(--muted); font-size: 12px; }
.open-link { grid-column: 2; margin-top: 5px; color: var(--accent); font-size: 12px; font-weight: 700; }

.empty-state { padding: 55px 20px; text-align: center; background: white; border: 1px solid var(--line); border-radius: 14px; }
.empty-state p { color: var(--muted); }

.detail-container { padding-top: 28px; }
.back-link { color: var(--muted); font-size: 13px; }
.detail-heading { padding: 30px 0; }
.detail-heading h1 { margin: 8px 0; font-size: clamp(27px, 4vw, 38px); }
.detail-heading p { color: var(--muted); margin: 5px 0; }
.detail-actions { display: flex; gap: 10px; margin-top: 22px; }
.secondary-button { padding: 11px 18px; border: 1px solid var(--line); border-radius: 8px; background: white; font-weight: 700; }
.pdf-container { height: min(78vh, 900px); min-height: 480px; background: #dedbd8; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.pdf-container iframe { width: 100%; height: 100%; border: 0; }

footer { padding: 25px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 12px; }

.admin-user { display: flex; align-items: center; gap: 20px; font-size: 13px; }
.admin-container { padding: 35px 0 60px; }
.admin-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.admin-heading p { color: var(--muted); }
.admin-stats { min-width: 110px; padding: 16px 22px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.admin-stats strong { display: block; font-size: 26px; }
.admin-stats span { color: var(--muted); font-size: 12px; }
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 15px; }
.admin-toolbar input { max-width: 450px; background: white; }
.admin-toolbar span { color: var(--muted); font-size: 12px; }
.admin-list { display: grid; gap: 13px; }
.admin-song { padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.admin-song[hidden] { display: none; }
.admin-song-top { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 15px; }
.admin-song-top h3 { margin: 4px 0; font-size: 16px; }
.admin-song-top small { color: var(--muted); overflow-wrap: anywhere; }
.status { align-self: flex-start; padding: 4px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.status.published { color: #17643a; background: #e7f5ec; }
.status.draft { color: #805a17; background: #fff4db; }
.song-edit { display: grid; gap: 12px; }
.song-edit label { display: grid; gap: 5px; color: #5e5752; font-size: 12px; font-weight: 700; }
.edit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.publish-check { display: flex !important; align-items: center; grid-template-columns: auto 1fr; }
.publish-check input { width: auto; }
.edit-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 15px; }
.edit-actions button { font-size: 12px; }
.edit-actions a { color: var(--accent); font-size: 12px; font-weight: 700; }
.save-message { font-size: 12px; }
.save-message.success { color: #17643a; }
.save-message.error { color: #a21b20; }

@media (max-width: 700px) {
  .topbar { height: 66px; padding: 0 5%; }
  .hero { margin-top: 20px; padding: 32px 24px; }
  .filters { flex-direction: column; }
  .filters select { max-width: none; }
  .song-grid { grid-template-columns: 1fr; }
  .admin-heading { align-items: flex-start; }
  .edit-row { grid-template-columns: 1fr; }
  .admin-user { gap: 8px; flex-direction: column; align-items: flex-end; }
  .pdf-container { height: 68vh; min-height: 400px; }
}
