/* ============================================================
   Reservas da Casa — warm coastal design system
   Big type, generous spacing, high contrast for older users.
   ============================================================ */

:root {
  /* Warm coastal palette */
  --cream:        #FBF6EC;
  --cream-deep:   #F3EADA;
  --surface:      #FFFDF8;
  --surface-2:    #FBF4E7;
  --ink:          #33302A;
  --ink-soft:     #6B6457;
  --ink-faint:    #9A917F;
  --line:         #E7DFCF;
  --line-strong:  #D8CDB6;

  /* Brand / primary action — warm espresso, high contrast */
  --primary:      #36302A;
  --primary-hi:   #4A4138;
  --on-primary:   #FCF7EC;

  /* Apartment identities */
  --cima:         #C5683F;   /* terracotta */
  --cima-deep:    #A4522E;
  --cima-tint:    #F7E6DA;
  --cima-tint-2:  #F1D6C4;

  --baixo:        #2E8B83;   /* sea teal */
  --baixo-deep:   #226B65;
  --baixo-tint:   #DBEDEA;
  --baixo-tint-2: #C3E1DD;

  /* Sun accent (used sparingly) */
  --sun:          #E0A95C;
  --sun-tint:     #F7E9CF;

  /* Status */
  --ok:           #3E8C5B;
  --ok-tint:      #DEEEE2;
  --danger:       #C0492F;
  --danger-tint:  #F6E0D8;

  /* Type scale — large by default */
  --fs-xs:   14px;
  --fs-sm:   16px;
  --fs-base: 19px;
  --fs-md:   22px;
  --fs-lg:   27px;
  --fs-xl:   34px;
  --fs-2xl:  44px;

  --radius:    18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --shadow:    0 1px 2px rgba(54,48,42,.05), 0 6px 22px rgba(54,48,42,.07);
  --shadow-lg: 0 10px 40px rgba(54,48,42,.16);

  --maxw: 760px;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Tweakable base scale (controlled by Tweaks panel) */
  --scale: 1;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: calc(var(--fs-base) * var(--scale));
  line-height: 1.5;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

a { color: inherit; }

/* App shell --------------------------------------------------- */
#root { min-height: 100vh; }

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.shell {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 18px;
}

/* Header ------------------------------------------------------ */
.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(251,246,236,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.appbar__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: calc(var(--fs-md) * var(--scale));
  letter-spacing: -.01em;
}
.brand__mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--sun), var(--cima));
  display: grid; place-items: center;
  color: #fff; flex: none;
  box-shadow: var(--shadow);
}
.appbar__spacer { flex: 1; }

.who {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700;
}
.who__name { display: none; }
@media (min-width: 540px) { .who__name { display: inline; } }

/* Bottom nav (mobile-first) ----------------------------------- */
.nav {
  position: sticky;
  bottom: 0;
  z-index: 40;
  background: rgba(251,246,236,.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav__inner {
  display: flex;
  max-width: var(--maxw);
  margin: 0 auto;
}
.nav__btn {
  flex: 1;
  background: none;
  border: none;
  padding: 9px 4px 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--ink-faint);
  font-weight: 700;
  font-size: calc(13px * var(--scale));
  cursor: pointer;
  min-height: 60px;
  border-top: 3px solid transparent;
  transition: color .15s;
}
.nav__btn.is-active { color: var(--primary); border-top-color: var(--cima); }
.nav__btn svg { width: 26px; height: 26px; }

.content {
  flex: 1;
  padding: 22px 0 30px;
}

/* Cards ------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card--pad { padding: 20px; }

.section-title {
  font-size: calc(var(--fs-xl) * var(--scale));
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}
.section-sub { color: var(--ink-soft); font-size: calc(var(--fs-sm) * var(--scale)); }

/* Buttons ----------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 14px 20px;
  font-weight: 800;
  font-size: calc(var(--fs-base) * var(--scale));
  line-height: 1.1;
  cursor: pointer;
  min-height: 54px;
  transition: transform .06s ease, background .15s, box-shadow .15s;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 22px; height: 22px; }

.btn--primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow); }
.btn--primary:hover:not(:disabled) { background: var(--primary-hi); }

.btn--ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); }

.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover:not(:disabled) { filter: brightness(1.06); }

.btn--block { width: 100%; }
.btn--lg { min-height: 62px; font-size: calc(var(--fs-md) * var(--scale)); padding: 16px 24px; }
.btn--sm { min-height: 42px; padding: 9px 14px; font-size: calc(var(--fs-sm) * var(--scale)); border-radius: 11px; }

/* Form fields ------------------------------------------------- */
.field { margin-bottom: 18px; }
.field__label {
  display: block;
  font-weight: 800;
  font-size: calc(var(--fs-sm) * var(--scale));
  margin-bottom: 7px;
  color: var(--ink);
}
.field__hint { color: var(--ink-soft); font-size: calc(var(--fs-xs) * var(--scale)); margin-top: 6px; }

.input, .select, .textarea {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--line-strong);
  border-radius: 13px;
  padding: 14px 15px;
  font-size: calc(var(--fs-base) * var(--scale));
  min-height: 56px;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--cima);
  box-shadow: 0 0 0 4px var(--cima-tint);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236B6457' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 46px;
}

