:root {
  --primary: #1df1b2;
  --secondary: #65f0cc;
  --aqua: #a0f7e5;
  --gold: #c7b434;
  --gold-soft: #e5da9a;
  --ink: #161514;
  --muted: #676e69;
  --line: #dce8e3;
  --bg: #fcfefd;
  --panel: #ffffff;
  --shadow: 0 18px 55px rgba(22, 21, 20, 0.11);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.role-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at top left, rgba(29, 241, 178, 0.18), transparent 32%),
    linear-gradient(135deg, #fcfefd 0%, #f5fffb 55%, #fffdf2 100%);
}

.role-panel {
  width: min(580px, 100%);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  padding: 40px;
  text-align: center;
  backdrop-filter: blur(8px);
}

.role-logo {
  width: 136px;
  height: 136px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--aqua);
  box-shadow: 0 12px 28px rgba(29, 241, 178, 0.22);
}

.eyebrow {
  margin: 0 0 4px;
  color: #14765d;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.1rem, 5vw, 4rem);
  line-height: 1;
}

.role-copy {
  max-width: 570px;
  margin: 0 auto 24px;
  color: var(--muted);
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.auth-box {
  max-width: 420px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfffd;
  padding: 24px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.auth-tab {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--muted);
  font-weight: 800;
}

.auth-tab.active {
  border-color: var(--primary);
  background: #eafff8;
  color: #0f6952;
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.auth-form.active {
  display: flex;
}

.role-card {
  min-height: 154px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.role-card span {
  display: inline-flex;
  min-width: 44px;
  width: auto;
  padding: 0 10px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #eefbf7;
  color: #14765d;
  font-size: 0.78rem;
  font-weight: 800;
}

.role-card strong,
.role-card small {
  display: block;
}

.role-card strong {
  margin: 16px 0 8px;
}

.role-card small {
  color: var(--muted);
  line-height: 1.35;
}

.role-card.selected,
.role-card:hover {
  border-color: var(--primary);
  box-shadow: 0 12px 34px rgba(29, 241, 178, 0.2);
}

.primary-action,
.secondary-action,
.status-button,
.chat-form button,
.pricing-grid button {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  font-weight: 800;
}

.primary-action,
.chat-form button,
.pricing-grid button {
  background: var(--primary);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.role-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at top left, rgba(29, 241, 178, 0.18), transparent 32%),
    linear-gradient(135deg, #fcfefd 0%, #f5fffb 55%, #fffdf2 100%);
}

.role-panel {
  width: min(580px, 100%);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  padding: 40px;
  text-align: center;
  backdrop-filter: blur(8px);
}

.role-logo {
  width: 136px;
  height: 136px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--aqua);
  box-shadow: 0 12px 28px rgba(29, 241, 178, 0.22);
}

.eyebrow {
  margin: 0 0 4px;
  color: #14765d;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.1rem, 5vw, 4rem);
  line-height: 1;
}

.role-copy {
  max-width: 570px;
  margin: 0 auto 24px;
  color: var(--muted);
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.auth-box {
  max-width: 420px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfffd;
  padding: 24px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.auth-tab {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--muted);
  font-weight: 800;
}

.auth-tab.active {
  border-color: var(--primary);
  background: #eafff8;
  color: #0f6952;
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.auth-form.active {
  display: flex;
}

.role-card {
  min-height: 154px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.role-card span {
  display: inline-flex;
  min-width: 44px;
  width: auto;
  padding: 0 10px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #eefbf7;
  color: #14765d;
  font-size: 0.78rem;
  font-weight: 800;
}

.role-card strong,
.role-card small {
  display: block;
}

.role-card strong {
  margin: 16px 0 8px;
}

.role-card small {
  color: var(--muted);
  line-height: 1.35;
}

.role-card.selected,
.role-card:hover {
  border-color: var(--primary);
  box-shadow: 0 12px 34px rgba(29, 241, 178, 0.2);
}

.primary-action,
.secondary-action,
.status-button,
.chat-form button,
.pricing-grid button {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  font-weight: 800;
}

.primary-action,
.chat-form button,
.pricing-grid button {
  background: var(--primary);
  color: var(--ink);
  padding: 0 18px;
}

.secondary-action {
  background: #fff9d8;
  color: #5f5512;
  border: 1px solid var(--gold-soft);
  padding: 0 16px;
}

.status-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  gap: 12px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 80px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  overflow: hidden;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s;
}

.app-shell.sidebar-collapsed .sidebar {
  width: 80px;
  padding: 22px 10px;
}
.app-shell.sidebar-collapsed .sidebar .brand span,
.app-shell.sidebar-collapsed .sidebar .brand strong,
.app-shell.sidebar-collapsed .sidebar .nav-label,
.app-shell.sidebar-collapsed .sidebar .drawer-profile-header,
.app-shell.sidebar-collapsed .sidebar #logoutSidebarButton .nav-label,
.app-shell.sidebar-collapsed .sidebar #driveSidebarLink .nav-label {
  display: none;
}
.app-shell.sidebar-collapsed .sidebar .brand img {
  width: 40px;
  height: 40px;
}
.app-shell.sidebar-collapsed .sidebar .brand {
  justify-content: center;
}
.app-shell.sidebar-collapsed .sidebar .nav-item {
  justify-content: center;
  padding: 0;
}
.app-shell.sidebar-collapsed .sidebar .nav-item i {
  margin-right: 0;
}

/* Sidebar toggle button inside topbar */
#sidebarToggleBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 1.25rem;
  cursor: pointer;
  transition: background 0.2s;
}
#sidebarToggleBtn:hover {
  background: var(--bg-panel);
}

.brand img {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--secondary);
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 0.86rem;
}

  /* Mobile Bible fixes */
  #bibleContent {
    font-size: 1.15rem;
    line-height: 1.6;
    padding: 0 8px;
  }
  #bibleContent p {
    margin-bottom: 14px;
  }
  #bibleContent span.verse-num {
    font-size: 0.8em;
    vertical-align: super;
    margin-right: 4px;
    color: var(--primary);
    font-weight: 700;
  }

