/* ── Auth screens ─────────────────────────────────────────────────────────── */

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #041530;
  padding: 1.5rem 1rem max(1.5rem, env(safe-area-inset-bottom));
  overflow-y: auto;
}

.auth-brand {
  text-align: center;
  margin-bottom: 1.75rem;
  flex-shrink: 0;
}

.auth-logo {
  width: 72px;
  height: 72px;
  margin-bottom: 1rem;
  border-radius: 14px;
}

.auth-brand h1 {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 2.25rem;
  font-weight: 400;
  margin: 0 0 0.35rem;
  color: #edf4ff;
  letter-spacing: 0;
}

.auth-brand p {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #d8b24a;
  margin: 0;
}

.auth-card {
  background: #fff;
  border-radius: 20px;
  padding: 1.75rem;
  width: 100%;
  max-width: 390px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  flex-shrink: 0;
}

/* Auth tabs — segmented control */
.auth-tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 0.25rem;
  margin-bottom: 1.5rem;
  gap: 0;
  border: none;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 0;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: #637488;
  transition: color 0.15s, background 0.15s;
}

.auth-tab.is-active {
  color: #fff;
  background: #041530;
  font-weight: 700;
}

/* Form elements */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
}

.auth-input {
  padding: 0.7rem 0.9rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  box-sizing: border-box;
  background: #f8fafc;
  color: #0f172a;
  font-family: inherit;
}

.auth-input:focus {
  border-color: #041530;
  background: #fff;
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: #475569;
}

.auth-check input[type="checkbox"]:checked {
  accent-color: #041530;
}

.auth-error {
  background: #fee2e2;
  color: #b91c1c;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.83rem;
}

.auth-success {
  background: #d1fae5;
  color: #065f46;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.83rem;
}

.auth-note {
  font-size: 0.78rem;
  color: #64748b;
  text-align: center;
  margin: 0;
  line-height: 1.45;
}

/* Gold primary button for auth context */
.auth-card .button.primary {
  background: #d8b24a;
  color: #041530;
  border: none;
  border-radius: 10px;
  padding: 0.85rem;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(216,178,74,0.3);
  transition: filter 0.15s, transform 0.12s;
}

.auth-card .button.primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(216,178,74,0.35);
}

.full-width { width: 100%; }

/* ── Header user actions ─────────────────────────────────────────────────── */

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Role-based tab visibility ───────────────────────────────────────────── */
/* All role-* tabs hidden by default; JS adds body[data-role="X"] */

.tab[class*="role-"] { display: none; }

body[data-role="admin"]     .tab.role-admin,
body[data-role="director"]  .tab.role-director,
body[data-role="conductor"] .tab.role-conductor,
body[data-role="choir"]     .tab.role-choir     { display: flex; }

/* ── Recordings panel ────────────────────────────────────────────────────── */

.rec-subnav {
  display: flex;
  border-bottom: 2px solid var(--color-border, #e0e0e0);
  margin-bottom: 1rem;
}

.rec-subnav-btn {
  background: none;
  border: none;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted, #aac0e2);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.rec-subnav-btn.is-active {
  color: var(--text, #edf4ff);
  border-bottom-color: var(--gold, #d8b24a);
  font-weight: 600;
}

.rec-list { display: flex; flex-direction: column; gap: 0.6rem; }

.rec-card {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: box-shadow 0.15s;
  color: #1a1a1a;
}

.rec-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

/* Sync-status left-border indicators */
.rec-card[data-sync="local"]    { border-left: 4px solid #f97316; }
.rec-card[data-sync="uploading"]{ border-left: 4px solid #eab308; }
.rec-card[data-sync="synced"]   { border-left: 4px solid #22c55e; }

.sync-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
}
.sync-local    { background: #fff7ed; color: #c2410c; }
.sync-uploading{ background: #fefce8; color: #a16207; }

.rec-card-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.2rem; }
.rec-card-meta  { font-size: 0.8rem; color: var(--color-text-muted, #666); display: flex; gap: 0.75rem; flex-wrap: wrap; }

.badge-choral {
  background: #dbeafe;
  color: #1e40af;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-deleted {
  background: #fee2e2;
  color: #b91c1c;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
}

.badge-unread {
  background: var(--color-primary, #08244a);
  color: #fff;
  border-radius: 10px;
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Recording detail */
.rec-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.rec-player { width: 100%; margin-bottom: 1rem; }

.rap-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--color-surface-alt, #f3f4f6);
  border-radius: 8px;
  box-sizing: border-box;
}

.rap-btn {
  background: var(--color-primary, #08244a);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 0.9rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.rap-cur, .rap-tot {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #1a1a1a;
  min-width: 2.8rem;
}
.rap-tot { text-align: right; }

.rap-bar {
  flex: 1;
  height: 5px;
  background: var(--color-border, #dde1e8);
  border-radius: 3px;
  cursor: pointer;
  overflow: hidden;
}

.rap-fill {
  height: 100%;
  background: var(--color-primary, #08244a);
  border-radius: 3px;
  width: 0%;
  pointer-events: none;
}

.rec-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }

/* Recorder UI */
.recorder-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 2rem 1rem;
}

.rec-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: none;
  background: #dc2626;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(220,38,38,0.4);
  transition: transform 0.1s, box-shadow 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rec-btn:hover { transform: scale(1.06); }
.rec-btn.is-recording { background: #7f1d1d; animation: pulse 1.2s infinite; }

@keyframes pulse {
  0%,100% { box-shadow: 0 4px 16px rgba(220,38,38,0.4); }
  50%      { box-shadow: 0 4px 32px rgba(220,38,38,0.7); }
}

.rec-timer { font-size: 2rem; font-variant-numeric: tabular-nums; font-weight: 700; }
.rec-timer.is-warning { color: #dc2626; }

.rec-upload-progress { width: 100%; }
.rec-upload-bar { width: 100%; height: 6px; background: var(--color-border, #e0e0e0); border-radius: 3px; overflow: hidden; }
.rec-upload-bar-fill { height: 100%; background: var(--color-primary, #08244a); transition: width 0.3s; }

/* Comments */
.comment-thread { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }

.comment-item {
  background: var(--color-surface-alt, #f9fafb);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--color-text-muted, #666);
  margin-bottom: 0.4rem;
}

.comment-author { font-weight: 600; color: var(--color-text, #1a1a1a); }
.comment-ts-chip {
  background: var(--color-primary, #08244a);
  color: #fff;
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
  cursor: pointer;
  border: none;
}

.comment-body { font-size: 0.9rem; }

.comment-form { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.comment-textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--color-border, #ccc);
  border-radius: 6px;
  font-size: 0.9rem;
  box-sizing: border-box;
  font-family: inherit;
}

.comment-ts-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; }

/* ── Reports panel ───────────────────────────────────────────────────────── */

.report-controls { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.report-label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; font-weight: 500; }
.report-input { padding: 0.45rem 0.6rem; border: 1px solid var(--color-border, #ccc); border-radius: 6px; font-size: 0.9rem; }

.report-table-wrap { overflow-x: auto; }
.report-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.report-table th { text-align: left; padding: 0.5rem 0.75rem; background: var(--color-surface-alt, #f3f4f6); font-weight: 600; }
.report-table td { padding: 0.5rem 0.75rem; border-top: 1px solid var(--color-border, #e5e7eb); }

.report-chart { background: var(--color-surface-alt, #f9fafb); border: 1px solid var(--color-border, #e5e7eb); border-radius: 8px; padding: 1rem; margin-bottom: 1.25rem; overflow-x: auto; }
.report-charts-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.report-charts-row .report-chart { flex: 1; min-width: 260px; margin-bottom: 0; }

/* ── Users panel ─────────────────────────────────────────────────────────── */

.user-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.user-table th { text-align: left; padding: 0.5rem 0.75rem; background: var(--color-surface-alt, #f3f4f6); font-weight: 600; }
.user-table td { padding: 0.5rem 0.75rem; border-top: 1px solid var(--color-border, #e5e7eb); vertical-align: middle; }
.user-table-wrap { overflow-x: auto; }

.status-badge {
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.status-active    { background: #d1fae5; color: #065f46; }
.status-pending   { background: #fef3c7; color: #92400e; }
.status-suspended { background: #fee2e2; color: #b91c1c; }

.settings-divider { border: none; border-top: 1px solid var(--color-border, #e0e0e0); margin: 1.25rem 0; }
