/* ── CSS VARIABLES ─────────────────────────────────────────── */
:root {
  /* Cores de fundo de cada tag (usadas no gradiente diagonal) */
  --tag-bg-plantao: rgba(245,101,101,0.28);
  --tag-bg-ferias:  rgba(132,204,22,0.28);
  --tag-bg-abono:   rgba(159,122,234,0.28);
  --tag-bg-extra1:  rgba(246,150,58,0.28);
  --tag-bg-extra2:  rgba(0,181,216,0.28);
  --tag-bg-extra3:  rgba(72,187,120,0.28);

  --bg:         #f0f4f8;
  --surface:    #ffffff;
  --surface-2:  #f7fafc;
  --surface-3:  #edf2f7;
  --border:     #e2e8f0;
  --text:       #2d3748;
  --text-2:     #4a5568;
  --text-3:     #718096;
  --text-muted: #a0aec0;
  --text-faint: #cbd5e0;
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.07);
  --shadow-md:  0 2px 6px rgba(0,0,0,0.09);
  --accent:     #4299e1;
}

body.dark {
  --tag-bg-plantao: rgba(245,101,101,0.38);
  --tag-bg-ferias:  rgba(132,204,22,0.38);
  --tag-bg-abono:   rgba(159,122,234,0.38);
  --tag-bg-extra1:  rgba(246,150,58,0.38);
  --tag-bg-extra2:  rgba(0,181,216,0.38);
  --tag-bg-extra3:  rgba(72,187,120,0.38);

  --bg:         #1a202c;
  --surface:    #2d3748;
  --surface-2:  #374151;
  --surface-3:  #4a5568;
  --border:     #4a5568;
  --text:       #f0f4f8;
  --text-2:     #e2e8f0;
  --text-3:     #a0aec0;
  --text-muted: #718096;
  --text-faint: #4a5568;
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.35);
  --shadow-md:  0 2px 6px rgba(0,0,0,0.45);
  --accent:     #4299e1;
}

/* ── RESET & BASE ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background 0.25s, color 0.25s;
}

/* ── HEADER (global) ────────────────────────────────────────── */
header {
  background: var(--surface);
  padding: 8px 20px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 20;
  flex-shrink: 0;
}

/* ── THEME TOGGLE — slider sol/lua ─────────────────────────── */
.theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  width: 64px;
  height: 30px;
  border-radius: 15px;
  background: #1a1a2e;
  border: 2px solid rgba(255,255,255,0.15);
  cursor: pointer;
  padding: 0 4px;
  gap: 0;
  transition: background 0.35s;
  flex-shrink: 0;
  overflow: hidden;
}
.theme-toggle.dark {
  background: #1a1a2e;
}
body:not(.dark) .theme-toggle {
  background: #87ceeb;
  border-color: rgba(0,0,0,0.1);
}

.theme-toggle-icon {
  font-size: 0.85rem;
  line-height: 1;
  z-index: 1;
  flex-shrink: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.theme-toggle-sun  { margin-right: auto; }
.theme-toggle-moon { margin-left: auto; }

/* Modo claro: sol visível, lua apagada — knob à direita (sobre a lua) */
body:not(.dark) .theme-toggle .theme-toggle-sun  { opacity: 1; }
body:not(.dark) .theme-toggle .theme-toggle-moon { opacity: 0.35; }

/* Modo escuro: lua visível, sol apagado — knob à esquerda (sobre o sol) */
body.dark .theme-toggle .theme-toggle-sun  { opacity: 0.35; }
body.dark .theme-toggle .theme-toggle-moon { opacity: 1; }

.theme-toggle-knob {
  position: absolute;
  top: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}
/* Modo claro: knob à direita (cobre lua) */
body:not(.dark) .theme-toggle-knob { left: calc(100% - 24px); }
/* Modo escuro: knob à esquerda (cobre sol) */
body.dark .theme-toggle-knob { left: 2px; }

/* ── BARRA ESPECÍFICA DO CALENDÁRIO ─────────────────────────── */
.cal-subbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 7px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  flex-wrap: wrap;
  z-index: 10;
}

.cal-subbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.app-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.app-title span { color: var(--accent); }

.app-logo-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

/* Year navigation */
.year-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-3);
  border-radius: 50px;
  padding: 4px 10px;
}
.year-nav button {
  background: var(--surface);
  border: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, color 0.15s;
}
.year-nav button:hover { background: var(--accent); color: white; }
#yearDisplay {
  font-size: 1.05rem;
  font-weight: 700;
  min-width: 46px;
  text-align: center;
  color: var(--text);
}

