:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #66736d;
  --line: #dce5df;
  --surface: #ffffff;
  --surface-soft: #f8fbf9;
  --page: #f3f6f1;
  --green: #2f725c;
  --green-dark: #173f32;
  --green-soft: #e8f2ed;
  --gold: #b58a3b;
  --gold-soft: #f7efd9;
  --red: #b23a48;
  --shadow: 0 18px 42px rgba(28, 46, 38, 0.08);
  --shadow-soft: 0 10px 28px rgba(28, 46, 38, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(229, 239, 232, 0.9), transparent 360px),
    linear-gradient(180deg, #f7f8f4 0%, var(--page) 42%, #eef3ef 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 86px;
  padding: 14px clamp(18px, 4vw, 44px);
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 26px rgba(31, 47, 39, 0.06);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.brand img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.auth-slot {
  display: flex;
  align-items: center;
  margin-left: 8px;
}

.auth-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 8px;
}

.nav-link-button {
  min-height: 38px;
  padding: 10px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 760;
  font-family: inherit;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.nav-link-button:hover,
.nav-link-button:focus-visible {
  color: var(--green-dark);
  background: var(--green-soft);
  box-shadow: inset 0 0 0 1px rgba(47, 114, 92, 0.08);
  outline: none;
}

.nav a {
  min-height: 38px;
  padding: 10px 13px;
  color: var(--muted);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 760;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.nav a.active,
.nav a:hover {
  color: var(--green-dark);
  background: var(--green-soft);
  box-shadow: inset 0 0 0 1px rgba(47, 114, 92, 0.08);
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.sign-in-body {
  min-height: 100vh;
}

.sign-in-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px 16px;
}

.sign-in-shell {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 0.8fr);
  gap: 22px;
  width: min(980px, 100%);
  align-items: stretch;
}

.sign-in-copy,
.sign-in-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.sign-in-copy {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 28px;
}

.sign-in-logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
}

.sign-in-text {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.sign-in-card {
  padding: 18px;
}

.sign-in-fallback {
  display: grid;
  gap: 0.75rem;
  justify-items: start;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.sign-in-fallback-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

::selection {
  color: #fff;
  background: var(--green);
}

.flash {
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--green-soft);
  border: 1px solid #bdd8ca;
  border-radius: 8px;
  color: var(--green-dark);
  font-weight: 760;
}

.page-heading {
  display: flex;
  align-items: end;
  margin-bottom: 22px;
}

.page-heading.split {
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1;
  color: #111c18;
  font-weight: 850;
}

h2 {
  margin-bottom: 18px;
  font-size: 20px;
  color: #1b2a24;
  font-weight: 800;
}

.metrics-grid,
.dashboard-grid {
  display: grid;
  gap: 16px;
}

.metrics-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.dashboard-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel,
.metric,
.table-wrap,
.form-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.metric {
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfb 100%);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
  color: var(--green-dark);
  font-weight: 850;
}

.panel {
  padding: 20px;
}

.panel h1 {
  font-size: 30px;
}

.info-panel {
  margin-bottom: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfb 100%);
}

.info-panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.info-panel-value {
  display: block;
  color: var(--green-dark);
  font-size: 22px;
  font-weight: 850;
}

