:root {
  --qg-sidebar: 232px;
  --qg-bg: #f4f6fb;
  --qg-panel: #ffffff;
  --qg-border: #e2e8f0;
  --qg-ink: #0f172a;
  --qg-muted: #64748b;
}

body { background: var(--qg-bg); color: var(--qg-ink); }

/* ---------- Shell ---------- */
.qg-shell { display: flex; min-height: 100vh; }

.qg-sidebar {
  width: var(--qg-sidebar); flex: 0 0 var(--qg-sidebar);
  background: #0f172a; color: #cbd5e1;
  display: flex; flex-direction: column; gap: .25rem;
  padding: 1rem .75rem; position: sticky; top: 0; height: 100vh;
}
.qg-brand {
  display: flex; align-items: center; gap: .6rem;
  color: #fff; text-decoration: none; font-weight: 600; padding: .35rem .5rem 1rem;
}
.qg-logo {
  width: 32px; height: 32px; border-radius: 9px; background: #2563eb;
  display: grid; place-items: center; font-size: .8rem; font-weight: 700; letter-spacing: .5px;
}
.qg-nav { display: flex; flex-direction: column; gap: 2px; }
.qg-nav a {
  color: #cbd5e1; text-decoration: none; padding: .5rem .65rem; border-radius: 8px;
  font-size: .9rem; display: flex; align-items: center; gap: .6rem; transition: background .15s;
}
.qg-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.qg-nav a.active { background: #2563eb; color: #fff; }
.qg-nav-soon { margin-top: auto; padding-top: 1rem; display: flex; flex-direction: column; gap: 1px; }
.qg-nav-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: #64748b; padding: 0 .65rem .35rem;
}
.qg-soon {
  font-size: .82rem; color: #64748b; padding: .3rem .65rem;
  display: flex; align-items: center; gap: .6rem;
}
.qg-user {
  display: flex; align-items: center; gap: .6rem;
  border-top: 1px solid rgba(255,255,255,.1); margin-top: .75rem; padding-top: .75rem;
}
.qg-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: #334155; color: #fff;
  display: grid; place-items: center; font-size: .78rem; font-weight: 600; text-decoration: none;
  flex: 0 0 34px;
}
.qg-main { flex: 1; padding: 1.5rem 1.75rem; min-width: 0; }
.qg-messages { max-width: 720px; }

/* ---------- Cabeçalho de página ---------- */
.qg-page-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.qg-page-head h1 { font-size: 1.35rem; font-weight: 650; margin: 0; }

/* ---------- Cartões de módulo ---------- */
.qg-module-card {
  background: var(--qg-panel); border: 1px solid var(--qg-border); border-radius: 14px;
  padding: 1.1rem; height: 100%; text-decoration: none; color: inherit; display: block;
  transition: transform .12s, box-shadow .12s;
}
a.qg-module-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(15,23,42,.09); }
.qg-module-card.disabled { opacity: .55; }
.qg-module-icon {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  color: #fff; font-size: 1.15rem; margin-bottom: .7rem;
}

