/* ============ Projeto Casa — Design System ============ */
:root {
  --azul: #1779A8;
  --azul-escuro: #0F5E85;
  --azul-noite: #0A2A3D;
  --azul-claro: #E3F1F8;
  --roxo: #8E44AD;
  --rosa: #E91E8C;
  --laranja: #F39C12;
  --verde: #27AE60;
  --vermelho: #E74C3C;
  --amarelo: #F1C40F;
  --fundo: #F4F8FB;
  --card: #FFFFFF;
  --texto: #16323F;
  --texto-2: #5A7484;
  --borda: #DCE8F0;
  --sombra: 0 4px 20px rgba(15, 94, 133, 0.08);
  --sombra-hover: 0 10px 32px rgba(15, 94, 133, 0.16);
  --raio: 16px;
  --grad: linear-gradient(135deg, #1779A8 0%, #0F5E85 55%, #0A2A3D 100%);
  --grad-quente: linear-gradient(135deg, #E91E8C, #F39C12);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100dvh;
}
h1, h2, h3, h4, .display { font-family: 'Outfit', 'Inter', sans-serif; }
a { color: var(--azul); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 15px; }
img, svg, video { max-width: 100%; }
::selection { background: rgba(23, 121, 168, .25); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 12px; font-weight: 600; font-size: 14.5px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s, opacity .15s;
  user-select: none; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(23,121,168,.35); }
.btn-primary:hover { box-shadow: 0 8px 24px rgba(23,121,168,.45); transform: translateY(-1px); }
.btn-ghost { background: var(--azul-claro); color: var(--azul-escuro); }
.btn-ghost:hover { background: #d3e8f3; }
.btn-danger { background: #FDECEA; color: var(--vermelho); }
.btn-success { background: #E8F8EF; color: var(--verde); }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border-radius: var(--raio); box-shadow: var(--sombra);
  padding: 22px; border: 1px solid rgba(220,232,240,.6);
}
.card-hover { transition: transform .18s ease, box-shadow .18s ease; cursor: pointer; }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--sombra-hover); }

/* ---------- Formulários ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 13px; color: var(--texto-2); margin-bottom: 6px; letter-spacing: .02em; }
.input, .field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--borda); border-radius: 12px;
  background: #fff; color: var(--texto); outline: none; transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  border-color: var(--azul); box-shadow: 0 0 0 4px rgba(23,121,168,.12);
}
.field textarea { resize: vertical; min-height: 80px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.badge-azul { background: var(--azul-claro); color: var(--azul-escuro); }
.badge-verde { background: #E8F8EF; color: #1E8449; }
.badge-vermelho { background: #FDECEA; color: #C0392B; }
.badge-laranja { background: #FEF5E7; color: #B9770E; }
.badge-roxo { background: #F4ECF7; color: #7D3C98; }
.badge-cinza { background: #EEF2F5; color: #5A7484; }

/* ---------- Tabelas ---------- */
.tabela-wrap { overflow-x: auto; border-radius: var(--raio); }
table.tabela { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }
.tabela th { text-align: left; padding: 13px 16px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-2); background: #F8FBFD; border-bottom: 1px solid var(--borda); white-space: nowrap; }
.tabela td { padding: 13px 16px; border-bottom: 1px solid #EEF4F8; vertical-align: middle; }
.tabela tr:last-child td { border-bottom: none; }
.tabela tr:hover td { background: #FAFCFE; }

/* ---------- Avatares ---------- */
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #fff; flex-shrink: 0; font-family: 'Outfit', sans-serif;
}

/* ---------- Estrelas ---------- */
.stars { display: inline-flex; gap: 2px; font-size: 18px; line-height: 1; }
.stars .on { color: var(--amarelo); }
.stars .off { color: #D8E2EA; }
.stars-input { display: flex; gap: 8px; }
.stars-input button {
  font-size: 34px; line-height: 1; color: #D8E2EA; transition: transform .12s ease, color .12s;
  padding: 4px;
}
.stars-input button.on { color: var(--amarelo); text-shadow: 0 2px 10px rgba(241,196,15,.4); }
.stars-input button:active { transform: scale(1.25); }

/* ---------- Modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(10, 42, 61, .55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
  animation: fadeIn .18s ease;
}
.modal {
  background: #fff; border-radius: 20px; width: 100%; max-width: 560px; max-height: 92dvh;
  overflow-y: auto; padding: 26px; animation: slideUp .22s cubic-bezier(.2,.9,.3,1.2);
}
.modal h3 { font-size: 20px; margin-bottom: 18px; display:flex; align-items:center; justify-content:space-between; }
.modal .fechar { font-size: 22px; color: var(--texto-2); padding: 4px 10px; border-radius: 10px; }
.modal .fechar:hover { background: var(--fundo); }
@keyframes fadeIn { from { opacity: 0 } }
@keyframes slideUp { from { opacity: 0; transform: translateY(26px) } }

/* ---------- Toast ---------- */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.toast {
  padding: 14px 18px; border-radius: 14px; color: #fff; font-weight: 600; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: slideUp .25s ease; display: flex; gap: 10px; align-items: center;
}
.toast-ok { background: linear-gradient(135deg, #27AE60, #1E8449); }
.toast-erro { background: linear-gradient(135deg, #E74C3C, #C0392B); }

/* ---------- Barras de progresso ---------- */
.prog { height: 8px; background: #E5EEF4; border-radius: 99px; overflow: hidden; }
.prog > div { height: 100%; border-radius: 99px; background: var(--grad); transition: width .4s ease; }

/* ---------- Utilitários ---------- */
.flex { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 4px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--texto-2); font-size: 13px; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.center { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vazio { text-align: center; padding: 48px 20px; color: var(--texto-2); }
.vazio .emoji { font-size: 44px; display: block; margin-bottom: 10px; }

/* ---------- Safe areas (app iOS / notch) ---------- */
.topo { padding-top: calc(16px + env(safe-area-inset-top, 0px)) !important; }
.navbar { padding-top: calc(12px + env(safe-area-inset-top, 0px)) !important; }
.topbar { padding-top: calc(14px + env(safe-area-inset-top, 0px)) !important; }
.sidebar { padding-top: calc(22px + env(safe-area-inset-top, 0px)) !important; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #C4D6E2; border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }
