@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Manrope:wght@400;500;600;700&display=swap');

:root {
  --bg: #f7f1ea;
  --bg-soft: #fdfaf7;
  --card: rgba(255, 255, 255, 0.88);
  --card-strong: rgba(255, 255, 255, 0.96);
  --line: #eadfd4;
  --text: #3d302a;
  --muted: #857266;
  --gold: #b5845c;
  --gold-soft: #f6ecdf;
  --green: #5f8f73;
  --green-soft: #e9f4ec;
  --red: #b96b66;
  --red-soft: #f9ecea;
  --blue: #6f90a3;
  --blue-soft: #ebf2f6;
  --amber: #d49b5b;
  --amber-soft: #fff3e5;
  --shadow-sm: 0 10px 28px rgba(95, 66, 45, 0.06);
  --shadow-md: 0 22px 44px rgba(95, 66, 45, 0.1);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --radius-pill: 999px;
  --transition: 0.22s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(181, 132, 92, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(95, 143, 115, 0.11), transparent 22%),
    linear-gradient(180deg, #fbf7f2 0%, #f5eee6 100%);
  line-height: 1.5;
  padding-bottom: 88px;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea,
a {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

a {
  text-decoration: none;
}

select,
input,
textarea {
  border: 1px solid var(--line);
  outline: none;
}

.app-shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 16px;
}

.sidebar {
  display: none;
}

.hero-card,
.controls-card,
.card,
.summary-card,
.agenda-day-card,
.agenda-mini-card,
.agenda-row,
.family-card,
.applicant-card,
.service-card,
.cash-card,
.modal-card {
  background: var(--card);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(234, 223, 212, 0.9);
  box-shadow: var(--shadow-sm);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.topbar-note {
  font-size: 14px;
  color: var(--text);
  margin-top: 3px;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.app-tab {
  display: none;
  animation: fadeIn 0.22s ease;
}

.app-tab.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-card,
.controls-card,
.card {
  border-radius: var(--radius-lg);
  padding: 18px;
}

.hero-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(249, 240, 231, 0.92));
}

.section-title,
.brand-logo {
  display: block;
  width: 140px;
  max-width: 100%;
  height: auto;
}

.brand-logo {
  margin-left: auto;
  margin-right: auto;
}

.brand-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 34px;
  line-height: 0.95;
  font-weight: 700;
}

.brand-title span {
  color: var(--gold);
}

.brand-subtitle,
.section-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
  max-width: 620px;
}

.hero-actions,
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip-switch,
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.pill {
  border-radius: var(--radius-pill);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  transition: var(--transition);
}

.chip.active,
.pill.active,
.chip:hover,
.pill:hover {
  background: var(--gold-soft);
  border-color: rgba(181, 132, 92, 0.36);
  color: #8c5d39;
}

.controls-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-group label,
.form-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.summary-grid-painel,
.summary-grid-caixa {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-card {
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--line);
}

.summary-card.is-green::before {
  background: var(--green);
}

.summary-card.is-red::before {
  background: var(--red);
}

.summary-card.is-gold::before {
  background: var(--gold);
}

.summary-card.is-blue::before {
  background: var(--blue);
}

.summary-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.summary-value {
  font-size: clamp(18px, 1rem + 0.6vw, 24px);
  font-weight: 800;
  margin-top: 6px;
  line-height: 1.15;
  overflow-wrap: break-word;
}

.summary-subtext {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.panel-grid,
.message-layout {
  display: grid;
  gap: 16px;
}

.card-title {
  font-size: 18px;
  margin-bottom: 14px;
}

.mini-list,
.card-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mini-item,
.family-card,
.applicant-card,
.service-card,
.cash-card,
.agenda-row,
.agenda-mini-card {
  border-radius: var(--radius-md);
}

.mini-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(234, 223, 212, 0.72);
}

.mini-item strong {
  font-size: 13px;
}