.nav-list {
  display: grid;
  gap: 6px;
  overflow: auto;
  padding-right: 2px;
}

.nav-item {
  min-height: 40px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0 12px;
  font-weight: 750;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background: #eafff8;
  color: #0f6952;
}

.nav-item.active {
  background: var(--primary) !important;
  color: #ffffff !important;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(20, 118, 93, 0.2);
}

.nav-icon {
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  transition: transform 0.2s ease;
}

.nav-item:hover .nav-icon {
  transform: scale(1.1);
}

.nav-label {
  font-size: 0.9rem;
  font-weight: 600;
}


.status-button {
  margin-top: auto;
  background: var(--ink);
  color: white;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 76px;
  margin: -24px -24px 24px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(252, 254, 253, 0.9);
  backdrop-filter: blur(12px);
}

.topbar h2 {
  margin: 0;
  font-size: 1.4rem;
}

.icon-button {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge,
.trial {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 800;
}

.badge {
  background: #eafff8;
  color: #0f6952;
}

.trial {
  background: #fff9d8;
  color: #5f5512;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h3 {
  margin-bottom: 4px;
  font-size: 1.7rem;
}




.section-heading p {
  color: var(--muted);
  margin-bottom: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.metrics article,
.panel,
.cards-grid > article,
.pricing-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(22, 21, 20, 0.05);
}

.metrics article {
  min-height: 126px;
  padding: 16px;
}

.metrics span,
.metrics small {
  display: block;
  color: var(--muted);
}

.metrics strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 2.1rem;
}

/* Clickable metric cards */
.metrics article[data-goto] {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.metrics article[data-goto]:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(20,118,93,0.14);
  border-color: var(--primary);
}
.metrics article[data-goto]:hover strong {
  color: var(--primary);
}

/* Live clock in topbar */
#topbarClock {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.02em;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}
#topbarClock .clock-time {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}
#topbarClock .clock-date {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: capitalize;
}

.dashboard-grid,
.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.panel-head h4 {
  margin: 0;
}

.panel-head span {
  color: var(--muted);
  font-size: 0.86rem;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.quick-actions button,
.filters button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-weight: 750;
}

.quick-actions button:hover,
.filters button.active {
  border-color: var(--primary);
  background: #eafff8;
}

.soft-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.soft-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: #f7fffc;
}

.soft-list span {
  color: var(--muted);
}

.ai-panel {
  grid-column: 1 / -1;
}

.text-button {
  border: 0;
  background: transparent;
  color: #0f6952;
  font-weight: 800;
}

.chat-log {
  min-height: 118px;
  max-height: 220px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfffd;
}

.chat-log p {
  width: fit-content;
  max-width: 82%;
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #eafff8;
}

.chat-log p.user {
  justify-self: end;
  background: #fff9d8;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  padding: 10px 12px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.form-grid .primary-action,
.form-grid .secondary-action {
  width: 100%;
}

.form-stack {
  display: grid;
  gap: 12px;
}

.two-columns,
.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
}

td button {
  min-height: 32px;
  border: 1px solid var(--gold-soft);
  border-radius: var(--radius);
  background: #fff9d8;
  color: #5f5512;
  font-weight: 800;
}

.tag {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: #eafff8;
  color: #0f6952;
  font-size: 0.78rem;
  font-weight: 800;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.cards-grid > article {
  padding: 18px;
}

.cards-grid h4 {
  margin-bottom: 6px;
}

.cards-grid p {
  color: var(--muted);
  margin-bottom: 12px;
}

.card-meta {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.attendance-grid {
  display: grid;
  grid-template-columns: 1.1fr repeat(7, 1fr);
  gap: 8px;
}

.attendance-grid span,
.attendance-grid label {
  min-height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #f7fffc;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.attendance-grid label input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--primary);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filters button {
  padding: 0 14px;
}

.filters select {
  max-width: 230px;
}

.chart-panel {
  min-height: 280px;
}

.bars {
  height: 200px;
  display: flex;
  align-items: end;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  background: #f7fffc;
}

.bars span {
  flex: 1;
  min-width: 34px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--primary), var(--gold-soft));
}

.donut {
  width: 210px;
  height: 210px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--primary) 0 0%, #eef3f0 0% 100%);
}

.donut.empty {
  background: conic-gradient(var(--primary) 0 0%, #eef3f0 0% 100%);
}

.donut span {
  width: 128px;
  height: 128px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: white;
  font-size: 2rem;
  font-weight: 900;
}

.profile-card {
  text-align: center;
}

.profile-card img {
  width: 128px;
  height: 128px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--secondary);
}

.profile-card dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  text-align: left;
}

.profile-card dt {
  color: var(--muted);
}

.profile-card dd {
  margin: 0;
  font-weight: 800;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(22, 21, 20, 0.38);
}

.modal-card {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: var(--radius);
  background: white;
  padding: 24px;
  box-shadow: var(--shadow);
}

.modal-card.wide {
  width: min(980px, 100%);
}

.close-modal {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  font-size: 1.4rem;
}

.simple-create {
  display: grid;
  gap: 12px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.pricing-grid article {
  padding: 18px;
}

.pricing-grid article.featured {
  border-color: var(--primary);
  box-shadow: 0 18px 38px rgba(29, 241, 178, 0.18);
}

.pricing-grid span {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: #fff9d8;
  color: #5f5512;
  font-size: 0.78rem;
  font-weight: 900;
}

.pricing-grid strong {
  display: block;
  font-size: 1.8rem;
}

.pricing-grid ul {
  padding-left: 18px;
  color: var(--muted);
}

.pricing-grid button {
  width: 100%;
}


.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9999;
  max-width: 340px;
  border-radius: var(--radius);
  background: #10b981;
  color: white;
  padding: 14px 20px;
  box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.4);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.3s ease-out;
}
.toast::before {
  content: '✓';
  font-weight: bold;
  font-size: 1.1rem;
}
.toast.error {
  background: #ef4444;
  box-shadow: 0 10px 25px -5px rgba(239, 68, 68, 0.4);
}
.toast.error::before {
  content: '✖';
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}


@media (max-width: 1120px) {
  .metrics,
  .cards-grid,
  .pricing-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 15;
    inset: 0 auto 0 0;
    width: min(300px, 82vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .icon-button {
    display: inline-grid;
    place-items: center;
  }

  .role-grid,
  .metrics,
  .dashboard-grid,
  .two-columns,
  .profile-grid,
  .report-grid,
  .cards-grid,
  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid > article,
  .dashboard-grid > div {
    grid-column: span 1 !important;
  }

  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .quick-action-card {
    padding: 14px !important;
    gap: 8px !important;
  }

  .quick-action-card-icon {
    font-size: 1.5rem !important;
  }

  .quick-action-card-title {
    font-size: 0.88rem !important;
  }

  .quick-action-card-desc {
    font-size: 0.72rem !important;
    line-height: 1.25 !important;
  }

  .main {
    padding: 18px;
  }

  .topbar {
    margin: -18px -18px 18px;
    padding: 12px 18px;
  }

  .top-actions {
    gap: 6px;
  }

  .trial {
    display: none;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .auth-form {
    grid-template-columns: 1fr;
  }

  .attendance-grid {
    grid-template-columns: 1fr repeat(4, 42px);
    overflow: auto;
  }

  .topbar {
    padding: 0 16px;
    height: 64px;
  }
  .topbar .eyebrow {
    display: none;
  }
  
  #topbarClock {
    display: none !important; /* Hide clock on mobile to save space */
  }/* Ocultar rol para limpieza */

  .bible-controls {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 560px) {
  .role-screen {
    padding: 14px;
  }

  .role-panel {
    padding: 22px;
  }

  .quick-actions,
  .chat-form {
    grid-template-columns: 1fr;
  }

  .topbar h2 {
    font-size: 1.1rem;
  }
}

/* Nuevos Estilos: Botones de Tabla */
.small-btn {
  min-height: 28px !important;
  font-size: 0.8rem !important;
  padding: 4px 8px !important;
}
td button.danger-btn {
  background: #ffebee !important;
  color: #c62828 !important;
  border-color: #ffcdd2 !important;
}
td button.danger-btn:hover {
  background: #ffcdd2 !important;
}
td button.warning-btn {
  background: #fff3e0 !important;
  color: #ef6c00 !important;
  border-color: #ffe0b2 !important;
}
td button.warning-btn:hover {
  background: #ffe0b2 !important;
}
td button.success-btn {
  background: #e8f5e9 !important;
  color: #2e7d32 !important;
  border-color: #c8e6c9 !important;
}
td button.success-btn:hover {
  background: #c8e6c9 !important;
}

/* Notificaciones (Campana) */
.notification-wrapper {
  position: relative;
}
.badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e53935;
  color: white;
  font-size: 0.65rem;
  font-weight: bold;
  border-radius: 50%;
  width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.badge-count.hidden {
  display: none;
}
.notification-dropdown {
  position: absolute;
  right: 0;
  top: 40px;
  width: 300px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 1000;
  max-height: 380px;
  overflow-y: auto;
  animation: fadeIn 0.2s ease;
}
.notification-dropdown.hidden {
  display: none;
}
.notification-header {
  padding: 10px 14px;
  font-weight: bold;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  background: rgba(0, 0, 0, 0.02);
}
.notification-list {
  display: flex;
  flex-direction: column;
}
.notification-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s ease;
}
.notification-item:hover {
  background: var(--bg-hover);
}
.notification-item:last-child {
  border-bottom: none;
}
.notification-item.today {
  border-left: 3px solid #e53935;
  background: #fff8f8;
}
.notification-item.tomorrow {
  border-left: 3px solid #fb8c00;
  background: #fffcf5;
}
.notification-item strong {
  display: block;
  color: var(--text);
  margin-bottom: 2px;
}
.notification-item span {
  color: var(--muted);
  font-size: 0.75rem;
}

/* Calendario */
.calendar-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 850px) {
  .calendar-layout {
    grid-template-columns: 1fr;
  }
}
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  text-align: center;
}
.calendar-day-header {
  font-weight: bold;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 6px 0;
  border-bottom: 2px solid var(--border);
}
.calendar-day {
  aspect-ratio: 1.1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  background: var(--bg-panel);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  min-height: 60px;
}
.calendar-day:hover {
  background: var(--bg-hover);
  border-color: var(--gold-soft);
}
.calendar-day.empty {
  background: transparent;
  border: none;
  cursor: default;
}
.calendar-day.busy { background: #fdf2f2; }
.calendar-day.few { background: #fffdf5; }
.calendar-day.today {
  border: 2px solid var(--gold-soft);
  background: #fffdf0;
}
.calendar-day.selected {
  outline: 3px solid var(--gold);
  outline-offset: -3px;
  box-shadow: 0 4px 12px rgba(20, 118, 93, 0.15);
  font-weight: bold;
}
.calendar-day-number {
  font-weight: bold;
  font-size: 0.85rem;
}
.calendar-event-dots {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  width: 100%;
}
.calendar-event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.calendar-event-dot.actividad { background-color: #29b6f6; }
.calendar-event-dot.reunión { background-color: #ffb74d; }
.calendar-event-dot.culto { background-color: #ba68c8; }
.calendar-event-dot.retiro { background-color: #81c784; }

.event-detail-item {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--bg-panel);
  transition: box-shadow 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: start;
}
.event-detail-item:hover {
  box-shadow: var(--shadow-sm);
}
.event-info {
  flex-grow: 1;
}
.event-info h5 {
  margin: 0 0 4px 0;
  font-size: 0.9rem;
  color: var(--text);
}
.event-info p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.event-meta {
  display: flex;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

/* Ollama status styles */
.ollama-status-banner {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  border: 1px solid var(--line);
  background: #fbfdfc;
  color: var(--muted);
}

.ollama-status-banner.status-ok {
  background: #eafff8;
  border-color: #a3e2c9;
  color: #0f6952;
}

.ollama-status-banner.status-warn {
  background: #fff9d8;
  border-color: #e5da9a;
  color: #5f5512;
}

.ollama-status-banner.status-error {
  background: #ffebee;
  border-color: #ffcdd2;
  color: #c62828;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b0bec5;
  flex-shrink: 0;
  display: inline-block;
}

.status-ok .status-dot {
  background: #2e7d32;
  box-shadow: 0 0 8px rgba(46, 125, 50, 0.6);
}

.status-warn .status-dot {
  background: #ef6c00;
  box-shadow: 0 0 8px rgba(239, 108, 0, 0.6);
}

.status-error .status-dot {
  background: #c62828;
  box-shadow: 0 0 8px rgba(198, 40, 40, 0.6);
}

/* Custom AI config and WhatsApp styles */
.ia-modes-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ia-mode-option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--bg);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.ia-mode-option:hover {
  border-color: var(--secondary);
  background: #f5fffb;
}

.ia-mode-option.active {
  border-color: var(--primary);
  background: #eafff8;
  box-shadow: 0 4px 14px rgba(29, 241, 178, 0.15);
}

.ia-switch {
  width: 42px;
  height: 24px;
  border-radius: 12px;
  background: #ccc;
  position: relative;
  transition: background-color 0.25s ease;
  flex-shrink: 0;
}

.ia-switch-handle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.ia-mode-option.active .ia-switch {
  background: #2e7d32;
}

.ia-mode-option.active .ia-switch-handle {
  transform: translateX(18px);
}

.ia-mode-icon {
  font-size: 1.25rem;
}

.ia-mode-info {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.ia-mode-info strong {
  font-size: 0.9rem;
  color: var(--ink);
}

.ia-mode-info span {
  font-size: 0.75rem;
  color: var(--muted);
}

.premium-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
}
.premium-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(29, 241, 178, 0.15);
}

.badge-status {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  display: inline-block;
}
.badge-status.disconnected {
  background: #ffebee;
  color: #c62828;
}
.badge-status.connecting {
  background: #fff9d8;
  color: #5f5512;
}
.badge-status.qr_received {
  background: #e3f2fd;
  color: #0d47a1;
}
.badge-status.connected {
  background: #eafff8;
  color: #0f6952;
}

/* ==========================================
   Estilos de Impresión / Exportación PDF
   ========================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }
  
  /* Ocultar elementos interactivos de navegación y UI */
  .sidebar,
  .topbar,
  .section-heading button,
  .filters,
  #fakePdf,
  #exportPeopleCsvReport,
  #exportFinancesCsvReport,
  .toast,
  .modal {
    display: none !important;
  }
  
  /* Ajustar la estructura principal */
  .app-shell {
    display: block !important;
    background: #ffffff !important;
  }
  
  .main {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    background: #ffffff !important;
  }
  
  /* Ocultar todas las secciones excepto Informes */
  .view {
    display: none !important;
  }
  
  #informes.view {
    display: block !important;
    width: 100% !important;
  }
  
  /* Asegurar que las tarjetas y grillas de informes se impriman bien */
  .report-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
  }
  
  .panel {
    border: 1px solid #dddddd !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
    background: #ffffff !important;
    color: #000000 !important;
    padding: 15px !important;
    margin-bottom: 15px !important;
    border-radius: 4px !important;
  }
  
  .chart-panel {
    min-height: auto !important;
  }

  /* Márgenes de página estándar */
  @page {
    margin: 1.6cm;
  }
}

/* ==========================================
   Estilos de Diseño Móvil Premium (Estética Nueva)
   ========================================== */

/* Header y Barra Lateral por Defecto (Desktop) */
.mobile-church-title {
  display: none;
}
.drawer-profile-header {
  display: none;
}
.mobile-tab-bar {
  display: none;
}
.sidebar-backdrop {
  display: none;
}

/* Estilos Generales para el Drawer Profile Header (Desktop/Mobile Base) */
.drawer-profile-header {
  flex-direction: column;
  padding: 10px 0 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

.profile-user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius);
  transition: background-color 0.2s ease;
}
.profile-user-row:hover {
  background: rgba(29, 241, 178, 0.08);
}

