:root {
  color-scheme: light;
  --bg: #eef7f3;
  --bg-deep: #09231f;
  --ink: #10201d;
  --muted: #667a74;
  --line: rgba(16, 32, 29, 0.1);
  --panel: rgba(255, 255, 255, 0.86);
  --panel-solid: #ffffff;
  --emerald: #047857;
  --emerald-dark: #065f46;
  --aqua: #0e9f9a;
  --gold: #f4b94f;
  --gold-soft: #fff2cf;
  --shadow: 0 24px 70px rgba(9, 35, 31, 0.16);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(14, 159, 154, 0.23), transparent 34rem),
    linear-gradient(140deg, #f9fffc 0%, var(--bg) 52%, #dfeee9 100%);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(120deg, rgba(4, 120, 87, 0.05) 1px, transparent 1px),
    linear-gradient(30deg, rgba(9, 35, 31, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  content: "";
  mask-image: linear-gradient(to bottom, #000, transparent 76%);
}

a {
  color: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  padding: 12px 16px 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 16px 42px rgba(9, 35, 31, 0.08);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 17px;
  background: linear-gradient(145deg, var(--emerald), var(--aqua));
  color: #fff;
  box-shadow: 0 14px 28px rgba(4, 120, 87, 0.28);
}

.brand-mark svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.brand strong {
  display: block;
  font-size: 1.08rem;
  letter-spacing: 0;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

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

.top-nav a {
  padding: 10px 13px;
  border-radius: 999px;
  color: #45605a;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 180ms ease, color 180ms ease;
}

.top-nav a:hover {
  background: rgba(4, 120, 87, 0.1);
  color: var(--emerald-dark);
}

main {
  display: grid;
  gap: 22px;
  padding-top: 22px;
}

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 430px);
  align-items: center;
  gap: 22px;
  min-height: 260px;
  padding: clamp(24px, 4vw, 48px);
  overflow: hidden;
  position: relative;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(9, 35, 31, 0.9), rgba(6, 95, 70, 0.82)),
    radial-gradient(circle at 82% 20%, rgba(244, 185, 79, 0.45), transparent 24rem);
  box-shadow: var(--shadow);
  color: #fff;
}

.hero-section::after {
  position: absolute;
  right: -120px;
  bottom: -160px;
  width: 420px;
  height: 420px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  content: "";
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 640px;
  min-width: 0;
}

.overline,
.panel-label {
  margin: 0 0 10px;
  color: var(--aqua);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-section .overline {
  color: #97f0df;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  max-width: 100%;
  font-size: clamp(3.2rem, 7vw, 5.35rem);
  line-height: 0.94;
  letter-spacing: 0;
  overflow-wrap: normal;
}

.hero-text {
  max-width: 610px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: clamp(1rem, 2vw, 1.24rem);
  line-height: 1.7;
}

.controls-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.13);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px);
}

.print-button,
.secondary-print {
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--gold), #ffd978);
  color: #17322d;
  cursor: pointer;
  font: 850 0.9rem/1 Inter, sans-serif;
  min-height: 44px;
  padding: 0 18px;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.print-button {
  width: 100%;
}

.print-button:hover,
.secondary-print:hover {
  box-shadow: 0 12px 26px rgba(244, 185, 79, 0.24);
  transform: translateY(-1px);
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-height: 44px;
  padding: 0 44px 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, currentColor 50%) calc(100% - 22px) 23px / 6px 6px no-repeat,
    linear-gradient(135deg, currentColor 50%, transparent 50%) calc(100% - 16px) 23px / 6px 6px no-repeat,
    rgba(255, 255, 255, 0.94);
  color: #17322d;
  font: 700 0.96rem/1 Inter, sans-serif;
  outline: none;
}

select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(244, 185, 79, 0.2);
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.5fr);
  gap: 22px;
}

.status-panel,
.today-panel,
.table-card,
.source-strip {
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 20px 60px rgba(9, 35, 31, 0.1);
  backdrop-filter: blur(18px);
}

.status-panel,
.today-panel {
  padding: 24px;
}

.status-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  min-height: 220px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.9), rgba(221, 246, 238, 0.9)),
    var(--panel-solid);
}

.status-panel h2 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1.08;
}

.now-panel {
  min-height: 210px;
}

