/* Fontes carregadas via <link> em cada HTML (preconnect + parallel fetch) para
 * melhor performance de carregamento. Não use @import aqui. */

:root {
  --blue: #3A409C;
  --blue-light: #eef0fa;
  --blue-mid: #c5c9ed;
  --gold: #C8972A;
  --black: #1a1a1a;
  --gray: #6b7280;
  --gray-light: #f3f4f6;
  --border: #e5e7eb;
  --white: #ffffff;
  --surface: #ffffff;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
}

/* Dark mode — via sistema ou classe manual */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --blue: #7b82d4;
    --blue-light: #1e2140;
    --blue-mid: #3a4080;
    --gold: #d4a640;
    --black: #e8e9f0;
    --gray: #9ca3af;
    --gray-light: #1e2030;
    --border: #2e3352;
    --white: #151725;
    --surface: #1a1d35;
    --danger: #f87171;
    --success: #4ade80;
    --warning: #fbbf24;
  }
}

:root[data-theme="dark"] {
  --blue: #7b82d4;
  --blue-light: #1e2140;
  --blue-mid: #3a4080;
  --gold: #d4a640;
  --black: #e8e9f0;
  --gray: #9ca3af;
  --gray-light: #1e2030;
  --border: #2e3352;
  --white: #151725;
  --surface: #1a1d35;
  --danger: #f87171;
  --success: #4ade80;
  --warning: #fbbf24;
}

:root[data-theme="light"] {
  --blue: #3A409C;
  --blue-light: #eef0fa;
  --blue-mid: #c5c9ed;
  --gold: #C8972A;
  --black: #1a1a1a;
  --gray: #6b7280;
  --gray-light: #f3f4f6;
  --border: #e5e7eb;
  --white: #ffffff;
  --surface: #ffffff;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  color: var(--black);
  background: var(--white);
  line-height: 1.5;
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

h1, h2, h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: var(--blue);
  font-weight: 700;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

/* Layout */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container--wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
header {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  margin-bottom: 2.5rem;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.header-brand span {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--blue);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-nav a {
  font-size: 0.9rem;
  color: var(--gray);
  font-weight: 500;
}

.header-nav a:hover { color: var(--blue); text-decoration: none; }

/* Page title */
.page-title {
  margin-bottom: 2rem;
}

.page-title p {
  color: var(--gray);
  margin-top: 0.25rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: 'Inter', system-ui, sans-serif;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: #2e3480;
  text-decoration: none;
  color: var(--white);
}

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

.btn-secondary:hover {
  background: var(--blue-light);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--gray);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--gray-light);
  text-decoration: none;
  color: var(--black);
}

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

.btn-danger:hover {
  background: #fef2f2;
  text-decoration: none;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--black);
  margin-bottom: 0.4rem;
}

input[type="text"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--black);
  background: var(--white);
  transition: border-color 0.15s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(58, 64, 156, 0.1);
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.checkbox-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}

.checkbox-pill input { display: none; }

.checkbox-pill:has(input:checked) {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue);
  font-weight: 500;
}

.radio-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

.radio-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s, border-color 0.15s;
}

.radio-card input { display: none; }

.radio-card:has(input:checked) {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue);
  font-weight: 500;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--gray);
  margin-top: 0.3rem;
}

.form-section {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}

.form-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray);
  margin-bottom: 1rem;
}

/* Cards / Lists */
.card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  background: var(--surface);
}

.card + .card { margin-top: 0.75rem; }

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  gap: 1rem;
}

.list-item + .list-item { margin-top: 0.5rem; }

.list-item:hover { background: var(--gray-light); }

.list-item__info { flex: 1; min-width: 0; }
.list-item__name { font-weight: 500; }
.list-item__meta { font-size: 0.85rem; color: var(--gray); margin-top: 0.15rem; }
.list-item__actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
  gap: 0;
}

.tab-btn {
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -2px;
  font-family: 'Inter', system-ui, sans-serif;
  transition: color 0.15s;
}

