:root {
  /* Cores e dimensões ajustadas para um layout mais fluido */
  --font-ui: "Plus Jakarta Sans", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --bg: #121212;
  --panel: #1e1e1e;
  --panel2: #2d2d2d;
  --text: #e0e0e0;
  --muted: #a0a0a0;
  --line: #333333;
  --line2: #3e3e3e;
  --accent: #0078d4;
  --accent2: #2196f3;
  --danger: #e53935;
  --ok: #4caf50;
  --warn: #fdd835;
  --shadow: 0 2px 5px rgba(0, 0, 0, .30);
  --radius: 8px;
  /* Largura um pouco maior para acomodar texto “Horários” sem quebrar */
  /* Coluna de horários mais larga para evitar quebra do texto “Horários” */
  --timeColW: 140px;
  --dayMinW: 160px;
  --headerH: 54px;
  --slotH: 20px;
}

/* Light mode overrides. When the <html> element has the class "light", these variables will be used instead of the dark theme defaults above. */
:root.light {
  --bg: #f7f9fb;
  --panel: #ffffff;
  --panel2: #f1f3f5;
  --text: #1e1e1e;
  --muted: #555555;
  --line: #d0d0d0;
  --line2: #c5c5c5;
  --accent: #0078d4;
  --accent2: #2196f3;
  --danger: #d32f2f;
  --ok: #388e3c;
  --warn: #fbc02d;
  --shadow: 0 2px 4px rgba(0, 0, 0, .08);
  --radius: 8px;
}

/* --------------------------------------------------------------------
   Light mode overrides

   O tema claro anterior ainda utilizava várias cores pensadas para o
   tema escuro, o que acabava deixando texto e componentes com baixo
   contraste. Nesta seção definimos estilos que só se aplicam quando a
   classe `light` está presente no elemento <html>. Os principais
   ajustes são: cores de texto mais escuras, bordas visíveis, fundos
   claros nas células de tabelas e Gantt, melhor contraste nas tags de
   projetos e notas, sombras mais suaves e modais adaptados ao tema.
-------------------------------------------------------------------- */
html.light thead th,
html.light table.gantt thead th {
  /* Cabeçalhos escuros sobre fundo claro */
  color: var(--text);
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
}

html.light tbody td,
html.light table.gantt tbody td {
  /* Células de corpo com texto escuro e linhas mais discretas */
  color: var(--text);
  border-bottom: 1px solid var(--line2);
}

html.light tbody tr:hover,
html.light table.gantt tbody tr:hover {
  /* Destaque ao passar o mouse em tabelas e Gantt no modo claro */
  background: rgba(78, 161, 255, .08);
}

html.light .tdMuted {
  /* Texto suavizado em campos "muted" nas tabelas */
  color: var(--muted);
}

html.light .tdNotes {
  /* Notas legíveis no modo claro */
  color: var(--text);
}

html.light .gCell {
  /* Células do Gantt com linhas mais discretas */
  border-left: 1px solid var(--line2);
  border-right: 1px solid var(--line2);
}

html.light .gCell.on {
  /* Bloco ativo do Gantt tem fundo e borda suavizados e texto escuro */
  background: rgba(78, 161, 255, .22);
  border-color: rgba(78, 161, 255, .35);
  color: var(--bg);
}

html.light .gCell.on span {
  /* Texto dentro do bloco ativo permanece legível em tema claro */
  background: rgba(255, 255, 255, .85);
  color: var(--text);
  border: 1px solid rgba(0, 0, 0, .12);
}

html.light table.gantt thead th.left {
  /* Coluna fixa da esquerda no Gantt com fundo consistente com cabeçalho */
  background: var(--panel2);
}

html.light table.gantt tbody td.left {
  /* Células fixas da esquerda com degradê suave no tema claro */
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border-right: 1px solid var(--line);
  color: var(--text);
}

html.light .gDayName,
html.light .gDayDate,
html.light .gDayWorked {
  /* Cabeçalhos e subtítulos do Gantt */
  color: var(--muted);
}

html.light .gDayWorked .chip {
  /* Chip de esforço diário com cores visíveis no tema claro */
  background: rgba(0, 0, 0, .05);
  border: 1px solid var(--line2);
}