.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--aqua);
  box-shadow: 0 4px 10px rgba(29, 241, 178, 0.15);
}

.profile-user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-grow: 1;
}

.profile-user-info span {
  font-weight: 750;
  color: var(--ink);
  font-size: 1rem;
}

.profile-user-info .chevron-right {
  color: var(--muted);
  font-size: 1.25rem;
  font-weight: normal;
}

.church-selector-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f4faf8;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px 6px 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.church-selector-row:hover {
  background: #eafff8;
}

.church-icon-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.church-selector-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.church-selector-info strong {
  font-size: 0.85rem;
  font-weight: 800;
  color: #14765d;
}

.progress-bar-container {
  width: 86px;
  height: 4px;
  background: #dce8e3;
  border-radius: 2px;
  margin-top: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
}

.church-selector-row .chevron-down {
  color: var(--muted);
  font-size: 0.75rem;
}

/* Sidebar Backdrop for Mobile */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(22, 21, 20, 0.45);
  backdrop-filter: blur(4px);
  z-index: 14;
  opacity: 1;
  transition: opacity 0.25s ease;
}

/* Bottom Tab Bar for Mobile */
.mobile-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: #ffffff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 15px rgba(22, 21, 20, 0.05);
  z-index: 10;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--muted);
  padding: 4px 0;
  text-decoration: none;
  position: relative;
  transition: color 0.2s ease;
}

.tab-icon {
  font-size: 1.35rem;
  margin-bottom: 2px;
}

.tab-label {
  font-size: 0.72rem;
  font-weight: 750;
}

.tab-item.active {
  color: #14765d;
}

.tab-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 18%;
  right: 18%;
  height: 3px;
  background: #14765d;
  border-radius: 0 0 3px 3px;
}

/* Sobreescritura en Pantallas Móviles */
@media (max-width: 860px) {
  .sidebar .brand {
    display: none;
  }

  .drawer-profile-header {
    display: flex;
  }

  .mobile-tab-bar {
    display: grid;
  }

  .main {
    padding: 16px;
    padding-bottom: 78px !important; /* Espacio extra para que la barra inferior no tape el contenido */
  }

  .topbar {
    margin: -16px -16px 16px;
    padding: 10px 16px;
    background: #14765d; /* Fondo verde oscuro de la barra superior */
    border-bottom: none;
    box-shadow: 0 2px 8px rgba(20, 118, 93, 0.2);
  }

  .topbar-title-wrapper {
    flex-grow: 1;
    text-align: center;
  }

  .topbar-title-wrapper .eyebrow,
  .topbar-title-wrapper #pageTitle {
    display: none !important;
  }

  .mobile-church-title {
    display: block;
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
  }

  .topbar .icon-button {
    display: inline-grid;
    place-items: center;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.4rem;
    width: 36px;
    height: 36px;
  }

  .topbar .notification-wrapper .badge-count {
    top: -2px;
    right: -2px;
  }

  .topbar #roleBadge {
    display: none; /* Ocultar rol para limpieza */
  }

  /* Tarjetas del Dashboard estilizadas exactamente como el Grid de la foto */
  .metrics {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .metrics article {
    min-height: 105px;
    padding: 14px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(22, 21, 20, 0.04);
    border-radius: var(--radius);
  }

  .metrics article span {
    font-size: 0.82rem;
    font-weight: 750;
    color: var(--muted);
    order: 2; /* Etiqueta abajo del número */
  }

  .metrics article strong {
    font-size: 2.1rem;
    color: #14765d;
    margin: 0 0 4px 0;
    order: 1; /* Número arriba de la etiqueta */
  }

  .metrics article small {
    display: none; /* Ocultar detalles en celular */
  }
}

/* Calendar Highlight and Premium Chat Styles */
.calendar-day.few-events {
  background: #eafff8;
  border-color: rgba(20, 118, 93, 0.35);
}
.calendar-day.few-events:hover {
  background: #d3f9ec;
  border-color: var(--primary);
}

.calendar-day.busy-day {
  background: #ffe8cc;
  border-color: rgba(230, 81, 0, 0.35);
}
.calendar-day.busy-day:hover {
  background: #ffd9ad;
  border-color: #e65100;
}

