:root {
  --fundo: #E9E9E9;
  --card: #FAFAFA;
  --texto: #111111;
  --suave: #6B6B6B;
  --linha: #E6E6E4;
  --fim-de-semana: #F3F3F1;
  --hoje: #EB5757;
  --azul: #2383E2;
  --raio: 24px;                                        /* definido no config.js */
  --raio-in: calc(var(--raio) / 2);                     /* ícones e miniatura */
  --raio-mini: max(calc(var(--raio) / 3), 3px);         /* tarefas e botões */
  --gap: 30px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #141414;
    --card: #1F1F1F;
    --texto: #F2F2F2;
    --suave: #9A9A9A;
    --linha: #2E2E2E;
    --fim-de-semana: #1A1A1A;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fundo);
  color: var(--texto);
  font-family: "Fira Sans", -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

.grade {
  max-width: 1124px;
  margin: 0 auto;
  padding: 80px 16px 80px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}
.grade > *, .links > * { min-width: 0; }
.card {
  background: var(--card);
  border-radius: var(--raio);
  padding: 14px;
}
.topo {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 12px; line-height: 16px;
}

/* ---------- Clima ---------- */
.clima { padding: 14px 24px 16px 14px; }
.clima .topo { padding-right: 0; }
#minmax { color: var(--suave); }
.clima .linha {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 14px;
}
.clima h1 { margin: 0; font-size: 30px; font-weight: 500; letter-spacing: -.01em; }
.clima .temp { font-size: 30px; font-weight: 500; }
.clima .desc { margin: 2px 0 0; font-size: 24px; font-weight: 400; letter-spacing: .01em; }

/* ---------- Notícias ---------- */
.noticias { grid-column: span 2; position: relative; }
.noticia { display: flex; gap: 14px; min-height: 98px; }
.thumb { flex: 0 0 98px; height: 98px; }
.n-corpo { flex: 1; min-width: 0; padding-right: 8px; }
.noticias h2 {
  margin: 10px 0 0; font-size: 30px; line-height: 30px; font-weight: 500;
  letter-spacing: -.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  transition: opacity .25s;
}
.noticia:hover h2 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
#n-tempo { color: var(--suave); }
.n-nav {
  position: absolute; right: 22px; bottom: 10px;
  display: flex; align-items: center; gap: 2px;
  font-size: 11px; color: var(--suave);
  opacity: 0; transition: opacity .2s;
}
.noticias:hover .n-nav { opacity: 1; }
.n-nav button {
  border: 0; background: none; width: 22px; height: 22px; border-radius: 6px;
  font-size: 16px; line-height: 1; color: var(--suave);
}
.n-nav button:hover { background: var(--linha); color: var(--texto); }

/* ---------- Links ---------- */
.links { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.grupo { display: grid; gap: 14px; }
.tile {
  position: relative; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: #fff; font-size: 12px; font-weight: 500; text-align: center; line-height: 14px;
  transition: transform .15s ease, filter .15s ease;
}
.tile:hover { transform: translateY(-2px); filter: brightness(1.05); }
.tile:active { transform: translateY(0); }
.tile .nome { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* modo "svg": quadrado colorido com o seu ícone */
.tile.modo-svg { aspect-ratio: 1; border-radius: var(--raio-in); padding: 6px; }
.tile.modo-svg .ic.svg {
  width: 42%; aspect-ratio: 1;
  -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat;
}

/* modo "site"/"imagem": o próprio ícone preenche o quadrado (como nos Preferidos do Safari) */
.tile.modo-site, .tile.modo-imagem { color: var(--texto); font-weight: 400; gap: 6px; }
.tile.modo-site .ic, .tile.modo-imagem .ic { width: 100%; }

/* caixa de ícone (links e miniatura da notícia) */
.ic {
  aspect-ratio: 1; border-radius: var(--raio-in); overflow: hidden;
  display: grid; place-items: center; background: #F2F2F2;
}
.ic.svg { border-radius: 0; overflow: visible; }
.ic img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .2s; }
.ic.cheio img, .ic.pequeno img { opacity: 1; }
.ic.cheio { background: #fff; }
.ic.pequeno { background: #fff; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.ic.pequeno img { width: 50%; height: 50%; object-fit: contain; }
.ic.letra { background: #9A9AA0; color: #fff; font-size: clamp(20px, 3.2vw, 40px); font-weight: 400; }
/* ---------- Calendário ---------- */
.cal { grid-column: 1 / -1; padding: 22px 22px 22px; min-height: 280px; }
.cal-topo { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-topo h3 { margin: 0 0 0 4px; font-size: 17px; font-weight: 600; }
.cal-topo h3::first-letter { text-transform: uppercase; }
.cal-acoes { display: flex; align-items: center; gap: 4px; }
.cal-status { font-size: 12px; color: var(--suave); margin-right: 8px; }
.btn {
  border: 1px solid transparent; background: none; border-radius: var(--raio-mini);
  height: 30px; padding: 0 10px; font-size: 14px;
  display: inline-flex; align-items: center;
}
.btn:hover { background: var(--linha); }
#cal-abrir { border-color: var(--linha); margin-right: 6px; }
.btn.icone { width: 30px; justify-content: center; padding: 0; font-size: 18px; color: var(--suave); }

.cal-rolagem { overflow-x: auto; margin: 0 -4px; }
.cal-grade {
  display: grid; grid-template-columns: repeat(7, minmax(128px, 1fr));
  min-width: 900px;
}
.dia-nome:first-child ~ .dia:nth-child(8) { border-left: 1px solid var(--linha); }
.dia-nome {
  text-align: center; font-size: 13px; color: var(--suave);
  padding: 6px 0 8px; border-right: 1px solid transparent;
}
.dias-nomes { display: contents; }
.dia {
  border-right: 1px solid var(--linha); border-bottom: 1px solid var(--linha); border-top: 1px solid var(--linha);
  min-height: 200px; padding: 6px 6px 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.dia.fds { background: var(--fim-de-semana); }
.dia-num { align-self: flex-end; font-size: 14px; height: 26px; min-width: 26px; display: grid; place-items: center; padding: 0 6px; margin-bottom: 2px; }
.dia.hoje .dia-num { background: var(--hoje); color: #fff; border-radius: 13px; font-weight: 500; }

.tarefa {
  display: block; border-radius: var(--raio-mini); padding: 7px 8px 6px;
  background: var(--c-bg); font-size: 13px; line-height: 17px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  transition: filter .15s;
}
.tarefa:hover { filter: brightness(.97); }
.t-linha1 { display: flex; justify-content: space-between; gap: 6px; }
.t-nome { font-weight: 600; overflow-wrap: anywhere; }
.t-hora { font-size: 11px; color: var(--suave); white-space: nowrap; padding-top: 1px; }
.t-tag {
  display: inline-block; margin-top: 5px; padding: 0 6px; border-radius: 4px;
  background: var(--c-tag); color: var(--c-txt); font-size: 12px; line-height: 19px;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.t-periodo { margin-top: 4px; font-size: 12px; color: var(--suave); }
.t-check {
  display: flex; align-items: center; gap: 6px; margin-top: 4px;
  font-size: 12px; background: none; border: 0; padding: 2px 0; border-radius: 4px;
}
.caixa {
  width: 14px; height: 14px; border-radius: 3px; border: 1.5px solid #B5B5B2;
  display: grid; place-items: center; flex: none; background: var(--card);
}
.caixa svg { width: 10px; height: 10px; stroke: #fff; stroke-width: 2.4; fill: none; display: none; }
.t-check[data-s="andamento"] .caixa,
.t-check[data-s="concluido"] .caixa { background: var(--azul); border-color: var(--azul); }
.t-check[data-s="andamento"] .menos,
.t-check[data-s="concluido"] .v { display: block; }
.t-check:disabled { opacity: .5; cursor: progress; }
.tarefa.feita .t-nome { color: var(--suave); }

.cal-vazio { grid-column: 1 / -1; padding: 40px; text-align: center; color: var(--suave); font-size: 14px; }

/* Cores do Notion */
.cor-default, .cor-gray { --c-bg:#F1F1EF; --c-tag:#E3E2E0; --c-txt:#32302C; }
.cor-brown  { --c-bg:#F4EEEE; --c-tag:#EEE0DA; --c-txt:#442A1E; }
.cor-orange { --c-bg:#FBECDD; --c-tag:#FADEC9; --c-txt:#49290E; }
.cor-yellow { --c-bg:#FBF3DB; --c-tag:#FDECC8; --c-txt:#402C1B; }
.cor-green  { --c-bg:#EDF3EC; --c-tag:#DBEDDB; --c-txt:#1C3829; }
.cor-blue   { --c-bg:#E7F3F8; --c-tag:#D3E5EF; --c-txt:#183347; }
.cor-purple { --c-bg:#F6F3F9; --c-tag:#E8DEEE; --c-txt:#412454; }
.cor-pink   { --c-bg:#FAF1F5; --c-tag:#F5E0E9; --c-txt:#4C2337; }
.cor-red    { --c-bg:#FDEBEC; --c-tag:#FFE2DD; --c-txt:#5D1715; }
@media (prefers-color-scheme: dark) {
  .cor-default, .cor-gray { --c-bg:#2F2F2F; --c-tag:#5A5A5A; --c-txt:#F0F0F0; }
  .cor-brown  { --c-bg:#4A3228; --c-tag:#603B2C; --c-txt:#F0E6E1; }
  .cor-orange { --c-bg:#5C3B23; --c-tag:#854C1D; --c-txt:#FBE8D8; }
  .cor-yellow { --c-bg:#564328; --c-tag:#89632A; --c-txt:#FBF0D6; }
  .cor-green  { --c-bg:#243D30; --c-tag:#2B593F; --c-txt:#DDF0E3; }
  .cor-blue   { --c-bg:#143A4E; --c-tag:#28456C; --c-txt:#DDEBF7; }
  .cor-purple { --c-bg:#3C2D49; --c-tag:#492F64; --c-txt:#EDE0F7; }
  .cor-pink   { --c-bg:#4E2C3C; --c-tag:#69314C; --c-txt:#F7DFEA; }
  .cor-red    { --c-bg:#522E2A; --c-tag:#6E3630; --c-txt:#F9DEDA; }
  .tarefa { box-shadow: none; }
  .tarefa:hover { filter: brightness(1.1); }
  .caixa { border-color: #6B6B6B; }
  .ic { background: #2A2A2A; }
}

/* Aviso */
.aviso {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: #111; color: #fff; font-size: 13px; padding: 10px 14px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: .25s; max-width: calc(100% - 32px);
}
.aviso.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsivo ---------- */
@media (max-width: 960px) {
  .grade { grid-template-columns: 1fr; padding-top: 32px; gap: 20px; }
  .noticias, .links, .cal { grid-column: auto; }
  .links { grid-template-columns: 1fr; gap: 20px; }
  .links .card { max-width: none; }
  .noticias h2 { font-size: 22px; line-height: 25px; }
  .n-nav { opacity: 1; }
}
@media (max-width: 480px) {
  .clima h1, .clima .temp { font-size: 24px; }
  .clima .desc { font-size: 18px; }
  .thumb { flex-basis: 64px; height: 64px; }
  .grupo { gap: 10px; }
  .noticia { min-height: 64px; }
  .noticias h2 { font-size: 18px; line-height: 21px; }
}