html.light .event {
  /* Eventos no calendário com contraste adequado no tema claro */
  background: rgba(0, 0, 0, .04);
  border: 1px solid rgba(0, 0, 0, .08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
  color: var(--text);
}

html.light .event:hover {
  background: rgba(78, 161, 255, .12);
  border-color: rgba(78, 161, 255, .35);
}

html.light .event.dragging {
  background: rgba(78, 161, 255, .18);
  border-color: rgba(123, 211, 255, .50);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .25);
}

html.light .badge {
  /* Badges de projetos ficam menos saturados no modo claro */
  background: rgba(78, 161, 255, .10);
  border: 1px solid rgba(78, 161, 255, .30);
  color: var(--accent2);
}

/* Sobrescreve cores específicas das badges baseadas nos atributos data-pcolor */
html.light .badge[data-pcolor="0"] {
  background: rgba(66, 211, 146, .12);
  border-color: #42d392;
  color: #42d392;
}

html.light .badge[data-pcolor="1"] {
  background: rgba(255, 200, 97, .14);
  border-color: #ffc861;
  color: #ffc861;
}

html.light .badge[data-pcolor="2"] {
  background: rgba(255, 159, 67, .14);
  border-color: #ff9f43;
  color: #ff9f43;
}

html.light .badge[data-pcolor="3"] {
  background: rgba(78, 161, 255, .14);
  border-color: #4ea1ff;
  color: #4ea1ff;
}

html.light .badge[data-pcolor="4"] {
  background: rgba(155, 89, 182, .14);
  border-color: #9b59b6;
  color: #9b59b6;
}

html.light .badge[data-pcolor="5"] {
  background: rgba(52, 152, 219, .14);
  border-color: #3498db;
  color: #3498db;
}

html.light .badge[data-pcolor="6"] {
  background: rgba(231, 76, 60, .14);
  border-color: #e74c3c;
  color: #e74c3c;
}

html.light .badge[data-pcolor="7"] {
  background: rgba(26, 188, 156, .14);
  border-color: #1abc9c;
  color: #1abc9c;
}

html.light .badge[data-pcolor="8"] {
  background: rgba(241, 196, 15, .14);
  border-color: #f1c40f;
  color: #f1c40f;
}

html.light .badge[data-pcolor="9"] {
  background: rgba(149, 165, 166, .14);
  border-color: #95a5a6;
  color: #95a5a6;
}

html.light .selectionHint {
  /* Balões de dica ficam claros e legíveis */
  background: rgba(255, 255, 255, .95);
  border: 1px solid var(--line2);
  color: var(--text);
}

html.light .dragTimeTooltip {
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line2);
  color: var(--text);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .18);
}

html.light .selectionBlock {
  /* Blocos de seleção ficam translúcidos, mais discretos no tema claro */
  background: rgba(78, 161, 255, .16);
  border: 1px solid rgba(78, 161, 255, .35);
  box-shadow: 0 0 0 4px rgba(78, 161, 255, .12);
}

/* Ajustes adicionais de contraste no modo claro para calendário */
html.light .weekGrid {
  /* garante que a grade permaneça clara */
  background: var(--panel);
}

html.light .timeCol {
  /* coluna de horários levemente mais escura para separar do fundo */
  background: rgba(0, 0, 0, .05);
}

html.light .dayCol {
  /* colunas de dias muito sutis para diferenciar da grade */
  background: rgba(0, 0, 0, .03);
}

html.light .weekGrid .dayCol.todayDay {
  /* destaca o dia atual no tema claro */
  background: rgba(78, 161, 255, .12);
}

html.light .slotRow {
  /* linhas principais com linhas discretas */
  border-top: 1px dashed rgba(30, 30, 30, .12);
}

html.light .slotRow.major {
  border-top: 1px solid rgba(30, 30, 30, .22);
}

html.light .slotRow.hoverPreview::after {
  background: rgba(78, 161, 255, .12);
  border-color: rgba(78, 161, 255, .32);
  box-shadow: 0 0 0 3px rgba(78, 161, 255, .08);
}

html.light .slotRow.hoverPreview::before {
  color: rgba(26, 69, 122, .95);
  background: rgba(255, 255, 255, .84);
  border-color: rgba(78, 161, 255, .30);
}

