:root {
  --primary: #4A90D9;
  --primary-dark: #357ABD;
  --primary-light: #7FB3E8;
  --accent: #E74C3C;
  --success: #2ECC71;
  --warning: #F39C12;
  --bg: #F5F7FA;
  --bg-card: #FFFFFF;
  --text: #2C3E50;
  --text-light: #7F8C8D;
  --text-muted: #BDC3C7;
  --border: #E1E8ED;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 12px;
  --nav-height: 60px;
  --header-height: 56px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Header */
#app-header {
  height: var(--header-height);
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

#app-header h1 {
  font-size: 17px;
  font-weight: 700;
}

#header-section {
  font-size: 13px;
  opacity: 0.8;
  font-weight: 400;
}

#header-actions {
  display: flex;
  gap: 8px;
}

#header-actions button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
}

/* Main content */
#main-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + 16px);
}

.nav-logout {
  display: none;
}

/* Bottom navigation */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg-card);
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid var(--border);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-light);
  font-size: 11px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: color 0.2s;
  position: relative;
  min-width: 48px;
}

.nav-item svg {
  fill: currentColor;
  margin-bottom: 2px;
}

.nav-item.active {
  color: var(--primary);
}

.badge {
  position: absolute;
  top: 0;
  right: 2px;
  background: var(--accent);
  color: white;
  font-size: 10px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card-meta {
  font-size: 13px;
  color: var(--text-light);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-danger {
  background: var(--accent);
  color: white;
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-icon {
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  border-radius: 50%;
}

.btn-icon:hover {
  background: var(--bg);
}

.btn-fab {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(74,144,217,0.4);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-fab-today {
  left: 16px;
  right: auto;
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
  font-size: inherit;
  flex-direction: column;
  gap: 1px;
  box-shadow: 0 4px 12px rgba(74,144,217,0.25);
}

.fab-today-month {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1;
}

.fab-today-day {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
}

.checkbox-label input {
  width: auto;
}

/* Login */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.login-box {
  background: white;
  border-radius: 16px;
  padding: 32px 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.login-box h1 {
  text-align: center;
  color: var(--primary);
  margin-bottom: 8px;
  font-size: 22px;
}

.login-box .subtitle {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 24px;
  font-size: 14px;
}

.login-box .btn {
  width: 100%;
  margin-top: 8px;
}

.login-error {
  color: var(--accent);
  text-align: center;
  font-size: 14px;
  margin-top: 12px;
}

/* Calendar */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.calendar-day-header {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  padding: 7px 0;
  background: var(--bg);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.calendar-day-header.weekend {
  color: var(--primary);
}

.calendar-day {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 4px;
  cursor: pointer;
  position: relative;
  background: var(--bg-card);
  min-height: 52px;
  overflow: hidden;
}

.calendar-day:hover {
  background: #F0F7FF;
}

.calendar-day.other-month {
  background: var(--bg);
}

.calendar-day.other-month .cal-day-num {
  color: var(--text-muted);
}

.calendar-day.weekend {
  background: #FAFBFC;
}

.calendar-day.weekend:hover {
  background: #EEF5FF;
}

.calendar-day.today {
  background: #EBF5FF;
}

.cal-day-num {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.today .cal-day-num {
  background: var(--primary);
  color: white;
  font-weight: 700;
}

.cal-event-pill {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--primary);
  color: white;
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 10px;
  line-height: 1.4;
  margin-bottom: 1px;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.cep-time {
  font-size: 9px;
  opacity: 0.85;
  flex-shrink: 0;
}

.cep-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-event-pill + .cal-event-pill {
  display: none;
}

.cal-event-more {
  display: none;
  font-size: 9px;
  color: var(--text-light);
  padding: 0 2px;
}

/* Day view */
.cal-day-view {
  margin-top: 8px;
}

.cal-day-time-grid {
  display: flex;
  overflow-y: auto;
  max-height: calc(100vh - 280px);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 8px;
}

.day-col-wrapper {
  flex: 1;
  position: relative;
  min-width: 0;
}

.cal-allday-bar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cal-allday-item {
  background: var(--primary);
  color: white;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
}

.btn-gcal {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  color: var(--primary);
  text-decoration: none;
  border: 1px solid var(--primary);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
}

.btn-gcal:hover {
  background: var(--primary);
  color: white;
}

.event-detail-modal {
  padding: 4px 0;
}

.event-detail-date {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 2px;
}

.event-detail-time {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
}

.event-detail-desc {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 10px;
  white-space: pre-wrap;
}

.event-detail-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.event-detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 16px;
}

.cal-event-pill {
  cursor: pointer;
}

.cal-event-pill:hover {
  opacity: 0.8;
}

/* View toggle */
.cal-view-toggle {
  display: flex;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  width: fit-content;
}

.cal-toggle-btn {
  background: none;
  border: none;
  padding: 5px 16px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-light);
  font-family: inherit;
}

.cal-toggle-btn.active {
  background: var(--primary);
  color: white;
  font-weight: 500;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.calendar-nav h2 {
  font-size: 18px;
}

.calendar-nav button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  color: var(--primary);
}

.event-list {
  margin-top: 12px;
}

.event-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: 8px;
  margin-bottom: 8px;
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow);
}

.event-time {
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
  min-width: 50px;
}

.event-details {
  flex: 1;
}

.event-details h4 {
  font-size: 15px;
  margin-bottom: 2px;
}

.event-details p {
  font-size: 13px;
  color: var(--text-light);
}

/* Week view */
.week-view-wrapper {
  min-width: 0;
}

.week-view {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.week-scroll {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 340px);
}

.week-header-row {
  display: grid;
  grid-template-columns: 44px repeat(7, minmax(44px, 1fr));
  min-width: 352px;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.week-rows {
  display: flex;
  min-width: 352px;
}

.week-gutter-hdr {
  border-right: 1px solid var(--border);
}

.week-col-hdr {
  text-align: center;
  padding: 8px 2px;
  border-left: 1px solid var(--border);
  cursor: pointer;
}

.week-col-hdr.weekend {
  background: #FAFBFC;
}

.week-col-hdr.today {
  background: #EBF5FF;
}

.week-col-dname {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.week-col-dnum {
  font-size: 18px;
  font-weight: 400;
  color: var(--text);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2px auto 0;
  border-radius: 50%;
}

.week-col-dnum.is-today {
  background: var(--primary);
  color: white;
  font-weight: 700;
}

.week-body {
  display: flex;
  overflow-y: auto;
  overflow-x: auto;
  max-height: calc(100vh - 340px);
}

.week-time-gutter {
  width: 44px;
  min-width: 44px;
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  position: sticky;
  left: 0;
  z-index: 5;
}

.week-hlabel {
  font-size: 9px;
  color: var(--text-muted);
  text-align: right;
  padding-right: 6px;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  padding-top: 3px;
}

.week-day-columns {
  display: grid;
  grid-template-columns: repeat(7, minmax(44px, 1fr));
  flex: 1;
  min-width: 308px;
}

.week-day-col {
  position: relative;
  border-left: 1px solid var(--border);
  background: var(--bg-card);
}

.week-day-col.weekend {
  background: #FAFBFC;
}

.week-day-col.today {
  background: #EBF5FF;
}

.week-hrow {
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
  cursor: pointer;
}

.week-hrow:hover {
  background: rgba(74,144,217,0.06);
}

.week-hrow-half {
  border-bottom-style: dashed;
  border-bottom-color: #EBEBEB;
}

.week-event {
  position: absolute;
  left: 2px;
  right: 2px;
  background: var(--primary);
  color: white;
  border-radius: 4px;
  padding: 2px 5px;
  overflow: hidden;
  cursor: pointer;
  z-index: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

.week-event:hover {
  background: var(--primary-dark);
  z-index: 2;
}

.week-ev-time {
  font-size: 9px;
  opacity: 0.9;
  line-height: 1.2;
}

.week-ev-title {
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.week-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  z-index: 3;
  pointer-events: none;
}

.week-now-line::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

/* Tasks */
.task-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text);
}

.filter-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}

.task-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.task-check.checked {
  background: var(--success);
  border-color: var(--success);
}

.task-check.checked::after {
  content: '\2713';
  color: white;
  font-size: 14px;
}

.task-info {
  flex: 1;
  min-width: 0;
}

.task-info h4 {
  font-size: 15px;
  margin-bottom: 2px;
}

.task-info h4.completed {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-meta {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--text-light);
}

.task-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.priority-alta { border-left: 4px solid var(--accent); }
.priority-normal { border-left: 4px solid var(--primary); }
.priority-baja { border-left: 4px solid var(--success); }

/* Chat */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height) - var(--nav-height));
  margin: -16px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-message {
  display: flex;
  gap: 8px;
  max-width: 85%;
}

.chat-message.own {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--bg-card);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  max-width: 100%;
}