.mini-item span {
  font-size: 13px;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.painel-section {
  margin-bottom: 22px;
}

.painel-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}

.mini-item-clickable {
  cursor: pointer;
  transition: background var(--transition);
}

.mini-item-clickable:hover {
  background: var(--gold-soft);
}

.empty-state {
  border-radius: var(--radius-md);
  padding: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 14px;
}

.badge-row,
.meta-row,
.agenda-row-top,
.family-head,
.cash-top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-delete {
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(180, 60, 60, 0.25);
  color: #b43c3c;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background var(--transition), color var(--transition);
}

.row-delete:hover {
  background: #b43c3c;
  color: #fff;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 800;
  text-transform: capitalize;
}

.badge.green {
  background: var(--green-soft);
  color: #426d55;
}

.badge.red {
  background: var(--red-soft);
  color: #924b46;
}

.badge.gold {
  background: var(--gold-soft);
  color: #8f633c;
}

.badge.blue {
  background: var(--blue-soft);
  color: #4e6f82;
}

.badge.neutral {
  background: #f3ede7;
  color: #7a6b61;
}

.agenda-day-card,
.agenda-mini-card,
.agenda-row,
.family-card,
.applicant-card,
.service-card,
.cash-card {
  padding: 16px;
}

.agenda-days-grid,
.agenda-month-grid,
.agenda-week-grid {
  display: grid;
  gap: 12px;
}

.agenda-day-card {
  border-radius: var(--radius-lg);
}

.day-clickable {
  cursor: pointer;
  transition: var(--transition);
}

.day-clickable:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.agenda-day-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.agenda-day-label h3 {
  font-size: 18px;
}

.agenda-day-label p,
.meta-row,
.cash-meta,
.family-meta,
.applicant-meta {
  color: var(--muted);
  font-size: 13px;
}

.agenda-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agenda-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(234, 223, 212, 0.72);
}

.agenda-row-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agenda-client {
  font-size: 17px;
  font-weight: 800;
}

.agenda-time {
  font-size: 13px;
  font-weight: 800;
  color: #8c5d39;
}

.agenda-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 16px;
  padding: 11px 15px;
  font-size: 14px;
  font-weight: 800;
  transition: var(--transition);
}

.btn:hover {
  transform: translateY(-1px);
}

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