.next-prayer {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid rgba(4, 120, 87, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
}

.next-prayer span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.next-prayer strong {
  color: var(--emerald-dark);
  font-size: 1.2rem;
}

.next-prayer small {
  color: var(--ink);
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  font-weight: 850;
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.today-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.today-head h2 {
  max-width: 100%;
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2.35rem);
  line-height: 1.05;
  white-space: nowrap;
}

.today-head strong {
  color: var(--emerald-dark);
  font-size: 1rem;
  white-space: nowrap;
}

.prayer-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(92px, 1fr));
  gap: 10px;
}

.prayer-card,
.skeleton-card {
  min-height: 98px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.prayer-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.prayer-card span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.prayer-card strong {
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
}

.prayer-card.is-key {
  border-color: rgba(244, 185, 79, 0.48);
  background: linear-gradient(145deg, var(--gold-soft), #fff);
}

.prayer-card.is-active {
  border-color: rgba(14, 159, 154, 0.5);
  background:
    linear-gradient(145deg, rgba(14, 159, 154, 0.18), rgba(4, 120, 87, 0.08)),
    #fff;
  box-shadow: inset 0 0 0 1px rgba(14, 159, 154, 0.18);
}

.prayer-card.is-active span,
.prayer-card.is-active strong {
  color: var(--emerald-dark);
}

.skeleton-card {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.62), rgba(232, 244, 240, 0.9), rgba(255, 255, 255, 0.62));
  background-size: 220% 100%;
  animation: shimmer 1.2s infinite linear;
}

.table-section {
  display: grid;
  gap: 14px;
}

.print-heading {
  display: none;
}

.table-section.is-hidden {
  display: none;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 0 4px;
}

.section-title h2 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title span {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.secondary-print {
  min-height: 38px;
  border-radius: 999px;
  background: var(--emerald);
  color: #fff;
  padding: 0 16px;
}

.table-card {
  overflow: hidden;
}

#ifis_bonetider_page_content {
  overflow-x: auto;
}

#ifis_bonetider_page_content table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  text-align: center;
}

#ifis_bonetider_page_content thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 18px 14px;
  background: var(--bg-deep);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tbody#ifis_bonetider tr {
  background: rgba(255, 255, 255, 0.72);
}

tbody#ifis_bonetider tr.even {
  background: rgba(229, 244, 239, 0.88);
}

tbody#ifis_bonetider tr.today {
  background: linear-gradient(90deg, rgba(244, 185, 79, 0.95), rgba(255, 230, 167, 0.86));
}

tbody#ifis_bonetider td {
  height: 54px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(16, 32, 29, 0.07);
  color: #162622;
  font-size: 0.98rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  vertical-align: middle;
}

tbody#ifis_bonetider td:first-child {
  color: var(--emerald-dark);
  font-weight: 800;
}

.loading,
.error {
  min-height: 240px;
  display: grid;
  place-items: center;
  padding: 32px;
  color: var(--muted);
  font-weight: 750;
  text-align: center;
}

.error {
  color: #a13c22;
}

.source-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  padding: 18px 22px;
  color: var(--emerald-dark);
  font-size: 0.94rem;
  font-weight: 800;
}

.source-strip a {
  text-decoration: none;
}

