:root {
  --purple: #5540e8;
  --purple-dark: #3f2fc6;
  --purple-soft: #efedff;
  --blue: #0798f6;
  --green: #12a52a;
  --ink: #192033;
  --muted: #6c7486;
  --line: #e6e9f1;
  --panel: #ffffff;
  --soft: #f4f6fb;
  --danger: #fa3d4b;
  /* Cores de dados: uma série, um hue. Validadas em light sobre superfície
     branca com o validador da skill (contraste, banda de lightness, croma). */
  --mark: #5540e8;          /* barras e preenchimento dos medidores */
  --meter-track: #aa9df5;   /* passo claro da MESMA rampa: 2.37:1 vs branco */
  --axis: #d8dce7;          /* linha de base, hairline recessiva */
  --reference: #8f97ad;     /* linha da meta */
  --shadow: 0 14px 40px rgba(43, 51, 89, .11);
  --card-shadow: 0 3px 11px rgba(42, 55, 96, .04);
  --radius: 18px;
  /* Altura da barra de navegação no celular, usada para reservar espaço
     no fim da página e para posicionar o cronômetro acima dela. */
  --tabbar: 62px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
h1, h2, h3 { font-family: Sora, system-ui, sans-serif; }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; border-radius: 8px; }

.icon { width: 22px; height: 22px; flex: none; }

.brand { font-family: Sora, sans-serif; color: var(--purple); font-size: 30px; letter-spacing: -1.5px; font-weight: 800; }
.brand span { color: var(--ink); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--blue); color: #fff; border-radius: 11px;
  min-height: 46px; padding: 0 18px; font-weight: 700;
  box-shadow: 0 7px 16px rgba(7, 152, 246, .22);
}
.button:hover { filter: brightness(.96); }
.button .icon { width: 18px; height: 18px; }
.button-secondary { color: var(--purple); background: var(--purple-soft); box-shadow: none; }
.button-block { width: 100%; }

.link { color: var(--purple); font-size: 12px; font-weight: 700; padding: 4px; border-radius: 7px; white-space: nowrap; }
.link:hover { text-decoration: underline; }

