/* ============================================================
   RC — Reforma & Construção · tema da marca
   Verde #3a5a40 (primária) · Laranja #ff751f (acento mínimo)
   Poppins · cantos 16/26/50 · losango translúcido
   ============================================================ */
:root {
  /* marca */
  --rc-green:        #3a5a40;
  --rc-green-d:      #2c4531;
  --rc-green-glass:  rgba(58, 90, 64, 0.92);
  --rc-green-light:  #6f9475;
  --rc-orange:       #ff751f;
  --rc-ink:          #08160c;
  --rc-ink-deep:     #05100b;

  /* aliases de UI */
  --bg: #f3f6f3;
  --surface: #ffffff;
  --ink: #0f1a12;
  --ink-2: #44544a;
  --ink-3: #5f7065;             /* secundário: 5.26:1 sobre branco (WCAG AA) */
  --line: #e3e8e3;
  --primary: var(--rc-green);
  --primary-d: var(--rc-green-d);
  --primary-soft: #eef3ee;      /* tint p/ seleção (substitui o creme laranja) */
  --accent: var(--rc-orange);

  /* superfícies escuras (gradiente verde-ink) */
  --grad-dark: linear-gradient(140deg, #1f4a2e 0%, #0c1d12 78%);
  --grad-bar:  linear-gradient(135deg, #1b3a25, #0c1d12);
  --grad-login: radial-gradient(120% 80% at 50% 0%, #1f4a2e 0%, #05100b 62%);

  /* semânticos financeiros (dado, não marca) — contraste AA verificado */
  --green: #14793f;        /* receita: 5.47:1 sobre branco, 4.75:1 sobre --green-bg */
  --green-bg: #e2f3e8;
  --red: #c4271c;          /* despesa/estouro: 5.75:1 sobre branco, 4.83:1 sobre --red-bg */
  --red-bg: #fbe7e4;

  /* raios da marca */
  --r-sm: 16px;
  --r: 26px;
  --r-pill: 50px;
  --radius: 26px;

  --shadow: 0 1px 3px rgba(16,40,24,.06), 0 10px 30px rgba(16,40,24,.08);
  --shadow-lg: 0 18px 46px rgba(8,22,12,.28);
  --shadow-card-dark: 0 14px 36px rgba(0,0,0,0.4);
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
.hidden { display: none !important; }
.tabnum { font-variant-numeric: tabular-nums; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; }

/* losango decorativo da marca (45°, cantos arredondados, translúcido) */
.rc-diamond {
  position: absolute; pointer-events: none;
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 44px;
  transform: rotate(45deg);
}

/* ---------- LOGIN ---------- */
.tela-login {
  position: relative; overflow: hidden;
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: var(--grad-login);
}
.tela-login::before, .tela-login::after {
  content: ""; position: absolute; border: 2px solid rgba(111,148,117,0.16);
  border-radius: 60px; transform: rotate(45deg); pointer-events: none;
}
.tela-login::before { width: 240px; height: 240px; top: -70px; right: -60px; }
.tela-login::after  { width: 320px; height: 320px; bottom: -120px; left: -90px; border-color: rgba(255,255,255,0.06); }
.login-card {
  position: relative; z-index: 1;
  background: var(--surface); width: 100%; max-width: 380px; border-radius: var(--r);
  padding: 36px 28px; box-shadow: var(--shadow-lg); text-align: center;
}
.login-logo {
  width: 66px; height: 66px; border-radius: var(--r-sm); margin: 0 auto 16px;
  background: linear-gradient(135deg, #46694d, var(--rc-green-d));
  color: #fff; font-weight: 900; font-size: 26px; display: grid; place-items: center;
  box-shadow: 0 10px 24px rgba(58,90,64,.40);
  filter: drop-shadow(0 4px 14px rgba(0,0,0,0.12));
}
.login-card h1 { font-size: 23px; font-weight: 800; letter-spacing: -.5px; }
.login-sub { color: var(--ink-3); margin-bottom: 24px; font-size: 14px; font-weight: 500; }
#form-login { display: grid; gap: 14px; text-align: left; }
#form-login label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: grid; gap: 6px; }
#form-login input {
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 13px 14px; background: #f6f9f6;
}
#form-login input:focus { outline: none; border-color: var(--rc-green); background: #fff; box-shadow: 0 0 0 3px rgba(58,90,64,.20); }

.btn-primary {
  background: var(--primary); color: #fff; font-weight: 700; font-size: 16px;
  border-radius: var(--r-pill); padding: 14px; margin-top: 4px; transition: transform .08s, background .12s;
  letter-spacing: .2px;
}
.btn-primary:active { transform: scale(.98); background: var(--primary-d); }
.btn-ghost { background: var(--bg); color: var(--ink-2); font-weight: 600; border-radius: var(--r-pill); padding: 14px; }
.erro { color: var(--red); font-size: 13px; text-align: center; }

/* ---------- APP SHELL ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; overflow: hidden;
  background: var(--grad-bar); color: #fff;
  padding: calc(env(safe-area-inset-top,0px) + 14px) 18px 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar::after {
  content: ""; position: absolute; width: 150px; height: 150px; top: -60px; right: -40px;
  border: 2px solid rgba(255,255,255,0.06); border-radius: 34px; transform: rotate(45deg);
}
.topbar-eyebrow {
  position: relative; padding-left: 30px;
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.78); font-weight: 600;
}
.topbar-eyebrow::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 22px; height: 3px; border-radius: 2px; background: var(--rc-orange);  /* acento laranja #1 */
}
.topbar h2 { font-size: 21px; font-weight: 800; letter-spacing: -.4px; z-index: 1; }
.topbar-acao { color: #e6efe8; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: var(--r-pill); background: rgba(255,255,255,.10); z-index: 1; }

#conteudo { padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 24px); max-width: 640px; margin: 0 auto; }

/* ---------- CARDS ---------- */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.card + .card, .stack > * + * { margin-top: 14px; }
.stack { display: block; }

.saldo-card {
  position: relative; overflow: hidden;
  background: var(--grad-dark); color: #fff; border-radius: var(--r); padding: 20px;
  box-shadow: var(--shadow-card-dark);
}
.saldo-card::after {
  content: ""; position: absolute; width: 170px; height: 170px; bottom: -80px; right: -50px;
  border: 2px solid rgba(255,255,255,0.10); border-radius: 40px; transform: rotate(45deg);
}
.saldo-card .rotulo { font-size: 13px; color: rgba(255,255,255,.72); font-weight: 500; }
.saldo-card .valor { font-size: 33px; font-weight: 900; margin: 4px 0 14px; letter-spacing: -.03em; }
.saldo-linhas { display: flex; gap: 10px; position: relative; z-index: 1; }
.saldo-linhas > div { flex: 1; background: rgba(255,255,255,.08); border-radius: var(--r-sm); padding: 10px 12px; }
.saldo-linhas .min { font-size: 12px; color: rgba(255,255,255,.82); display: flex; align-items: center; gap: 5px; }
.saldo-linhas .num { font-size: 16px; font-weight: 700; margin-top: 2px; }
.up { color: #5fcf8a; } .down { color: #f59a90; }
/* up/down em superfície clara */
.card .up, #conteudo > .up { color: var(--green); }

.sec-titulo { font-size: 13px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; margin: 22px 4px 10px; display: flex; justify-content: space-between; align-items: center; }
.sec-titulo a { color: var(--primary); font-size: 13px; font-weight: 700; text-transform: none; letter-spacing: 0; padding: 8px 6px; margin: -8px -6px; }  /* área de toque >=40px */

/* obra card */
.obra-card { display: block; }
.obra-card .topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.obra-card .nome { font-weight: 700; font-size: 16px; letter-spacing: -.2px; }
.obra-card .cliente { color: var(--ink-3); font-size: 13px; font-weight: 500; }
.badge { font-size: 11px; font-weight: 700; padding: 4px 11px; border-radius: var(--r-pill); white-space: nowrap; }
.badge.em_andamento { background: #e2eee5; color: var(--rc-green); }
.badge.concluida { background: var(--green-bg); color: #126b33; }   /* 5.74:1 */
.badge.pausada { background: #fcf0db; color: #92480a; }              /* 5.91:1 */
.badge.orcamento { background: #eef1ee; color: var(--ink-2); }
.badge.cancelada { background: var(--red-bg); color: var(--red); }  /* 4.83:1 */

.obra-nums { display: flex; gap: 8px; margin-top: 14px; }
.obra-nums > div { flex: 1; min-width: 0; }
.obra-nums .k { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.obra-nums .v { font-size: clamp(12px, 3.4vw, 15px); font-weight: 700; white-space: nowrap; }

/* resumo de 3 colunas do extrato (Receitas/Despesas/Saldo) */
.resumo3 .k { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.resumo3 .v { font-weight: 800; font-size: clamp(13px, 4vw, 17px); white-space: nowrap; }

.barra { height: 8px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; margin-top: 12px; }
.barra > i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--primary); }
.barra.estouro > i { background: var(--red); }

/* lançamento item (extrato) */
.lanc { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.lanc:last-child { border-bottom: none; }
.lanc .ic { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.lanc .ic.receita { background: var(--green-bg); color: var(--green); }
.lanc .ic.despesa { background: var(--red-bg); color: var(--red); }
.lanc .meta { flex: 1; min-width: 0; }
.lanc .meta .d { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lanc .meta .s { font-size: 12px; color: var(--ink-3); }
.lanc .val { font-weight: 700; font-size: 15px; white-space: nowrap; }
.lanc .val.receita { color: var(--green); }
.lanc .val.despesa { color: var(--ink); }
.lanc .tag { display:inline-block; width:8px; height:8px; border-radius:99px; margin-right:5px; vertical-align: middle; }

.vazio { text-align: center; color: var(--ink-3); padding: 40px 20px; font-weight: 500; }
.vazio .big { font-size: 40px; opacity: .5; margin-bottom: 8px; }

/* chips de mês/filtro */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 10px 16px; min-height: 40px; font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--ink-2); }
.chip.ativo { background: var(--rc-green); color: #fff; border-color: var(--rc-green); }

/* ---------- FAB ---------- */
.fab {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) - 26px + var(--safe-b)); z-index: 40;
  width: 58px; height: 58px; border-radius: 50%; font-size: 30px; font-weight: 300; line-height: 1;
  background: var(--rc-green); color: #fff; box-shadow: 0 10px 24px rgba(58,90,64,.50);
  display: grid; place-items: center; transition: transform .1s;
  border: 2px solid rgba(255,255,255,.14);
}
.fab:active { transform: translateX(-50%) scale(.92); background: var(--rc-green-d); }

/* ---------- BOTTOM NAV ---------- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255,255,255,.95); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); display: flex;
}
.bottomnav button {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; font-weight: 600; color: var(--ink-3);
}
.bottomnav button .ico { font-size: 19px; line-height: 1; }
.bottomnav button.ativo { color: var(--rc-green); }
.bottomnav button.ativo::before {           /* acento laranja #2 */
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--rc-orange);
}
.bottomnav .nav-fab-spacer { pointer-events: none; }

/* ---------- MODAL (bottom sheet) ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(8,22,12,.55); display: flex; align-items: flex-end; }
.modal-sheet {
  background: var(--surface); width: 100%; max-width: 640px; margin: 0 auto;
  border-radius: var(--r) var(--r) 0 0; padding: 8px 18px calc(20px + var(--safe-b));
  max-height: 92dvh; overflow-y: auto; animation: sheetUp .22s ease;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-grip { width: 40px; height: 4px; border-radius: 99px; background: var(--line); margin: 6px auto 10px; }
.modal h3 { font-size: 20px; font-weight: 800; letter-spacing: -.3px; margin-bottom: 16px; }

/* forms */
.form { display: grid; gap: 14px; }
.form label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: grid; gap: 6px; }
.form input, .form select, .form textarea {
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 13px 14px; background: #f6f9f6; width: 100%;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--rc-green); background: #fff; box-shadow: 0 0 0 3px rgba(58,90,64,.20); }
.form .row { display: flex; gap: 12px; }
.form .row > * { flex: 1; }

/* segmented tipo */
.seg { display: flex; background: var(--bg); border-radius: var(--r-sm); padding: 4px; gap: 4px; }
.seg button { flex: 1; padding: 11px; border-radius: 12px; font-weight: 700; font-size: 14px; color: var(--ink-2); }
.seg button.on-receita { background: var(--green); color: #fff; }
.seg button.on-despesa { background: var(--red); color: #fff; }

/* teclado de valor grande */
.valor-grande { font-size: 36px; font-weight: 900; text-align: center; border: none !important; background: transparent !important; letter-spacing: -.03em; color: var(--ink); }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px,1fr)); gap: 8px; }
.cat-pill { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 8px; font-size: 12px; font-weight: 600; text-align: center; background:#fff; display:flex; flex-direction:column; align-items:center; gap:6px; }
.cat-pill .dot { width: 12px; height: 12px; border-radius: 99px; }
.cat-pill.sel { border-color: var(--rc-green); background: var(--primary-soft); box-shadow: 0 0 0 2px var(--rc-green) inset; }

.anexo-btn { display: flex; align-items: center; gap: 10px; border: 1px dashed var(--rc-green-light); border-radius: var(--r-sm); padding: 13px; color: var(--ink-2); font-weight: 600; justify-content: center; }
.anexo-prev { width: 100%; border-radius: var(--r-sm); margin-top: 8px; max-height: 200px; object-fit: cover; }

.btn-del { color: var(--red); font-weight: 600; text-align: center; padding: 12px; }
.lista-acoes { display:flex; gap: 10px; margin-top: 4px; }
.lista-acoes > * { flex: 1; }

/* mais / lista de itens */
.menu-item { display:flex; align-items:center; gap: 14px; padding: 16px; background: var(--surface); border-radius: var(--r-sm); box-shadow: var(--shadow); font-weight:600; }
.menu-item .ico { font-size: 20px; }
.menu-item .seta { margin-left:auto; color: var(--ink-3); }
.menu-item + .menu-item { margin-top: 10px; }

.toast {
  position: fixed; bottom: calc(var(--nav-h) + 24px + var(--safe-b)); left: 50%; transform: translateX(-50%);
  background: var(--rc-ink); color: #fff; padding: 12px 18px; border-radius: var(--r-pill); font-size: 14px; font-weight: 600;
  z-index: 100; box-shadow: var(--shadow-lg); animation: toastIn .2s;
}
@keyframes toastIn { from { opacity: 0; } to { opacity: 1; } }

.skeleton { background: linear-gradient(90deg,#e3e8e3 25%,#f1f5f1 50%,#e3e8e3 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r-sm); }
@keyframes sk { to { background-position: -200% 0; } }
