:root {
  --fg: #111;
  --bg: #f8f9fb;
  --card: #fff;
  --border: #e5e7eb;
  --muted: #6b7280;
  --link: #0a58ca;
  --prayer-bg: #eef3ff;
  --prayer-fg: #123a72;
}
* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body {
  font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
}
.wrap { max-width: 1100px; margin: 40px auto; padding: 0 16px; }
.logo { width: 220px; height:auto; display:block; margin:0 auto 8px; }
h1 { text-align:center; font-size: 28px; margin: 0 0 6px; }
.sub { text-align:center; color: var(--muted); margin-bottom: 20px; }

/* Toolbar */
.toolbar {
  position: sticky; top: 0; z-index: 2;
  background: rgba(255,255,255,0.8);
  backdrop-filter: saturate(180%) blur(10px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr 150px 1fr 1fr 100px;
  gap: 10px;
  margin-bottom: 20px;
}
.toolbar input, .toolbar select, .toolbar .btn {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; background:#fff; font: inherit;
}
.toolbar .btn { cursor: pointer; }
.toolbar .btn:hover { background:#f4f6f8; }
.summary { text-align:right; color: var(--muted); margin-bottom: 8px; }

/* Groups */
.group { margin: 32px 0 28px; }
.date-badge {
  display:inline-block; padding:8px 12px; border-radius:999px;
  background: var(--card); border:1px solid var(--border); font-weight:600;
  margin-bottom: 8px;
}

/* Entry card */
.entry {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-top: 10px;
}
.entry-top, .entry-bottom {
  display:flex; align-items:center; justify-content: space-between; flex-wrap: wrap;
}
.entry-top { gap: 10px; margin-bottom: 6px; }
.file-name a { color: var(--link); text-decoration: none; }
.file-name a:hover { text-decoration: underline; }

.prayer-tag {
  background: var(--prayer-bg); color: var(--prayer-fg);
  padding: 4px 10px; border-radius: 999px; font-size: 13px; font-style: italic;
  white-space: nowrap;
}
.actions .open-modal-btn {
  background:#fff; border:1px solid var(--border); border-radius:8px;
  padding:6px 12px; cursor:pointer; font:inherit;
}
.actions .open-modal-btn:hover { background:#f7f7f7; }

.entry-bottom { gap: 10px; }
.entry-bottom audio { width: 260px; height: 36px; }
.no-audio { color: var(--muted); font-style: italic; }
.file-info, .file-date { font-size: 14px; color: var(--muted); }
.file-info { flex: 1 1 200px; }
.file-date { text-align:right; flex: 1 1 180px; }

.hidden { display:none !important; }

/* Modal */
.modal { position:fixed; inset:0; background: rgba(0,0,0,.5); display:none; align-items:center; justify-content:center; }
.modal.open { display:flex; }
.modal-content {
  background:#fff; border-radius:12px; padding: 20px; max-width: 560px; width: 92%;
  box-shadow: 0 10px 25px rgba(0,0,0,.2); position: relative; text-align:center;
}
.close-modal {
  position:absolute; top:10px; right:12px; border:0; background:transparent;
  font-size:28px; line-height:1; color: var(--muted); cursor:pointer;
}
.close-modal:hover { color:#000; }
.modal-file-name { font-size: 15px; color: var(--muted); font-style: italic; margin: 4px 0 12px; }
.modal-content audio { width: 100%; margin: 12px 0; }
.modal-file-info { color: var(--muted); }

.modal .modal-controls {
  display:flex; align-items:center; justify-content:center; gap:10px; flex-wrap:wrap;
  margin-bottom: 8px;
}
.modal .modal-controls .prayer-label { font-weight:600; }
.modal .modal-controls select, .modal .modal-controls .btn {
  padding:6px 10px; border:1px solid var(--border); border-radius:8px; background:#fff; font:inherit;
}
.modal .modal-controls .btn.small { padding:6px 10px; cursor:pointer; }
.modal .modal-controls .btn.small:hover { background:#f4f6f8; }
.modal .modal-controls .link { color: var(--link); text-decoration:none; }
.modal .modal-controls .link:hover { text-decoration:underline; }

/* Responsive */
@media (max-width: 760px) {
  .toolbar { grid-template-columns: 1fr 120px 1fr 1fr 80px; }
  .entry-bottom audio { width: 100%; }
  .file-date { text-align:left; }
}