.chat-log .chat-msg {
  width: fit-content;
  max-width: 90%;
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  position: relative;
  word-break: break-word;
}
.chat-log .chat-msg.user-msg {
  justify-self: end;
  background: #fff9d8;
  color: #5f5512;
}
.chat-log .chat-msg.bot-msg {
  justify-self: start;
  background: #eafff8;
  color: #0f6952;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-pdf-btn {
  margin-top: 6px;
  background: #ffffff;
  color: #14765d;
  border: 1px solid rgba(20, 118, 93, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: bold;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  width: fit-content;
}
.chat-pdf-btn:hover {
  background: #14765d;
  color: #ffffff;
  border-color: #14765d;
}

.calendar-day-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.calendar-day-icon {
  font-size: 0.75rem;
  color: #14765d;
  opacity: 0.85;
  transition: transform 0.2s ease;
}

.calendar-day.few-events:hover .calendar-day-icon,
.calendar-day.busy-day:hover .calendar-day-icon {
  transform: scale(1.2);
  opacity: 1;
}

/* Chat Tables Styles */
.chat-log table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 0.82rem;
  background: #ffffff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.chat-log th {
  background-color: #14765d;
  color: #ffffff;
  padding: 6px 10px;
  font-weight: 600;
  text-align: left;
  border: 1px solid rgba(20, 118, 93, 0.15);
}
.chat-log td {
  padding: 6px 10px;
  border: 1px solid rgba(20, 118, 93, 0.1);
  color: #333333;
}
.chat-log tr:nth-child(even) {
  background-color: rgba(20, 118, 93, 0.04);
}
.chat-log tr:hover {
  background-color: rgba(20, 118, 93, 0.08);
}

/* Premium Horizontal Slide Widgets, Animations, and Avatar Styling */
.slide-wrapper {
  display: flex;
  align-items: center;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease, margin-top 0.4s ease;
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  width: 100%;
  pointer-events: none;
}

.slide-wrapper.expanded {
  max-height: 60px;
  opacity: 1;
  margin-top: 10px;
  pointer-events: auto;
}

.quick-actions-horizontal {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding: 4px 0;
}

.quick-actions-horizontal::-webkit-scrollbar {
  display: none;
}

.quick-actions-horizontal {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.quick-actions-horizontal button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  white-space: nowrap;
}

.quick-actions-horizontal button:hover {
  border-color: var(--primary);
  background: #eafff8;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(20, 118, 93, 0.08);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-grid > article {
  animation: fadeInUp 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) both;
}

.dashboard-grid > article:nth-child(1) { animation-delay: 0.05s; }
.dashboard-grid > article:nth-child(2) { animation-delay: 0.1s; }
.dashboard-grid > article:nth-child(3) { animation-delay: 0.15s; }
.dashboard-grid > article:nth-child(4) { animation-delay: 0.2s; }

.avatar-upload-overlay {
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.avatar-upload-overlay:hover {
  background-color: rgba(0, 0, 0, 0.8) !important;
}

#backupsTable tbody tr {
  transition: background-color 0.2s ease;
}

#backupsTable tbody tr:hover {
  background-color: rgba(20, 118, 93, 0.04);
}

/* Custom modern checkbox card layout inside widgets config modal */
.widget-checkbox-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}
.widget-checkbox-card:hover {
  border-color: var(--primary);
  background: #f0fdf9;
  transform: translateY(-1px);
}
.widget-checkbox-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
}
.widget-checkbox-card:has(input[type="checkbox"]:checked) {
  border-color: var(--primary);
  background: #eafff8;
  box-shadow: 0 2px 8px rgba(20, 118, 93, 0.08);
}
.widget-checkbox-card span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Responsive grid for widget configuration checkboxes */
.widget-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

/* Mobile responsive calendar and quick actions optimization */
@media (max-width: 860px) {
  .main {
    padding: 10px !important;
    padding-bottom: 78px !important;
  }
  .calendar-layout .panel {
    padding: 10px !important;
  }
  .calendar-grid {
    gap: 2px !important;
  }
  .calendar-day {
    padding: 2px !important;
    min-height: 38px !important;
    aspect-ratio: 1 !important;
  }
  .calendar-day-number {
    font-size: 0.7rem !important;
  }
  .calendar-day-header {
    font-size: 0.65rem !important;
    padding: 4px 0 !important;
  }
  .calendar-day-icon {
    display: none !important; /* Hide redundant calendar icon in cells on mobile to save space */
  }
  .calendar-event-dot {
    width: 4px;
    height: 4px;
  }
  .calendar-event-dots {
    gap: 2px;
  }
  .calendar-header h4 {
    font-size: 1rem !important;
    min-width: auto !important;
  }
  .calendar-header button {
    padding: 4px 8px !important;
    font-size: 0.8rem !important;
    min-height: auto !important;
  }

  /* Quick Actions Wrapping on Mobile to avoid overlapping/covering */
  .slide-wrapper {
    display: flex !important;
    flex-wrap: wrap !important;
  }
  .quick-actions-horizontal {
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    gap: 8px !important;
    padding: 8px 0 !important;
    width: 100% !important;
  }
  .slide-wrapper.expanded {
    max-height: 300px !important; /* Allow panel to grow vertically under toggle buttons */
  }
}


/* MOBILE CARDS FOR TABLES */
@media (max-width: 860px) {
  table { border: 0; width: 100%; display: block; }
  table thead { display: none; }
  table tbody { display: block; width: 100%; }
  table tr {
    display: block;
    margin-bottom: 1rem;
    box-shadow: 0 4px 6px -1px var(--shadow), 0 2px 4px -2px var(--shadow);
    background: var(--surface);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--border);
  }
  table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    font-size: 0.9em;
    text-align: right;
    padding: 10px 4px;
    word-break: break-word;
  }
  table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.85em;
    text-align: left;
    margin-right: 15px;
  }
  table td:last-child { border-bottom: 0; }
  table td button { margin-left: 5px; }
  .table-wrap { overflow: visible; border: none; box-shadow: none; background: transparent; padding: 0; }
}

/* --- ADICIONES ESTÉTICAS PREMIUM --- */

/* Scrollbars Minimalistas */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbdcd5;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #a9c2b8;
}

/* Tarjetas Métricas Hover Elevado */
.metrics > div {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
}
.metrics > div:hover {
  transform: translateY(-4px) scale(1.015);
  box-shadow: 0 10px 25px rgba(22, 21, 20, 0.08);
}

/* Animaciones para Apertura de Modales */
.modal:not(.hidden) {
  animation: modalFadeIn 0.2s ease-out forwards;
}
.modal:not(.hidden) .modal-card {
  animation: modalScaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modalScaleIn {
  from { transform: scale(0.94) translateY(8px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* Estructura Skeleton de Carga Animada */
.skeleton {
  background: linear-gradient(90deg, #f0f5f3 25%, #e1ebe7 37%, #f0f5f3 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: 6px;
  display: inline-block;
}
.skeleton-text {
  width: 100%;
  height: 14px;
  margin: 6px 0;
}
.skeleton-title {
  width: 60%;
  height: 20px;
  margin-bottom: 12px;
}
.skeleton-rect {
  width: 100%;
  height: 120px;
}
@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Biblia y Copiado Rápido */
.bible-search-box {
  max-width: 480px;
  margin: 0 auto 20px;
  display: flex;
  gap: 10px;
}
.bible-verse-item {
  position: relative;
  padding: 12px 48px 12px 16px;
  border-bottom: 1px solid var(--line);
  transition: background 0.2s;
  text-align: left;
}
.bible-verse-item:hover {
  background: #f4faf8;
}
.copy-verse-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.3;
  transition: opacity 0.2s, transform 0.2s;
  padding: 4px;
}
.bible-verse-item:hover .copy-verse-btn {
  opacity: 1;
}
.copy-verse-btn:hover {
  transform: translateY(-50%) scale(1.2);
}

/* --- NUEVAS MEJORAS DE DISEÑO Y COMPONENTES PREMIUM --- */



/* Tablero Kanban de Consolidación */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 24px;
  text-align: left;
}
@media (max-width: 900px) {
  .kanban-board {
    grid-template-columns: 1fr;
  }
}
.kanban-column {
  background: rgba(220, 232, 227, 0.15);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 500px;
  transition: background 0.3s;
}

.kanban-column h4 {
  margin: 0 0 8px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
}
.kanban-column-count {
  background: var(--line);
  color: var(--ink);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
}
.kanban-cards-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
  overflow-y: auto;
  max-height: 600px;
}
.kanban-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 4px 12px rgba(22, 21, 20, 0.03);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(22, 21, 20, 0.06);
}
.kanban-card-title {
  font-weight: 800;
  font-size: 0.95rem;
  margin: 0;
  color: var(--ink);
}
.kanban-card-meta {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}
.kanban-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}
.kanban-card-nav-btns {
  display: flex;
  gap: 6px;
}
.kanban-card-btn {
  background: var(--line);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.kanban-card-btn:hover {
  background: var(--primary);
  color: #161514;
}

/* Botón de Plantilla de WhatsApp */
.wa-template-btn {
  background: #25d366;
  color: white !important;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.wa-template-btn:hover {
  background: #128c7e;
  transform: scale(1.05);
}

/* Anillos de Progreso Circular SVG */
.progress-ring-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.progress-ring {
  position: relative;
  width: 100px;
  height: 100px;
}
.progress-ring svg {
  transform: rotate(-90deg);
}
.progress-ring-circle-bg {
  fill: none;
  stroke: var(--line);
  stroke-width: 8;
}
.progress-ring-circle {
  fill: none;
  stroke: var(--primary);
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-ring-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
}

/* Acciones Rápidas con Degradados Premium */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.quick-action-card {
  position: relative;
  background: linear-gradient(135deg, var(--panel) 0%, rgba(255,255,255,0.7) 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  overflow: hidden;
  text-align: left;
}

.quick-action-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0.8;
}
.quick-action-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(22, 21, 20, 0.08);
  border-color: var(--secondary);
}

.quick-action-card-icon {
  font-size: 1.8rem;
}
.quick-action-card-title {
  font-weight: 800;
  font-size: 0.95rem;
  margin: 0;
  color: var(--ink);
}
.quick-action-card-desc {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
  margin: 0;
}

/* Pestañas de Navegación del Panel (Tabs) */
.view-tabs {
  display: flex;
  gap: 12px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 20px;
  padding-bottom: 8px;
}
.view-tab-btn {
  background: transparent;
  border: none;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--muted);
  padding: 6px 12px;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}
.view-tab-btn:hover {
  color: var(--ink);
}
.view-tab-btn.active {
  color: var(--primary);
}
.view-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--primary);
  border-radius: 99px;
}
.tab-content-panel {
  display: none;
}
.tab-content-panel.active {
  display: block;
}

.bible-controls {
  display: grid;
  grid-template-columns: 1.5fr 1fr 2fr auto;
  gap: 12px;
}