html.light .timeLabel {
  color: var(--muted);
  border-top: 1px solid var(--line);
}

html.light .event {
  /* eventos com fundo levemente mais escuro para aumentar contraste */
  /* Fundo e borda mais marcantes para maior contraste */
  background: rgba(0, 0, 0, .06);
  border: 1px solid rgba(0, 0, 0, .14);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .10);
  color: var(--text);
}

html.light .event:hover {
  background: rgba(78, 161, 255, .18);
  border-color: rgba(78, 161, 255, .50);
}

html.light .event.dragging {
  box-shadow: 0 6px 12px rgba(0, 0, 0, .25);
}

html.light .event.selected {
  border-color: rgba(26, 115, 232, .78);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, .20), 0 4px 14px rgba(0, 0, 0, .20);
}

html.light .event .times {
  color: var(--muted);
}

html.light .event .title {
  color: var(--text);
}

html.light .event .notes {
  color: var(--muted);
}

html.light .worked {
  color: var(--muted);
}

html.light .worked b {
  color: var(--accent2);
}

html.light .worked .chip {
  background: rgba(0, 0, 0, .05);
  border: 1px solid var(--line2);
  color: var(--text);
}

html.light .modalBackdrop {
  /* No tema claro, fundo mais escuro para destacar melhor o popup */
  background: rgba(0, 0, 0, .62);
}

html.light .modal {
  /* Janela modal clara com sombra suave */
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .25);
}

html.light .modalHeader {
  border-bottom: 1px solid var(--line);
}

html.light .modalHeader h2,
html.light .modalHeader .when,
html.light .modalBody,
html.light .modalFooter {
  color: var(--text);
}

html.light .importDropZone {
  background: rgba(15, 23, 42, .035);
  border-color: rgba(15, 23, 42, .20);
}

html.light .importDropZone.isDragging {
  background: rgba(78, 161, 255, .10);
  border-color: rgba(47, 111, 216, .70);
}

html.light .modalBody input[type="text"],
html.light .modalBody textarea {
  background: #ffffff;
  border: 1px solid var(--line2);
  color: var(--text);
}

html.light .modalBody input[type="text"]:focus,
html.light .modalBody textarea:focus {
  border-color: rgba(78, 161, 255, .50);
  box-shadow: 0 0 0 4px rgba(78, 161, 255, .15);
}

html.light .xBtn {
  background: rgba(0, 0, 0, .05);
  border-color: var(--line2);
}

html.light .xBtn:hover {
  background: rgba(0, 0, 0, .08);
}

html.light .helpBackdrop {
  background: rgba(0, 0, 0, .62);
}

html.light .helpModal {
  background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(247, 249, 252, .98));
  border: 1px solid var(--line);
  box-shadow: 0 18px 48px rgba(15, 23, 42, .18);
}

html.light .helpSection {
  background: rgba(15, 23, 42, .025);
  border-color: var(--line);
}

html.light .helpVideo {
  background: rgba(15, 23, 42, .035);
  border-color: var(--line);
}

/* Charts view styles */
#chartsView {
  /* A altura e rolagem são semelhantes à grade, a visibilidade será controlada via classe .hidden */
  padding: 10px 12px 80px;
  overflow: auto;
  height: 100%;
}

#chartsView .chartsControls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

#chartsView .chartsControls .ctrlLabel {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.ctrlDate,
.ctrlSelect {
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid var(--line2);
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  color-scheme: dark;
  outline: none;
  transition: border-color 0.2s;
}

.ctrlDate:focus,
.ctrlSelect:focus {
  border-color: var(--accent);
}

html.light .ctrlDate,
html.light .ctrlSelect {
  color-scheme: light;
  background: #fff;
}

/* .chartsWrap and .chartContainer obsolete but retained if needed elsewhere */
#chartsView .chartsWrap {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

#chartsView .chartContainer {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  height: 320px;
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  font-family: var(--font-ui);
  /* Remove gradientes complexos, deixando apenas a cor de fundo */
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  font-family: var(--font-ui);
}

header.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 18px 7px 20px;
  min-height: 0;
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.topbarRow {
  min-width: 0;
  display: grid;
  align-items: center;
  gap: 6px 10px;
}

.topbarRow--top {
  grid-template-columns: minmax(0, 1fr) auto;
}

.topbarRow--middle {
  grid-template-columns: max-content minmax(0, 1fr);
}

.topbarRow--bottom {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.siteBrand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 0;
  margin-bottom: 1px;
  white-space: nowrap;
  flex: 0 0 auto;
  /* É um botão (leva ao calendário), mas com cara de logo */
  justify-self: start;
  width: max-content;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.siteBrand:focus-visible {
  outline: 2px solid var(--accent, #2196f3);
  outline-offset: 3px;
  border-radius: 6px;
}

.siteBrand__icon {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.siteBrand__word {
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.05em;
  color: var(--text);
  line-height: 1;
}

.headerUtilityBar,
.viewBtns,
.rightActions,
.navGroup,
.periodMeta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.headerUtilityBar,
.rightActions,
.periodMeta {
  justify-content: flex-end;
}

.headerUtilityBar,
.viewBtns,
.navGroup {
  flex-wrap: nowrap;
}

.topbarRow--bottom .navGroup {
  justify-self: start;
}

.topbarRow--bottom .centerGroup {
  justify-self: center;
}

.topbarRow--bottom .periodMeta {
  justify-self: end;
}

.rightActions .btn {
  justify-content: center;
  text-align: center;
}

#btnExportBackupNow {
  min-width: 0;
}

.viewBtns .btn {
  width: 100px;
  min-width: 100px;
  justify-content: center;
  text-align: center;
}

.navGroup .btn {
  width: 112px;
  min-width: 112px;
  justify-content: center;
  text-align: center;
}

.headerUtilityBar .emailWrap {
  min-width: 280px;
}

.headerUtilityBar .exportMenuWrap>.btn {
  width: 144px;
  min-width: 144px;
  justify-content: center;
}

.saveInfoBar {
  min-height: 14px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-width: 200px;
  max-width: 320px;
}

#lastSavedInfo {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  opacity: 0.82;
  text-align: right;
}

#lastSavedInfo[data-mode="target-ready"],
#lastSavedInfo[data-mode="saved-handle"] {
  color: rgba(175, 239, 197, .96);
  opacity: 1;
}

#lastSavedInfo[data-mode="saved-download"] {
  color: rgba(255, 232, 176, .96);
  opacity: 1;
}

#lastSavedInfo[data-mode="needs-target"],
#lastSavedInfo[data-mode="pending"] {
  color: rgba(255, 214, 122, .98);
  opacity: 1;
  font-weight: 600;
}

#lastSavedInfo[data-mode="permission-required"],
#lastSavedInfo[data-mode="target-unavailable"] {
  color: rgba(255, 178, 165, .98);
  opacity: 1;
  font-weight: 600;
}

html.light #lastSavedInfo[data-mode="target-ready"],
html.light #lastSavedInfo[data-mode="saved-handle"] {
  color: #1d6b45;
}

html.light #lastSavedInfo[data-mode="saved-download"] {
  color: #8a5a00;
}

html.light #lastSavedInfo[data-mode="needs-target"],
html.light #lastSavedInfo[data-mode="pending"] {
  color: #9a5f00;
}

html.light #lastSavedInfo[data-mode="permission-required"],
html.light #lastSavedInfo[data-mode="target-unavailable"] {
  color: #b43220;
}

header.topbar .centerGroup {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

header.topbar .rangeSm {
  max-width: clamp(220px, 30vw, 360px);
  min-width: 220px;
  overflow: hidden;
}

header.topbar .rangeSm strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(78, 161, 255, .15)
}

.brand h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: .2px
}

.sub {
  font-size: 12px;
  color: var(--muted);
  margin-left: 6px
}

.toolbar {
  display: none
}

.utilityControls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 0;
  flex: 0 0 auto;
}

.utilityBtn {
  min-width: 38px;
  min-height: 38px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.utilityBtn .btnIcon {
  margin-right: 0;
}

.utilityBtn svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settingsWrap {
  position: relative;
  display: inline-flex;
}

.baseMini {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .18);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.baseMini .miniDot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .20)
}