/* Pills / segmented ------------------------------------------- */
.seg {
  display: inline-flex;
  background: var(--cream-deep);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px;
  gap: 4px;
}
.seg__btn {
  border: none;
  background: none;
  padding: 10px 16px;
  border-radius: 11px;
  font-weight: 800;
  font-size: calc(var(--fs-sm) * var(--scale));
  color: var(--ink-soft);
  cursor: pointer;
  min-height: 44px;
  white-space: nowrap;
}
.seg__btn.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  font-weight: 800;
  font-size: calc(var(--fs-xs) * var(--scale));
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.pill--cima  { background: var(--cima-tint);  color: var(--cima-deep);  border-color: var(--cima-tint-2); }
.pill--baixo { background: var(--baixo-tint); color: var(--baixo-deep); border-color: var(--baixo-tint-2); }
.pill--ok    { background: var(--ok-tint);    color: var(--ok); }
.pill--muted { background: var(--cream-deep); color: var(--ink-soft); }
.pill--cancel{ background: var(--danger-tint);color: var(--danger); }
.pill--admin { background: var(--sun-tint);   color: #97631f; }

.dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.dot--cima { background: var(--cima); }
.dot--baixo { background: var(--baixo); }

/* Booking blocks ---------------------------------------------- */
.booking {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .08s, box-shadow .15s;
  text-align: left;
  width: 100%;
  padding: 0;
}
.booking:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.booking__stripe { width: 7px; flex: none; }
.booking__stripe--cima { background: var(--cima); }
.booking__stripe--baixo { background: var(--baixo); }
.booking__body { padding: 14px 16px; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.booking__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.booking__who { font-weight: 800; font-size: calc(var(--fs-md) * var(--scale)); letter-spacing: -.01em; line-height: 1.15; }
.booking__by { color: var(--ink-soft); font-size: calc(var(--fs-sm) * var(--scale)); font-weight: 700; line-height: 1.2; }
.booking__dates { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--ink-soft); font-weight: 700; font-size: calc(var(--fs-sm) * var(--scale)); }
.booking.is-cancelled { opacity: .62; }
.booking.is-cancelled .booking__who { text-decoration: line-through; }

/* Agenda groups ----------------------------------------------- */
.agenda-group { margin-bottom: 26px; }
.agenda-group__label {
  font-weight: 800;
  font-size: calc(var(--fs-sm) * var(--scale));
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 0 2px 12px;
}
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.wrap { flex-wrap: wrap; }

/* Calendar grid ----------------------------------------------- */
.cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}
.cal__month { font-weight: 800; font-size: calc(var(--fs-lg) * var(--scale)); letter-spacing: -.01em; text-align: center; }
.cal__nav { display: flex; gap: 8px; }
.iconbtn {
  width: 50px; height: 50px;
  border-radius: 13px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  display: grid; place-items: center;
  cursor: pointer;
}
.iconbtn:hover { background: var(--surface-2); }
.iconbtn svg { width: 24px; height: 24px; }

