/* Group app (private): list, filters, dialogs, form. Builds on style.css tokens. */

.muted { color: var(--text-dim); font-size: 13px; }
[hidden] { display: none !important; }


.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

/* Filters */
.filters { display: grid; gap: 10px; margin-bottom: 8px; }
.field-inline { display: flex; align-items: center; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--text-dim);
  padding: 7px 12px; border-radius: 999px; font: 500 12px/1 var(--body); cursor: pointer;
}
.chip[aria-pressed="true"] { color: var(--text); border-color: var(--amber-bright); background: rgba(217, 119, 42, 0.12); }
.chips.small .chip { padding: 6px 10px; font-size: 12px; }

select, input, textarea {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; font: 15px/1.4 var(--body);
}
select { width: auto; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus, .chip:focus-visible, .event-btn:focus-visible {
  outline: 2px solid var(--amber-bright); outline-offset: 1px; border-color: transparent;
}
input[type="date"] { color-scheme: dark; min-height: 44px; }

/* List */
.events .month {
  list-style: none; margin-top: 18px; font-size: 11px; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--amber-bright);
}
.events > li:not(.month) { list-style: none; }
.event-btn { width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.event-btn:hover { border-color: #5a4c41; }
.event-btn.pending { border-style: dashed; border-color: #7a5a3a; }
.event-btn.cancelled { opacity: 0.5; }
.event-btn.cancelled .event-venue { text-decoration: line-through; }
.event-btn.blocked { background: repeating-linear-gradient(135deg, var(--bg-raised) 0 10px, #1b1714 10px 20px); }
.event-body { min-width: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; padding: 3px 7px; border: 1px solid var(--line); border-radius: 3px; color: var(--text-dim); }
.tag.public { border-color: var(--amber); color: var(--amber-bright); }
.tag.pending { border-style: dashed; border-color: #a7794a; color: #e0b483; }
.tag.cancelled { border-color: var(--bordo); color: #d98f92; }
.tag.missing { border-style: dashed; color: #8c8279; }
.tag.warn { border-color: #b08a2a; color: #e9c86a; text-transform: none; letter-spacing: 0; }
.tag.plain { border-color: transparent; padding-left: 0; }

main { padding-bottom: 96px; }

/* Dialogs: full screen on phones, centred panel on wider screens */
.dialog {
  border: 0; padding: 0; margin: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%;
  background: var(--bg); color: var(--text);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.7); }
.sheet { padding: 18px var(--gutter) 0; max-width: 640px; margin: 0 auto; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.icon-btn { background: transparent; border: 1px solid var(--line); color: var(--text); width: 40px; height: 40px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; flex-shrink: 0; }
.sheet-actions { display: flex; align-items: center; gap: 12px; padding: 18px 0 24px; }
.sheet-actions.sticky {
  position: sticky; bottom: 0; background: linear-gradient(180deg, transparent, var(--bg) 30%);
  padding-top: 28px; padding-bottom: max(20px, env(safe-area-inset-bottom));
}
.btn.primary { background: var(--amber); border-color: var(--amber-bright); padding: 14px 26px; }
.btn.ghost { border-color: var(--line); }
.btn:disabled { opacity: 0.5; }
@media (min-width: 720px) {
  .dialog { width: 640px; height: auto; max-height: 90vh; margin: auto; border: 1px solid var(--line); border-radius: 6px; }
}

/* Detail */
.group { padding: 14px 0; border-top: 1px solid var(--line); }
.group h3 { margin: 0 0 10px; }
.group dl { margin: 0; display: grid; gap: 10px; }
.kv { display: grid; grid-template-columns: 9.5em 1fr; gap: 12px; }
.kv dt { color: var(--text-dim); font-size: 13px; }
.kv dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.warn-box { border: 1px solid #b08a2a; color: #e9c86a; padding: 10px 12px; border-radius: var(--radius); font-size: 13px; }

/* Form */
fieldset { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 16px 0 6px; display: grid; gap: 14px; }
legend { padding: 0 8px 0 0; }
.field { display: grid; gap: 6px; }
.field-label { font-size: 13px; color: var(--text-dim); }
.hint { font-size: 12px; color: #8c8279; margin: 0; }
.hint.error { color: #e48a8d; }
.field .chips { margin-top: 8px; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span {
  display: inline-block; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13px; color: var(--text-dim); cursor: pointer;
}
.segmented input:checked + span { color: var(--text); border-color: var(--amber-bright); background: rgba(217, 119, 42, 0.14); }
.segmented input:focus-visible + span { outline: 2px solid var(--amber-bright); outline-offset: 2px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); opacity: 0;
  background: #26201c; border: 1px solid var(--line); padding: 10px 16px; border-radius: var(--radius);
  font-size: 14px; transition: opacity 0.2s, transform 0.2s; pointer-events: none; max-width: calc(100% - 32px); z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: var(--bordo); color: #f2b8ba; }

/* Card details: every filled-in column, compact */
.card-details { grid-column: 1 / -1; margin: 0; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 4px; font-size: 13px; }
.card-details .kv { grid-template-columns: minmax(7em, 30%) 1fr; gap: 12px; }
.card-details dt { font-size: 12px; }
.card-details dd { color: var(--text); }
.card-details .unpaid dd { color: #f2b8ba; }

/* Editor: start and end date side by side */
.date-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#save-state { display: block; padding: 0 0 20px; }

/* Big add button under the page heading */
.add-big {
  display: flex; align-items: center; gap: 14px; width: 100%; margin: 4px 0 22px; padding: 14px 18px;
  background: rgba(160, 74, 0, 0.18); border: 1px solid var(--amber-bright); border-radius: var(--radius);
  color: var(--text); font: 600 12px/1.2 var(--body); letter-spacing: 0.18em; text-transform: uppercase; cursor: pointer; text-align: left;
}
.add-big:hover { background: rgba(160, 74, 0, 0.3); }
.add-big:focus-visible { outline: 2px solid var(--amber-bright); outline-offset: 3px; }
.add-plus {
  display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%;
  background: var(--amber); font: 300 28px/1 var(--body); letter-spacing: 0;
}

/* Month calendar */
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-title { flex: 1; margin: 0; text-align: center; font: 500 15px/1.2 var(--body); letter-spacing: 0.18em; text-transform: uppercase; }
.cal-today { margin: 10px 0 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-head { font-size: 10px; letter-spacing: 0.16em; text-align: center; color: var(--text-dim); padding: 4px 0; }
.cal-day {
  min-height: 64px; padding: 4px 3px; display: flex; flex-direction: column; gap: 2px; align-items: stretch;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: 3px; color: var(--text);
  font: inherit; text-align: left; cursor: pointer; min-width: 0;
}
.cal-day.weekend { background: #1a1613; }
.cal-day.today .cal-num { color: var(--bg); background: var(--amber-bright); border-radius: 999px; padding: 0 5px; }
.cal-day.selected { border-color: var(--amber-bright); box-shadow: inset 0 0 0 1px var(--amber-bright); }
.cal-day:focus-visible { outline: 2px solid var(--amber-bright); outline-offset: 1px; }
.cal-num { font-size: 12px; align-self: flex-start; line-height: 18px; }
.cal-ev {
  display: block; font-size: 9px; line-height: 1.25; padding: 2px 3px; border-radius: 2px;
  background: var(--amber); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: 0.04em;
}
.cal-ev.pending { background: transparent; border: 1px dashed #c08a54; color: #e0b483; }
.cal-ev.cancelled { background: #2a2321; color: #8c8279; text-decoration: line-through; }
.cal-ev.blocked { background: repeating-linear-gradient(135deg, #3a332e 0 4px, #2a2421 4px 8px); color: var(--text-dim); }
.cal-more { font-size: 9px; color: var(--text-dim); }
#cal-caption { margin: 16px 0 8px; }
@media (min-width: 640px) {
  .cal-day { min-height: 92px; padding: 6px; }
  .cal-ev { font-size: 11px; padding: 2px 5px; }
  .cal-head { font-size: 11px; }
}

/* Page heading and the Sheet button share one line, also on phones */
.list-head { flex-wrap: nowrap; align-items: center; }
.list-head h1 { font-size: clamp(20px, 6vw, 44px); min-width: 0; }
.list-head .btn { flex-shrink: 0; padding: 9px 12px; }

/* Songs: list beside editor on wide screens, one at a time on phones */
.songs-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.song-side input[type="search"] { margin-bottom: 10px; }
.song-side .chips { margin-bottom: 6px; }
.song-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.song-year { font-size: 11px; letter-spacing: 0.24em; color: var(--amber-bright); padding: 14px 4px 6px; }
.song-item {
  display: block; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line);
  color: var(--text); font: inherit; padding: 10px 6px; cursor: pointer;
}
.song-item[aria-current="true"] { background: rgba(217, 119, 42, 0.12); }
.song-item:focus-visible { outline: 2px solid var(--amber-bright); outline-offset: -2px; }
.song-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.song-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.song-date { margin-left: auto; color: var(--text-dim); font-size: 12px; white-space: nowrap; padding-left: 8px; }
.song-badge { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: #8fd0c8; border: 1px solid #3f7f79; border-radius: 3px; padding: 1px 5px; }
.song-preview { display: block; color: var(--text-dim); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 0 0 17px; }
.song-empty { padding: 24px 6px; text-align: center; }
.song-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: #8c8279; }
.song-dot.st-raksta { background: #e0a83c; }
.song-dot.st-demo { background: #5fb3ab; }
.song-dot.st-gatava { background: #7bc47f; }

.song-editor { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; display: grid; gap: 14px; }
.song-back { justify-self: start; padding: 8px 12px; }
.song-title-input { font: 500 24px/1.2 var(--body); background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 4px 0 8px; }
.song-title-input:focus { border-color: transparent; }
.song-meta { display: grid; grid-template-columns: minmax(0, 11em) minmax(0, 1fr); gap: 10px; }
.song-demo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.song-demo audio { flex: 1; min-width: 220px; height: 40px; }
.song-analysis { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.song-analysis summary { cursor: pointer; color: var(--text-dim); font-size: 13px; }
.song-analysis div { white-space: pre-wrap; font-size: 14px; margin-top: 8px; }
.song-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.song-lyrics { min-height: 50vh; font-size: 17px; line-height: 1.7; }
.song-ideas { min-height: 22vh; border-style: dashed; font-size: 15px; }
.song-links { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.song-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; }

@media (max-width: 899px) {
  .songs-layout.has-sel .song-side { display: none; }
  .songs-layout:not(.has-sel) .song-editor { display: none; }
}
@media (min-width: 900px) {
  .songs-layout { grid-template-columns: minmax(260px, 330px) minmax(0, 1fr); }
  .song-side { position: sticky; top: 12px; }
  .song-list { max-height: 70vh; overflow: auto; }
  .song-back { display: none; }
  .song-cols { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .song-ideas { min-height: 50vh; }
  .song-links { grid-template-columns: 1fr 1fr; }
}