.app-version {
  padding: 7px 10px;
  border: 1px solid rgba(4, 120, 87, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

@media (max-width: 980px) {
  .hero-section,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .hero-section {
    min-height: auto;
  }

  .controls-card {
    grid-template-columns: 1fr 1fr;
  }

  .prayer-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100% - 18px, 1180px);
    padding-top: 12px;
  }

  .site-header {
    align-items: center;
    flex-direction: row;
    border-radius: 20px;
    padding: 10px;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 15px;
  }

  .brand strong {
    font-size: 1rem;
  }

  .brand small {
    font-size: 0.7rem;
  }

  .top-nav {
    justify-content: flex-end;
    width: auto;
  }

  .top-nav a {
    padding: 8px 9px;
    font-size: 0.75rem;
  }

  .hero-section {
    gap: 20px;
    padding: 26px 18px 18px;
    border-radius: 24px;
  }

  h1 {
    font-size: clamp(2.5rem, 12vw, 3rem);
  }

  .controls-card {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    padding: 12px;
    border-radius: 18px;
  }

  .print-button {
    grid-column: 1 / -1;
  }

  select {
    min-height: 46px;
  }

  .prayer-cards {
    grid-template-columns: 1fr;
  }

  .summary-grid,
  main {
    gap: 14px;
  }

  .status-panel,
  .today-panel {
    padding: 18px;
    border-radius: 22px;
  }

  .status-panel h2 {
    font-size: 2rem;
  }

  .next-prayer {
    padding: 14px;
  }

  .prayer-card {
    min-height: 86px;
    padding: 13px 14px;
  }

  .today-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .today-head h2 {
    font-size: clamp(1.2rem, 5vw, 1.48rem);
  }

  .next-prayer small {
    font-size: 1.15rem;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-actions {
    width: 100%;
    justify-content: space-between;
  }

  #ifis_bonetider_page_content table {
    min-width: 650px;
  }

  tbody#ifis_bonetider td {
    height: 48px;
    padding: 10px 12px;
    font-size: 0.92rem;
  }

  .source-strip {
    align-items: flex-start;
    flex-direction: column;
    border-radius: 22px;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body {
    background: #fff !important;
    width: 210mm;
  }

  body.is-printing-month::before,
  body.is-printing-month .site-header,
  body.is-printing-month .hero-section,
  body.is-printing-month .summary-grid,
  body.is-printing-month .source-strip,
  body.is-printing-month .section-title,
  body.is-printing-month .print-button,
  body.is-printing-month .secondary-print {
    display: none !important;
  }

  body.is-printing-month .app-shell {
    min-height: 297mm;
    width: 100%;
    padding: 5mm 10mm 9mm;
  }

  body.is-printing-month main {
    display: grid;
    min-height: 283mm;
    padding: 0;
  }

  body.is-printing-month .table-section,
  body.is-printing-month .table-section.is-hidden {
    display: grid !important;
    grid-template-rows: auto 1fr;
    min-height: 283mm;
  }

  body.is-printing-month .print-heading {
    display: block;
    margin-bottom: 4mm;
    padding: 0 0 3.4mm;
    border-bottom: 1.2pt solid #09231f;
    border-radius: 0;
    background: transparent;
    color: #09231f;
    break-inside: avoid;
  }

  body.is-printing-month .print-heading h1 {
    margin: 0;
    font-size: 25pt;
    line-height: 1;
    text-align: center;
  }

  body.is-printing-month .print-heading p {
    margin: 3mm 0 0;
    color: #047857;
    font-size: 10pt;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
  }

  body.is-printing-month .table-card {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    break-inside: avoid;
    display: flex;
  }

  body.is-printing-month #ifis_bonetider_page_content {
    display: flex;
    overflow: visible;
    width: 100%;
  }

  body.is-printing-month #ifis_bonetider_page_content table {
    overflow: hidden;
    table-layout: fixed;
    min-width: 0;
    width: 100%;
    height: 100%;
    border: 0.8pt solid rgba(9, 35, 31, 0.16);
    border-radius: 3mm;
  }

  body.is-printing-month #ifis_bonetider_page_content thead th {
    height: 9.6mm;
    padding: 2.7mm 1.8mm;
    border-right: 0.45pt solid rgba(255, 255, 255, 0.16);
    background: #09231f;
    font-size: 8.6pt;
    letter-spacing: 0.08em;
  }

  body.is-printing-month #ifis_bonetider_page_content thead th:last-child,
  body.is-printing-month tbody#ifis_bonetider td:last-child {
    border-right: 0;
  }

  body.is-printing-month tbody#ifis_bonetider td {
    height: 7.85mm;
    padding: 1.3mm 1.9mm;
    border-right: 0.35pt solid rgba(16, 32, 29, 0.06);
    border-bottom: 0.35pt solid rgba(16, 32, 29, 0.08);
    font-size: 9.2pt;
    font-weight: 700;
  }

  body.is-printing-month tbody#ifis_bonetider tr.today {
    background: rgba(255, 255, 255, 0.72) !important;
  }

  body.is-printing-month tbody#ifis_bonetider tr:nth-child(even),
  body.is-printing-month tbody#ifis_bonetider tr.today:nth-child(even) {
    background: #eaf5f1 !important;
  }

  body.is-printing-month tbody#ifis_bonetider tr:last-child td {
    border-bottom: 0;
  }
}
