:root {
  --brand: #1a4d7c;
  --brand-hover: #123d63;
  --bg: #f8fafc;
  --panel: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --ok: #059669;
  --err: #dc2626;
  --shadow: 0 10px 25px rgba(0,0,0,0.1);
  --radius-card: 16px;
  --radius-input: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at center, #ffffff 0%, #f1f5f9 100%);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

.auth-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

@media (max-width: 480px) {
  .auth-wrap {
    padding: 10px; /* Reduced to make the card wider on small screens */
  }
}

.card {
  width: min(580px, 100%);
  background: var(--panel);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--line);
  margin: 0 auto;
}

.card-wide {
  width: min(900px, 100%);
}

.card-header {
  background: var(--brand);
  color: #fff;
  padding: 32px 24px;
  text-align: center;
  position: relative;
}


.card-header .logo {
  max-width: 180px;
  margin-bottom: 16px;
  filter: brightness(0) invert(1);
}

.card-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-header p {
  margin: 8px 0 0;
  font-size: 15px;
  opacity: 0.9;
}

.card-body {
  padding: 32px;
}

.card-footer {
  padding: 16px;
  text-align: center;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  background: #f8fafc;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  font-size: 15px;
  transition: all 0.2s;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 77, 124, 0.1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border-radius: 50px;
  border: none;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  gap: 8px;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
}

.count-input {
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  color: var(--brand);
}

@media (max-width: 480px) {
  .count-input {
    font-size: 16px;
    height: 48px;
  }
}

.btn-block {
  display: flex;
  width: 100%;
}

.total-field {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: var(--brand) !important;
  font-weight: 800 !important;
  text-align: center;
}

.btn-outline {
  background: #fff;
  color: var(--brand);
  border: 2px solid var(--brand);
}

.btn-outline:hover {
  background: #f1f5f9;
}

.btn-outline.active, .btn-outline.btn-primary {
  background: var(--brand);
  color: #fff;
}

.grid-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

/* Recitativos Form specific */
.sunday-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.sunday-card-title {
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 16px;
  font-size: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.grid-counts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 600px) {
  .grid-btns {
    grid-template-columns: 1fr;
  }
  .grid-counts {
    grid-template-columns: repeat(3, 1fr); /* Mantém 3 colunas até telas bem pequenas */
    gap: 8px;
  }
}

@media (max-width: 400px) {
  .grid-counts {
    grid-template-columns: repeat(3, 1fr); /* Força 3 colunas no iPhone 8/SE */
    gap: 6px;
  }
  .grid-counts label {
    font-size: 10px; /* Fonte levemente menor para caber em 320px */
  }
  .grid-counts .count-input {
    padding: 8px 4px !important;
    font-size: 15px;
  }
}

.hidden { display: none !important; }

.top-nav {
  width: 100%;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(8px);
  padding: 0 24px;
  height: 80px; 
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  box-sizing: border-box;
}

@media (max-width: 480px) {
  .top-nav {
    padding: 0 16px;
    height: 70px;
  }
}

.header-icon, .top-nav img {
  height: 42px !important;
  width: auto;
}

.top-nav .btn-logout, .top-nav .btn-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s;
  height: 38px; /* Altura fixa para ambos os botões */
  white-space: nowrap; /* Impede quebra de linha no texto */
}

.top-nav .btn-logout {
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
}

.top-nav .btn-logout:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
}

.top-nav .btn-back {
  background: #fff;
  color: var(--brand);
  border: 1px solid var(--line);
}

.top-nav .btn-back:hover {
  background: #f8fafc;
  border-color: var(--brand);
  transform: translateY(-1px);
}

.auth-wrap {
  /* No extra padding-top needed as it's flexed bellow nav */
}

.header-icon {
  height: 28px;
  vertical-align: middle;
  margin-right: 10px;
}



/* --- HYBRID MOCIDADE THEME (Blue Header + SAC Inputs) --- */

.sac-card {
  width: min(500px, 98%); /* Increased from 95% */
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  overflow: hidden; /* For header rounding */
  text-align: center;
}

.sac-header {
  background: #1e4b7a; /* Blue from mockup */
  padding: 40px 30px;
  color: #fff;
}

.sac-logo {
  max-width: 200px; /* Increased from 180px */
  height: auto;
  margin: 0 auto 15px;
  display: block;
  filter: brightness(0) invert(1); /* Force white for the lineart logo */
}

@media (max-width: 480px) {
  .sac-header {
    padding: 24px 15px; /* Reduced padding */
  }
  .sac-logo {
    max-width: 160px; /* Increased from 120px for better visibility */
    margin-bottom: 12px;
  }
  .sac-title {
    font-size: 22px;
    line-height: 1.2;
  }
  .sac-subtitle {
    font-size: 14px;
    line-height: 1.4;
    max-width: 250px;
    margin: 0 auto;
  }
}