.chat-message.own .chat-bubble {
  background: var(--primary);
  color: white;
}

.chat-sender {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
}

.chat-message.own .chat-sender {
  display: none;
}

.chat-text {
  font-size: 15px;
  word-break: break-word;
  white-space: pre-wrap;
}

.chat-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.chat-message.own .chat-time {
  color: rgba(255,255,255,0.7);
}

.chat-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.chat-input-area input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  font-size: 15px;
  outline: none;
}

.chat-input-area input:focus {
  border-color: var(--primary);
}

.chat-input-area button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-typing {
  font-size: 12px;
  color: var(--text-light);
  padding: 4px 16px;
  font-style: italic;
  min-height: 20px;
}

/* Shopping */
.shopping-list-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}

.shopping-list-card:active {
  background: var(--bg);
}

.shopping-icon {
  font-size: 28px;
  width: 44px;
  text-align: center;
}

.shopping-list-info {
  flex: 1;
}

.shopping-list-info h3 {
  font-size: 16px;
  margin-bottom: 2px;
}

.shopping-count {
  font-size: 13px;
  color: var(--text-light);
}

.shopping-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: 8px;
  margin-bottom: 4px;
}

.shopping-item.checked {
  opacity: 0.5;
}

.shopping-item.priority {
  border-left: 4px solid var(--warning);
  background: #fffaf1;
}