.field { display: grid; gap: 7px; margin-bottom: 16px; color: #4a5263; font-size: 13px; font-weight: 600; }
.field input, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  min-height: 46px; padding: 0 13px; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus { border-color: var(--purple); outline: none; box-shadow: 0 0 0 3px rgba(85, 64, 232, .13); }

/* ----------------------------------------------------------------- login -- */

.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 85% 10%, #d8d3ff 0, transparent 28%), linear-gradient(135deg, #f8f9ff, #e8e8ff);
}
.auth-card { width: min(100%, 430px); background: #fff; border-radius: 28px; padding: 38px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 26px; margin: 30px 0 8px; letter-spacing: -.6px; }
.auth-card p { color: var(--muted); margin: 0 0 26px; line-height: 1.55; }
.auth-note { font-size: 12px; color: var(--muted); text-align: center; margin: 20px 0 0 !important; }

/* ------------------------------------------------------- layout / menu ---- */

.shell { min-height: 100vh; display: grid; grid-template-columns: 252px 1fr; }

.sidebar {
  background: var(--purple); color: #fff;
  display: flex; flex-direction: column; gap: 28px;
  padding: 26px 16px; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { padding: 0 10px; }
.sidebar .brand { color: #fff; }
.sidebar .brand span { color: #bfb7ff; }

.nav { display: grid; gap: 6px; }
.nav button {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 13px; border-radius: 12px;
  color: #ded9ff; font-size: 14px; text-align: left; width: 100%;
}
.nav button:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.nav button.active { background: rgba(255, 255, 255, .18); color: #fff; font-weight: 700; }
.nav-label-short { display: none; }

.sidebar-tip {
  margin-top: auto; background: rgba(255, 255, 255, .13);
  padding: 15px; border-radius: 14px; font-size: 12px; line-height: 1.55; color: #f1efff;
}
.sidebar-tip strong { display: block; margin-bottom: 5px; }

.main { padding: 33px clamp(18px, 4vw, 56px) 90px; max-width: 1440px; width: 100%; margin: 0 auto; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 26px; }
.eyebrow { color: var(--purple); text-transform: uppercase; font-size: 11px; letter-spacing: .11em; font-weight: 800; margin: 0; }
.topbar h1 { margin: 6px 0 0; font-size: clamp(23px, 3vw, 31px); letter-spacing: -1.1px; }

.avatar {
  display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 50%; overflow: hidden; color: #fff; font-weight: 800; font-size: 14px;
  background: linear-gradient(135deg, #f7aa84, #5540e8);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 76px; height: 76px; font-size: 23px; }
.avatar-button { border-radius: 50%; padding: 3px; flex: none; }
.avatar-button.active { box-shadow: 0 0 0 2px var(--purple); }

/* ----------------------------------------------------------------- cards -- */

.grid { display: grid; gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 22px; }
.card h2 { margin: 0 0 6px; font-size: 19px; letter-spacing: -.3px; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-title h2 { margin: 0; font-size: 16px; }
.card-sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.count { background: var(--purple-soft); color: var(--purple); font-size: 12px; font-weight: 800; border-radius: 999px; padding: 3px 10px; }

/* Cartão principal do dashboard: o tempo de hoje e a ação de iniciar o foco
   ficam no topo, antes de qualquer número secundário. */
.hero { background: linear-gradient(135deg, #ffffff, #f7f5ff); border-color: #ded8ff; }
.hero-main { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.hero-label { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.hero-time strong { display: block; font-family: Sora, sans-serif; font-size: clamp(38px, 7vw, 52px); letter-spacing: -1.8px; margin: 4px 0 6px; }
.hero-next { margin: 0; color: var(--muted); font-size: 13px; }
.hero-next b { color: var(--ink); }
.hero-cta { min-height: 50px; padding: 0 22px; }

.stats { grid-template-columns: repeat(4, 1fr); margin-top: 18px; }
.stat { padding: 18px; }
.stat small { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.stat strong { display: block; font-size: 26px; margin-top: 8px; font-family: Sora, sans-serif; letter-spacing: -.8px; }
.stat strong em { font-style: normal; font-size: 15px; color: var(--muted); font-weight: 600; }
.trend { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }

.columns { grid-template-columns: 1.25fr .75fr; margin-top: 18px; }

.progress-row { margin-top: 20px; }
.progress-label { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.progress-label span { color: var(--muted); font-weight: 500; }
.progress-label span b { color: var(--ink); }
/* Medidor: preenchimento chapado no hue de dado, trilha num passo claro da
   mesma rampa -- o estado se lê ao longo da barra inteira. */
.bar { height: 10px; background: var(--meter-track); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--mark); transition: width .3s ease; }

/* --------------------------------------------------------------- gráfico -- */

.chart { --chart-gap: 8px; padding-top: 22px; margin: 0; }
.chart-plot { position: relative; height: 150px; border-bottom: 1px solid var(--axis); }
.chart-bars { position: absolute; inset: 0; z-index: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--chart-gap); }
/* A coluna toda é o alvo de hover/foco -- bem maior que a barra, como manda a
   regra de alvo mínimo. A barra é fina e cresce da linha de base. */
.chart-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; border-radius: 8px 8px 0 0; }
.chart-col:hover, .chart-col:focus { background: rgba(85, 64, 232, .07); }
.chart-bar { position: relative; width: 100%; max-width: 24px; background: var(--mark); border-radius: 4px 4px 0 0; transition: height .3s ease; }
/* Valor do dia atual: rótulo direto e permanente. Os demais dias ficam no
   tooltip e na tabela equivalente, para não poluir com um número por barra. */
.chart-value, .chart-tip {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  margin-bottom: 6px; font-size: 11px; font-weight: 700; color: var(--ink);
  white-space: nowrap; pointer-events: none;
}
.chart-tip { opacity: 0; transition: opacity .15s ease; background: var(--ink); color: #fff; border-radius: 6px; padding: 3px 7px; font-size: 10.5px; }
.chart-col:hover .chart-tip, .chart-col:focus .chart-tip { opacity: 1; }
/* Linha da meta diária: dá escala ao gráfico, senão as barras não significam
   nada. Hairline sólida -- tracejado vira ruído visual. */
.chart-goal { position: absolute; left: 0; right: 0; z-index: 2; border-top: 1px solid var(--reference); pointer-events: none; }
.chart-goal span { position: absolute; right: 0; top: -18px; font-size: 10px; font-weight: 700; color: var(--muted); background: var(--panel); padding: 0 4px; }
.chart-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--chart-gap); margin-top: 9px; text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; }
/* Texto usa token de texto, nunca a cor do dado. */
.chart-days .today { color: var(--ink); font-weight: 800; }

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* --------------------------------------------------------------- listas --- */

.task-list { display: grid; }
.task { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid #f1f2f6; }
.task:last-child { border-bottom: 0; padding-bottom: 0; }
.task label { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; }
.task input { accent-color: var(--purple); width: 19px; height: 19px; flex: none; }
.task span { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.task.done span { color: #9aa1ae; text-decoration: line-through; }
.task small { flex: none; padding: 5px 9px; background: var(--purple-soft); color: var(--purple); border-radius: 7px; font-size: 10.5px; font-weight: 800; }

.objective-list { display: grid; gap: 10px; }
.objective { padding: 14px; display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 13px; }
.objective-icon { width: 38px; height: 38px; flex: none; border-radius: 10px; background: var(--purple-soft); color: var(--purple); display: grid; place-items: center; }
.objective-body { flex: 1; min-width: 0; }
.objective-body strong { font-size: 13.5px; overflow-wrap: anywhere; }
.objective-body p { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin: 4px 0 0; }
.tag { background: var(--purple-soft); color: var(--purple); border-radius: 6px; padding: 2px 7px; font-weight: 700; }

.icon-button { color: var(--muted); font-size: 15px; width: 34px; height: 34px; flex: none; border-radius: 9px; display: grid; place-items: center; }
.icon-button:hover { background: #f2f3f7; color: var(--danger); }

.empty { text-align: center; color: var(--muted); padding: 26px 10px; font-size: 13px; margin: 0; }

/* ------------------------------------------------------------ formulários - */

.page { max-width: 940px; display: grid; gap: 18px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.add-task { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.add-task .field { margin-bottom: 0; }
.add-task .grow { flex: 1 1 220px; }

.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.settings-row p { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.switch { position: relative; width: 46px; height: 27px; flex: none; background: #d5d8e1; border-radius: 30px; transition: background .2s; }
.switch i { transition: left .2s; width: 21px; height: 21px; border-radius: 50%; position: absolute; left: 3px; top: 3px; background: #fff; }
.switch.on { background: var(--purple); }
.switch.on i { left: 22px; }

form.card > .button { margin-top: 22px; }

.profile-head { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.profile-head h2 { margin: 0; }
.profile-head .card-sub { margin: 4px 0 8px; }
.upload-label { color: var(--purple); font-size: 12px; font-weight: 700; cursor: pointer; }
.upload-label input { display: none; }

/* ----------------------------------------------------------- cronômetro --- */

.timer-scrim { display: none; }
.timer {
  position: fixed; z-index: 56; right: 24px; bottom: 24px;
  width: min(340px, calc(100vw - 32px));
  background: #17213c; color: #fff; border-radius: 19px;
  box-shadow: 0 18px 55px rgba(21, 30, 57, .35); padding: 15px;
}
.timer-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.timer-title { display: flex; align-items: center; gap: 9px; font-size: 12px; font-weight: 700; color: #d8ddf1; }
.timer-title .icon { width: 17px; height: 17px; }
.timer .min-clock { font-family: Sora, sans-serif; font-size: 14px; color: #fff; font-variant-numeric: tabular-nums; }
.timer .icon-button { color: #cbd3ea; }
.timer .icon-button:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.timer h3 { font-family: Sora, sans-serif; margin: 12px 0 2px; font-size: 30px; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.timer p { margin: 0 0 13px; color: #aeb8d2; font-size: 11.5px; }
.timer-controls { display: flex; gap: 8px; }
.timer .button { min-height: 38px; flex: 1; font-size: 12.5px; }
.timer .button-secondary { color: #fff; background: rgba(255, 255, 255, .14); }
.timer.running .min-clock { color: #7ef29a; }
.timer.minimized { width: auto; padding: 8px 8px 8px 14px; border-radius: 999px; }
.timer.minimized .timer-body { display: none; }

/* ============================================================== responsivo = */

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }

  /* No celular o menu vira barra inferior fixa, com ícone e rótulo visíveis.
     Antes os botões ficavam com font-size:0 e o menu sumia por completo. */
  .sidebar {
    position: fixed; inset: auto 0 0 0; height: auto; z-index: 50;
    flex-direction: row; gap: 0; padding: 6px 6px calc(6px + var(--safe-bottom));
    background: rgba(255, 255, 255, .97);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 24px rgba(23, 33, 60, .07);
  }
  .sidebar-brand, .sidebar-tip { display: none; }

  .nav { display: flex; width: 100%; gap: 2px; }
  .nav button {
    flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px;
    padding: 7px 2px; font-size: 10px; line-height: 1.2;
    text-align: center; color: var(--muted); border-radius: 12px;
  }
  .nav button .icon { width: 23px; height: 23px; }
  .nav button:hover { background: transparent; color: var(--purple); }
  .nav button.active { background: transparent; color: var(--purple); font-weight: 800; }
  .nav button.active .icon { stroke-width: 2.3; }
  /* O perfil é alcançado pelo avatar no cabeçalho: 5 abas cabem, 6 não. */
  .nav button[data-nav="profile"] { display: none; }
  .nav-label { display: none; }
  .nav-label-short { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

  /* Espaço no fim da página para a barra inferior e o cronômetro recolhido. */
  .main { padding: 26px clamp(16px, 4vw, 32px) calc(var(--tabbar) + 76px + var(--safe-bottom)); }

  .columns { grid-template-columns: 1fr; }

  /* Recolhido, o cronômetro é uma pílula ancorada acima do menu. Expandido,
     vira folha inferior modal com fundo escurecido -- antes ele ficava sempre
     aberto por cima do conteúdo e cobria os botões do fim da página. */
  .timer { right: 12px; left: 12px; width: auto; bottom: calc(var(--tabbar) + 12px + var(--safe-bottom)); }
  /* Recolhido vira uma barra ancorada logo acima do menu, e o padding do .main
     reserva a altura dela: assim ela nunca fica por cima de um botão. */
  .timer.minimized {
    left: 0; right: 0; bottom: calc(var(--tabbar) + var(--safe-bottom));
    width: auto; border-radius: 15px 15px 0 0; padding: 11px 16px;
  }
  .timer-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(15, 20, 38, .38); }
}

@media (max-width: 620px) {
  .auth-card { padding: 27px 22px; }
  .topbar { margin-bottom: 20px; }
  .topbar h1 { font-size: 23px; }

  .card { padding: 18px; border-radius: 16px; }
  .grid { gap: 14px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat { padding: 15px; }
  .stat strong { font-size: 21px; margin-top: 6px; }
  .stat small { font-size: 12px; }

  .hero-main { display: grid; }
  .hero-cta { width: 100%; }

  .form-row { grid-template-columns: 1fr; }
  .add-task { display: grid; }
  .add-task .button { width: 100%; }

  .chart-plot { height: 120px; }
  .chart { --chart-gap: 5px; }
  .chart-goal span { font-size: 9px; }

}

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