/* Legend */
.legend {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.leg {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.72rem; font-weight: 600; color: var(--text-3);
  white-space: nowrap;
}
.leg-dot { width: 13px; height: 13px; border-radius: 4px; }
.ld-hoje    { background: #4299e1; }
.ld-plantao { background: #f56565; }
.ld-ferias  { background: #84cc16; }
.ld-abono   { background: #9f7aea; }

/* Editable legend labels */
.leg-label {
  cursor: pointer;
  border-radius: 3px;
  padding: 0 2px;
  transition: background 0.15s;
}
.leg-label:hover {
  background: var(--border);
  text-decoration: underline dotted;
}
.label-edit-input {
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  padding: 0 4px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  outline: none;
  min-width: 50px;
  max-width: 100px;
}

/* Grouped legend tags */
.leg-group {
  display: flex;
  align-items: center;
  background: var(--surface-3);
  border-radius: 8px;
  padding: 3px 4px;
  gap: 0;
}
.leg-group .leg-btn {
  border-radius: 6px;
  padding: 3px 8px;
}
.leg-separator {
  width: 1px;
  height: 14px;
  background: var(--border);
  flex-shrink: 0;
}

/* Remove tag button */
.tag-remove-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0 0 0 3px;
  opacity: 0;
  transition: color 0.12s, opacity 0.15s;
}
.leg-btn:hover .tag-remove-btn { opacity: 1; }
.tag-remove-btn:hover { color: #fc8181; }

/* Add tag button */
.add-tag-btn {
  background: none;
  border: 1.5px dashed var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  margin-left: 4px;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.add-tag-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Extra tags container — display:contents makes children participate directly in the parent flex row */
#extraTagsContainer { display: contents; }

/* Extra category day colours — orange · cyan · verde */
.day.cat-extra1 { background: rgba(246,150,58,0.28);  color: #7b341e; }
.day.cat-extra2 { background: rgba(0,181,216,0.28);   color: #065666; }
.day.cat-extra3 { background: rgba(72,187,120,0.28);  color: #22543d; }
body.dark .day.cat-extra1 { background: rgba(246,150,58,0.38);  color: #fbd38d; }
body.dark .day.cat-extra2 { background: rgba(0,181,216,0.38);   color: #b2f5ea; }
body.dark .day.cat-extra3 { background: rgba(72,187,120,0.38);  color: #c6f6d5; }
.day.cat-extra1 .ddot { background: #f6963a; }
.day.cat-extra2 .ddot { background: #00b5d8; }
.day.cat-extra3 .ddot { background: #48bb78; }

/* Brush mode legend items */
.leg-btn {
  cursor: pointer;
  border-radius: 6px;
  padding: 3px 7px;
  transition: background 0.15s;
}
.leg-btn:hover { background: var(--surface-3); }
.leg-btn.brush-active {
  background: #ebf8ff;
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
body.dark .leg-btn.brush-active { background: #1a365d; }

/* Brush hint */
.brush-hint {
  display: none;
  font-size: 0.7rem;
  font-weight: 600;
  color: #2b6cb0;
  background: #ebf8ff;
  border-radius: 6px;
  padding: 4px 10px;
  white-space: nowrap;
}
body.dark .brush-hint { background: #1a365d; color: #90cdf4; }

.brush-mode .day:not(.empty) { cursor: crosshair !important; }

/* Header action buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hbtn {
  border: none;
  border-radius: 8px;
  padding: 7px 13px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
  white-space: nowrap;
}
.hbtn:hover { opacity: 0.85; transform: scale(1.03); }
.hbtn-scale      { background: var(--surface-3); color: var(--text-2); }
.hbtn-mood-chart { background: var(--surface-3); color: var(--text-2); }
.hbtn-theme      { background: var(--surface-3); color: var(--text-2); }

.hbtn-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
.hbtn-icon-only {
  padding: 7px 10px;
  background: var(--surface-3);
  color: var(--accent);
}

body.dark .hbtn-scale      { background: #744210; color: #fefcbf; }
body.dark .hbtn-mood-chart { background: #1a365d; color: #90cdf4; }

/* ── MOOD CHART MODAL ───────────────────────────────────────── */
.modal-mood-chart {
  width: calc(100vw - 48px) !important;
  max-width: 1400px !important;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mood-chart-periods {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.mcp-btn {
  padding: 5px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.mcp-btn:hover { background: var(--surface-3); color: var(--text-2); }
.mcp-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.mood-chart-canvas {
  width: 100%;
  height: 420px;
  display: block;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.mood-chart-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.mcs-card {
  flex: 1;
  min-width: 110px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  text-align: center;
}
.mcs-card .mcs-val {
  font-size: 1.6rem;
  line-height: 1.2;
  display: block;
}
.mcs-card .mcs-label {
  font-size: 0.68rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 3px;
}

/* ── VIEW SELECTOR DROPDOWN ────────────────────────────────── */
.hbtn-view {
  background: var(--surface-3);
  color: var(--text-2);
  min-width: 110px;
  text-align: left;
}
body.dark .hbtn-view { background: var(--surface-3); color: var(--text-2); }

.cal-view-wrap {
  position: relative;
}

.cal-view-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  min-width: 150px;
  z-index: 200;
  overflow: hidden;
  padding: 4px;
}
.cal-view-menu.open { display: block; }

.cvm-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  background: none;
  border: none;
  border-radius: 7px;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.12s;
}
.cvm-item:hover   { background: var(--surface-3); }
.cvm-item.cvm-active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-weight: 700;
}

/* ── VISUALIZAÇÃO: ANO INTEIRO ──────────────────────────────── */

/* Mesmo sistema do mês: absolute preenche o cal-scroll sem cortar */
.cal-view-year {
  position: absolute !important;
  top: 18px; bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  /* 4 colunas × 3 linhas: cada linha ocupa 1/3 da altura disponível */
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 14px;
}

/* Cada card de mês cresce para preencher sua célula do grid */
.cal-view-year .month-card {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* Days-grid ocupa o espaço restante do card e distribui linhas igual */
.cal-view-year .days-grid {
  flex: 1;
  min-height: 0;
  gap: 1px;
  grid-auto-rows: minmax(0, 1fr);
}

/* Células: sem aspect-ratio — altura definida pela linha do grid */
.cal-view-year .day {
  aspect-ratio: auto;
  min-height: 0;
  overflow: hidden;
}

/* ── Ano: modo scroll (zoom > 65%) — flow normal, linhas proporcionais ──── */
.cal-year-scroll {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  /* grid-template-rows definido via JS com altura proporcional ao zoom */
  gap: 14px;
  margin: 0 auto;
}
/* Cards preenchem a linha do grid com layout flex */
.cal-year-scroll .month-card {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  height: 100%; /* ocupa toda a linha do grid */
}
/* Days-grid preenche o espaço restante do card */
.cal-year-scroll .days-grid {
  flex: 1;
  min-height: 0;
  gap: 1px;
  grid-auto-rows: minmax(0, 1fr);
}
/* Células: sem aspect-ratio, altura definida pela linha do grid */
.cal-year-scroll .day {
  aspect-ratio: auto;
  min-height: 0;
  overflow: hidden;
}

/* ── VISUALIZAÇÃO: MÊS ÚNICO ────────────────────────────────── */

/* position:relative no scroll — usado por mês/ano fit e semana */
.cal-scroll.month-fit {
  overflow: hidden;
  position: relative;
}

/* ─── Mês: estilos gerais (qualquer zoom) ────────────────────── */
.cal-view-month {
  grid-template-columns: 1fr !important; /* único mês ocupa toda a largura */
  margin: 0 auto;                         /* centra no flow normal (scroll mode) */
}

/* ─── Mês: modo FIT (zoom mínimo) — tudo cabe sem scroll ────── */
.cal-view-month.cal-month-fit {
  position: absolute !important;
  top: 18px;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex !important;
  flex-direction: column;
  margin: 0;
}

.cal-view-month.cal-month-fit .month-card {
  flex: 1;
  min-height: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
  padding: 20px 18px 12px;
  box-sizing: border-box;
}

/* Days-grid preenche o restante e distribui linhas igual */
.cal-view-month.cal-month-fit .days-grid {
  flex: 1;
  min-height: 0;
  gap: 4px;
  grid-auto-rows: minmax(0, 1fr);
}

/* Células fit: altura definida pela grade (sem aspect-ratio) */
.cal-view-month.cal-month-fit .day {
  aspect-ratio: auto;
  min-height: 0;
  overflow: hidden;
}

/* ── Mês: modo scroll (zoom > 65%) — flow normal, altura proporcional ─── */
.cal-month-scroll {
  grid-template-columns: 1fr !important;
  margin: 0 auto;
  /* min-height definido via JS com altura proporcional ao zoom */
}
/* Card preenche a altura mínima do container com layout flex */
.cal-month-scroll .month-card {
  min-height: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 20px 18px 12px;
  height: 100%; /* ocupa o container */
}
/* Days-grid preenche o espaço restante do card */
.cal-month-scroll .days-grid {
  flex: 1;
  min-height: 0;
  gap: 4px;
  grid-auto-rows: minmax(0, 1fr);
}
/* Células: sem aspect-ratio, altura definida pelas linhas do grid */
.cal-month-scroll .day {
  aspect-ratio: auto;
  min-height: 0;
  overflow: hidden;
}

/* ─── Mês: estilos de célula comuns (fit e scroll) ───────────── */
.cal-view-month .month-name {
  font-size: 1.1rem;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.cal-view-month .wk-headers {
  margin-bottom: 6px;
  flex-shrink: 0;
}
.cal-view-month .wh { font-size: 0.75rem; font-weight: 600; }

.cal-view-month .day {
  border-radius: 10px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 6px 4px 4px;
}
.cal-view-month .day > span:first-child {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 2px;
  flex-shrink: 0;
  width: 100%;
  text-align: center;
}

/* Dots saem do posicionamento absoluto */
.cal-view-month .day-dots {
  position: static;
  margin-top: auto;
  justify-content: center;
  gap: 4px;
}
.cal-view-month .ddot      { width: 8px; height: 8px; }
.cal-view-month .ddot-proj { width: 12px; height: 12px; }

.cal-view-month .day-deadline-bar { display: none; }
.cal-view-month .day-star { top: 3px; right: 4px; font-size: 0.6rem; }

.cal-view-month .day:hover       { transform: scale(1.04); z-index: 3; }
.cal-view-month .day.today       { transform: none; }
.cal-view-month .day.today:hover { transform: scale(1.03); }

/* Detalhes do mês ampliado */
.mcd-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 3px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}
.mcd-item {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.67rem;
  line-height: 1.3;
  border-radius: 4px;
  padding: 1px 4px;
  overflow: hidden;
  background: rgba(0,0,0,0.045);
  white-space: nowrap;
}
body.dark .mcd-item { background: rgba(255,255,255,0.07); }
.mcd-reminder { background: rgba(159,122,234,0.15) !important; }
body.dark .mcd-reminder { background: rgba(159,122,234,0.22) !important; }
.mcd-todo     { background: rgba(66,153,225,0.12) !important; }
body.dark .mcd-todo { background: rgba(66,153,225,0.18) !important; }
.mcd-proj     { background: rgba(72,187,120,0.12) !important; }
body.dark .mcd-proj { background: rgba(72,187,120,0.18) !important; }
.mcd-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mcd-dot-sq { border-radius: 2px; }
.mcd-icon   { font-size: 0.62rem; flex-shrink: 0; line-height: 1; }
.mcd-prog   { color: var(--text-3); }
.mcd-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  color: var(--text-2);
}

/* ── VISUALIZAÇÃO: SEMANA ──────────────────────────────────── */
.cal-view-week {
  grid-template-columns: 1fr !important;
  /* mesmo truque do mês: absolute para preencher o cal-scroll sem cortar */
  position: absolute !important;
  top: 18px;
  bottom: 18px;
  left: 20px;
  right: 20px;
  width: auto !important;
}

.week-view {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr)); /* minmax(0,1fr) impede as colunas de expandir além da largura disponível */
  gap: 6px;
  width: 100%;
  height: 100%;
  align-items: stretch;
}

/* Corpo scrollável de cada coluna */
.wv-col-expanded {
  min-height: 0;
  cursor: default;
}
.wv-col-expanded:hover { box-shadow: var(--shadow-sm); }

.wv-body {
  flex: 1;
  min-height: 0;   /* ESSENCIAL: sem isso o flex não cria scroll — cresce até o conteúdo */
  overflow-y: auto;
  padding: 10px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Textarea de anotações na semana: tamanho fixo com scroll */
.wv-notes-expanded {
  min-height: 90px !important;
  max-height: 90px !important;
  overflow-y: auto !important;
  resize: none !important;
}

/* Conteúdo da semana: versão compacta para colunas estreitas */
.wv-body .cbtn {
  padding: 4px 8px;
  font-size: 0.7rem;
  gap: 4px;
}
.wv-body .mood-btn {
  padding: 5px 2px;
  font-size: 1.15rem;
}
.wv-body .important-row {
  padding: 8px 10px;
}
.wv-body .imp-title {
  font-size: 0.78rem;
}
.wv-body .imp-sub {
  font-size: 0.67rem;
}
.wv-body .section-title {
  font-size: 0.75rem;
}
.wv-body .notes-ta {
  font-size: 0.78rem;
  padding: 7px 9px;
}
.wv-body .task-inp {
  font-size: 0.75rem;
  padding: 5px 8px;
}
.wv-body .reminder-text {
  font-size: 0.73rem;
}
.wv-body .rem-time-badge {
  font-size: 0.62rem;
  padding: 1px 4px;
}
.wv-body .rem-time-inp {
  width: 54px;          /* compacto para colunas estreitas */
  font-size: 0.68rem;
  padding: 4px 4px;
}
.wv-body .task-add {
  width: 28px; height: 28px;  /* era 33×33px */
  font-size: 0.95rem;
  flex-shrink: 0;
}
.wv-body .panel-section {
  gap: 7px;
}
.wv-body {
  gap: 10px;
  padding: 8px 8px 12px;
}

.wv-col {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 300px;
  cursor: pointer;
  transition: box-shadow 0.15s;
  overflow: hidden;
}
.wv-col:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.12); }

/* Colunas: fundo sempre neutro — cor só no cabeçalho */
.wv-col.cat-plantao,
.wv-col.cat-ferias,
.wv-col.cat-abono,
.wv-col.cat-extra1,
.wv-col.cat-extra2,
.wv-col.cat-extra3,
.wv-col.cat-dual    { background: var(--surface) !important; }

/* Cor da tag aplicada apenas no cabeçalho */
.wv-col.cat-plantao .wv-col-header { background: rgba(245,101,101,0.35) !important; }
.wv-col.cat-ferias  .wv-col-header { background: rgba(132,204,22,0.35)  !important; }
.wv-col.cat-abono   .wv-col-header { background: rgba(159,122,234,0.35) !important; }
.wv-col.cat-extra1  .wv-col-header { background: rgba(246,150,58,0.35)  !important; }
.wv-col.cat-extra2  .wv-col-header { background: rgba(0,181,216,0.35)   !important; }
.wv-col.cat-extra3  .wv-col-header { background: rgba(72,187,120,0.35)  !important; }
body.dark .wv-col.cat-plantao .wv-col-header { background: rgba(245,101,101,0.5) !important; }
body.dark .wv-col.cat-ferias  .wv-col-header { background: rgba(132,204,22,0.5)  !important; }
body.dark .wv-col.cat-abono   .wv-col-header { background: rgba(159,122,234,0.5) !important; }
body.dark .wv-col.cat-extra1  .wv-col-header { background: rgba(246,150,58,0.5)  !important; }
body.dark .wv-col.cat-extra2  .wv-col-header { background: rgba(0,181,216,0.5)   !important; }
body.dark .wv-col.cat-extra3  .wv-col-header { background: rgba(72,187,120,0.5)  !important; }

.wv-col.wv-today {
  border-top: 3px solid var(--accent);
  box-shadow: 0 0 0 2.5px rgba(66,153,225,0.55), 0 4px 14px rgba(66,153,225,0.18);
}
.wv-col.wv-selected:not(.wv-today) {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.wv-col .wv-col-header { background: var(--surface); }
.wv-col.wv-sunday  .wv-weekday,
.wv-col.wv-saturday .wv-weekday    { color: #e53e3e; }
body.dark .wv-col.wv-sunday  .wv-weekday,
body.dark .wv-col.wv-saturday .wv-weekday { color: #fc8181; }

.wv-col-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px 8px;
  border-bottom: 1px solid var(--border);
  gap: 4px;
}

.wv-weekday {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  color: var(--text-2);
  text-transform: uppercase;
}

.wv-date-num {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-2);
  line-height: 1;
}

.wv-today-num {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(66,153,225,0.45);
}

.wv-content {
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

/* Tag badge no week view */
.wv-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  text-align: center;
  letter-spacing: 0.03em;
}
.wv-tag-plantao { background: rgba(245,101,101,0.2);  color: #742a2a; }
.wv-tag-ferias  { background: rgba(132,204,22,0.2);   color: #3f6212; }
.wv-tag-abono   { background: rgba(159,122,234,0.2);  color: #44337a; }
.wv-tag-extra1  { background: rgba(246,150,58,0.2);   color: #7b341e; }
.wv-tag-extra2  { background: rgba(0,181,216,0.2);    color: #065666; }
.wv-tag-extra3  { background: rgba(72,187,120,0.2);   color: #22543d; }
body.dark .wv-tag-plantao { background: rgba(245,101,101,0.3);  color: #fed7d7; }
body.dark .wv-tag-ferias  { background: rgba(132,204,22,0.3);   color: #d9f99d; }
body.dark .wv-tag-abono   { background: rgba(159,122,234,0.3);  color: #e9d8fd; }
body.dark .wv-tag-extra1  { background: rgba(246,150,58,0.3);   color: #fbd38d; }
body.dark .wv-tag-extra2  { background: rgba(0,181,216,0.3);    color: #b2f5ea; }
body.dark .wv-tag-extra3  { background: rgba(72,187,120,0.3);   color: #c6f6d5; }

/* Item de evento/tarefa */
.wv-item {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  padding: 4px 5px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
}
.wv-item:hover { background: var(--surface-3); }

.wv-dot {
  width: 7px;
  height: 7px;
  min-width: 7px;
  border-radius: 50%;
  margin-top: 4px;
}

.wv-item-text {
  font-size: 0.7rem;
  color: var(--text-2);
  line-height: 1.35;
  word-break: break-word;
}

/* Icon-only buttons */
.icon-btn {
  background: var(--surface-3);
  border: none;
  border-radius: 8px;
  width: 34px; height: 34px;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.12s;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--border); transform: scale(1.1); }

/* Grupo de zoom (lupa − e lupa +) */
.zoom-group {
  display: flex;
  align-items: center;
  background: var(--surface-3);
  border-radius: 50px;
  padding: 3px;
  gap: 0;
}

.zoom-group button {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 10px;
  border-radius: 50px;
  cursor: pointer;
  color: var(--text-2);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.zoom-group button:hover:not(:disabled) {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.zoom-group button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.zoom-icon { font-size: 0.82rem; line-height: 1; }
.zoom-sign { font-size: 1rem; font-weight: 800; line-height: 1; }

.zoom-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── BODY ──────────────────────────────────────────────────── */
.app-body {
  flex: 1;
  min-height: 0;   /* garante que a altura flex seja limitada ao espaço disponível */
  display: flex;
  overflow: hidden;
}

/* ── CALENDAR AREA ─────────────────────────────────────────── */
.cal-scroll {
  flex: 1;
  min-height: 0;   /* permite que o scroll funcione corretamente em qualquer altura */
  overflow-y: auto;
  padding: 18px 20px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  width: 80%;
  margin: 0 auto;
  transition: width 0.3s ease;
}

/* ── MONTH CARD ────────────────────────────────────────────── */
.month-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 14px 12px 12px;
  box-shadow: var(--shadow-sm);
}

.month-card.current-month {
  border-top: 4px solid var(--accent);
  box-shadow: 0 0 0 1.5px rgba(66,153,225,0.35), 0 4px 16px rgba(66,153,225,0.2);
}
.month-card.current-month .month-name {
  color: var(--accent);
  font-weight: 800;
}

.month-name {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}

.wk-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 3px;
}
.wh {
  text-align: center;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text-faint);
}

.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}

/* ── DAY CELL ──────────────────────────────────────────────── */
.day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: 7px;
  font-size: 0.71rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-2);
  transition: transform 0.12s, background 0.12s;
  user-select: none;
}
.day:hover {
  transform: scale(1.15);
  z-index: 2;
  background: var(--surface-3);
}
.day.empty { pointer-events: none; }

.day.today {
  background: var(--accent) !important;
  color: white !important;
  font-weight: 800;
  transform: scale(1.18);
  z-index: 2;
  box-shadow: 0 0 0 2px white, 0 0 0 3.5px var(--accent), 0 4px 12px rgba(66,153,225,0.5);
}
.day.today:hover { transform: scale(1.22); }

/* Hoje com categoria: anel troca de branco para a cor da categoria */
.day.today.cat-plantao { box-shadow: 0 0 0 2px #f56565, 0 0 0 3.5px var(--accent), 0 4px 12px rgba(66,153,225,0.5); }
.day.today.cat-ferias  { box-shadow: 0 0 0 2px #84cc16, 0 0 0 3.5px var(--accent), 0 4px 12px rgba(66,153,225,0.5); }
.day.today.cat-abono   { box-shadow: 0 0 0 2px #9f7aea, 0 0 0 3.5px var(--accent), 0 4px 12px rgba(66,153,225,0.5); }
.day.today.cat-extra1  { box-shadow: 0 0 0 2px #f6963a, 0 0 0 3.5px var(--accent), 0 4px 12px rgba(66,153,225,0.5); }
.day.today.cat-extra2  { box-shadow: 0 0 0 2px #00b5d8, 0 0 0 3.5px var(--accent), 0 4px 12px rgba(66,153,225,0.5); }
.day.today.cat-extra3  { box-shadow: 0 0 0 2px #48bb78, 0 0 0 3.5px var(--accent), 0 4px 12px rgba(66,153,225,0.5); }
.day.selected:not(.today) {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Category colours — light */
.day.cat-plantao { background: rgba(245,101,101,0.22); color: #742a2a; }
.day.cat-ferias  { background: rgba(132,204,22,0.22);  color: #3f6212; }
.day.cat-abono   { background: rgba(159,122,234,0.22); color: #44337a; }

/* Category colours — dark */
body.dark .day.cat-plantao { background: rgba(245,101,101,0.35); color: #fed7d7; }
body.dark .day.cat-ferias  { background: rgba(132,204,22,0.35);  color: #d9f99d; }
body.dark .day.cat-abono   { background: rgba(159,122,234,0.35); color: #e9d8fd; }

/* Célula com 2 tags — gradiente diagonal via inline style; classe só para texto */
.day.cat-dual { color: #2d3748; }
body.dark .day.cat-dual { color: #f0f4f8; }

/* ── Feriados nacionais — número verde em qualquer fundo ──────── */
.day.feriado {
  color: #1a9c50 !important;
  font-weight: 700;
  font-size: 0.78rem;
}
body.dark .day.feriado {
  color: #48bb78 !important;
  font-weight: 700;
  font-size: 0.78rem;
}

/* Sunday & Saturday */
.day.sunday:not(.today):not(.cat-plantao):not(.cat-ferias):not(.cat-abono),
.day.saturday:not(.today):not(.cat-plantao):not(.cat-ferias):not(.cat-abono) {
  color: #e53e3e;
}
body.dark .day.sunday:not(.today):not(.cat-plantao):not(.cat-ferias):not(.cat-abono),
body.dark .day.saturday:not(.today):not(.cat-plantao):not(.cat-ferias):not(.cat-abono) {
  color: #fc8181;
}

/* Important star badge */
.day-star {
  position: absolute;
  top: 0px;
  right: 2px;
  font-size: 0.78rem;
  color: #ed8936;
  line-height: 1;
  pointer-events: none;
}
.day.today .day-star { color: #fefcbf; }

/* Indicator dots */
.day-dots {
  display: flex; gap: 2px;
  position: absolute; bottom: 5px;
}
.ddot {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--text-muted);
}
/* Barra de prazo — faixa fina na borda inferior da célula */
.day-deadline-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 0 0 7px 7px;
  pointer-events: none;
}
.day.today       .ddot { background: rgba(255,255,255,0.7); }

.day.cat-plantao .ddot { background: #f56565; }
.day.cat-ferias  .ddot { background: #84cc16; }
.day.cat-abono   .ddot { background: #9f7aea; }

/* ── RIGHT PANEL ───────────────────────────────────────────── */
.day-panel {
  width: 0;
  overflow: hidden;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 16px rgba(0,0,0,0.06);
  transition: width 0.28s cubic-bezier(0.4,0,0.2,1),
              min-width 0.28s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
}
.day-panel.open {
  width: 380px;
  min-width: 380px;
}

.panel-inner {
  min-width: 380px;
  padding: 22px 20px 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Panel header */
.panel-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 4px;
}
.panel-date-big {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
}
.panel-date-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}
.panel-feriado {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ebf8ff;
  color: #2b6cb0;
  font-weight: 700;
  font-size: 0.76rem;
  border: 1px solid #90cdf4;
  border-radius: 20px;
  padding: 1px 8px;
  vertical-align: middle;
}
body.dark .panel-feriado {
  background: rgba(66,153,225,0.15);
  color: #63b3ed;
  border-color: rgba(66,153,225,0.35);
}

/* ── GALERIA DE FOTOS ───────────────────────────────────── */
.pg-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pg-modal {
  background: var(--surface);
  border-radius: 16px;
  width: min(1100px, 96vw);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
}
.pg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pg-month-label {
  flex: 1;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.pg-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  font-size: 1.4rem;
  padding: 2px 10px;
  border-radius: 6px;
  line-height: 1;
}
.pg-nav-btn:hover { background: var(--surface-3); }
.pg-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  font-size: 0.95rem;
  padding: 4px 8px;
  border-radius: 6px;
}
.pg-close-btn:hover { background: var(--surface-3); color: var(--text); }
.pg-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 8px 12px 4px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pg-weekdays span {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pg-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  padding: 10px 12px 14px;
  overflow-y: auto;
  flex: 1;
}
.pg-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}
.pg-cell.pg-empty { background: transparent; }
.pg-cell.pg-has-photo { cursor: pointer; }
.pg-cell.pg-has-photo:hover .pg-thumb { transform: scale(1.06); }
.pg-cell.pg-today { outline: 2.5px solid var(--accent); outline-offset: -1px; }
.pg-day-num {
  position: absolute;
  top: 5px;
  left: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-2);
  z-index: 2;
  line-height: 1;
}
.pg-cell.pg-has-photo .pg-day-num {
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}
.pg-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

/* ── FOTO DO DIA ────────────────────────────────────────── */
.photo-add-btn {
  width: 100%;
  padding: 16px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  background: none;
  color: var(--text-3);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  font-family: inherit;
}
.photo-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.photo-preview-wrap {
  border-radius: 10px;
  overflow: hidden;
  line-height: 0;
}
.photo-preview {
  width: 100%;
  display: block;
  object-fit: cover;
  max-height: 300px;
  border-radius: 10px;
  cursor: zoom-in;
  transition: opacity 0.15s;
}
.photo-preview:hover { opacity: 0.92; }
.photo-remove-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 7px;
  border-radius: 5px;
  line-height: 1;
}
.photo-remove-btn:hover { background: var(--surface-3); color: var(--text); }
.photo-uploading {
  text-align: center;
  padding: 20px;
  color: var(--text-3);
  font-size: 0.84rem;
}
.photo-err {
  color: #e55;
  font-size: 0.82rem;
  text-align: center;
  padding: 10px;
}

.panel-close {
  background: var(--surface-3);
  border: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.panel-close:hover { background: var(--border); }

/* Section blocks */
.panel-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.section-hdr {
  display: flex;
  align-items: center;
  gap: 7px;
}
.section-icon { font-size: 0.95rem; }
.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-2);
}
.section-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: -4px;
}

/* Divider */
.divider { height: 1px; background: var(--surface-3); }

/* Color buttons */
.color-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cbtn {
  border: none;
  border-radius: 20px;
  padding: 6px 13px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.12s, box-shadow 0.15s;
  opacity: 0.7;
  display: flex; align-items: center; gap: 5px;
}
.cbtn:hover { opacity: 1; transform: scale(1.04); }
.cbtn-none    { background: var(--surface-3); color: var(--text-3); }
.cbtn-plantao { background: rgba(245,101,101,0.15); color: #742a2a; }
.cbtn-ferias  { background: rgba(132,204,22,0.15);  color: #3f6212; }
.cbtn-abono   { background: rgba(159,122,234,0.15); color: #44337a; }
.cbtn.active  { opacity: 1; }

/* Hint quando 2 tags já estão selecionadas */
.tags-max-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 5px 9px;
  margin-top: -4px;
}
.cbtn-none.active    { box-shadow: 0 0 0 2px var(--surface), 0 0 0 2.5px #a0aec0; }
.cbtn-plantao.active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 2.5px #f56565; }
.cbtn-ferias.active  { box-shadow: 0 0 0 2px var(--surface), 0 0 0 2.5px #84cc16; }
.cbtn-abono.active   { box-shadow: 0 0 0 2px var(--surface), 0 0 0 2.5px #9f7aea; }

body.dark .cbtn-plantao { color: #fed7d7; }
body.dark .cbtn-ferias  { color: #d9f99d; }
body.dark .cbtn-abono   { color: #e9d8fd; }

/* Important toggle row */
.important-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px 14px;
  border: 1.5px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}
.important-row.active {
  background: #fffbeb;
  border-color: #f6e05e;
}
body.dark .important-row.active { background: #2d2011; border-color: #744210; }

.imp-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.imp-star {
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
}
.imp-texts {}
.imp-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}
.imp-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 42px; height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Mood row */
.mood-row {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}
.mood-btn {
  flex: 1;
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: 12px;
  font-size: 1.4rem;
  padding: 8px 4px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  line-height: 1;
}
.mood-btn:hover { transform: scale(1.15); background: var(--surface-3); }
.mood-btn.active {
  border-color: var(--accent);
  background: #ebf8ff;
  transform: scale(1.12);
}
body.dark .mood-btn.active { background: #1a365d; }

/* Notes */
.notes-ta {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.83rem;
  color: var(--text-2);
  background: var(--surface);
  resize: none;
  min-height: 80px;
  max-height: 340px;
  line-height: 1.6;
  overflow-y: auto;
  transition: border-color 0.15s;
}
.notes-ta:focus { outline: none; border-color: var(--accent); }
.notes-ta::placeholder { color: var(--text-faint); }


/* Tasks */
.task-row { display: flex; gap: 7px; }
.task-inp {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--text-2);
  background: var(--surface);
  transition: border-color 0.15s;
}
.task-inp:focus { outline: none; border-color: var(--accent); }
.task-inp::placeholder { color: var(--text-faint); }

.task-add {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  width: 33px; height: 33px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.task-add:hover { background: #3182ce; }

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
}
.task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 7px 9px;
}
.task-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px; height: 15px;
  cursor: pointer;
  flex-shrink: 0;
}
.task-text {
  flex: 1;
  font-size: 0.78rem;
  color: var(--text-2);
  word-break: break-word;
}
.task-text.done { text-decoration: line-through; color: var(--text-muted); }
.task-text.important { font-weight: 600; }

/* Task importance toggle button */
.task-imp {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  color: var(--text-faint);
  padding: 0;
  flex-shrink: 0;
  transition: color 0.12s, transform 0.12s;
}
.task-imp:hover { color: #ed8936; transform: scale(1.2); }
.task-imp.on { color: #ed8936; }

/* New task importance toggle */
.new-imp-btn {
  background: var(--surface-3);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  width: 33px; height: 33px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.new-imp-btn:hover { border-color: #ed8936; }
.new-imp-btn.on {
  background: #fffbeb;
  border-color: #ed8936;
}
body.dark .new-imp-btn.on { background: #744210; }

.task-del {
  background: none; border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 0.82rem;
  line-height: 1;
  display: flex; align-items: center;
  padding: 0;
  transition: color 0.12s;
  flex-shrink: 0;
}
.task-del:hover { color: #fc8181; }
.no-tasks {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-faint);
  padding: 6px 0;
}

/* Reminder item */
.reminder-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fffbeb;
  border-radius: 8px;
  padding: 7px 9px;
  border-left: 3px solid #ed8936;
  transition: opacity 0.2s;
}
body.dark .reminder-item { background: #2d2011; }

.reminder-item.reminder-done { opacity: 0.55; }

.reminder-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px; height: 15px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Drag handle */
.rem-drag {
  cursor: grab;
  color: var(--text-faint);
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1;
  padding: 0 1px;
  user-select: none;
}
.rem-drag:active { cursor: grabbing; }

/* Badge de hora no item */
.rem-time-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  border-radius: 5px;
  padding: 1px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
body.dark .rem-time-badge { background: #451a03; color: #fcd34d; }

/* Input de hora no formulário */
.rem-time-inp {
  position: relative;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 4px 6px;
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--surface);
  width: 64px;
  cursor: pointer;
  transition: border-color 0.15s;
  color-scheme: light dark;
  flex-shrink: 0;
  /* remove espaço reservado pelo browser para o ícone */
  -webkit-appearance: none;
  appearance: none;
}
.rem-time-inp:focus { outline: none; border-color: var(--accent); }
.rem-time-inp::-webkit-datetime-edit { padding: 0; }
.rem-time-inp::-webkit-datetime-edit-fields-wrapper { padding: 0; }
.rem-time-inp::-webkit-inner-spin-button { display: none; }
.rem-time-inp::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
  padding: 0;
}

/* Estados de drag */
.reminder-item.dragging  { opacity: 0.35; }
.reminder-item.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

.reminder-text {
  flex: 1;
  font-size: 0.78rem;
  color: var(--text-2);
  word-break: break-word;
  transition: color 0.15s, text-decoration 0.15s;
}
.reminder-text.important { font-weight: 600; }
.reminder-text.done {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* ── RECURRING REMINDER UI ──────────────────────────────────── */

/* Icon button */
.rec-wrap {
  position: relative;
  flex-shrink: 0;
}

.rec-icon-btn {
  width: 33px;
  height: 33px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  font-size: 0.88rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.rec-icon-btn:hover { border-color: var(--accent); }
.rec-icon-btn.rec-active {
  background: #ebf8ff;
  border-color: var(--accent);
}
body.dark .rec-icon-btn.rec-active { background: #1a365d; }

/* Floating dropdown */
.rec-dropdown {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.16);
  padding: 10px;
  z-index: 500;
  min-width: 210px;
}

.rec-dropdown-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding-bottom: 7px;
  margin-bottom: 7px;
  border-bottom: 1px solid var(--border);
}

.rec-opts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.rec-opt-btn {
  padding: 4px 10px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 0.73rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}
.rec-opt-btn:hover { border-color: var(--accent); color: var(--text); }
.rec-opt-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.rec-secondary {
  padding: 8px 2px 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.rec-sec-label {
  font-size: 0.78rem;
  color: var(--text-3);
}

.rec-n-inp {
  width: 56px;
  height: 28px;
  padding: 0 8px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.82rem;
  text-align: center;
  outline: none;
}
.rec-n-inp:focus { border-color: var(--accent); }

.rec-days-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.rec-day-btn {
  width: 32px;
  height: 28px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 0.71rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.rec-day-btn.on {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.rec-day-btn:hover:not(.on) { border-color: var(--accent); color: var(--accent); }

/* Recurring reminder items */
.reminder-rec {
  background: #f0f9ff;
  border-left-color: #63b3ed;
}
body.dark .reminder-rec { background: #1a2a3a; }

.rec-badge {
  font-size: 0.8rem;
  flex-shrink: 0;
  line-height: 1;
}

.rem-rec-sep {
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 2px 2px;
  border-top: 1px solid var(--border);
  margin-top: 3px;
}

/* Delete occurrence menu */
.rec-del-menu {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  overflow: hidden;
  min-width: 190px;
}

.rec-del-opt {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  text-align: left;
  font-size: 0.84rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
}
.rec-del-opt:hover { background: var(--surface-2); }
.rec-del-all { color: #f56565; font-weight: 600; }
.rec-del-opt + .rec-del-opt { border-top: 1px solid var(--border); }

/* ── MODAL ─────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px;
  width: 400px;
  max-width: calc(100vw - 40px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}
.modal-close {
  background: var(--surface-3);
  border: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--border); }

.modal-desc {
  font-size: 0.82rem;
  color: var(--text-3);
  line-height: 1.55;
}

.field-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.date-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
  color-scheme: light dark;
}
.date-input:focus { outline: none; border-color: var(--accent); }

.scale-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--text-2);
  min-height: 40px;
}
.preview-icon { font-size: 1rem; }

.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mbtn {
  border: none;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
}
.mbtn:hover { opacity: 0.85; transform: scale(1.02); }
.mbtn-apply  { background: var(--accent); color: white; }
.mbtn-clear  { background: #fff5f5; color: #c53030; }
.mbtn-cancel { background: var(--surface-3); color: var(--text-3); }
body.dark .mbtn-clear { background: #742a2a; color: #fed7d7; }

/* ── TOAST ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--surface);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  z-index: 999;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── SCROLLBARS ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── PAGE VIEW (tab content) ────────────────────────────────── */
.page-view {
  flex: 1;
  min-height: 0;   /* garante que a cadeia flex limite a altura corretamente */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── TABS NO HEADER ─────────────────────────────────────────── */
.header-tabs {
  display: flex;
  align-items: center;
  background: var(--surface-3);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.htab {
  background: none;
  border: none;
  border-radius: 7px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.htab:hover  { color: var(--text); }
.htab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.htab-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.tab-count {
  display: none;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 7px;
  min-width: 18px;
  text-align: center;
}
.tab-count.visible { display: inline-block; }

/* ── PÁGINA TAREFAS ─────────────────────────────────────────── */
.todos-page {
  flex: 1;
  min-height: 0;   /* sem isso o flex item expande com o conteúdo e o scroll nunca ativa */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.todos-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.todos-filters { display: flex; gap: 6px; flex-wrap: wrap; }

.todos-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.tfilter-btn {
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.15s;
}
.tfilter-btn:hover           { border-color: var(--accent); color: var(--accent); }
.tfilter-btn.active          { background: var(--accent); border-color: var(--accent); color: white; }

/* ── Toggle "Ocultar projetos" ──────────────────────────────── */
.hide-proj-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 6px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  font-size: 0.78rem;
  color: var(--text-3);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.hide-proj-toggle:hover { border-color: var(--text-3); color: var(--text-2); }

/* Trilho do switch */
.toggle-track {
  width: 28px;
  height: 16px;
  border-radius: 8px;
  background: var(--border);
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}
/* Bolinha do switch */
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.2s;
}

/* Estado ligado */
.hide-proj-toggle.active { border-color: var(--accent); color: var(--accent); }
.hide-proj-toggle.active .toggle-track { background: var(--accent); }
.hide-proj-toggle.active .toggle-thumb { transform: translateX(12px); }

.new-todo-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.12s;
}
.new-todo-btn:hover { opacity: 0.88; transform: scale(1.02); }

.todos-list {
  flex: 1;
  min-height: 0;   /* necessário para que overflow-y: auto gere scroll */
  overflow-y: auto;
  padding: 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 65%;
  min-width: 420px;
  margin: 0 auto;
  align-self: center;
  box-sizing: border-box;
}

/* Zoom dos cards — compacto / padrão / expandido */
#todosList.todo-zoom-sm .todo-body { padding: 5px 10px; gap: 2px; }
#todosList.todo-zoom-sm .todo-desc { font-size: 0.82rem; }
#todosList.todo-zoom-sm .todo-meta { font-size: 0.62rem; }
#todosList.todo-zoom-sm .todo-right-col { padding: 4px 8px; min-width: 64px; }

#todosList.todo-zoom-lg .todo-body { padding: 12px 16px; gap: 6px; }
#todosList.todo-zoom-lg .todo-desc { font-size: 1rem; }
#todosList.todo-zoom-lg .todo-meta { font-size: 0.74rem; gap: 10px; }
#todosList.todo-zoom-lg .prog-badge { font-size: 0.74rem; padding: 4px 12px; }
#todosList.todo-zoom-lg .prio-badge { font-size: 0.74rem; }
#todosList.todo-zoom-lg .todo-right-col { padding: 10px 14px; min-width: 88px; }
#todosList.todo-zoom-lg .todo-cat-end { font-size: 0.76rem; }

/* ── TODO CARD ──────────────────────────────────────────────── */
.todo-card {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;   /* impede encolhimento — o scroll da lista deve ativar no lugar */
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.1s;
}
.todo-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.todo-stripe { width: 4px; flex-shrink: 0; }

.todo-body {
  flex: 1;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.todo-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.todo-desc {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.todo-desc.done-text { text-decoration: line-through; color: var(--text-muted); }

.prog-badge {
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 20px;
  padding: 3px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.prog-badge.clickable { cursor: pointer; transition: filter 0.15s, transform 0.12s; }
.prog-badge.clickable:hover { filter: brightness(0.9); transform: scale(1.06); }

.prog-badge.nao-iniciado { background: #edf2f7; color: #718096; }
.prog-badge.em-andamento { background: #ebf8ff; color: #2b6cb0; }
.prog-badge.finalizado   { background: #f0fff4; color: #276749; }
body.dark .prog-badge.nao-iniciado { background: #4a5568; color: #e2e8f0; }
body.dark .prog-badge.em-andamento { background: #1a365d; color: #bee3f8; }
body.dark .prog-badge.finalizado   { background: #1c4532; color: #c6f6d5; }

.todo-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}


.todo-prazo {
  font-size: 0.68rem;
  color: var(--text-muted);
}
.todo-prazo.overdue { color: #e53e3e; font-weight: 700; }

.todo-obs {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

/* Coluna direita do card: mostra projeto+categoria, esconde no hover para revelar ações */
.todo-right-col {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  min-width: 76px;
  flex-shrink: 0;
}

.todo-cat-end {
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  text-align: center;
  transition: opacity 0.15s;
  pointer-events: none;
}

.todo-stripe-right {
  width: 4px;
  flex-shrink: 0;
}

.todo-actions {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
  background: var(--surface);
  border-radius: 0;
}
.todo-card:hover .todo-actions { opacity: 1; }
.todo-card:hover .todo-cat-end { opacity: 0; }

.todo-act-btn {
  background: none;
  border: none;
  width: 26px; height: 26px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s;
}
.todo-act-btn:hover       { background: var(--surface-3); color: var(--text); }
.todo-act-btn.del:hover   { background: #fff5f5; color: #e53e3e; }
body.dark .todo-act-btn.del:hover { background: #2d1515; }
.todo-act-btn.pause:hover { background: #fffff0; color: #744210; }
body.dark .todo-act-btn.pause:hover { background: rgba(236,201,75,0.15); }

/* Empty state */
.todos-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  padding: 60px 20px;
}
.todos-empty-icon { font-size: 2.8rem; opacity: 0.5; }
.todos-empty-text { font-size: 0.9rem; font-weight: 700; }
.todos-empty-sub  { font-size: 0.78rem; }

/* ── MODAL TAREFA ───────────────────────────────────────────── */
.modal-todo { width: 500px; }

.field-req { color: #e53e3e; }

.todo-form-row {
  display: flex;
  gap: 12px;
}
.todo-form-col { flex: 1; display: flex; flex-direction: column; gap: 6px; }

.prog-row { display: flex; gap: 8px; flex-wrap: wrap; }

.prog-btn {
  flex: 1;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 8px 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-3);
  text-align: center;
  white-space: nowrap;
  transition: all 0.15s;
}
.prog-btn:hover { border-color: var(--accent); color: var(--accent); }
.prog-btn.active[data-p="nao-iniciado"] { background: #edf2f7; border-color: #a0aec0; color: #4a5568; }
.prog-btn.active[data-p="em-andamento"] { background: #ebf8ff; border-color: var(--accent); color: #2b6cb0; }
.prog-btn.active[data-p="finalizado"]   { background: #f0fff4; border-color: #48bb78; color: #276749; }
body.dark .prog-btn.active[data-p="nao-iniciado"] { background: #2d3748; }
body.dark .prog-btn.active[data-p="em-andamento"] { background: #1a365d; }
body.dark .prog-btn.active[data-p="finalizado"]   { background: #1c4532; }

.obs-counter {
  float: right;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: none;
  letter-spacing: 0;
}

.todo-obs-ta { resize: none; }

/* Botões de seleção de categoria no modal */
.cat-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.cat-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 20px;
  padding: 4px 11px;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.15s;
}
.cat-btn:hover { border-color: var(--cat-c, #a0aec0); color: var(--cat-c, #a0aec0); }
.cat-btn.active {
  background: color-mix(in srgb, var(--cat-c, #a0aec0) 12%, transparent);
  border-color: var(--cat-c, #a0aec0);
  color: var(--cat-c, #a0aec0);
}

.cat-btn-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--cat-c, #a0aec0);
  flex-shrink: 0;
}

/* Label colorida no card */
.todo-cat-label {
  font-size: 0.68rem;
  font-weight: 700;
}

/* Botão e painel de edição de categorias */
.cat-edit-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0 0 0 5px;
  opacity: 0.5;
  transition: opacity 0.15s;
  vertical-align: middle;
}
.cat-edit-toggle:hover { opacity: 1; }

.cat-edit-panel {
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
  padding: 10px;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.cat-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cat-color-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.cat-color-wrap:hover .cat-edit-dot {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cat-edit-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: outline 0.12s;
}

/* Input color nativo — invisível, posicionado sobre a bolinha */
.cat-color-inp {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  padding: 0;
  border: none;
}

.cat-edit-inp {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.78rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
}
.cat-edit-inp:focus { outline: none; border-color: var(--accent); }

/* Botão excluir categoria customizada */
.cat-del-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0.45;
  transition: opacity 0.15s, background 0.12s;
  flex-shrink: 0;
}
.cat-del-btn:hover { opacity: 1; background: #fff5f5; }
body.dark .cat-del-btn:hover { background: #2d1515; }

/* Espaçador para alinhar quando não há botão excluir */
.cat-del-placeholder { width: 26px; flex-shrink: 0; }

/* Botão adicionar nova categoria */
.cat-add-btn {
  margin-top: 4px;
  background: none;
  border: 1px dashed var(--border);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}
.cat-add-btn:hover { background: var(--surface-2); border-color: var(--accent); }

/* Tarefas com prazo no painel do dia */
.due-task-item {
  display: flex;
  align-items: stretch;
  background: var(--surface-2);
  border-radius: 8px;
  overflow: hidden;
  gap: 0;
}
.due-task-stripe {
  width: 4px;
  flex-shrink: 0;
}
.due-task-body {
  flex: 1;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.due-task-desc {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.due-task-prog {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Projetos com prazo no painel do dia */
.due-proj-item {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border-radius: 8px;
  overflow: hidden;
  gap: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.due-proj-item:hover { background: var(--surface-3); }
.due-proj-stripe { width: 4px; flex-shrink: 0; align-self: stretch; }
.due-proj-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  padding: 8px 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.due-proj-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  padding-right: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 90px;
}

/* Tag de projeto no card de tarefa (clicável) */
.todo-proj-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: color-mix(in srgb, var(--proj-c) 14%, transparent);
  color: var(--proj-c);
  border: 1px solid color-mix(in srgb, var(--proj-c) 35%, transparent);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: filter 0.12s;
}
.todo-proj-tag:hover { filter: brightness(0.88); }

/* Dot colorido para projeto com prazo no calendário */
.ddot-proj {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Indicador "+N" quando há mais de 2 projetos no mesmo dia */
.ddot-more {
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--text-2);
  line-height: 1;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}

/* Prioridade — botões do modal */
.prio-btn {
  flex: 1;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 8px 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-3);
  text-align: center;
  white-space: nowrap;
  transition: all 0.15s;
}
.prio-btn:hover { border-color: var(--accent); color: var(--accent); }
.prio-btn.active[data-prio="baixa"] { background: #f0fff4; border-color: #48bb78; color: #276749; }
.prio-btn.active[data-prio="media"] { background: #fffff0; border-color: #d69e2e; color: #744210; }
.prio-btn.active[data-prio="alta"]  { background: #fff5f5; border-color: #f56565; color: #c53030; }
body.dark .prio-btn.active[data-prio="baixa"] { background: #1c4532; }
body.dark .prio-btn.active[data-prio="media"] { background: #2d2011; }
body.dark .prio-btn.active[data-prio="alta"]  { background: #2d1515; }

/* Prioridade — badge no card */
.prio-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.prio-dot.baixa { background: #48bb78; }
.prio-dot.media { background: #d69e2e; }
.prio-dot.alta  { background: #f56565; }

.prio-badge {
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}
.prio-badge.baixa { color: #38a169; }
.prio-badge.media { color: #b7791f; }
.prio-badge.alta  { color: #e53e3e; }

/* Separador · entre itens do card */
.todo-meta-sep {
  color: var(--text-faint);
  font-size: 0.65rem;
  line-height: 1;
}

/* ── EM ESPERA — badge e botões ────────────────────────────── */
.prog-badge.em-espera { background: #fffff0; color: #744210; }
body.dark .prog-badge.em-espera { background: #2d2011; color: #fbd38d; }
.prog-btn.active[data-p="em-espera"] { background: #fffff0; border-color: #d69e2e; color: #744210; }
body.dark .prog-btn.active[data-p="em-espera"] { background: #2d2011; }

/* ── PROJETOS — página ──────────────────────────────────────── */
.projetos-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.projetos-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.new-proj-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
}
.new-proj-btn:hover { opacity: 0.88; transform: scale(1.02); }

.projetos-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 65%;
  min-width: 420px;
  margin: 0 auto;
  align-self: center;
  box-sizing: border-box;
}

/* ── CARD DE PROJETO ────────────────────────────────────────── */
.proj-card {
  flex-shrink: 0;   /* não encolhe — o scroll do grid deve ativar no lugar */
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.12s;
}
.proj-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* Drag-and-drop */
.proj-card.dragging  { opacity: 0.4; cursor: grabbing; }
.proj-card.drag-over { outline: 2px dashed var(--accent); outline-offset: 2px; transform: scale(1.02); }

/* Handle de arrasto (inline no header) */
.proj-drag-handle {
  font-size: 1rem;
  color: var(--text-faint);
  cursor: grab;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
  user-select: none;
  line-height: 1;
}
.proj-card:hover .proj-drag-handle { opacity: 1; }

/* Projeto pausado */
.proj-card.paused { opacity: 0.65; }
.proj-card.paused .proj-bar-fill { filter: grayscale(0.6); }
.proj-paused-badge {
  font-size: 0.65rem;
  font-weight: 600;
  background: #fffff0;
  color: #744210;
  border: 1px solid #d69e2e;
  border-radius: 10px;
  padding: 1px 6px;
  white-space: nowrap;
}
body.dark .proj-paused-badge { background: #2d2011; color: #fbd38d; }

/* Botão de pausar/retomar */
.proj-pause-btn {
  background: none;
  border: none;
  font-size: 0.82rem;
  cursor: pointer;
  opacity: 0;
  padding: 3px 5px;
  border-radius: 5px;
  flex-shrink: 0;
  line-height: 1;
  color: var(--text-2);
  white-space: nowrap;
  transition: opacity 0.15s, background 0.12s;
}
.proj-card:hover .proj-pause-btn,
.proj-pause-btn.always { opacity: 1; }
.proj-pause-btn:hover { background: var(--surface-3); }

.proj-stripe { width: 5px; flex-shrink: 0; }

.proj-card-body {
  flex: 1;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.proj-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.proj-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.proj-card-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proj-edit-btn {
  background: none;
  border: none;
  font-size: 0.82rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  padding: 3px 5px;
  border-radius: 5px;
  flex-shrink: 0;
  line-height: 1;
}
.proj-card:hover .proj-edit-btn,
.proj-edit-btn.always { opacity: 1; }
.proj-edit-btn:hover { background: var(--surface-3); }

.proj-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.proj-bar-bg {
  flex: 1;
  height: 7px;
  background: var(--surface-3);
  border-radius: 4px;
  overflow: hidden;
}

.proj-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.proj-pct {
  font-size: 1.35rem;
  font-weight: 800;
  min-width: 52px;
  text-align: right;
  line-height: 1;
}

.proj-card-foot {
  font-size: 0.7rem;
  color: var(--text-faint);
}

/* ── DETALHE DO PROJETO ─────────────────────────────────────── */
.projetos-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.proj-detail-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 24px;
  background: var(--surface);
  flex-shrink: 0;
}

.proj-back-btn {
  background: var(--surface-3);
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
  white-space: nowrap;
}
.proj-back-btn:hover { background: var(--border); }

.proj-detail-name {
  font-size: 1.1rem;
  font-weight: 800;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proj-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Caixa de descrição editável inline */
.proj-desc-box {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.6;
  outline: none;
  cursor: text;
  white-space: pre-wrap;
  word-break: break-word;
  box-sizing: border-box;
  transition: border-color 0.15s, background 0.15s;
}
.proj-desc-box:empty::before {
  content: attr(title);
  color: var(--text-faint);
  pointer-events: none;
}
.proj-desc-box:focus {
  border-color: var(--accent);
  background: var(--surface);
  cursor: text;
}

.proj-detail-progress { display: flex; flex-direction: column; gap: 10px; }

.proj-detail-pct-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.proj-detail-pct {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
}

.proj-detail-count {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.proj-bar-lg { height: 10px; border-radius: 5px; }

/* ── LISTA DE TAREFAS NO DETALHE ────────────────────────────── */
.proj-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.proj-task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  background: var(--surface);
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
  transition: opacity 0.15s;
}

.proj-task-item.done { opacity: 0.5; }

.proj-task-prog {
  font-size: 0.88rem;
  flex-shrink: 0;
  line-height: 1;
  width: 16px;
  text-align: center;
}

.proj-task-prio {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.proj-task-desc {
  flex: 1;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proj-task-item.done .proj-task-desc {
  text-decoration: line-through;
  color: var(--text-muted);
  font-weight: 400;
}

.proj-task-prazo {
  font-size: 0.68rem;
  color: var(--text-faint);
  white-space: nowrap;
  flex-shrink: 0;
}

.proj-no-tasks {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 40px 20px;
  line-height: 1.7;
  background: var(--surface);
  border-radius: 9px;
}

/* ── Seção "Em espera" no detalhe de projeto ──────────────────── */
.proj-em-espera-section {
  margin-top: 4px;
  border-radius: 10px;
  overflow: hidden;
}
.proj-em-espera-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 13px;
  background: var(--surface-3);
  border-radius: 9px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
}
.proj-em-espera-hdr:hover { background: var(--border); }
/* .proj-done-hdr herda a cor padrão do .proj-em-espera-hdr */

.proj-em-espera-cards {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 5px;
}


/* ── EMPTY STATE PROJETOS ───────────────────────────────────── */
.projetos-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  padding: 80px 20px;
  width: 100%;
}
.projetos-empty-icon { font-size: 3rem; opacity: 0.4; }
.projetos-empty-text { font-size: 1rem; font-weight: 700; }
.projetos-empty-sub  { font-size: 0.8rem; text-align: center; max-width: 280px; line-height: 1.55; }

/* ── MODAL DE PROJETO — seletor de cor ──────────────────────── */
.proj-color-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.proj-color-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  flex-shrink: 0;
}
.proj-color-btn:hover { transform: scale(1.18); }
.proj-color-btn.active {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text-muted);
  transform: scale(1.1);
}

/* Botão de cor personalizada */
.proj-color-custom {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  border: 2px dashed var(--border);
}
.proj-color-custom:hover { border-color: var(--text-3); transform: scale(1.12); }
.proj-color-custom input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  border: none;
  padding: 0;
}
.proj-custom-icon {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-3);
  pointer-events: none;
  line-height: 1;
}

/* ── MINI DATE PICKER ───────────────────────────────────────── */

/* Popup flutuante */
.dp-popup {
  position: absolute;
  z-index: 3000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  padding: 12px;
  width: 252px;
  user-select: none;
}

/* Cabeçalho do picker */
.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.dp-nav-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-2);
  padding: 2px 8px;
  border-radius: 6px;
  transition: background 0.12s;
}
.dp-nav-btn:hover { background: var(--surface-2); }

.dp-month-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

/* Dias da semana */
.dp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}
.dp-weekdays span {
  text-align: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 2px 0;
}

/* Grade de dias */
.dp-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.dp-day {
  background: none;
  border: none;
  border-radius: 7px;
  height: 30px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.dp-day:hover { background: var(--surface-2); }

.dp-day.dp-today {
  font-weight: 800;
  color: var(--accent);
}
.dp-day.dp-selected {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.dp-day.dp-selected:hover { background: var(--accent); filter: brightness(0.92); }

/* Rodapé */
.dp-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.dp-today-btn, .dp-clear-btn {
  background: none;
  border: none;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  transition: background 0.12s;
}
.dp-today-btn { color: var(--accent); }
.dp-today-btn:hover { background: var(--surface-2); }
.dp-clear-btn { color: var(--text-muted); }
.dp-clear-btn:hover { background: var(--surface-2); }

/* Textarea de descrição do projeto */
.proj-desc-ta { resize: none; min-height: 60px; }

/* Select de projeto no modal de tarefa */
.todo-proj-select { appearance: none; cursor: pointer; }
.todo-proj-select.proj-sel-locked {
  opacity: 0.75;
  cursor: not-allowed;
  background: var(--surface-3);
  border-color: var(--border);
  padding-right: 10px;
}
.todo-proj-select.proj-sel-locked::after { content: '🔒'; }

/* ── ZOOM DOS CARDS DE PROJETO ──────────────────────────────── */

/* SM — só barra de progresso (compacto, sem nome nem rodapé) */
.projetos-grid.proj-zoom-sm .proj-card-body {
  padding: 7px 12px;
  gap: 0;
  justify-content: center;
}
.projetos-grid.proj-zoom-sm .proj-card-desc,
.projetos-grid.proj-zoom-sm .proj-card-foot { display: none; }
.projetos-grid.proj-zoom-sm .proj-card-name { font-size: 0.82rem; }
.projetos-grid.proj-zoom-sm .proj-edit-btn  { display: none; }
.projetos-grid.proj-zoom-sm .proj-bar-bg   { height: 8px; }
.projetos-grid.proj-zoom-sm .proj-pct      { font-size: 1rem; min-width: 36px; }
.projetos-grid.proj-zoom-sm .proj-stripe   { width: 7px; }

/* MD — nome + barra + rodapé (padrão, sem alteração) */

/* LG — expansivo: nome grande, descrição em múltiplas linhas, barra grossa */
.projetos-grid.proj-zoom-lg .proj-card-body {
  padding: 20px 24px;
  gap: 12px;
}
.projetos-grid.proj-zoom-lg .proj-card-name {
  font-size: 1.15rem;
  white-space: normal;
  word-break: break-word;
}
.projetos-grid.proj-zoom-lg .proj-card-desc {
  font-size: 0.82rem;
  white-space: normal;
  color: var(--text-2);
  line-height: 1.5;
  overflow: visible;
  text-overflow: unset;
}
.projetos-grid.proj-zoom-lg .proj-bar-bg  { height: 12px; border-radius: 6px; }
.projetos-grid.proj-zoom-lg .proj-bar-fill { border-radius: 6px; }
.projetos-grid.proj-zoom-lg .proj-pct     { font-size: 1.6rem; min-width: 60px; }
.projetos-grid.proj-zoom-lg .proj-card-foot { font-size: 0.78rem; color: var(--text-muted); }
.projetos-grid.proj-zoom-lg .proj-edit-btn  { opacity: 1; font-size: 0.95rem; }
.projetos-grid.proj-zoom-lg .proj-stripe    { width: 8px; }

/* ── CABEÇALHO DE TAREFAS NO DETALHE DO PROJETO ─────────────── */
.proj-tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.proj-tasks-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.proj-add-task-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
}
.proj-add-task-btn:hover { opacity: 0.88; transform: scale(1.03); }

/* Task items inside project detail are now clickable */
.proj-task-item {
  cursor: pointer;
}
.proj-task-item:hover {
  background: var(--surface-2);
}

/* ── SEÇÃO "EM ESPERA" RECOLHÍVEL NA ABA TAREFAS ────────────── */
.em-espera-section {
  flex-shrink: 0;   /* não encolhe — mantém altura mínima para o scroll da lista funcionar */
  margin-top: 14px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.em-espera-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.em-espera-header:hover { background: var(--surface-3); }

.em-espera-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.em-espera-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fffff0;
  color: #744210;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 20px;
}
body.dark .em-espera-count {
  background: rgba(236,201,75,0.18);
  color: #ecc94b;
}

.em-espera-chevron {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* When expanded, header bottom corners are squared to join the cards below */
.em-espera-section.expanded .em-espera-header {
  border-radius: 12px 12px 0 0;
  border-bottom-color: transparent;
}

.em-espera-cards {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 6px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg);
}

/* ════════════════════════════════════════════════════════════
   MOBILE / TOUCH  (≤ 767 px)
   Desktop permanece exatamente igual — tudo aqui é override.
════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* Usa dvh para compensar barra de endereço do browser mobile */
  body { height: 100dvh; }

  /* ── HEADER ─────────────────────────────────────────────── */
  header {
    flex-wrap: wrap;
    padding: 8px 12px 4px;
    gap: 4px;
    align-items: center;
  }
  .app-title { order: 1; font-size: 1rem; }
  .header-actions { order: 2; margin-left: auto; gap: 5px; }
  .icon-btn { width: 32px; height: 32px; font-size: 0.9rem; }

  /* Tabs ficam na segunda linha, largura total */
  .header-tabs {
    order: 3;
    width: 100%;
    gap: 4px;
  }
  .htab {
    flex: 1;
    justify-content: center;
    padding: 7px 6px;
    font-size: 0.76rem;
    gap: 5px;
  }

  /* ── CAL SUBBAR ─────────────────────────────────────────── */
  .cal-subbar {
    padding: 6px 12px;
    gap: 6px;
    flex-wrap: wrap;
  }
  /* Linha 1: ano (esquerda) + escala (direita) */
  .year-nav { order: 1; }
  .cal-subbar-actions { order: 2; margin-left: auto; }
  .cal-subbar-actions .zoom-group { display: none; }
  .hbtn-scale { font-size: 0.73rem; padding: 6px 10px; }

  /* Linha 2: legenda em scroll horizontal */
  .legend {
    order: 3;
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 6px;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }
  /* Oculta o "Hoje" (só info, ocupa espaço) */
  .legend > .leg:first-child { display: none; }
  /* Grupo de tags: sem quebra, scroll junto com a legenda */
  .leg-group { flex-shrink: 0; }

  /* ── CALENDÁRIO ─────────────────────────────────────────── */
  .cal-scroll { padding: 8px; }

  /* 2 meses por linha, largura plena (sobrepõe inline style do JS) */
  .cal-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    width: 100% !important;
    gap: 8px;
  }

  /* ── Ano: mobile — cancela o modo fit/absolute e usa flow normal ── */
  /* CSS !important vence inline style sem !important (regra da cascata) */
  .cal-view-year {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    grid-template-columns: repeat(2, 1fr) !important;
    grid-template-rows: auto !important;
    width: 100% !important;
  }
  .cal-year-scroll {
    grid-template-columns: repeat(2, 1fr) !important;
    grid-template-rows: auto !important; /* cancela repeat(3, Npx) do JS */
    width: 100% !important;
  }
  /* Scroll container ano: scrollável (o grid agora é relative/flow) */
  .cal-scroll.month-fit:has(.cal-view-year),
  .cal-scroll.month-fit:has(.cal-year-scroll) {
    overflow-y: auto !important;
    overflow-x: hidden;
  }
  /* Cada card de mês com altura automática (cresce com o conteúdo) */
  .cal-view-year .month-card,
  .cal-year-scroll .month-card {
    height: auto !important;
  }
  /* days-grid: sem flex:1 no mobile (pai não tem altura fixa) — cresce pelo conteúdo */
  .cal-view-year .days-grid,
  .cal-year-scroll .days-grid {
    flex: none !important;
    grid-auto-rows: auto !important;
  }

  /* ── Mês: 1 coluna, posição absoluta preservada ─────────────── */
  .cal-view-month {
    grid-template-columns: 1fr !important;
    width: 100% !important;
  }
  /* Mês fit: restaura posicionamento absoluto correto */
  .cal-view-month.cal-month-fit {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    width: auto !important;
  }
  /* Mês scroll: anula minHeight do JS, deixa CSS controlar */
  .cal-month-scroll {
    min-height: 0 !important;
    height: 100%;
  }

  /* ── Semana: largura total, sem layout grid de 2 colunas ──────── */
  .cal-view-week {
    grid-template-columns: 1fr !important;
    width: 100% !important;
  }
  /* Restaura aspect-ratio:1 nos dias do ano (year view cancela isso, mas no mobile queremos quadrado) */
  .cal-view-year .day,
  .cal-year-scroll .day {
    aspect-ratio: 1 !important;
  }

  .month-card { padding: 10px 8px 8px; border-radius: 10px; }
  .month-name { font-size: 0.72rem; margin-bottom: 6px; }

  .day { font-size: 0.66rem; border-radius: 5px; }
  .day.feriado { font-size: 0.66rem; } /* cancela o tamanho maior do PC */
  .day:hover     { transform: scale(1.06); }
  .day.today     { transform: scale(1.12); }
  .day.today:hover { transform: scale(1.16); }

  /* Bloqueia scroll do calendário enquanto painel está aberto */
  body.panel-open .cal-scroll { overflow: hidden; pointer-events: none; }

  /* ── DAY PANEL → bottom sheet ───────────────────────────── */
  /* .app-body mantém overflow:hidden — position:fixed do painel
     não é afetado pelo pai, então não precisamos de visible aqui */

  .day-panel {
    position: fixed !important;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 0;
    max-height: 82vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -6px 32px rgba(0,0,0,0.18);
    /* substitui animação de largura (desktop) por altura (mobile) */
    transition: height 0.32s cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
    z-index: 50;
  }
  .day-panel.open {
    height: 82vh;
    width: 100% !important;
    min-width: 0 !important;
  }

  .panel-inner {
    min-width: 0;
    padding: 4px 16px 36px;
    gap: 14px;
  }

  /* Handle visual no topo do bottom sheet */
  .panel-inner::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 12px;
  }

  /* ── PÁGINA TAREFAS ─────────────────────────────────────── */
  .todos-topbar {
    padding: 10px 12px;
    gap: 6px;
    flex-wrap: wrap;
  }
  .todos-topbar-right {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }
  /* Zoom dos cards ocultado no mobile */
  .todos-topbar-right .zoom-group { display: none; }

  .tfilter-btn { padding: 5px 10px; font-size: 0.72rem; }
  .new-todo-btn { padding: 8px 14px; font-size: 0.8rem; }

  .todos-list {
    width: 100% !important;
    min-width: 0 !important;
    padding: 10px 12px;
  }

  .projetos-grid {
    width: 100% !important;
    min-width: 0 !important;
    padding: 10px 12px;
  }

  /* ── TODO CARD — ações sempre visíveis (touch não tem hover) */
  .todo-actions {
    opacity: 1 !important;
    background: transparent !important;
  }

  /* ── User menu no mobile — só ícone, sem label ──────────── */
  #syncStatus { display: none; }
  .user-badge-label { display: none; }
  .user-badge-chevron { display: none; }
  .user-badge { padding: 0.3rem 0.5rem; }
  .user-dropdown { right: 0; min-width: 160px; }

} /* fim @media (max-width: 767px) */

/* ═══════════════════════════════════════════════════════════
   USER MENU — Badge + dropdown de conta
   ═══════════════════════════════════════════════════════════ */

#userInfoArea {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

#syncStatus {
  font-size: 0.73rem;
  color: var(--text-3);
  min-width: 80px;
  text-align: right;
  white-space: nowrap;
}

.user-menu-wrap {
  position: relative;
}

/* Badge-botão clicável */
.user-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text-2);
  background: var(--surface-3);
  border: 1.5px solid var(--border);
  padding: 0.3rem 0.6rem;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
}
.user-badge:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}
.user-badge-icon { font-size: 0.8rem; }
.user-badge-label {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-badge-chevron { font-size: 0.6rem; opacity: 0.6; }

/* Dropdown */
.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  z-index: 200;
  overflow: hidden;
  flex-direction: column;
}
.user-dropdown.open { display: flex; }

.user-dropdown-email {
  padding: 10px 14px 8px;
  font-size: 0.72rem;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  word-break: break-all;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.12s;
}
.user-dropdown-item:hover { background: var(--surface-3); }
.logout-item { color: #e53e3e; }
.logout-item:hover { background: #fff5f5; }

/* ═══════════════════════════════════════════════════════════
   AUTH OVERLAY — Tela de login / cadastro
   ═══════════════════════════════════════════════════════════ */

#authOverlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 99999;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem 2rem 2rem;
  width: min(400px, 94vw);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}

.auth-logo { font-size: 2.4rem; text-align: center; margin-bottom: 0.1rem; }

.auth-title {
  font-size: 1.55rem;
  font-weight: 700;
  text-align: center;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.02em;
}
.auth-title span { color: var(--accent); }

.auth-sub {
  font-size: 0.85rem;
  text-align: center;
  color: var(--text-3);
  margin: 0 0 0.3rem;
  line-height: 1.45;
}

.auth-err {
  background: #fff0f0;
  color: #c0392b;
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  font-size: 0.82rem;
  text-align: center;
  line-height: 1.4;
}
body.dark .auth-err { background: #3a1515; color: #f08080; }

.auth-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  background: var(--surface-2);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s;
  font-family: inherit;
}
.auth-input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-btn {
  width: 100%;
  padding: 0.72rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  transition: opacity 0.15s, transform 0.1s;
  font-family: inherit;
}
.auth-btn:active  { transform: scale(0.98); }
.auth-btn:disabled { opacity: 0.55; cursor: default; pointer-events: none; }

.primary-btn {
  background: var(--accent);
  color: #fff;
}
.primary-btn:hover:not(:disabled) { opacity: 0.88; }

.ghost-btn {
  background: var(--surface-3);
  color: var(--text-2);
  border: 1.5px solid var(--border);
}
.ghost-btn:hover:not(:disabled) { opacity: 0.8; }

.google-btn {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  font-weight: 500;
}
.google-btn:hover { background: var(--surface-2); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text-3);
  font-size: 0.77rem;
  margin: 0.1rem 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-forgot {
  text-align: center;
  font-size: 0.8rem;
  margin: 0.1rem 0 0;
  color: var(--text-3);
}
.auth-forgot a {
  color: var(--accent);
  text-decoration: none;
}
.auth-forgot a:hover { text-decoration: underline; }

.auth-loading {
  text-align: center;
  padding: 1.5rem 0;
  color: var(--text-3);
  font-size: 0.95rem;
}

/* ── Área do usuário no header ─────────────────────────── */
#userInfoArea {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

#syncStatus {
  font-size: 0.73rem;
  color: var(--text-3);
  min-width: 80px;
  text-align: right;
  white-space: nowrap;
}

.user-badge {
  font-size: 0.78rem;
  color: var(--text-3);
  background: var(--surface-3);
  padding: 0.22rem 0.65rem;
  border-radius: 20px;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}