.baseMini.ok .miniDot {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(66, 211, 146, .12)
}

.baseMini.warn .miniDot {
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(255, 200, 97, .12)
}

.btnSm {
  padding: 6px 9px;
  font-size: 11px;
  border-radius: 8px
}

.rangeSm {
  padding: 6px 9px;
  border-radius: 9px;
  min-width: unset
}

.statusSm {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px
}

.baseMini {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .18);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap
}

.baseMini .miniDot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22)
}

.baseMini.ok .miniDot {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(66, 211, 146, .12)
}

.baseMini.warn .miniDot {
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(255, 200, 97, .12)
}

.baseMini .miniText {
  letter-spacing: .2px
}

.btnSm {
  padding: 6px 8px;
  font-size: 11px;
  border-radius: 8px
}

.rangeSm {
  padding: 7px 10px;
  min-width: 240px;
  font-size: 12px;
  border-radius: 10px
}

.statusSm {
  padding: 6px 9px;
  font-size: 12px;
  border-radius: 999px
}

.statusSm .statusDot {
  width: 8px;
  height: 8px
}

.toolbar::-webkit-scrollbar {
  height: 10px
}

.toolbar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .12);
  border-radius: 999px;
  border: 3px solid rgba(0, 0, 0, 0);
  background-clip: padding-box
}

.toolbar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .18);
  background-clip: padding-box
}

.spacer {
  flex: 1 1 auto;
  min-width: 12px
}

.btn {
  appearance: none;
  border: 1px solid var(--line2);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
  user-select: none;
  white-space: nowrap;
}

.btn:hover {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .18)
}

.btn:active {
  transform: translateY(1px)
}

.btn.primary {
  border-color: rgba(78, 161, 255, .45);
  background: rgba(78, 161, 255, .12)
}

.btn.danger {
  border-color: rgba(255, 92, 122, .45);
  background: rgba(255, 92, 122, .10)
}

.btn.ghost {
  background: transparent;
  border-color: var(--line)
}

.range {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .18);
  min-width: 230px;
  justify-content: center;
  font-size: 12px;
}

.range strong {
  font-weight: 650;
  letter-spacing: .2px
}

.statusPill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .18);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.statusDot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22)
}

.statusPill.ok .statusDot {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(66, 211, 146, .12)
}

.statusPill.warn .statusDot {
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(255, 200, 97, .12)
}

.btn.saved-green {
  background: var(--ok) !important;
  border-color: var(--ok) !important;
  color: #fff !important;
  transition: background 0.3s ease;
}

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

.settingsMenu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 130;
  display: flex;
  flex-direction: column;
  min-width: 150px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.settingsMenu__action {
  width: 100%;
  justify-content: flex-start;
  margin: 2px 0;
}

.settingsMenu__action .btnIcon {
  margin-right: 8px;
}

/* Atalhos que só aparecem no menu em telas de celular (ver @media max-width: 760px) */
.settingsMenu__mobileGroup {
  display: none;
}

.settingsMenu__divider {
  height: 1px;
  margin: 4px 2px;
  background: var(--line);
}

.menuSurface {
  min-width: 220px;
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.24);
}

.menuSurface .btn {
  width: 100%;
  justify-content: flex-start;
  margin: 2px 0;
}

.exportMenuWrap {
  position: relative;
  display: inline-flex;
}

.btnDropdownCaret {
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .78;
}

.btnDropdownCaret svg {
  width: 13px;
  height: 13px;
  display: block;
  fill: currentColor;
}

.exportMenu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
}

.onlineBadge {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 9999;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(0, 0, 0, .35);
  color: #fff;
  backdrop-filter: blur(8px);
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.2;
}

.app {
  /* Ajuste de altura para mobile e desktop */
  height: calc(100vh - var(--headerH));
  height: calc(100dvh - var(--headerH));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gridWrap {
  position: relative;
  height: 100%;
  overflow: auto;
  scrollbar-gutter: stable both-edges;
  /* AUMENTADO PADDING-BOTTOM PARA EVITAR CORTE (era 14px, agora 80px) */
  padding: 10px 12px 80px;
}

.gridWrap::-webkit-scrollbar {
  width: 12px;
  height: 12px
}

.gridWrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .12);
  border-radius: 999px;
  border: 3px solid rgba(0, 0, 0, 0);
  background-clip: padding-box;
}

