/* Portal de Relatórios · Elixir Criativo
   Identidade: grafite #222625 do site, laranja #E47F42 dos botões, azul #5BC0DE, Manrope. */

:root {
  --ink: #222625;
  --ink-2: #2e3332;
  --ink-line: #3b4140;
  --orange: #E47F42;
  --orange-dk: #c9672d;
  --sky: #5BC0DE;
  --fog: #EAEAEA;
  --paper: #FFFFFF;
  --page: #F5F5F4;
  --text: #2a2d2c;
  --muted: #646a69;
  --danger: #b83a2e;
  --ok: #2f7a4b;
  --radius: 5px;
  --bar-h: 64px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--page);
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.015em; }
p { margin: 0; }
code { font-size: .9em; background: var(--fog); padding: .1em .35em; border-radius: 3px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 3px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  font: 700 .95rem/1 var(--font);
  padding: .95em 1.4em;
  border-radius: var(--radius);
  border: 2px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dk); }
.btn-primary:disabled { background: #b9b9b6; cursor: not-allowed; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.btn-ghost:hover { border-color: #fff; }
.btn-ghost-dark { background: transparent; color: #fff; border-color: var(--ink-line); }
.btn-ghost-dark:hover { border-color: #fff; }
.btn-outline { background: var(--paper); color: var(--ink); border-color: #cfd1cf; }
.btn-outline:hover { border-color: var(--ink); }
.btn-danger { background: transparent; color: var(--danger); border-color: #e7c3bf; }
.btn-danger:hover { border-color: var(--danger); }
.btn-small { font-size: .85rem; padding: .7em 1em; }
.btn-block { width: 100%; }
.as-link { background: none; border: 0; font: inherit; cursor: pointer; padding: 0; }
.link-quiet { color: inherit; text-decoration: none; font-weight: 600; font-size: .9rem; opacity: .85; }
.link-quiet:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Campos ---------- */
.field { display: grid; gap: .35rem; }
.field > span { font-weight: 600; font-size: .875rem; }
.field input, .field select {
  font: 500 1rem var(--font);
  color: var(--text);
  padding: .8em .9em;
  border: 1.5px solid #cfd1cf;
  border-radius: var(--radius);
  background: var(--paper);
  width: 100%;
}
.field input:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(91,192,222,.35); }
.field input[type=file] { padding: .6em; background: var(--page); border-style: dashed; }

.alert { padding: .8em 1em; border-radius: var(--radius); font-weight: 600; font-size: .92rem; }
.alert-error { background: #fbeceb; color: var(--danger); }
.alert-ok { background: #e9f4ed; color: var(--ok); }

/* ---------- Barra superior (igual ao cabeçalho do site) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  height: var(--bar-h);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem;
  padding: 0 clamp(16px, 3vw, 32px);
  background: var(--ink); color: #fff;
}
.brand img { height: 38px; width: auto; }
.topbar-center { display: flex; justify-content: center; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 1.1rem; }
.who { font-weight: 700; font-size: .9rem; }
.month-current { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month-nav { display: flex; align-items: center; gap: .75rem; }
.nav-arrow {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 50%; border: 1.5px solid var(--ink-line);
  text-decoration: none; font-size: 1.4rem; line-height: 1; padding-bottom: 3px;
}
a.nav-arrow:hover { border-color: #fff; }
.nav-arrow.off { opacity: .25; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.login-side {
  background: var(--ink); color: #fff;
  padding: clamp(24px, 5vw, 64px);
  display: grid; grid-template-rows: auto 1fr auto; gap: 2rem;
  overflow: hidden;
}
.login-side .brand img { height: 52px; }
.login-pitch { align-self: center; max-width: 30rem; }
.login-pitch h1 { font-size: clamp(2.3rem, 4.6vw, 3.6rem); font-weight: 800; letter-spacing: -0.03em; }
.login-pitch p { margin-top: 1.1rem; color: #c9cccb; font-size: 1.05rem; max-width: 26rem; }

/* O elemento marcante: a régua de 12 meses subindo */
.login-months {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px;
  height: clamp(120px, 22vh, 200px); align-items: end;
}
.login-months li {
  height: var(--h); position: relative;
  background: var(--ink-line); border-radius: 3px 3px 0 0;
  transform-origin: bottom;
  animation: rise .9s cubic-bezier(.2,.7,.2,1) both;
}
.login-months li:nth-child(n+8) { background: var(--orange); }
.login-months li:last-child { background: var(--sky); }
.login-months span {
  position: absolute; bottom: -1.6em; left: 0; right: 0; text-align: center;
  font-size: .7rem; color: #9ea3a2; font-weight: 600;
}
.login-months { padding-bottom: 1.6em; }
/* atrasos escalonados */
.login-months li:nth-child(1){animation-delay:.05s}.login-months li:nth-child(2){animation-delay:.1s}.login-months li:nth-child(3){animation-delay:.15s}.login-months li:nth-child(4){animation-delay:.2s}.login-months li:nth-child(5){animation-delay:.25s}.login-months li:nth-child(6){animation-delay:.3s}.login-months li:nth-child(7){animation-delay:.35s}.login-months li:nth-child(8){animation-delay:.4s}.login-months li:nth-child(9){animation-delay:.45s}.login-months li:nth-child(10){animation-delay:.5s}.login-months li:nth-child(11){animation-delay:.55s}.login-months li:nth-child(12){animation-delay:.6s}
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.login-form-wrap { display: grid; place-items: center; padding: clamp(24px, 5vw, 64px) 16px; background: var(--paper); }
.login-form { width: 100%; max-width: 22rem; display: grid; gap: 1.1rem; }
.login-form h2 { font-size: 1.9rem; font-weight: 800; }
.login-form .muted { margin-top: -.6rem; }
.login-help { font-size: .9rem; color: var(--muted); text-align: center; }
.login-help a { color: var(--ink); font-weight: 700; }

/* ---------- Painel do cliente ---------- */
.panel-hero {
  background: var(--ink); color: #fff;
  padding: clamp(32px, 6vw, 72px) clamp(16px, 5vw, 64px) clamp(36px, 6vw, 64px);
}
.panel-client { color: var(--orange); font-weight: 700; margin-bottom: .6rem; }
.panel-hero h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); font-weight: 800; max-width: 20ch; letter-spacing: -0.03em; }
.panel-hero .muted { color: #b5b9b8; margin-top: .8rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.8rem; }

.archive { padding: clamp(28px, 5vw, 56px) clamp(16px, 5vw, 64px) 120px; max-width: 1280px; }
.archive-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.archive-head h2 { font-size: 1.5rem; font-weight: 800; }
.compare-hint { margin-top: .6rem; color: var(--muted); font-weight: 600; }

.year { margin-top: 2rem; display: grid; grid-template-columns: 5rem 1fr; gap: 1rem; align-items: start; }
.year-label { font-size: 1.6rem; font-weight: 800; color: var(--ink); padding-top: .4rem; }
.year-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.month {
  display: grid; gap: .15rem; padding: .9rem 1rem; min-height: 76px;
  border-radius: var(--radius); text-decoration: none;
}
.month-name { font-weight: 700; }
.month-meta { font-size: .78rem; }
.month.has { background: var(--paper); border: 1.5px solid #dcdedc; border-left: 4px solid var(--orange); transition: border-color .15s, background-color .15s; }
.month.has:hover { border-color: var(--ink); border-left-color: var(--orange); }
.month.has .month-meta { color: var(--muted); }
.month.empty { border: 1.5px dashed #d6d8d6; color: #a5aaa9; }

/* modo comparação */
.is-comparing .month.has { cursor: pointer; }
.is-comparing .month.empty { opacity: .45; }
.month.is-picked { background: var(--ink); color: #fff; border-color: var(--ink); }
.month.is-picked .month-meta { color: var(--orange); font-weight: 700; }
.compare-bar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  width: min(560px, calc(100% - 32px));
  background: var(--ink); color: #fff; border-radius: 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem .75rem .75rem 1.2rem;
  box-shadow: 0 12px 32px rgba(0,0,0,.25);
}
.compare-bar p { font-weight: 700; font-size: .95rem; }
.compare-bar-actions { display: flex; gap: .5rem; }

/* ---------- Visualizador ---------- */
.page-viewer { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.viewer { flex: 1; display: flex; background: var(--paper); }
.report-frame { flex: 1; width: 100%; border: 0; background: #fff; }

/* ---------- Comparar ---------- */
.compare { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.compare-panes { flex: 1; display: grid; grid-template-columns: 1fr 1fr; min-height: 0; margin: 0; }
.pane { display: flex; flex-direction: column; min-height: 0; border-right: 2px solid var(--ink); }
.pane:last-child { border-right: 0; }
.pane-head {
  display: flex; align-items: center; gap: .8rem;
  padding: .6rem 1rem; background: var(--fog);
}
.pane-head select {
  font: 700 1rem var(--font); color: var(--ink);
  border: 1.5px solid #cfd1cf; border-radius: var(--radius); background: #fff; padding: .45em .6em;
}
.pane-head .link-quiet { margin-left: auto; }
.pane-tag { font-size: .75rem; font-weight: 800; padding: .3em .7em; border-radius: 99px; background: #fff; color: var(--muted); }
.pane-tag-now { background: var(--orange); color: #fff; }
.compare-tabs { display: none; }

/* ---------- Admin ---------- */
.admin { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - var(--bar-h)); }
.admin-side { background: var(--paper); border-right: 1px solid #e2e3e2; padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: 1rem; }
.admin-side h2 { font-size: 1rem; padding: 0 .5rem; }
.client-list { display: grid; gap: 2px; }
.client-list a { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .6rem .7rem; border-radius: var(--radius); text-decoration: none; font-weight: 600; }
.client-list a:hover { background: var(--page); }
.client-list a.is-current { background: var(--ink); color: #fff; }
.client-list small { color: var(--muted); font-weight: 500; white-space: nowrap; }
.client-list a.is-current small { color: #b5b9b8; }
.side-mcp { padding: 0 .5rem; }
.admin-main { padding: clamp(20px, 4vw, 40px); display: grid; gap: 1.5rem; align-content: start; max-width: 1000px; }
.admin-head h1 { font-size: 2rem; font-weight: 800; }
.admin-head p { margin-top: .3rem; }
.block { background: var(--paper); border: 1px solid #e2e3e2; border-radius: 8px; padding: clamp(16px, 3vw, 28px); display: grid; gap: 1rem; }
.block h2 { font-size: 1.15rem; font-weight: 800; }
.upload { display: grid; grid-template-columns: 180px 1fr; gap: 1rem; align-items: end; }
.upload .drop { grid-column: 1 / -1; }
.upload .btn { justify-self: start; }
.grid-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; align-items: end; }
.grid-form .btn { justify-self: start; }
.block-split { grid-template-columns: 1fr 1fr; gap: 2rem; }
.inline-form { display: grid; gap: .8rem; align-content: start; }
.inline-form .btn { justify-self: start; }
.danger-zone h2 { color: var(--danger); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 700; padding: .5rem; border-bottom: 1.5px solid #e2e3e2; }
.table td { padding: .7rem .5rem; border-bottom: 1px solid #efefee; vertical-align: middle; }
.row-actions { display: flex; gap: .4rem; justify-content: flex-end; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.reveal { background: var(--ink); color: #fff; border-radius: 8px; padding: 1.4rem; display: grid; gap: .7rem; }
.reveal p { color: #c9cccb; }
.reveal dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; }
.reveal dt { color: #9ea3a2; font-weight: 600; }
.reveal dd { margin: 0; font-weight: 700; word-break: break-all; }
.reveal .btn { justify-self: start; }
.copy-row { display: flex; gap: .5rem; }
.copy-row input { flex: 1; min-width: 0; font: 500 .85rem var(--font); padding: .7em .8em; border: 1.5px solid #cfd1cf; border-radius: var(--radius); background: var(--page); }
.mcp form .btn { justify-self: start; }

/* ---------- Cartões centrais (setup, login admin, 404) ---------- */
.center-card, .notfound { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--ink); }
.card-form { background: var(--paper); border-radius: 8px; padding: 2rem; width: 100%; max-width: 24rem; display: grid; gap: 1rem; }
.card-form h1 { font-size: 1.6rem; font-weight: 800; }
.card-logo { background: var(--ink); padding: 8px 12px; border-radius: var(--radius); width: auto; height: 56px; justify-self: start; }
.notfound { color: #fff; text-align: center; align-content: center; gap: 1.2rem; }
.notfound img { margin: 0 auto 1rem; height: 56px; width: auto; }
.notfound h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); max-width: 22ch; margin: 0 auto; }
.notfound p { color: #c9cccb; max-width: 34rem; margin: 0 auto; }
.notfound .btn { justify-self: center; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-weight: 700; padding: .8em 1.2em; border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0,0,0,.25); z-index: 50;
}

/* ---------- Responsivo ---------- */
@media (max-width: 1000px) {
  .year-grid { grid-template-columns: repeat(4, 1fr); }
  .admin { grid-template-columns: 1fr; }
  .admin-side { border-right: 0; border-bottom: 1px solid #e2e3e2; }
  .client-list { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}
@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; }
  .login-side { grid-template-rows: auto auto auto; gap: 1.6rem; }
  .login-months { height: 90px; }
  .hide-sm { display: none !important; }
  .compare-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--ink); padding: 0 8px 8px; gap: 8px; }
  .compare-tabs button { font: 700 .95rem var(--font); padding: .7em; border-radius: var(--radius); border: 1.5px solid var(--ink-line); background: transparent; color: #fff; }
  .compare-tabs button[aria-selected="true"] { background: var(--orange); border-color: var(--orange); }
  .compare-panes { grid-template-columns: 1fr; }
  .pane { display: none; border-right: 0; }
  .pane.is-active { display: flex; }
  .upload, .grid-form, .block-split { grid-template-columns: 1fr; }
  .table thead { display: none; }
  .table tr { display: grid; padding: .6rem 0; border-bottom: 1px solid #efefee; }
  .table td { border: 0; padding: .2rem 0; }
  .row-actions { justify-content: flex-start; padding-top: .5rem !important; }
}
@media (max-width: 560px) {
  .year { grid-template-columns: 1fr; gap: .6rem; }
  .year-grid { grid-template-columns: repeat(3, 1fr); }
  .month { padding: .7rem .75rem; min-height: 66px; }
  .month-meta { font-size: .72rem; }
  .who { display: none; }
  .brand img { height: 32px; }
  .topbar { gap: .6rem; }
  .month-nav { gap: .4rem; }
  .month-current { font-size: .9rem; }
  .page-viewer .topbar-right .link-quiet { font-size: .8rem; }
  .compare-bar { flex-direction: column; align-items: stretch; text-align: center; padding: 1rem; }
  .compare-bar-actions .btn { flex: 1; }
  .pane-head .link-quiet { display: none; }
  .page-compare .topbar-center { display: none; }
  .page-viewer .month-current { font-size: .82rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