.info-panel-text {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.info-panel-link-row {
  margin: 10px 0 0;
}

.info-panel-link {
  color: var(--green);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.info-panel-link:hover {
  color: var(--green-dark);
  text-decoration: underline;
}

.dashboard-grid .panel:last-child {
  grid-column: span 2;
}

.bar-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 120px minmax(120px, 1fr) 48px;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.log-bar-row {
  grid-template-columns: minmax(150px, 220px) minmax(120px, 1fr) 48px;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  background: #e9efec;
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), #4f9276);
}

.bar-fill.accent {
  background: linear-gradient(90deg, var(--gold), #d5ae62);
}

.toolbar,
.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.filter-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.search-row {
  margin-bottom: 0;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(220px, 0.9fr) minmax(320px, 1.7fr);
  gap: 14px;
}

.log-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.log-checks {
  grid-template-columns: 1.6fr 0.7fr 0.7fr;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid #dbe7e0;
  border-radius: 8px;
  background: var(--surface-soft);
}

legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.check-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-option {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 9px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #d9e5df;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 760;
}

.check-option input {
  width: 15px;
  min-height: 15px;
  margin: 0;
  accent-color: var(--green);
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cddbd4;
  border-radius: 7px;
  font: inherit;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #79aa96;
  box-shadow: 0 0 0 3px rgba(47, 114, 92, 0.14);
}

.month-picker {
  position: relative;
}

.month-picker-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cddbd4;
  border-radius: 7px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.month-picker-button:focus {
  outline: none;
  border-color: #79aa96;
  box-shadow: 0 0 0 3px rgba(47, 114, 92, 0.14);
}

.month-picker-caret {
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
}

.month-picker.open .month-picker-caret {
  transform: rotate(225deg) translateY(-2px);
}

.month-picker-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  display: none;
  width: min(420px, 100%);
  padding: 10px;
  background: #fff;
  border: 1px solid #cddbd4;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.month-picker.open .month-picker-menu {
  display: grid;
  gap: 10px;
}

.month-picker-tools {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.month-picker-tools button {
  min-height: 30px;
  padding: 5px 10px;
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid #bdd8ca;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.month-picker-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.month-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 8px;
  color: var(--ink);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.month-option:hover {
  background: #f3f7f5;
}

.month-option input {
  width: 15px;
  min-height: 15px;
  margin: 0;
  accent-color: var(--green);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid #bdd8ca;
  border-radius: 7px;
  font: inherit;
  font-weight: 820;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 6px 14px rgba(31, 64, 50, 0.05);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(31, 64, 50, 0.1);
}

.button.primary {
  color: #fff;
  background: linear-gradient(180deg, #367f66 0%, var(--green) 100%);
  border-color: var(--green);
}

.button.ghost {
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.button.danger {
  color: #fff;
  background: linear-gradient(180deg, #c44654 0%, var(--red) 100%);
  border-color: var(--red);
}

.button:disabled {
  color: #8c98a3;
  background: #edf1f4;
  border-color: #d8e0e7;
  cursor: not-allowed;
}

.button.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: #fbf8ef;
}

.members-table {
  min-width: 1060px;
  table-layout: fixed;
}

.col-name {
  width: 20%;
}

.col-status {
  width: 10%;
}

.col-membership {
  width: 12%;
}

.col-email {
  width: 28%;
}

.col-phone {
  width: 13%;
}

.col-city {
  width: 12%;
}

.col-actions {
  width: 154px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  background: #f8fbf9;
}

td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

code {
  padding: 2px 5px;
  color: var(--green-dark);
  background: var(--green-soft);
  border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

tr:last-child td {
  border-bottom: 0;
}

.muted-row {
  color: var(--muted);
  background: #f7f8f7;
}

.status {
  display: inline-flex;
  padding: 5px 8px;
  background: #e9efec;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 820;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  white-space: nowrap;
}

.actions form {
  margin: 0;
}

.empty {
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.empty-note {
  margin: 0;
  color: var(--muted);
}

.error-flash {
  color: #7f1d1d;
  background: #fee2e2;
  border-color: #fecaca;
}

.date-loader {
  margin-bottom: 18px;
}

.date-picker-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto auto;
  align-items: end;
  gap: 10px;
}

.date-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
}

.selected-date-count {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 8px 6px 10px;
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid #bdd8ca;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 820;
}

.date-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  color: var(--green-dark);
  background: #fff;
  border: 1px solid #c4d9cf;
  border-radius: 999px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.rnd-form {
  display: grid;
  gap: 16px;
}

.songs-form {
  display: grid;
  gap: 16px;
}

.songs-config-grid {
  display: grid;
  grid-template-columns: minmax(160px, 0.7fr) minmax(140px, 0.5fr) minmax(240px, 1fr) minmax(130px, 0.4fr) auto;
  align-items: end;
  gap: 14px;
}

.songs-config-actions {
  display: flex;
  gap: 10px;
}

.service-meta {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(160px, 0.4fr) minmax(260px, 1fr);
  align-items: end;
  gap: 14px;
  padding: 18px;
}

.song-section {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfb 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.song-section.complete {
  background: linear-gradient(180deg, #f3fbf6 0%, #eef8f2 100%);
  border-color: #a8d3bc;
}

.song-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: #f8fbf9;
  border-bottom: 1px solid var(--line);
}

.song-section.complete .song-section-header {
  background: #e4f2eb;
  border-bottom-color: #a8d3bc;
}

.song-section-header h2 {
  margin: 0;
}

.sequence-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  padding: 10px;
  color: #fff;
  background: linear-gradient(180deg, #367f66 0%, var(--green) 100%);
  border-radius: 999px;
  font-size: 18px;
  font-weight: 850;
  box-shadow: 0 12px 22px rgba(47, 114, 92, 0.18);
}

.song-fields-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(260px, 1fr);
  gap: 14px;
  padding: 18px;
}

.song-fields-grid .wide {
  grid-column: 1 / -1;
}

.song-fields-grid textarea {
  min-height: 180px;
}

.rnd-section {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfb 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.rnd-section.complete {
  background: linear-gradient(180deg, #f3fbf6 0%, #eef8f2 100%);
  border-color: #a8d3bc;
}

.rnd-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: #f8fbf9;
  border-bottom: 1px solid var(--line);
}

.rnd-section.complete .rnd-section-header {
  background: #e4f2eb;
  border-bottom-color: #a8d3bc;
}

.complete-badge {
  display: inline-flex;
  margin-top: 8px;
  padding: 5px 8px;
  color: var(--green-dark);
  background: #d7ecdf;
  border: 1px solid #a8d3bc;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}

.rnd-section-header h2 {
  margin: 0;
}

.translate-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  white-space: nowrap;
}

.translate-toggle input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--green);
}

.rnd-language-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}

.rnd-language {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.rnd-language:first-child {
  border-right: 1px solid var(--line);
}

.rnd-language h3 {
  margin: 0;
  font-size: 16px;
  color: var(--green-dark);
  font-weight: 850;
}

.rnd-language textarea {
  min-height: 132px;
}

.rnd-language label:last-child textarea {
  min-height: 104px;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 12px 0;
  background: linear-gradient(to top, var(--page) 72%, rgba(243, 246, 241, 0));
}

.verse-actions {
  align-items: center;
}

.translate-all-toggle {
  margin-right: auto;
}

.report-table-wrap {
  margin-top: 16px;
}

.logs-table {
  min-width: 1080px;
}

.logs-table td:first-child {
  white-space: nowrap;
}

.member-form {
  display: grid;
  gap: 16px;
}

.form-section {
  padding: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

label.wide {
  margin-top: 14px;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.compact-table td {
  padding: 10px 0;
}

.empty-page {
  min-height: 60vh;
}

.error-panel p {
  color: var(--muted);
}

@media (max-width: 900px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    justify-content: flex-start;
  }

  .sign-in-shell {
    grid-template-columns: 1fr;
  }

  .metrics-grid,
  .dashboard-grid,
  .filter-grid,
  .log-filter-grid,
  .songs-config-grid,
  .service-meta,
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid .panel:last-child {
    grid-column: span 1;
  }
}

@media (max-width: 640px) {
  .page {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .page-heading.split,
  .toolbar,
  .search-row,
  .date-picker-row,
  .rnd-section-header,
  .song-section-header,
  .songs-config-actions,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics-grid,
  .dashboard-grid,
  .filter-grid,
  .log-filter-grid,
  .rnd-language-grid,
  .songs-config-grid,
  .service-meta,
  .song-fields-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .date-picker-row {
    display: flex;
  }

  .rnd-language:first-child {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .bar-row {
    grid-template-columns: 88px minmax(80px, 1fr) 36px;
  }
}