.gridWrap::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .18);
  background-clip: padding-box
}

.daysHeader {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: var(--timeColW) repeat(7, minmax(var(--dayMinW), 1fr));
  /* Fundo simplificado e propriedades separadas para legibilidade */
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.daysHeader .cell {
  padding: 10px 10px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  min-height: 66px;
}

.daysHeader .cell:last-child {
  border-right: none
}

.daysHeader .timeHead {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  /* Garante que o título não quebre em várias linhas e que seja alinhado horizontalmente */
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
  /* Força a orientação horizontal mesmo se estilos anteriores aplicarem escrita vertical */
  writing-mode: horizontal-tb;
}

.dayName {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .2px
}

.dayDate {
  font-size: 14px;
  font-weight: 650
}

.todayPill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  color: var(--accent2);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .2px
}

.todayPill span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent2);
  box-shadow: 0 0 0 4px rgba(123, 211, 255, .12)
}

.worked {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: rgba(231, 238, 247, .88);
  letter-spacing: .2px;
}

.worked b {
  font-weight: 750;
  color: var(--accent2);
  font-variant-numeric: tabular-nums;
}

.worked .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(0, 0, 0, .18);
  color: rgba(231, 238, 247, .88);
  white-space: nowrap;
}

.worked .chip .miniDot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(66, 211, 146, .9);
  box-shadow: 0 0 0 4px rgba(66, 211, 146, .12)
}

.weekGrid {
  margin-top: 10px;
  position: relative;
  display: grid;
  grid-template-columns: var(--timeColW) repeat(7, minmax(var(--dayMinW), 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  /* Plano de fundo simplificado para melhor desempenho */
  background: var(--panel);
  box-shadow: var(--shadow);
  user-select: none;
}

.timeCol {
  background: rgba(0, 0, 0, .20);
  border-right: 1px solid var(--line);
  position: relative;
  z-index: 2
}

.dayCol {
  position: relative;
  border-right: 1px solid var(--line);
  background: rgba(0, 0, 0, .10)
}

.dayCol:last-child {
  border-right: none
}

.slots {
  position: relative
}

.slotRow {
  height: var(--slotH);
  border-top: 1px dashed rgba(255, 255, 255, .09);
  position: relative
}

.slotRow.hoverPreview {
  z-index: 1;
}

.slotRow.hoverPreview::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 1px;
  bottom: 1px;
  border-radius: 10px;
  background: rgba(78, 161, 255, .10);
  border: 1px solid rgba(78, 161, 255, .26);
  box-shadow: 0 0 0 3px rgba(78, 161, 255, .06);
  z-index: 0;
  pointer-events: none;
}

.slotRow.hoverPreview::before {
  content: "clique e arraste";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(123, 211, 255, .30);
  background: rgba(12, 20, 31, .62);
  color: rgba(230, 241, 252, .95);
  font-size: 10px;
  letter-spacing: .15px;
  line-height: 1.2;
  white-space: nowrap;
  z-index: 1;
  pointer-events: none;
}

.slotRow.major {
  border-top: 1px solid rgba(255, 255, 255, .18)
}

.timeLabel {
  height: calc(var(--slotH) * 6);
  border-top: 1px solid rgba(255, 255, 255, .14);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 6px 10px 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .2px;
}

.selectionBlock {
  position: absolute;
  left: 6px;
  right: 6px;
  border-radius: 12px;
  background: rgba(78, 161, 255, .16);
  border: 1px solid rgba(78, 161, 255, .45);
  box-shadow: 0 0 0 4px rgba(78, 161, 255, .08);
  pointer-events: none;
  z-index: 6;
}

.selectionHint {
  position: absolute;
  top: -28px;
  left: 6px;
  background: rgba(0, 0, 0, .55);
  border: 1px solid var(--line2);
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--text);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

.dragTimeTooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10000;
  padding: 6px 9px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .72);
  border: 1px solid var(--line2);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-9999px, -9999px, 0);
  transition: opacity .08s ease;
  will-change: transform;
}

