:root {
  --ink: #2a2d47;
  --ink-2: #5b5f7f;
  --ink-3: #8b8fad;
  --pink: #e8649f;
  --pink-2: #f6a6c9;
  --blue: #4f7cf5;
  --blue-2: #9ab7ff;
  --green: #0fb57a;
  --green-2: #34d399;
  --red: #e5384f;
  --red-2: #fb7185;
  --amber: #e9a23b;
  --glass: rgba(255, 255, 255, 0.52);
  --glass-2: rgba(255, 255, 255, 0.34);
  --glass-line: rgba(255, 255, 255, 0.75);
  --shadow: 0 10px 40px rgba(120, 100, 180, 0.16);
  --r: 20px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Sora', 'Manrope', system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(135deg, #fbe3ef 0%, #efe6fb 45%, #dde9ff 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, h4, .num, .kpi b, .hero-val { font-family: var(--display); letter-spacing: -0.01em; }
.hidden { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* fundo com bolhas desfocadas */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .6; }
.b1 { width: 520px; height: 520px; background: #f9a8cf; top: -140px; left: -120px; }
.b2 { width: 560px; height: 560px; background: #a5c3ff; bottom: -180px; right: -140px; }
.b3 { width: 340px; height: 340px; background: #d7b8ff; top: 35%; left: 45%; opacity: .45; }
.b4 { width: 300px; height: 300px; background: #ffc9de; bottom: 5%; left: 8%; opacity: .45; }

.glass {
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.8);
  border-radius: var(--r);
}
.muted { color: var(--ink-2); }
.tiny { font-size: 12px; color: var(--ink-3); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); padding: 36px 28px 28px; text-align: center; display: grid; gap: 14px; }
.login-card h1 { margin: 4px 0 0; font-size: 26px; }
.login-card p { margin: 0; }
.logo { display: grid; place-items: center; }
.erro { color: var(--red); min-height: 20px; font-weight: 600; }

input[type=text], input[type=password], input[type=number], input[type=month], input[type=search], select, textarea {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(255,255,255,.9);
  background: rgba(255,255,255,.7); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue-2); box-shadow: 0 0 0 4px rgba(79,124,245,.15); }

.btn {
  border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.65); padding: 9px 14px;
  border-radius: 12px; font-weight: 700; font-size: 14px; color: var(--ink); transition: transform .12s, box-shadow .15s, background .15s;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { background: #fff; box-shadow: 0 6px 18px rgba(120,100,180,.18); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--pink), var(--blue)); color: #fff; border-color: transparent; box-shadow: 0 8px 22px rgba(160,110,230,.35); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.big { padding: 13px 18px; font-size: 16px; justify-content: center; }
.btn.danger { color: var(--red); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.btn.ghost { background: transparent; border-color: transparent; }

/* ---------- topo ---------- */
.top {
  position: sticky; top: 10px; z-index: 20; margin: 10px auto 0; width: min(1320px, calc(100% - 24px));
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand strong { display: block; font-family: var(--display); font-size: 15px; }
.save { display: block; font-size: 12px; color: var(--ink-3); }
.save.ok { color: var(--green); }
.save.err { color: var(--red); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.tabs button {
  border: 0; background: transparent; padding: 8px 12px; border-radius: 12px; font-weight: 700; font-size: 14px; color: var(--ink-2);
  display: flex; align-items: center; gap: 6px;
}
.tabs button i { font-style: normal; font-size: 15px; opacity: .8; }
.tabs button:hover { background: rgba(255,255,255,.6); color: var(--ink); }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 4px 14px rgba(120,100,180,.18); }

.view { width: min(1320px, calc(100% - 24px)); margin: 18px auto 110px; display: grid; gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.card { padding: 18px; }
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card .sub { margin: 0 0 14px; font-size: 13px; color: var(--ink-2); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.section-title h2 { margin: 0; font-size: 22px; }

/* ---------- indicadores verde / vermelho com brilho ---------- */
.shine { position: relative; overflow: hidden; isolation: isolate; }
.shine::after {
  content: ""; position: absolute; inset: -2px; z-index: 1; pointer-events: none;
  background: linear-gradient(110deg, transparent 28%, rgba(255,255,255,.55) 46%, rgba(255,255,255,.15) 54%, transparent 70%);
  transform: translateX(-130%); animation: shine 3.6s ease-in-out infinite;
}
@keyframes shine { 0% { transform: translateX(-130%); } 55%, 100% { transform: translateX(130%); } }
.pos { background: linear-gradient(135deg, #16c784 0%, #0ea371 100%); color: #fff;
  box-shadow: 0 8px 24px rgba(14,163,113,.35), inset 0 1px 0 rgba(255,255,255,.45); }
.neg { background: linear-gradient(135deg, #f7516a 0%, #d92445 100%); color: #fff;
  box-shadow: 0 8px 24px rgba(217,36,69,.33), inset 0 1px 0 rgba(255,255,255,.45); }
.zero { background: linear-gradient(135deg, #b9bdd6, #9aa0c0); color: #fff; }
.txt-pos { color: var(--green); }
.txt-neg { color: var(--red); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.chip.pos, .chip.neg, .chip.zero { box-shadow: none; }

.hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; }
.hero-main { padding: 22px; display: grid; gap: 14px; align-content: start; }
.hero-badge { border-radius: 18px; padding: 18px 20px; }
.hero-badge small { display: block; font-weight: 700; opacity: .92; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.hero-val { font-size: clamp(30px, 4.6vw, 46px); font-weight: 700; line-height: 1.1; margin-top: 4px; position: relative; z-index: 2; }
.hero-badge p { margin: 6px 0 0; font-size: 14px; opacity: .95; position: relative; z-index: 2; }
.mini { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.mini div { background: var(--glass-2); border: 1px solid rgba(255,255,255,.7); border-radius: 14px; padding: 10px 12px; }
.mini small { display: block; color: var(--ink-2); font-size: 12px; font-weight: 600; }
.mini b { font-family: var(--display); font-size: 17px; }
.bar { height: 10px; border-radius: 99px; background: rgba(255,255,255,.7); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--pink), var(--blue)); }
.bar.green > span { background: linear-gradient(90deg, #34d399, #0ea371); }

.kpi { padding: 16px; display: grid; gap: 4px; align-content: start; min-height: 108px; }
.kpi small { color: var(--ink-2); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.kpi b { font-size: 22px; font-weight: 700; }
.kpi span { font-size: 13px; color: var(--ink-2); }
.kpi.pos small, .kpi.neg small, .kpi.pos span, .kpi.neg span { color: rgba(255,255,255,.92); }
.kpi > * { position: relative; z-index: 2; }

.months { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 8px; }
.mpill { border-radius: 14px; padding: 10px 6px; text-align: center; cursor: pointer; border: 0; }
.mpill small { display: block; font-size: 11px; font-weight: 800; letter-spacing: .05em; opacity: .9; position: relative; z-index: 2; }
.mpill b { display: block; font-family: var(--display); font-size: 13px; margin-top: 2px; position: relative; z-index: 2; }
.mpill.cur { outline: 3px solid rgba(255,255,255,.95); outline-offset: 2px; }

.chartbox { position: relative; height: 300px; }
.chartbox.sm { height: 240px; }

.insights { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.insights li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; background: var(--glass-2);
  border: 1px solid rgba(255,255,255,.7); border-radius: 14px; padding: 10px 12px; font-size: 14px; line-height: 1.45; }
.insights .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff; }
.ic.pos { background: linear-gradient(135deg, #16c784, #0ea371); }
.ic.neg { background: linear-gradient(135deg, #f7516a, #d92445); }
.ic.info { background: linear-gradient(135deg, var(--pink), var(--blue)); }

.list { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; background: var(--glass-2);
  border: 1px solid rgba(255,255,255,.7); border-radius: 14px; padding: 10px 12px; }
.item.done { opacity: .62; }
.item.done .nm { text-decoration: line-through; text-decoration-color: rgba(42,45,71,.35); }
.item .nm { font-weight: 700; }
.item .meta { font-size: 12px; color: var(--ink-3); }
.item .val { font-family: var(--display); font-weight: 600; text-align: right; }
.item .val input { width: 110px; text-align: right; padding: 6px 8px; border-radius: 10px; }
.day { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-family: var(--display);
  background: rgba(255,255,255,.8); color: var(--ink-2); font-size: 14px; }
.day.late { background: linear-gradient(135deg, #f7516a, #d92445); color: #fff; }
.day.soon { background: linear-gradient(135deg, #f5b544, #e9902b); color: #fff; }

.check { width: 26px; height: 26px; border-radius: 9px; border: 2px solid rgba(79,124,245,.35); background: rgba(255,255,255,.8);
  display: grid; place-items: center; padding: 0; color: transparent; font-weight: 900; font-size: 15px; }
.check.on { background: linear-gradient(135deg, #16c784, #0ea371); border-color: transparent; color: #fff; }

.cat { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 7px; font-size: 11px; font-weight: 800; color: #fff; padding: 0 5px; }
.cat-C { background: #e8649f; } .cat-L { background: #a78bfa; } .cat-E { background: #4f7cf5; } .cat-F { background: #38bdf8; }
.cat-D { background: #f59e0b; } .cat-M { background: #14b8a6; } .cat-P { background: #0fb57a; }

/* ---------- planilha ---------- */
.sheet-wrap { overflow: auto; max-height: calc(100vh - 230px); border-radius: 16px; }
table.sheet { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 13px; }
.sheet th, .sheet td { padding: 0; border-bottom: 1px solid rgba(255,255,255,.75); white-space: nowrap; }
.sheet thead th { position: sticky; top: 0; z-index: 3; background: rgba(250,244,252,.96); padding: 10px 8px; font-size: 12px; letter-spacing: .06em; font-weight: 800; color: var(--ink-2); }
.sheet thead th.cur { color: var(--pink); }
.sheet .nm { position: sticky; left: 0; z-index: 2; background: rgba(250,246,253,.97); min-width: 210px; max-width: 250px; padding: 6px 10px; text-align: left; }
.sheet thead .nm { z-index: 4; }
.sheet .nm button { border: 0; background: none; padding: 0; text-align: left; font-weight: 700; display: flex; gap: 8px; align-items: center; width: 100%; overflow: hidden; text-overflow: ellipsis; }
.sheet .nm .d { color: var(--ink-3); font-weight: 700; font-size: 12px; min-width: 18px; }
.sheet .nm .until { font-size: 11px; color: var(--ink-3); font-weight: 600; margin-left: auto; }
.sheet td.c { position: relative; min-width: 96px; }
.sheet td.c input { width: 100%; border: 0; background: transparent; padding: 8px 24px 8px 8px; text-align: right; border-radius: 0; font-variant-numeric: tabular-nums; }
.sheet td.c input:focus { background: #fff; box-shadow: inset 0 0 0 2px var(--blue-2); }
.sheet td.c.note input { color: var(--ink-3); font-style: italic; font-size: 12px; }
.sheet td.c .dot { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(139,143,173,.45); background: transparent; padding: 0; }
.sheet td.c .dot.on { background: #10b981; border-color: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.sheet td.c.curcol { background: rgba(232,100,159,.06); }
.sheet tr.tot td, .sheet tr.tot th { font-weight: 800; background: rgba(255,255,255,.55); }
.sheet tr.tot td.v { text-align: right; padding: 8px 10px; font-family: var(--display); font-size: 13px; }
.sheet tr.sobra td.v span { display: inline-block; padding: 4px 9px; border-radius: 9px; }
.sheet tr.grp th { text-align: left; padding: 12px 10px 6px; font-size: 12px; letter-spacing: .08em; color: var(--ink-2); background: rgba(240,232,250,.9); position: sticky; left: 0; }
.sheet tr.grp td { background: rgba(240,232,250,.9); }
.sheet tr.calc td.v { text-align: right; padding: 8px 10px; color: var(--ink-2); font-style: italic; }
.sheet tr.calc .nm { font-style: italic; color: var(--ink-2); }
.sheet tr.sub td.v { text-align: right; padding: 7px 10px; color: var(--ink-2); font-size: 12px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); align-items: center; }

.yearsw { display: inline-flex; background: rgba(255,255,255,.6); border-radius: 12px; padding: 3px; gap: 2px; border: 1px solid rgba(255,255,255,.9); }
.yearsw button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font-weight: 800; color: var(--ink-2); }
.yearsw button.on { background: linear-gradient(135deg, var(--pink), var(--blue)); color: #fff; }

.monthnav { display: flex; align-items: center; gap: 8px; }
.monthnav h2 { margin: 0; min-width: 210px; text-align: center; font-size: 22px; }
.navbtn { width: 38px; height: 38px; border-radius: 12px; border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.65); font-size: 18px; font-weight: 800; }

/* ---------- projetos ---------- */
.proj { display: grid; gap: 10px; padding: 14px 16px; }
.proj-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.proj-head h4 { margin: 0; font-size: 15px; }
.proj-head .cl { font-size: 12px; color: var(--ink-2); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.parc { display: flex; gap: 6px; flex-wrap: wrap; }
.pc { border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.65); border-radius: 10px; padding: 5px 9px; font-size: 12px; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.pc.ok { background: linear-gradient(135deg, #16c784, #0ea371); color: #fff; border-color: transparent; }
.pc.late { background: linear-gradient(135deg, #f7516a, #d92445); color: #fff; border-color: transparent; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; background: rgba(255,255,255,.55); border-radius: 12px; padding: 3px; border: 1px solid rgba(255,255,255,.9); }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 9px; font-weight: 700; font-size: 13px; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(120,100,180,.15); }

/* ---------- tabela simples ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; padding: 8px; }
.tbl td { padding: 8px; border-top: 1px solid rgba(255,255,255,.8); vertical-align: middle; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl input, .tbl select { padding: 7px 9px; border-radius: 10px; }
.tbl input.w-n { width: 110px; text-align: right; }
.tbl input.w-s { width: 70px; text-align: center; }
.tbl tr.done td { opacity: .55; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(60,50,90,.28); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-card { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: rgba(255,255,255,.82); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 0; }
.modal-head h3 { margin: 0; font-size: 18px; }
.x { border: 0; background: rgba(255,255,255,.8); width: 34px; height: 34px; border-radius: 10px; font-size: 20px; }
.modal-body { padding: 14px 18px; display: grid; gap: 12px; }
.modal-foot { padding: 0 18px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
.f { display: grid; gap: 5px; }
.f label { font-size: 12px; font-weight: 800; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.f3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.toggle { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.toggle input { width: 18px; height: 18px; accent-color: var(--pink); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(30px); opacity: 0; transition: .25s;
  background: rgba(42,45,71,.92); color: #fff; padding: 11px 16px; border-radius: 14px; font-weight: 700; font-size: 14px; z-index: 60; pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty { text-align: center; color: var(--ink-3); padding: 24px; }
.sim { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; align-items: end; }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) {
  .g5 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .top { position: sticky; top: 0; margin-top: 0; width: 100%; border-radius: 0 0 18px 18px; backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(255,255,255,.86); }
  .tabs { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 30; justify-content: space-between; flex-wrap: nowrap;
    background: rgba(255,255,255,.78); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,.9);
    border-radius: 18px; padding: 6px; box-shadow: var(--shadow); padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .tabs button { flex-direction: column; gap: 1px; padding: 6px 4px; font-size: 10.5px; flex: 1; min-width: 0; }
  .tabs button i { font-size: 17px; }
  .view { width: calc(100% - 32px); margin: 14px 16px 110px; }
  .g2, .g3, .g4, .g5 { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .g2 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .months { grid-template-columns: repeat(6, minmax(0,1fr)); }
  .mini { grid-template-columns: 1fr 1fr; }
  .chartbox { height: 250px; }
  .monthnav h2 { min-width: 0; font-size: 18px; }

  .f3 { grid-template-columns: 1fr 1fr; }
  .item { grid-template-columns: auto 1fr auto; gap: 8px; }
  .item .val input { width: 92px; }
  .sheet .nm { min-width: 150px; max-width: 160px; }
  .kpi b { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  .shine::after { animation: none; display: none; }
  * { transition: none !important; }
}