.shopping-item.checked .item-name {
  text-decoration: line-through;
}

.item-check {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 2px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-check.checked {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.item-priority {
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  padding: 4px;
}

.item-priority.active {
  color: var(--warning);
}

.item-name {
  flex: 1;
  font-size: 15px;
}

.item-qty {
  font-size: 13px;
  color: var(--text-light);
  min-width: 36px;
  text-align: center;
}

.item-qty-edit {
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg);
}

.item-qty-edit:hover {
  background: var(--border);
}

.shopping-input-area {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.shopping-input-area input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 12px;
  background: none;
  border: none;
  padding: 0;
}

/* Estampas */
.estampa-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 2px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-size: 15px;
}

.estampa-list-item:last-child {
  border-bottom: none;
}

.estampa-list-item:active {
  color: var(--primary);
}

/* Prayers */
.prayer-item {
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--warning);
}

.prayer-item.expired {
  border-left-color: var(--text-muted);
  opacity: 0.7;
}

.prayer-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.prayer-desc {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.prayer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-light);
}

.prayer-deadline {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Gospel */
.gospel-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.gospel-reader {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  line-height: 1.7;
}

.gospel-date {
  font-size: 13px;
  color: var(--text-light);
  text-transform: capitalize;
  margin-bottom: 4px;
}

.gospel-liturgical {
  font-size: 14px;
  color: var(--primary);
  font-weight: 500;
  margin-bottom: 12px;
}

.gospel-title {
  font-size: 18px;
  margin-bottom: 12px;
  line-height: 1.4;
}

.gospel-ref {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 16px;
}

.gospel-text p {
  margin-bottom: 12px;
  font-size: 15px;
  color: var(--text);
}

.gospel-commentary-title {
  font-size: 16px;
  margin: 20px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.gospel-commentary p {
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--text-light);
}

.gospel-source {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-light);
  text-align: right;
  font-style: italic;
}

/* Admin */
.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: 600;
}

.user-info {
  flex: 1;
}

.user-info h4 {
  font-size: 15px;
}

.user-info span {
  font-size: 13px;
  color: var(--text-light);
}

.user-actions {
  display: flex;
  gap: 4px;
}

/* Modal */
#modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

#modal-content {
  background: var(--bg-card);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 20px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
  padding: 4px;
}

/* Toast */
#toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: fadeIn 0.3s ease;
  min-width: 200px;
  text-align: center;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--accent); }
.toast.info { background: var(--primary); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Utility */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  fill: var(--text-muted);
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 15px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.tag-pending { background: #FFF3CD; color: #856404; }
.tag-progress { background: #D1ECF1; color: #0C5460; }
.tag-done { background: #D4EDDA; color: #155724; }
.tag-admin { background: #E8DAEF; color: #6C3483; }

/* Admin tabs */
.admin-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.admin-tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: none;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
}

.admin-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(74, 144, 217, 0.05);
}

/* Notification target toggle */
.notif-target-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

/* Notification history */
.notif-history-item {
  padding: 14px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

.notif-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.notif-history-body {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 8px;
  white-space: pre-wrap;
}

.notif-history-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Weekly Menu */
.menu-header {
  text-align: center;
  margin-bottom: 16px;
}

.menu-week-label {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 4px;
}

.menu-grid {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.menu-grid-header {
  display: grid;
  grid-template-columns: 100px 1fr 1fr;
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.menu-corner {
  padding: 10px;
}

.menu-meal-header {
  padding: 10px 12px;
  text-align: center;
  border-left: 1px solid rgba(255,255,255,0.2);
}

.menu-row {
  display: grid;
  grid-template-columns: 100px 1fr 1fr;
  border-bottom: 1px solid var(--border);
}

.menu-row:last-child {
  border-bottom: none;
}

.menu-row-today {
  background: rgba(74, 144, 217, 0.06);
}

.menu-row-today .menu-day-label {
  background: var(--primary);
  color: white;
}

.menu-row-today .menu-day-label .menu-day-date {
  color: rgba(255,255,255,0.8);
}

.menu-day-label {
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border);
}

.menu-day-name {
  font-weight: 600;
  font-size: 13px;
}

.menu-day-date {
  font-size: 11px;
  color: var(--text-light);
}

.menu-cell {
  padding: 10px 12px;
  border-left: 1px solid var(--border);
  min-height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: background 0.15s;
}

.menu-cell-editable {
  cursor: pointer;
}

.menu-cell-editable:hover {
  background: var(--bg);
}

.menu-cell-editable:active {
  background: var(--border);
}

.menu-dish {
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.menu-placeholder {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* Location / Map */
.location-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.location-header h2 {
  font-size: 18px;
}

#family-map {
  width: 100%;
  height: 350px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  z-index: 1;
}

.custom-marker {
  background: none;
  border: none;
}

.marker-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 700;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.location-list-title {
  font-size: 16px;
  margin-bottom: 10px;
}

.location-member-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.location-member-card:active {
  background: var(--bg);
}

.location-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}

.location-member-info {
  display: flex;
  flex-direction: column;
}

.location-member-name {
  font-weight: 600;
  font-size: 15px;
}

.location-member-time {
  font-size: 12px;
  color: var(--text-light);
}

/* Tablet enhancements */
@media (min-width: 768px) {
  #main-content {
    max-width: 700px;
    margin: 0 auto;
    padding: 24px;
    padding-bottom: calc(var(--nav-height) + 24px);
  }

  #modal-content {
    border-radius: 16px;
    margin-bottom: 10vh;
  }

  #modal-overlay {
    align-items: center;
  }

  .btn-fab {
    right: calc(50% - 350px + 16px);
  }

  .btn-fab-today {
    left: calc(50% - 350px + 16px);
    right: auto;
  }

  /* Shopping grid */
  .shopping-lists-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .shopping-lists-grid .shopping-list-card {
    margin-bottom: 0;
  }

  /* Tasks wider */
  .task-item {
    padding: 16px 20px;
  }

  /* Prayer grid */
  .prayers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .prayers-grid .prayer-item {
    margin-bottom: 0;
  }

  /* Admin grid */
  .users-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .users-grid .user-card {
    margin-bottom: 0;
  }

  /* Menu grid tablet */
  .menu-grid-header {
    grid-template-columns: 120px 1fr 1fr;
  }

  .menu-row {
    grid-template-columns: 120px 1fr 1fr;
  }

  /* Location tablet */
  #family-map {
    height: 400px;
  }

  .location-members-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .location-members-grid .location-member-card {
    margin-bottom: 0;
  }
}

/* Desktop enhancements */
@media (min-width: 1024px) {
  :root {
    --nav-height: 0px;
    --header-height: 0px;
  }

  #app {
    flex-direction: row;
  }

  #app-header {
    display: none;
  }

  /* Sidebar navigation */
  #bottom-nav {
    position: static;
    flex-direction: column;
    width: 220px;
    min-width: 220px;
    height: 100vh;
    border-top: none;
    border-right: 1px solid var(--border);
    justify-content: flex-start;
    padding: 0;
    gap: 0;
    background: var(--bg-card);
  }

  #bottom-nav::before {
    content: 'Familia MA';
    display: block;
    padding: 20px 16px;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    text-align: center;
  }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 0;
    font-size: 14px;
    min-width: auto;
    width: 100%;
    border-left: 3px solid transparent;
    transition: all 0.2s;
  }

  .nav-item:hover {
    background: var(--bg);
  }

  .nav-item.active {
    background: rgba(74, 144, 217, 0.08);
    border-left-color: var(--primary);
    color: var(--primary);
  }

  .nav-item svg {
    margin-bottom: 0;
    width: 22px;
    height: 22px;
  }

  .nav-item span {
    font-size: 14px;
  }

  .badge {
    position: static;
    margin-left: auto;
  }

  .nav-logout {
    display: flex;
    margin-top: auto;
    border-top: 1px solid var(--border);
    color: var(--accent) !important;
  }

  /* Main content area */
  #main-content {
    flex: 1;
    max-width: none;
    padding: 32px 40px;
    padding-bottom: 32px;
    overflow-y: auto;
    height: 100vh;
  }

  .content-wrapper {
    max-width: 900px;
    margin: 0 auto;
  }

  /* Calendar desktop layout */
  .calendar-grid {
    gap: 1px;
  }

  .calendar-day {
    min-height: 84px;
    padding: 5px;
  }

  .cal-event-pill + .cal-event-pill {
    display: flex;
  }

  .cal-event-more {
    display: block;
  }

  .cal-event-pill {
    font-size: 11px;
  }

  .cep-time {
    font-size: 10px;
  }

  .cal-day-num {
    font-size: 13px;
    width: 24px;
    height: 24px;
  }

  .calendar-nav h2 {
    font-size: 22px;
  }

  .week-body {
    max-height: calc(100vh - 280px);
  }

  .week-scroll {
    max-height: calc(100vh - 280px);
  }

  .week-col-dnum {
    font-size: 22px;
  }

  .week-ev-title {
    font-size: 12px;
  }

  /* Events list sidebar */
  .week-body {
    max-height: calc(100vh - 280px);
  }

  .week-scroll {
    max-height: calc(100vh - 280px);
  }

  /* Chat desktop */
  .chat-container {
    height: calc(100vh - 64px);
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
  }

  .chat-message {
    max-width: 60%;
  }

  /* Shopping grid desktop */
  .shopping-lists-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .shopping-list-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
    transition: all 0.2s;
  }

  /* Shopping items in columns */
  .shopping-items-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 16px;
  }

  /* Prayers grid desktop */
  .prayers-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Admin grid desktop */
  .users-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Tasks desktop */
  .tasks-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .tasks-grid .task-item {
    margin-bottom: 0;
  }

  /* FAB position */
  .btn-fab {
    bottom: 32px;
    right: 32px;
  }

  .btn-fab-today {
    left: calc(220px + 32px);
    right: auto;
  }

  /* Modal wider */
  #modal-content {
    max-width: 560px;
    border-radius: 16px;
  }

  #modal-overlay {
    align-items: center;
  }

  /* Menu desktop */
  .menu-grid-header {
    grid-template-columns: 140px 1fr 1fr;
  }

  .menu-row {
    grid-template-columns: 140px 1fr 1fr;
  }

  .menu-cell {
    min-height: 70px;
  }

  /* Location desktop */
  #family-map {
    height: 500px;
  }

  /* Hover effects */
  .event-item:hover,
  .task-item:hover,
  .prayer-item:hover,
  .user-card:hover,
  .location-member-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s;
  }

  .btn-icon:hover {
    background: var(--bg);
    transform: scale(1.1);
    transition: all 0.15s;
  }
}