/* ---------- Kanban ---------- */
.qg-board { display: flex; gap: .85rem; align-items: flex-start; overflow-x: auto; padding-bottom: 1rem; }
.qg-column {
  background: #eceff5; border-radius: 12px; width: 288px; flex: 0 0 288px;
  display: flex; flex-direction: column; max-height: calc(100vh - 190px);
}
.qg-column-head {
  display: flex; align-items: center; gap: .4rem; padding: .65rem .75rem .5rem; cursor: grab;
}
.qg-column-head h2 { font-size: .88rem; font-weight: 650; margin: 0; flex: 1; }
.qg-count { font-size: .72rem; color: var(--qg-muted); background: #dbe2ec; border-radius: 20px; padding: .05rem .45rem; }
.qg-count.over { background: #fecaca; color: #991b1b; }
.qg-cards { padding: 0 .55rem; overflow-y: auto; flex: 1; min-height: 12px; display: flex; flex-direction: column; gap: .45rem; }
.qg-card {
  background: #fff; border-radius: 9px; padding: .55rem .6rem; cursor: pointer;
  box-shadow: 0 1px 2px rgba(15,23,42,.14); font-size: .87rem; border-left: 3px solid transparent;
}
.qg-card:hover { box-shadow: 0 2px 8px rgba(15,23,42,.18); }
.qg-card.done .qg-card-title { text-decoration: line-through; color: var(--qg-muted); }
.qg-card-title { line-height: 1.3; }
.qg-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: .35rem; }
.qg-label-chip { height: 7px; width: 30px; border-radius: 4px; display: inline-block; }
.qg-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .4rem; font-size: .74rem; color: var(--qg-muted); }
.qg-badge-due { border-radius: 5px; padding: .05rem .3rem; }
.qg-badge-due.late { background: #fee2e2; color: #b91c1c; }
.qg-badge-due.today { background: #fef3c7; color: #92400e; }
.qg-column-foot { padding: .4rem .55rem .6rem; }
.qg-ghost { opacity: .45; }
.qg-drag { transform: rotate(1.5deg); }
.qg-add-column { width: 288px; flex: 0 0 288px; background: rgba(255,255,255,.65); border: 1px dashed #cbd5e1; border-radius: 12px; padding: .7rem; }
.qg-prio { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* ---------- Auth ---------- */
.qg-auth { min-height: 100vh; display: grid; place-items: center; background: #0f172a; padding: 1.5rem; }
.qg-auth-card { background: #fff; border-radius: 16px; padding: 2rem; width: 100%; max-width: 400px; }

@media (max-width: 900px) {
  .qg-shell { flex-direction: column; }
  .qg-sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .qg-nav { flex-direction: row; flex-wrap: wrap; }
  .qg-nav-soon { display: none; }
  .qg-brand { padding-bottom: 0; }
  .qg-user { border: 0; margin: 0 0 0 auto; padding: 0; }
  .qg-main { padding: 1rem; }
}

/* ---------- Hábitos ---------- */
.qg-habit-list { display: flex; flex-direction: column; gap: .6rem; }
.qg-habit-card {
  background: var(--qg-panel); border: 1px solid var(--qg-border); border-radius: 14px;
  padding: .8rem 1rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.qg-habit-main { display: flex; align-items: center; gap: .75rem; min-width: 220px; flex: 1 1 220px; }
.qg-habit-icon {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  color: #fff; font-size: 1rem; flex: 0 0 38px;
}
.qg-habit-strip { display: flex; gap: .3rem; }
.qg-habit-side { display: flex; align-items: center; gap: .75rem; margin-left: auto; }

.qg-dot {
  width: 34px; height: 38px; border-radius: 9px; border: 1.5px solid var(--qg-border);
  background: #fff; color: var(--qg-muted); font-size: .7rem; font-weight: 600;
  display: grid; place-items: center; cursor: pointer; transition: transform .1s, background .12s;
  padding: 0;
}
.qg-dot:hover { transform: translateY(-2px); }
.qg-dot.done { color: #fff; }
.qg-dot.off { background: #f1f5f9; color: #cbd5e1; border-style: dashed; }
.qg-dot.now { box-shadow: 0 0 0 2px rgba(37,99,235,.35); }

/* Grade do mês */
.qg-grid { border-collapse: separate; border-spacing: 3px; font-size: .75rem; margin: .5rem; }
.qg-grid th { font-weight: 600; color: var(--qg-muted); text-align: center; padding: 0 1px; }
.qg-grid th.weekend { color: #94a3b8; }
.qg-grid-dow { font-size: .62rem; text-transform: uppercase; opacity: .7; }
.qg-grid-name { position: sticky; left: 0; background: var(--qg-panel); text-align: left !important;
  min-width: 150px; max-width: 150px; padding-right: .5rem !important; z-index: 1; }
.qg-grid-chip { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 9px; }
.qg-grid-total { font-weight: 600; color: var(--qg-muted); text-align: center; padding-left: .4rem; }
.qg-grid td.today .qg-grid-cell { box-shadow: 0 0 0 2px rgba(37,99,235,.4); }
.qg-grid-cell {
  width: 20px; height: 20px; border-radius: 5px; border: 1px solid var(--qg-border);
  background: #fff; display: block; cursor: pointer; padding: 0;
}
.qg-grid-cell:hover { border-color: #94a3b8; }
.qg-grid-cell.off { background: #f1f5f9; border-style: dashed; }
.qg-grid-cell.future { background: #f8fafc; border-style: dotted; cursor: default; }

/* Mapa de calor do detalhe */
.qg-heat { display: flex; flex-wrap: wrap; gap: 4px; }
.qg-heat-cell {
  width: 20px; height: 20px; border-radius: 5px; border: 1px solid var(--qg-border); background: #fff;
}
.qg-heat-cell.off { background: #f1f5f9; border-style: dashed; }

/* ---------- Gastos ---------- */
/* Papéis de cor da visualização. Tons da paleta de referência validada:
   série sequencial azul (#2a78d6) e sua trilha clara (passo 100). */
:root {
  --viz-series-1: #2a78d6;
  --viz-track: #cde2fb;
  --viz-good: #0ca30c;
  --viz-warning: #fab219;
  --viz-critical: #d03b3b;
}

.qg-panel {
  background: var(--qg-panel); border: 1px solid var(--qg-border);
  border-radius: 14px; padding: 1rem 1.1rem;
}
.qg-panel-head { display: flex; align-items: baseline; gap: .75rem; margin-bottom: .75rem; }
.qg-panel-head h2 { font-size: .95rem; font-weight: 650; margin: 0; flex: 1; }

.qg-subnav { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1rem; }
.qg-subnav a {
  font-size: .84rem; padding: .35rem .7rem; border-radius: 8px;
  color: var(--qg-muted); text-decoration: none;
}
.qg-subnav a:hover { background: #e8ecf3; color: var(--qg-ink); }
.qg-subnav a.active { background: var(--qg-panel); color: var(--qg-ink); font-weight: 600;
  border: 1px solid var(--qg-border); }

/* Fichas de número (KPI). Valor em algarismos proporcionais — tabular só em coluna. */
.qg-kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; }
.qg-stat {
  background: var(--qg-panel); border: 1px solid var(--qg-border);
  border-radius: 14px; padding: .9rem 1rem;
}
.qg-stat-label { font-size: .78rem; color: var(--qg-muted); }
.qg-stat-value { font-size: 1.6rem; font-weight: 650; line-height: 1.2; }
.qg-stat-value.is-negative { color: var(--viz-critical); }
.qg-stat-delta { font-size: .76rem; margin-top: .15rem; color: var(--qg-muted); }
.qg-stat-delta.is-good { color: var(--viz-good); }
.qg-stat-delta.is-bad { color: var(--viz-critical); }
.qg-stat-period { color: var(--qg-muted); font-weight: 400; }

/* Lista de barras: magnitude em um tom só, ponta arredondada, base reta. */
.qg-barlist { display: flex; flex-direction: column; gap: .5rem; }
.qg-bar-row { display: grid; grid-template-columns: 150px 1fr 130px; align-items: center; gap: .6rem; }
.qg-bar-label { display: flex; align-items: center; gap: .4rem; font-size: .84rem; min-width: 0; }
.qg-bar-track { background: #f1f5f9; border-radius: 4px; height: 14px; overflow: hidden; }
.qg-bar-fill {
  height: 100%; background: var(--viz-series-1);
  border-radius: 0 4px 4px 0; min-width: 3px;
}
.qg-bar-value { text-align: right; font-size: .84rem; font-variant-numeric: tabular-nums; }
.qg-bar-share { color: var(--qg-muted); font-size: .74rem; margin-left: .3rem; }

/* Medidor de orçamento: trilha é um passo claro da própria rampa do estado. */
.qg-meter { margin-bottom: .9rem; }
.qg-meter:last-child { margin-bottom: 0; }
.qg-meter-head { display: flex; justify-content: space-between; gap: .5rem; font-size: .84rem; margin-bottom: .25rem; }
.qg-meter-state { font-size: .74rem; font-weight: 600; white-space: nowrap; }
.qg-meter-track { border-radius: 4px; height: 14px; overflow: hidden; }
.qg-meter-fill { height: 100%; border-radius: 0 4px 4px 0; min-width: 3px; }
.qg-meter-foot {
  display: flex; justify-content: space-between; font-size: .74rem;
  color: var(--qg-muted); margin-top: .2rem; font-variant-numeric: tabular-nums;
}

.qg-chip { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: 0 0 9px; }
.qg-num { font-variant-numeric: tabular-nums; }
.qg-income { color: var(--viz-good); font-weight: 600; }
.qg-expense { color: var(--viz-critical); font-weight: 600; }

.qg-table thead th {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--qg-muted); font-weight: 600; border-bottom: 1px solid var(--qg-border);
}
.qg-table td { font-size: .87rem; }
.qg-filterbar {
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: center;
  padding: .75rem 1rem; border-bottom: 1px solid var(--qg-border);
}
.qg-filterbar .form-control, .qg-filterbar .form-select { width: auto; min-width: 140px; }

@media (max-width: 720px) {
  .qg-bar-row { grid-template-columns: 110px 1fr; }
  .qg-bar-value { grid-column: 2; text-align: left; }
}

/* ---------- Academia ---------- */
.qg-setlist { display: flex; flex-wrap: wrap; gap: .4rem; }
.qg-set {
  display: inline-flex; align-items: center; gap: .4rem;
  background: #f1f5f9; border-radius: 8px; padding: .2rem .5rem; font-size: .82rem;
}
.qg-set-n {
  width: 18px; height: 18px; border-radius: 50%; background: #cbd5e1; color: #0f172a;
  font-size: .66rem; font-weight: 700; display: grid; place-items: center;
}

/* Gráfico de linha: uma série, sem caixa de legenda — o título nomeia a linha. */
.qg-chart {
  background: var(--qg-panel); border: 1px solid var(--qg-border);
  border-radius: 14px; padding: 1rem 1.1rem; margin: 0 0 1rem; position: relative;
}
.qg-chart-head { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.qg-chart-head h2 { font-size: .95rem; font-weight: 650; margin: 0; }
.qg-chart-head p { font-size: .78rem; color: var(--qg-muted); margin: 0; }
.qg-chart-change { margin-left: auto; font-size: .82rem; font-weight: 600; text-align: right; }
.qg-chart-change span { display: block; font-weight: 400; font-size: .72rem; color: var(--qg-muted); }
.qg-chart-change.is-up { color: var(--viz-good); }
.qg-chart-change.is-down { color: var(--viz-critical); }
.qg-chart-change.is-flat { color: var(--qg-muted); }

.qg-chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.qg-grid-line { stroke: var(--qg-border); stroke-width: 1; }   /* fino e sólido, recessivo */
.qg-axis-text { fill: var(--qg-muted); font-size: 11px; }
.qg-line {
  fill: none; stroke: var(--viz-series-1); stroke-width: 2;
  stroke-linejoin: round; stroke-linecap: round;
}
.qg-dot-mark {                                   /* 8px com anel da superfície */
  fill: var(--viz-series-1); stroke: var(--qg-panel); stroke-width: 2;
}
.qg-chart-label { fill: var(--qg-ink); font-size: 12px; font-weight: 650; }
.qg-crosshair { stroke: var(--qg-muted); stroke-width: 1; opacity: .45; }
.qg-hit { fill: transparent; cursor: pointer; }
.qg-hit:hover ~ .qg-dot-mark { stroke-width: 3; }

.qg-tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: #0f172a; color: #fff; font-size: .74rem; line-height: 1.35;
  padding: .35rem .55rem; border-radius: 7px; max-width: 260px;
  transform: translate(-50%, -140%); white-space: nowrap;
}

/* ---------- Dieta ---------- */
.qg-hero-label { font-size: .78rem; color: var(--qg-muted); }
.qg-hero {                        /* figura principal: uma só por tela */
  font-size: 3rem; font-weight: 650; line-height: 1.05; letter-spacing: -.02em;
}
.qg-hero span { font-size: 1rem; font-weight: 500; color: var(--qg-muted); }
.qg-macro-tag {
  display: inline-grid; place-items: center; width: 18px; height: 18px;
  border-radius: 5px; background: #e2e8f0; color: #334155;
  font-size: .66rem; font-weight: 700;
}
.qg-meal-empty { border-style: dashed; background: rgba(255,255,255,.6); }

/* ---------- Agenda ---------- */
.qg-badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 9px; background: #db2777; color: #fff;
  font-size: .66rem; font-weight: 700; margin-left: auto;
}

.qg-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.qg-cal-head {
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--qg-muted); text-align: center; padding: .25rem 0 .35rem;
}
.qg-cal-cell {
  background: var(--qg-panel); border: 1px solid var(--qg-border); border-radius: 8px;
  min-height: 104px; padding: .3rem; display: flex; flex-direction: column; gap: 2px;
  overflow: hidden;
}
.qg-cal-cell.is-out { background: #f8fafc; opacity: .6; }
.qg-cal-cell.is-weekend { background: #f9fafc; }
.qg-cal-cell.is-today { border-color: #7c3aed; box-shadow: inset 0 0 0 1px #7c3aed; }
.qg-cal-day { font-size: .74rem; font-weight: 600; color: var(--qg-muted); }
.qg-cal-cell.is-today .qg-cal-day { color: #7c3aed; }

.qg-chip-event {
  display: flex; align-items: center; gap: 4px; text-decoration: none;
  font-size: .72rem; line-height: 1.25; color: var(--qg-ink);
  background: color-mix(in srgb, var(--chip) 12%, #fff);
  border-left: 3px solid var(--chip);
  border-radius: 4px; padding: 2px 4px; min-width: 0;
}
.qg-chip-event:hover { background: color-mix(in srgb, var(--chip) 22%, #fff); }
.qg-chip-event.is-cont { opacity: .72; border-left-style: dashed; }
.qg-chip-time { font-variant-numeric: tabular-nums; color: var(--qg-muted); flex: none; }
.qg-chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--chip); flex: none; }

.qg-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
.qg-week-col {
  background: var(--qg-panel); border: 1px solid var(--qg-border);
  border-radius: 12px; padding: .5rem; min-height: 180px;
}
.qg-week-col.is-weekend { background: #f9fafc; }
.qg-week-col.is-today { border-color: #7c3aed; box-shadow: inset 0 0 0 1px #7c3aed; }
.qg-week-head {
  display: flex; flex-direction: column; align-items: center;
  border-bottom: 1px solid var(--qg-border); padding-bottom: .35rem; margin-bottom: .4rem;
}
.qg-week-head span { font-size: .68rem; text-transform: uppercase; color: var(--qg-muted); }
.qg-week-head strong { font-size: .82rem; }
.qg-week-body { display: flex; flex-direction: column; gap: 3px; }

@media (max-width: 900px) {
  .qg-cal-cell { min-height: 74px; font-size: .7rem; }
  .qg-week { grid-template-columns: 1fr; }
  .qg-week-col { min-height: auto; }
  .qg-week-head { flex-direction: row; gap: .5rem; justify-content: flex-start; }
}