.btn-success {
  background: var(--green);
  color: #fff;
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-secondary {
  background: #efe4d8;
  color: #74543c;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.btn-link {
  background: var(--blue-soft);
  color: #4e6f82;
}

.btn-small {
  padding: 9px 12px;
  font-size: 12px;
  border-radius: 14px;
}

.filter-pills {
  margin-bottom: 16px;
}

.family-card,
.applicant-card,
.service-card,
.cash-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.family-name,
.applicant-name,
.cash-name {
  font-size: 19px;
  font-weight: 800;
}

.family-note,
.applicant-note,
.cash-note {
  font-size: 14px;
}

.family-card-rich {
  gap: 14px;
}

.family-sections {
  display: grid;
  gap: 12px;
}

.family-section {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(234, 223, 212, 0.72);
}

.family-section h4 {
  font-size: 14px;
  margin-bottom: 10px;
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(234, 223, 212, 0.72);
  font-size: 13px;
}

.detail-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.detail-row strong {
  font-size: 13px;
}

.detail-row span {
  color: var(--muted);
  text-align: right;
}

.detail-row-stack {
  flex-direction: column;
}

.detail-row-stack span {
  text-align: left;
}

.builder-card {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(234, 223, 212, 0.72);
}

.builder-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.builder-head h4 {
  font-size: 15px;
}

.builder-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.builder-row {
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(234, 223, 212, 0.8);
}

.builder-grid {
  margin-bottom: 10px;
}

.builder-remove {
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.builder-add {
  margin-top: 12px;
}

.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.btn.wa-no-phone {
  opacity: 0.5;
}

.cash-card.entry {
  border-left: 4px solid var(--green);
}

.cash-card.exit {
  border-left: 4px solid var(--red);
}

.cash-value.entry {
  color: var(--green);
}

.cash-value.exit {
  color: var(--red);
}

.cash-top {
  justify-content: space-between;
  align-items: flex-start;
}

.cash-value {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
  text-align: left;
  word-break: break-word;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.input,
.textarea,
.form-field select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  padding: 13px 14px;
}

.textarea {
  resize: vertical;
  min-height: 118px;
}

.mobile-nav {
  position: fixed;
  inset: auto 0 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  padding: 10px 6px 12px;
  background: rgba(251, 247, 242, 0.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(234, 223, 212, 0.92);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  border-radius: 14px;
  padding: 8px 2px;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.mobile-nav-item .nav-icon {
  width: 22px;
  height: 22px;
}

.mobile-nav-item.active {
  background: var(--gold-soft);
  color: #8c5d39;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  padding: 18px;
  background: rgba(61, 48, 42, 0.34);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal.open {
  display: flex;
  align-items: flex-end;
}

.modal-card {
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  max-height: calc(100vh - 36px);
  border-radius: 28px 28px 18px 18px;
  padding: 20px;
  background: var(--card-strong);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-card-sm {
  max-width: 460px;
}

.confirm-copy {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 18px;
}

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

.modal-header h3 {
  font-size: 24px;
  font-family: 'Cormorant Garamond', Georgia, serif;
}

.modal-close {
  font-size: 30px;
  line-height: 1;
  color: var(--muted);
}

.toast-wrap {
  position: fixed;
  right: 16px;
  top: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: 220px;
  max-width: 300px;
  border-radius: 16px;
  padding: 12px 14px;
  color: #fff;
  background: rgba(61, 48, 42, 0.9);
  box-shadow: var(--shadow-md);
}

@media (min-width: 700px) {
  .summary-grid-painel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .summary-grid-caixa {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-grid,
  .message-layout,
  .form-grid,
  .agenda-week-grid,
  .agenda-month-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agenda-days-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal.open {
    align-items: center;
  }

  .modal-card {
    max-height: calc(100vh - 48px);
    border-radius: 28px;
  }

  .family-sections {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  body {
    padding-bottom: 0;
  }

  .app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 24px;
    padding: 24px;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 24px;
    height: fit-content;
  }

  .brand-block {
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
  }

  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 18px;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 800;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(234, 223, 212, 0.7);
  }

  .nav-item.active,
  .nav-item:hover {
    background: var(--gold-soft);
    color: #8c5d39;
    border-color: rgba(181, 132, 92, 0.34);
  }

  .mobile-nav {
    display: none;
  }

  .summary-grid-painel {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }

  .summary-grid-caixa {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }

  .panel-grid,
  .message-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agenda-week-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .agenda-month-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

  .hero-card,
  .controls-card {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .controls-card {
    align-items: end;
  }
}

@media (max-width: 560px) {
  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .cash-top {
    flex-direction: column;
    gap: 10px;
  }

  .cash-value {
    font-size: 16px;
  }

  .mini-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .detail-row {
    flex-direction: column;
  }

  .detail-row span {
    text-align: left;
  }
}

/* ── Login screen ───────────────────────────────────────────── */
#login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top left, rgba(181, 132, 92, 0.14), transparent 30%),
    radial-gradient(circle at bottom right, rgba(95, 143, 115, 0.12), transparent 28%),
    linear-gradient(180deg, #fbf7f2 0%, #f5eee6 100%);
  z-index: 9999;
  padding: 24px;
}

.login-card {
  background: var(--card-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-brand {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.login-brand span {
  color: var(--gold);
}

.login-subtitle {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: -12px;
}

.login-error {
  font-size: 0.8125rem;
  color: var(--red);
  min-height: 1.2em;
}

.field-with-action {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.field-with-action .input {
  flex: 1;
  min-width: 0;
}
.field-with-action .btn-sm {
  white-space: nowrap;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}