/* =============================================================
   RESPONSIVE MÓVIL / TABLET — CORRECCIONES COMPLETAS v14
   Aplica para pantallas ≤ 860px (celular y tablet)
   ============================================================= */

/* ---- Modales: más compactos y sin desbordamiento en celular ---- */
@media (max-width: 860px) {
  .modal {
    padding: 10px;
    align-items: flex-end;   /* El modal aparece desde abajo como sheet */
  }

  .modal-card {
    border-radius: 18px 18px 0 0;
    width: 100%;
    max-height: 92vh;
    padding: 20px 16px 30px;
  }

  .modal-card.wide {
    width: 100%;
  }

  /* ---- Toast: sube para no quedar debajo de la barra de pestañas ---- */
  .toast {
    bottom: 78px;           /* Altura de .mobile-tab-bar (62px) + margen */
    right: 12px;
    left: 12px;
    max-width: 100%;
    font-size: 0.88rem;
    padding: 12px 16px;
  }

  /* ---- Sección de Configuración ---- */
  .two-columns {
    grid-template-columns: 1fr;
  }

  /* Botones de exportación apilados verticalmente en celular */
  article.panel .secondary-action.small-btn,
  article.panel .primary-action.small-btn {
    width: 100% !important;
    min-width: unset !important;
  }

  /* ---- Tarjetas de modo IA: texto no se desborda ---- */
  .ia-mode-option {
    gap: 10px;
    padding: 12px;
  }

  .ia-mode-info strong {
    font-size: 0.85rem;
  }

  .ia-mode-info span {
    font-size: 0.72rem;
  }

  /* ---- Gestión de Usuarios: formulario ---- */
  #userForm.form-grid {
    grid-template-columns: 1fr;
  }

  /* ---- Notificaciones: dropdown ancho completo en celular ---- */
  .notification-dropdown {
    right: -10px;
    left: 10px;
    width: auto;
  }

  /* ---- Sección heading: botones de acción apilados ---- */
  .section-heading {
    gap: 12px;
  }

  .section-heading > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .section-heading > div:last-child button,
  .section-heading > div:last-child select,
  .section-heading > div:last-child input {
    flex: 1;
    min-width: 120px;
  }

  /* ---- Panel de Biblia: altura máxima razonable en celular ---- */
  #bibleContentBody {
    max-height: 340px !important;
    font-size: 1rem !important;
    line-height: 1.65 !important;
  }

  /* ---- Tabla de respaldos: no desborda en celular ---- */
  #backupsTable {
    font-size: 0.82rem;
  }

  /* ---- Kanban board: 1 columna en tablet ---- */
  .kanban-board {
    grid-template-columns: 1fr;
  }

  /* ---- Chat form: textarea y botón apilados ---- */
  .chat-form {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* ---- Asistir asistencia: grid compacto ---- */
  .attendance-grid {
    font-size: 0.82rem;
  }

  /* ---- Filtros de sección con flex wrap ---- */
  .panel-head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .panel-head select,
  .panel-head input[type="text"],
  .panel-head input[type="search"] {
    width: 100%;
    max-width: 100%;
  }
}

/* =============================================================
   SOLO CELULARES (≤ 480px) — ajustes adicionales ultra compactos
   ============================================================= */
@media (max-width: 480px) {
  .main {
    padding: 8px !important;
    padding-bottom: 78px !important;
  }

  .panel {
    padding: 14px;
    border-radius: 12px;
  }

  h3.page-title,
  .section-heading h3 {
    font-size: 1.15rem;
  }

  /* Formulario de personas: 1 columna */
  #personForm.form-grid,
  #financeForm.form-grid,
  #meetingForm.form-grid,
  #schoolForm.form-grid {
    grid-template-columns: 1fr;
  }

  /* Tarjetas de métricas: 2 columnas pero más compactas */
  .metrics {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .metrics article strong {
    font-size: 1.75rem;
  }

  /* Acciones rápidas en 2 columnas bien apretadas */
  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .quick-action-card {
    padding: 10px 8px !important;
    gap: 6px !important;
  }

  .quick-action-card-icon {
    font-size: 1.25rem !important;
  }

  .quick-action-card-title {
    font-size: 0.8rem !important;
  }

  .quick-action-card-desc {
    display: none !important;
  }

  /* Modal en pantalla completa */
  .modal {
    padding: 0;
  }

  .modal-card {
    border-radius: 14px 14px 0 0;
    padding: 18px 14px 28px;
    max-height: 95vh;
  }

  /* Ocultar textos secundarios del sidebar (ya debería estar hidden) */
  .sidebar {
    transform: translateX(-105%);
  }

  /* Barra de pestañas: etiquetas más pequeñas */
  .tab-label {
    font-size: 0.62rem !important;
  }

  .tab-icon {
    font-size: 1.2rem !important;
  }

  /* Bible: controles en columna única */
  .bible-controls {
    grid-template-columns: 1fr !important;
  }

  /* Tabla de resumen financiero */
  .finance-summary {
    grid-template-columns: 1fr !important;
  }

  /* Tabs internas de vista (Ver por día, semana...) */
  .view-tabs-bar {
    overflow-x: auto;
    scrollbar-width: none;
  }
  .view-tabs-bar::-webkit-scrollbar {
    display: none;
  }

  /* Chat log: burbujas ocupan todo el ancho disponible */
  .chat-log .chat-msg {
    max-width: 96% !important;
  }
}



