:root {
  --cream: #f5efe2;
  --paper: #fffdf8;
  --gold: #c99a43;
  --sage: #8fa58c;
  --green: #153f35;
  --deep: #0b2c26;
  --text: #24312d;
  --muted: #6b7772;
  --border: #ded8ca;
  --danger: #9a3d36;
  --shadow: 0 18px 50px rgba(15, 52, 43, .10);
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: linear-gradient(135deg, var(--cream), #e6eee6); font: 16px/1.55 system-ui, -apple-system, Segoe UI, sans-serif; min-height: 100vh; }
a { color: var(--green); }
.container { width: min(1180px, calc(100% - 32px)); margin: 34px auto 80px; }
.topbar { min-height: 78px; padding: 12px max(22px, calc((100vw - 1180px) / 2)); background: rgba(255,253,248,.94); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); }
.brand { text-decoration: none; font-family: Georgia, serif; font-size: 22px; font-weight: 700; }
.brand span { display: block; color: var(--gold); font: 12px/1.2 system-ui; text-transform: uppercase; letter-spacing: .16em; }
nav { display: flex; align-items: center; gap: 18px; }
nav form { margin: 0; }
.link-button { border: 0; padding: 0; background: none; color: var(--green); text-decoration: underline; cursor: pointer; }
h1,h2,h3 { color: var(--deep); font-family: Georgia, serif; line-height: 1.18; }
h1 { font-size: clamp(32px, 5vw, 50px); margin: 0 0 12px; }
h2 { margin-top: 0; }
.lead { color: var(--muted); max-width: 760px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 28px 0 20px; }
.toolbar-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.dashboard-toolbar-actions { gap: 14px; }
.assignment-filters { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.filter-button { display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 8px 10px 8px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--paper); color: var(--green); text-decoration: none; font-size: 14px; font-weight: 750; }
.filter-button:hover { border-color: var(--sage); background: #f3f5ec; }
.filter-button-active { border-color: var(--green); background: var(--green); color: white; }
.filter-button-active:hover { background: var(--green); }
.filter-count { display: inline-grid; min-width: 24px; height: 24px; padding: 0 6px; place-items: center; border-radius: 999px; background: #e4ece2; color: var(--green); font-size: 12px; font-weight: 800; }
.filter-button-active .filter-count { background: rgba(255,255,255,.2); color: white; }
.inline-form { display: inline-flex; margin: 0; }
.button { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; padding: 11px 18px; background: var(--green); color: white; text-decoration: none; font-weight: 700; cursor: pointer; }
.button-secondary { background: var(--paper); color: var(--green); border: 1px solid var(--border); }
.button-danger { background: var(--danger); }
.button-complete { background: var(--gold); color: var(--deep); }
.icon-button { position: relative; width: 44px; height: 44px; flex: 0 0 44px; padding: 0; }
.icon-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-button[data-tooltip]::after { content: attr(data-tooltip); position: absolute; z-index: 20; left: 50%; bottom: calc(100% + 9px); transform: translate(-50%, 4px); padding: 7px 10px; border-radius: 7px; background: var(--deep); color: white; box-shadow: 0 7px 18px rgba(12, 52, 44, .2); font-size: 12px; font-weight: 700; line-height: 1; white-space: nowrap; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .15s ease, transform .15s ease, visibility .15s ease; }
.icon-button[data-tooltip]:hover::after, .icon-button[data-tooltip]:focus-visible::after { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.song-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--paper); border: 1px solid var(--border); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); }
.dashboard-song { padding: 0; overflow: hidden; }
.dashboard-song-published { background: #ecece8; border-color: #c9ccc7; box-shadow: 0 12px 34px rgba(45, 53, 50, .08); }
.dashboard-song-published .dashboard-thumb img { filter: grayscale(1); opacity: .58; }
.dashboard-song-published .dashboard-song-body { opacity: .62; }
.dashboard-thumb { display: block; aspect-ratio: 16 / 9; background: #e7e9df; text-decoration: none; overflow: hidden; }
.dashboard-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dashboard-thumb span { display: grid; width: 100%; height: 100%; place-items: center; color: var(--muted); }
.dashboard-song-body { padding: 16px 18px 18px; }
.dashboard-song-head { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; }
.dashboard-song h2 { margin: 4px 0 8px; font-size: 22px; }
.dashboard-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.processing { display: inline-flex; align-items: center; border-radius: 999px; padding: 7px 11px; font-size: 13px; font-weight: 700; }
.processing-pending { background: #f2ead8; color: #76571f; }
.processing-active { background: #dcebe5; color: var(--green); }
.processing-failed { background: #f5deda; color: #742c27; }
.processing-error { flex-basis: 100%; margin: 0; color: #742c27; font-size: 13px; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 14px; }
.status { display: inline-flex; border-radius: 999px; background: #e4ece2; color: var(--green); padding: 5px 10px; font-size: 13px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
label { display: grid; gap: 7px; font-weight: 700; }
label.full { grid-column: 1 / -1; }
.full { grid-column: 1 / -1; }
input, textarea, select { width: 100%; border: 1px solid var(--border); border-radius: 12px; padding: 12px 13px; background: #fff; color: var(--text); font: inherit; }
.permission-form { display: grid; gap: 14px; }
.checkbox-label { display: flex; align-items: center; gap: 10px; }
.checkbox-label input { width: auto; accent-color: var(--green); }
.playlist-picker { margin: 0; border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.playlist-picker legend { padding: 0 7px; color: var(--green); font-weight: 800; }
.playlist-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 14px; }
.playlist-option { display: flex; align-items: flex-start; gap: 9px; padding: 9px 10px; border-radius: 10px; background: #f8f6ed; cursor: pointer; font-weight: 600; }
.playlist-option:hover { background: #f1ecd9; }
.playlist-option input { width: auto; margin-top: 3px; accent-color: var(--green); }
textarea { resize: vertical; min-height: 105px; }
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(201,154,67,.25); border-color: var(--gold); }
.form-actions { grid-column: 1 / -1; display: flex; gap: 12px; justify-content: flex-end; padding-top: 8px; }
.flash { border-radius: 14px; margin-bottom: 20px; padding: 14px 18px; background: #e1ecdf; }
.flash-error { background: #f5deda; color: #742c27; }
.details { display: grid; grid-template-columns: 1.1fr .9fr; gap: 22px; }
.definition { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; }
.definition dt { color: var(--muted); }
.definition dd { margin: 0; }
.result { position: relative; margin: 16px 0; }
.result textarea { background: #f9f7f1; padding-right: 90px; }
.copy { position: absolute; top: 34px; right: 8px; border: 0; border-radius: 999px; padding: 7px 10px; background: white; box-shadow: 0 3px 12px rgba(0,0,0,.1); cursor: pointer; }
.thumbnail { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 14px; border: 1px solid var(--border); }
.login-shell { min-height: calc(100vh - 80px); display: grid; place-items: center; }
.login-card { width: min(460px, 100%); }
.login-card form { display: grid; gap: 18px; }
.section-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.section-nav a { padding: 7px 11px; border-radius: 999px; background: #edf1e9; text-decoration: none; font-size: 14px; }
.card details { border-top: 1px solid var(--border); padding: 13px 0; }
.card details:first-of-type { margin-top: 12px; }
.card details summary { color: var(--green); cursor: pointer; line-height: 1.45; }
.card details ol, .flash ol { margin: 10px 0 0; padding-left: 22px; }
.card details li, .flash li { margin: 6px 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }
@media (max-width: 1000px) {
  .song-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .grid,.song-grid,.form-grid,.details { grid-template-columns: 1fr; }
  label.full,.form-actions { grid-column: 1; }
  .topbar { position: static; }
  .definition { grid-template-columns: 1fr; }
  .playlist-options { grid-template-columns: 1fr; }
  .definition dt { margin-top: 8px; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .dashboard-toolbar-actions { width: 100%; justify-content: flex-start; }
}