.sac-title {
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
}

.sac-subtitle {
  color: rgba(255,255,255,0.9);
  font-size: 15px;
  line-height: 1.4;
  margin: 0 auto;
}

.sac-body {
  padding: 40px;
  background: #fff;
}

@media (max-width: 480px) {
  .sac-body {
    padding: 15px; /* Reduced from 20px */
  }
}

.sac-form .form-group {
  margin-bottom: 15px;
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  background: #fff;
  position: relative;
  transition: border-color 0.2s;
  overflow: visible;
}

.sac-form .form-group:focus-within {
  border-color: var(--brand);
  z-index: 1001;
}

.sac-form .form-group.is-locked {
  background: #f8fafc;
  cursor: not-allowed;
  border-color: var(--line);
}

.sac-form .form-group.is-locked input {
  font-weight: 700;
  color: var(--brand);
  cursor: not-allowed;
}

.sac-form .input-icon-box {
  width: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-right: 1px solid var(--line);
  color: var(--brand);
  border-radius: 10px 0 0 10px;
  font-size: 18px;
  flex-shrink: 0;
}

.sac-form input, .sac-form select {
  flex: 1;
  border: none !important;
  height: 52px;
  padding: 0 15px !important;
  font-size: 15px;
  color: #334155;
  background: transparent;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

@media (max-width: 480px) {
  .sac-form .form-group {
    flex-direction: row !important; /* Keep icon side-by-side on mobile */
    align-items: stretch !important;
  }
  
  .sac-form .input-icon-box {
    width: 46px !important;
  }
}

.sac-form input, .sac-form select {
  flex: 1;
  border: none !important;
  height: 52px;
  padding: 0 15px !important;
  font-size: 15px;
  color: #334155;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%231e4b7a' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 12px;
}

.sac-form input {
  background-image: none !important; /* Only for select, not input */
}

.sac-btn {
  width: 100%;
  height: 38px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sac-btn:hover {
  background: #15355a;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(30, 75, 122, 0.2);
}

.sac-btn:active {
  transform: scale(0.98);
}

.sac-btn svg {
  width: 16px;
  height: 16px;
}

.sac-footer-links {
  margin-top: 20px;
  font-size: 13px;
  color: #64748b;
}

.sac-btn-secondary {
  display: block;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #64748b;
  font-weight: 600;
  text-decoration: none;
  background: #fff;
  font-size: 13px;
}

.sac-page-footer {
  margin-top: 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0.85;
  padding-bottom: 30px;
}

.sac-page-footer a {
  text-decoration: none;
  transition: opacity 0.2s;
}

.sac-page-footer a:hover {
  opacity: 0.7;
}

.sac-page-footer .footer-brand {
  display: block;
  font-size: 13px;
  color: #64748b;
}

.sac-page-footer .footer-ccb {
  display: block;
  font-size: 13px;
  color: #1e4b7a;
  text-decoration: none;
  font-weight: 500;
}

.sac-page-footer .footer-region {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.password-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  cursor: pointer;
  color: #94a3b8;
  transition: all 0.2s;
}

.password-toggle:hover {
  color: #1e4b7a;
  background: #f8fafc;
}

/* Seletor Pesquisável */
.sac-search-container {
  position: relative;
  flex: 1;
}

.sac-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-height: 250px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  width: 100%;
  left: 0;
}

@media (max-width: 480px) {
  .sac-search-results {
    position: absolute;
    top: 100%;
    left: -1px;
    right: -1px;
    width: calc(100% + 2px);
    max-height: 250px;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    background: #fff;
    border: 1px solid #e2e8f0;
  }
}

.sac-search-results.active {
  display: block;
}

.sac-search-item {
  padding: 10px 15px;
  cursor: pointer;
  font-size: 14px;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  transition: all 0.2s;
}

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

.sac-search-item:hover {
  background: #f1f5f9;
  color: #1e4b7a;
  font-weight: 600;
}

.sac-search-item strong {
  color: #1e3a5a;
}

/* --- Estados Bloqueados (Lock) --- */
.is-locked {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  cursor: not-allowed !important;
  opacity: 0.9;
}

.is-locked input {
  background-color: transparent !important;
  color: #64748b !important;
  cursor: not-allowed !important;
  font-weight: 600;
}

.is-locked .input-icon-box {
  background-color: #e2e8f0 !important;
  color: #475569 !important;
}

.is-locked .password-toggle,
.is-locked .sac-search-results {
  display: none !important;
}