.dragTimeTooltip.show {
  opacity: 1;
}

.workedTooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10000;
  min-width: 190px;
  max-width: min(300px, calc(100vw - 16px));
  padding: 11px 13px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line2);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-9999px, -9999px, 0);
  transition: opacity .12s ease;
  backdrop-filter: blur(10px);
  will-change: transform;
}

.workedTooltip.show {
  opacity: 1;
}

.workedTooltip.is-pinned {
  pointer-events: auto;
  user-select: text;
}

.workedTooltip__close {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: color .12s ease, background .12s ease;
}

.workedTooltip__close:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 12%, transparent);
}

.workedTooltip__title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .2px;
}

.workedTooltip.is-pinned .workedTooltip__title {
  padding-right: 22px;
}

.workedTooltip__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  line-height: 1.5;
}

.workedTooltip__label {
  color: var(--muted);
  white-space: nowrap;
}

.workedTooltip__value {
  color: var(--accent2);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.workedTooltip__empty {
  color: var(--muted);
}

.worked .chip {
  cursor: pointer;
}

.event {
  position: absolute;
  left: 4px;
  right: 4px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .28);
  padding: 6px 7px;
  cursor: pointer;
  z-index: 8;
  overflow: hidden;
}

.event:hover {
  border-color: rgba(78, 161, 255, .35);
  background: rgba(78, 161, 255, .10)
}

.event.dragging {
  opacity: .92;
  border-color: rgba(123, 211, 255, .55);
  background: rgba(78, 161, 255, .16);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .45);
  z-index: 30;
}

.event.selected {
  border-color: rgba(123, 211, 255, .86);
  box-shadow: 0 0 0 3px rgba(78, 161, 255, .28), 0 10px 24px rgba(0, 0, 0, .34);
}

.event.eventGhost {
  opacity: .24;
  border-color: rgba(255, 255, 255, .10);
  background: rgba(255, 255, 255, .08);
  box-shadow: none;
  pointer-events: none;
  z-index: 5;
}

.event.eventGhost .badge,
.event.eventGhost .times,
.event.eventGhost .title,
.event.eventGhost .notes {
  opacity: .72;
}

.event .topline {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  column-gap: 4px;
  row-gap: 2px;
  align-items: center;
  margin-bottom: 3px
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(78, 161, 255, .14);
  border: 1px solid rgba(78, 161, 255, .30);
  color: var(--accent2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.badge[data-pcolor="0"] {
  background: rgba(66, 211, 146, .18);
  border-color: #42d392;
  color: #42d392;
}

.badge[data-pcolor="1"] {
  background: rgba(255, 200, 97, .20);
  border-color: #ffc861;
  color: #ffc861;
}

.badge[data-pcolor="2"] {
  background: rgba(255, 159, 67, .22);
  border-color: #ff9f43;
  color: #ff9f43;
}

.badge[data-pcolor="3"] {
  background: rgba(78, 161, 255, .22);
  border-color: #4ea1ff;
  color: #4ea1ff;
}

.badge[data-pcolor="4"] {
  background: rgba(155, 89, 182, .22);
  border-color: #9b59b6;
  color: #9b59b6;
}

.badge[data-pcolor="5"] {
  background: rgba(52, 152, 219, .22);
  border-color: #3498db;
  color: #3498db;
}

.badge[data-pcolor="6"] {
  background: rgba(231, 76, 60, .22);
  border-color: #e74c3c;
  color: #e74c3c;
}

.badge[data-pcolor="7"] {
  background: rgba(26, 188, 156, .22);
  border-color: #1abc9c;
  color: #1abc9c;
}

.badge[data-pcolor="8"] {
  background: rgba(241, 196, 15, .22);
  border-color: #f1c40f;
  color: #f1c40f;
}

.badge[data-pcolor="9"] {
  background: rgba(149, 165, 166, .22);
  border-color: #95a5a6;
  color: #95a5a6;
}

.times {
  color: var(--muted);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: 0 0 auto;
  margin-left: auto;
  text-align: right
}

.title {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .2px;
  line-height: 1.14;
  margin-bottom: 1px
}

.notes {
  font-size: 10.5px;
  color: rgba(231, 238, 247, .86);
  line-height: 1.14;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