.cal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}
.cal__dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}
.cal__dow span {
  text-align: center;
  font-weight: 800;
  color: var(--ink-faint);
  font-size: calc(var(--fs-xs) * var(--scale));
  text-transform: uppercase;
}
.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cell {
  min-height: 76px;
  border-radius: 10px;
  padding: 5px 5px 4px;
  background: var(--cream);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}
.cell.is-out { opacity: .4; }
.cell.is-today { background: var(--sun-tint); border-color: var(--sun); }
.cell__n { font-weight: 800; font-size: calc(var(--fs-xs) * var(--scale)); color: var(--ink-soft); }
.cell.is-today .cell__n { color: #8a5a16; }
.chip {
  border: none;
  border-radius: 7px;
  padding: 3px 6px;
  font-size: calc(12px * var(--scale));
  font-weight: 800;
  color: #fff;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}
.chip--cima { background: var(--cima); }
.chip--baixo { background: var(--baixo); }
.chip--more { background: var(--cream-deep); color: var(--ink-soft); }
@media (max-width: 520px) {
  .cell { min-height: 60px; }
  .chip { padding: 2px 4px; font-size: calc(10px * var(--scale)); }
}

/* Modal ------------------------------------------------------- */
.scrim {
  position: fixed; inset: 0;
  background: rgba(40,35,28,.45);
  backdrop-filter: blur(2px);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fade .15s ease;
}
@media (min-width: 600px) { .scrim { align-items: center; padding: 24px; } }
.modal {
  background: var(--surface);
  width: 100%;
  max-width: 520px;
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-lg);
  max-height: 92vh;
  overflow-y: auto;
  animation: slideup .22s cubic-bezier(.2,.8,.2,1);
}
@media (min-width: 600px) { .modal { border-radius: 24px; animation: pop .18s ease; } }
.modal__head {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 0;
}
.modal__title { font-weight: 800; font-size: calc(var(--fs-lg) * var(--scale)); letter-spacing: -.01em; flex: 1; }
.modal__body { padding: 18px 20px 24px; }
.modal__x {
  width: 44px; height: 44px; border-radius: 12px; border: none;
  background: var(--cream-deep); cursor: pointer; display: grid; place-items: center; flex: none;
}
.modal__x svg { width: 22px; height: 22px; }

@keyframes fade { from { opacity: 0; } }
@keyframes slideup { from { transform: translateY(40px); } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }

/* Detail rows ------------------------------------------------- */
.dl { display: flex; flex-direction: column; gap: 14px; margin: 4px 0 20px; }
.dl__row { display: flex; gap: 14px; align-items: flex-start; }
.dl__k { width: 96px; flex: none; color: var(--ink-soft); font-weight: 800; font-size: calc(var(--fs-sm) * var(--scale)); padding-top: 2px; }
.dl__v { font-weight: 700; font-size: calc(var(--fs-base) * var(--scale)); flex: 1; }

/* Banner / alerts --------------------------------------------- */
.alert {
  border-radius: 13px;
  padding: 14px 16px;
  font-weight: 700;
  font-size: calc(var(--fs-sm) * var(--scale));
  display: flex; gap: 10px; align-items: flex-start;
  line-height: 1.4;
}
.alert svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.alert--error { background: var(--danger-tint); color: var(--danger); }
.alert--ok { background: var(--ok-tint); color: var(--ok); }
.alert--info { background: var(--baixo-tint); color: var(--baixo-deep); }
.alert--warn { background: var(--sun-tint); color: #8a5a16; }

/* Demo banner ------------------------------------------------- */
.demobar {
  background: repeating-linear-gradient(45deg, var(--sun-tint), var(--sun-tint) 12px, #f3e2c4 12px, #f3e2c4 24px);
  color: #7a4f12;
  text-align: center;
  font-weight: 800;
  font-size: calc(var(--fs-xs) * var(--scale));
  padding: 7px 14px;
  border-bottom: 1px solid #e7cfa0;
}

/* Toast ------------------------------------------------------- */
.toast-wrap {
  position: fixed; left: 0; right: 0; bottom: 86px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 80; pointer-events: none; padding: 0 16px;
}
.toast {
  background: var(--primary); color: var(--on-primary);
  padding: 14px 20px; border-radius: 14px; font-weight: 800;
  box-shadow: var(--shadow-lg); max-width: 460px;
  animation: slideup .2s ease; display: flex; gap: 10px; align-items: center;
}
.toast--ok { background: #2f6b46; }
.toast--err { background: var(--danger); }

/* Empty / loading --------------------------------------------- */
.empty {
  text-align: center;
  padding: 50px 24px;
  color: var(--ink-soft);
}
.empty__icon {
  width: 76px; height: 76px; border-radius: 22px;
  background: var(--cream-deep);
  display: grid; place-items: center; margin: 0 auto 16px;
  color: var(--ink-faint);
}
.empty__icon svg { width: 38px; height: 38px; }
.empty__title { font-weight: 800; font-size: calc(var(--fs-md) * var(--scale)); color: var(--ink); margin-bottom: 6px; }

.spinner {
  width: 38px; height: 38px;
  border: 4px solid var(--line-strong);
  border-top-color: var(--cima);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.spinner--sm { width: 22px; height: 22px; border-width: 3px; }
.spinner--light { border-color: rgba(255,255,255,.4); border-top-color: #fff; }
.loading { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 50px 0; color: var(--ink-soft); font-weight: 700; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--cream-deep) 25%, #f0e7d6 50%, var(--cream-deep) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: 12px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Login ------------------------------------------------------- */
.login {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 28px 18px;
  background:
    radial-gradient(120% 90% at 50% -10%, var(--sun-tint), transparent 60%),
    var(--cream);
}
.login__card {
  width: 100%;
  max-width: 440px;
}
.login__hero {
  text-align: center;
  margin-bottom: 26px;
}
.login__mark {
  width: 78px; height: 78px;
  border-radius: 22px;
  background: linear-gradient(150deg, var(--sun), var(--cima));
  display: grid; place-items: center; margin: 0 auto 18px;
  color: #fff; box-shadow: var(--shadow-lg);
}
.login__mark svg { width: 42px; height: 42px; }
.login__title { font-size: calc(var(--fs-2xl) * var(--scale)); font-weight: 800; letter-spacing: -.025em; line-height: 1.05; }
.login__sub { color: var(--ink-soft); font-size: calc(var(--fs-md) * var(--scale)); margin-top: 8px; font-weight: 600; }

.check {
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; user-select: none; font-weight: 700;
  padding: 6px 0;
}
.check input { width: 26px; height: 26px; accent-color: var(--cima); flex: none; }

/* Misc -------------------------------------------------------- */
.divider { height: 1px; background: var(--line); margin: 18px 0; border: none; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }
.mt-s { margin-top: 10px; } .mt-m { margin-top: 18px; } .mt-l { margin-top: 26px; }
.mb-s { margin-bottom: 10px; } .mb-m { margin-bottom: 18px; }
.fab-space { height: 8px; }

.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.list-item__main { flex: 1; min-width: 0; }
.list-item__name { font-weight: 800; font-size: calc(var(--fs-md) * var(--scale)); }
.list-item__meta { color: var(--ink-soft); font-weight: 700; font-size: calc(var(--fs-sm) * var(--scale)); }
.avatar {
  width: 48px; height: 48px; border-radius: 14px; flex: none;
  display: grid; place-items: center; font-weight: 800; color: #fff;
  font-size: calc(var(--fs-base) * var(--scale));
}

/* Tweaks panel container is host-managed; keep app readable */
@media (max-width: 380px) {
  :root { --fs-base: 18px; --fs-md: 20px; }
}