.tab-btn:hover { color: var(--blue); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-gray { background: var(--gray-light); color: var(--gray); }
.badge-gold { background: #fef3c7; color: #92400e; }
.badge-red  { background: #fef2f2; color: var(--danger); }
.badge-green { background: #f0fdf4; color: var(--success); }

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }
.alert-warning { background: #fffbeb; color: var(--warning); border: 1px solid #fde68a; }

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  text-align: left;
  padding: 0.6rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray);
  border-bottom: 2px solid var(--border);
}

td {
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-light); }

/* Empty state */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray);
}

.empty h3 { color: var(--gray); font-size: 1rem; margin-bottom: 0.5rem; }

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--white);
  position: relative;
}

.login-theme-toggle {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
}

.login-box {
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-logo {
  margin-bottom: 2rem;
}

.login-logo h1 {
  font-size: 1.75rem;
  margin-top: 0.5rem;
}

.login-logo p {
  color: var(--gray);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.pin-input {
  font-size: 1.5rem;
  text-align: center;
  letter-spacing: 0.4em;
  padding: 0.75rem;
}

/* Dashboard menu */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.menu-card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--black);
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--surface);
}

.menu-card:hover {
  border-color: var(--blue);
  box-shadow: 0 2px 8px rgba(58, 64, 156, 0.1);
  text-decoration: none;
  color: var(--black);
}

.menu-card__icon {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.menu-card__title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 0.25rem;
}

.menu-card__desc {
  font-size: 0.85rem;
  color: var(--gray);
  line-height: 1.4;
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--gray);
  transition: background 0.15s;
}
.theme-toggle:hover { background: var(--gray-light); }

/* Overlay / modal */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 100;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}

.overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 10px;
  width: 100%;
  max-width: 560px;
  padding: 2rem;
  position: relative;
  margin: auto;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.modal__close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--gray);
  padding: 0.25rem;
  line-height: 1;
}

.modal__close:hover { color: var(--black); }

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* Schedule grid */
.schedule-day {
  margin-bottom: 2rem;
}

.schedule-day__title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.schedule-task {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  background: var(--white);
}

.schedule-task__name {
  font-weight: 500;
  min-width: 160px;
  flex-shrink: 0;
}

.schedule-task__time {
  font-size: 0.8rem;
  color: var(--gray);
  min-width: 90px;
  flex-shrink: 0;
}

.schedule-task__volunteers {
  flex: 1;
}

.schedule-task__warning {
  font-size: 0.8rem;
  color: var(--warning);
}

/* Volunteer select */
.volunteer-select-wrap {
  position: relative;
  flex: 1;
}

.volunteer-select-wrap select {
  width: 100%;
}

/* ICS download button */
.ics-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: var(--blue-light);
  color: var(--blue);
  border: 1px solid var(--blue-mid);
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  font-family: 'Inter', system-ui, sans-serif;
}

.ics-btn:hover {
  background: var(--blue);
  color: var(--white);
  text-decoration: none;
}

/* Volunteer week view */
.week-task {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--blue);
  background: var(--blue-light);
  border-radius: 0 8px 8px 0;
  margin-bottom: 0.75rem;
}

.week-task__day {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--blue);
  min-width: 70px;
  padding-top: 0.1rem;
}

.week-task__info { flex: 1; }
.week-task__name { font-weight: 600; }
.week-task__time { font-size: 0.85rem; color: var(--gray); margin-top: 0.15rem; }

/* Trocas page */
.trocas-day {
  margin-bottom: 2rem;
}

.trocas-day__header {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--blue-light);
}

.trocas-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.trocas-row:last-child { border-bottom: none; }
.trocas-row__task { min-width: 140px; font-weight: 500; }
.trocas-row__time { min-width: 90px; color: var(--gray); font-size: 0.85rem; }
.trocas-row__people { flex: 1; color: var(--black); }

/* Utility */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-gray { color: var(--gray); }
.text-sm { font-size: 0.85rem; }
.hidden { display: none !important; }

/* Loading */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 600px) {
  h1 { font-size: 1.5rem; }
  .menu-grid { grid-template-columns: 1fr; }
  .schedule-task { flex-wrap: wrap; }
  .schedule-task__name { min-width: unset; width: 100%; }
}