/* === MINIJUEGO === */
.minijuego-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  gap: 12px;
}

.minijuego-header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 400px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.minijuego-best {
  color: var(--text-light);
}

#game-canvas {
  border-radius: var(--radius);
  border: 2px solid var(--border);
  display: block;
  background: #0f0f1a;
  max-width: 400px;
  width: 100%;
  touch-action: none;
}

.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.minijuego-wrapper {
  position: relative;
}

.game-overlay-content {
  background: rgba(15, 15, 26, 0.92);
  border-radius: var(--radius);
  padding: 32px 28px;
  text-align: center;
  color: #fff;
  pointer-events: auto;
  max-width: 280px;
}

.game-overlay-content h2 {
  margin-bottom: 8px;
  font-size: 1.4rem;
}

.game-overlay-content p {
  margin-bottom: 16px;
  color: #ccc;
  font-size: 0.95rem;
}

.game-overlay.hidden {
  display: none;
}

.minijuego-ranking {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.minijuego-ranking h3 {
  margin-bottom: 12px;
  font-size: 1rem;
  color: var(--text);
}

.ranking-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 3px;
}

.ranking-tab {
  flex: 1;
  padding: 6px 8px;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: all 0.2s;
}

.ranking-tab:hover {
  color: var(--text);
}

.ranking-tab.active {
  background: var(--primary);
  color: #fff;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.ranking-item:last-child {
  border-bottom: none;
}

.ranking-pos {
  font-weight: 700;
  color: var(--text-light);
  min-width: 24px;
}

.ranking-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.ranking-name {
  flex: 1;
  font-weight: 500;
}

.ranking-score {
  font-weight: 700;
  color: var(--primary);
}

.watchlist-header {
  margin-bottom: 12px;
}

.watchlist-header h2 {
  margin: 0 0 6px;
}

.watchlist-form,
.watchlist-filters {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}

.watchlist-form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.watchlist-form-submit {
  min-width: 140px;
}

.watchlist-grid {
  display: grid;
  gap: 10px;
}

.watchlist-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.watchlist-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.watchlist-card h3 {
  margin: 4px 0 0;
  font-size: 1rem;
}

.watchlist-type {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(74, 144, 217, 0.12);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
}

.watchlist-votes {
  min-width: 64px;
  text-align: center;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--bg-light);
}

.watchlist-votes span {
  display: block;
}

.watchlist-votes span:first-child {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.watchlist-votes span:last-child {
  font-size: 0.72rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.watchlist-meta {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.watchlist-proposer {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.88rem;
  color: var(--text-light);
}

.watchlist-proposer span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watchlist-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.watchlist-vote-btn {
  margin-top: 10px;
  width: 100%;
}

@media (max-width: 640px) {
  .watchlist-form-row {
    grid-template-columns: 1fr;
  }

  .watchlist-form-submit {
    min-width: 0;
  }
}
