:root {
  --desk: #e8e6e1;
  --paper: #fffffe;
  --frame: 6%; /* quanto o quadro de urgentes escurece o papel */
  --ink: #2b2b2b;
  --muted: #8a8a8a;
  --rule: #d9d9d9;
  --band: #ededed;
  --band-2: #cfcfcf;
  --pen: #1e3f94;
  --hl: #f3ee6f;
  --hol: #b3261e;
  --ev: #8e3fb5;
  --ok: #2f7d32;
  --bar: #262626;
  --bar-ink: #f2f2f2;
  --serif: "Crimson Pro", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --line: 22px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #0f0f0f; --paper: #1c1c1c; --ink: #e9e9e9; --muted: #999; --rule: #363636;
    --band: #262626; --band-2: #3a3a3a; --pen: #9db8ff; --hl: #d9cf4a; --hol: #ff8f86; --ev: #d4a3f0;
    --ok: #7bc47f; --bar: #161616; --frame: 20%; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --desk: #0f0f0f; --paper: #1c1c1c; --ink: #e9e9e9; --muted: #999; --rule: #363636;
  --band: #262626; --band-2: #3a3a3a; --pen: #9db8ff; --hl: #d9cf4a; --hol: #ff8f86; --ev: #d4a3f0;
  --ok: #7bc47f; --bar: #161616; --frame: 20%; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--desk);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { flex: none; }

input[type="text"], textarea {
  font: inherit;
  color: var(--pen);
  background-color: transparent;
  border: 0;
  outline: none;
  width: 100%;
  min-width: 0;
  padding: 0 4px;
  border-radius: 0;
}
input[type="text"]:focus, textarea:focus { background-color: color-mix(in srgb, var(--pen) 7%, transparent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--pen); cursor: pointer; }
:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }

textarea.ruled {
  --l: 28px;
  display: block;
  resize: none;
  line-height: var(--l);
  background-image: linear-gradient(to bottom, transparent calc(var(--l) - 1px), var(--rule) calc(var(--l) - 1px));
  background-size: 100% var(--l);
  background-attachment: local;
}

/* ---------- barra superior / abas ---------- */
.appbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 8px 20px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--bar); color: var(--bar-ink);
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-weight: 700; font-size: 21px; letter-spacing: .02em; white-space: nowrap; }
.brand svg { width: 22px; height: 22px; opacity: .8; }

/* ---------- alças de arrastar ---------- */
.grip {
  display: grid; place-items: center; width: 22px; height: 30px;
  color: var(--muted); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  font-size: 16px; line-height: 1;
}
.grip:active { cursor: grabbing; color: var(--pen); }

/* ---------- horário esticado (Hoje) ---------- */
.hour .slot { position: relative; display: block; min-width: 0; }
.hour .slot input { padding-right: 30px; }
.hour .slot.filled { cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.hour .slot.filled input:not(:focus) { pointer-events: none; }
.hour .slot.moving { opacity: .45; }
.hour .move-target, .hour .move-target input { background-color: color-mix(in srgb, var(--pen) 22%, transparent) !important; box-shadow: inset 0 -2px 0 var(--pen); }
.span-grip { position: absolute; right: 0; top: 50%; transform: translateY(-50%); height: 100%; opacity: .55; }
.hour .slot:hover .span-grip, .hour .slot:focus-within .span-grip { opacity: 1; }
@media (hover: none) { .span-grip { opacity: .8; } }
.hour .slot.span-start input { background-color: color-mix(in srgb, var(--pen) 13%, transparent); box-shadow: inset 3px 0 0 var(--pen); font-weight: 600; }
.span-range {
  position: absolute; right: 26px; top: 50%; transform: translateY(-50%);
  font-size: 10.5px; color: var(--pen); font-weight: 600; pointer-events: none; white-space: nowrap;
}
.hour .slot.span-start input { padding-right: 110px; }
.hour input.covered {
  background-color: color-mix(in srgb, var(--pen) 13%, transparent); box-shadow: inset 3px 0 0 var(--pen);
  cursor: default; opacity: 1;
}
.hour input.covered::placeholder { color: color-mix(in srgb, var(--pen) 55%, transparent); opacity: 1; font-style: italic; }
.hour .span-preview, .hour .span-preview input { background-color: color-mix(in srgb, var(--pen) 22%, transparent) !important; }

/* ---------- itens das anotações: mover e urgência ---------- */
.task.nitem { grid-template-columns: 1fr 28px 26px; -webkit-touch-callout: none; }
.nitem .ntext input[readonly] { cursor: pointer; -webkit-user-select: none; user-select: none; pointer-events: none; }
.task.nitem { -webkit-user-select: none; user-select: none; cursor: pointer; }
.nitem .ntext input:not([readonly]) { background: var(--band); }
.nitem .ntext { display: flex; align-items: center; min-width: 0; }
.nitem .urg { color: var(--hol); font-weight: 800; font-size: 16px; padding: 0 2px 0 4px; }
.nitem.urgent input[type="text"] { font-weight: 600; }
.urg-btn {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--rule); background: none;
  color: var(--muted); font-weight: 800; font-size: 14px; line-height: 1; padding: 0;
}
.urg-btn.on { background: var(--hol); border-color: var(--hol); color: #fff; }
.nitem.dragging { background: var(--band); box-shadow: 0 6px 18px rgba(0,0,0,.25); position: relative; z-index: 2; transition: none; will-change: transform; }

/* ---------- aniversários e datas anuais ---------- */
.mrow .tags { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; }
.tag.ev, .ev-name { color: var(--ev); }
.chip.ev { color: var(--ev); background: color-mix(in srgb, var(--ev) 12%, transparent); }
.mini td.ev a { position: relative; }
.mini td.ev a::after { content: ""; position: absolute; top: 0; right: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--ev); }
.lg.ev { width: 8px; height: 8px; border-radius: 50%; background: var(--ev); }
.yev { margin-top: 30px; padding-top: 20px; border-top: 2px solid var(--band-2); }
.yev-title { font-family: var(--serif); font-size: 22px; margin: 0 0 12px; }
.yev-form { display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; align-items: center; margin-bottom: 14px; }
.yev-form input[type="text"], .yev-form input[type="date"] {
  height: 40px; padding: 0 10px; border: 1px solid var(--rule); border-radius: 10px;
  background: var(--paper); color: var(--ink); font: inherit; font-size: 14px;
}
.yev-rep { display: flex; align-items: center; gap: 8px; font-size: 14px; white-space: nowrap; cursor: pointer; }
.yev-rep input { width: 20px; height: 20px; }
.yev-list { list-style: none; margin: 0; padding: 0; }
.yev-list li { display: grid; grid-template-columns: 56px 1fr auto 30px; align-items: center; gap: 8px; min-height: 40px; border-bottom: 1px solid var(--rule); }
.yev-date { font-family: var(--serif); font-weight: 700; font-size: 17px; color: var(--ev); }
.yev-name { font-size: 15px; }
.yev-tag { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.yev-list .x { border: 0; background: none; color: var(--muted); font-size: 18px; height: 30px; }
.yev-list .x:hover { color: var(--hol); }
@media (max-width: 760px) {
  .yev-form { grid-template-columns: 1fr 1fr; }
  .yev-form input[type="text"] { grid-column: 1 / -1; }
  .yev-form .btn { grid-column: 1 / -1; }
}

/* ---------- anotações ---------- */
.note-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 26px 28px; margin-bottom: 26px; align-items: start; }
.note-cat { min-width: 0; }
.nc-head { display: grid; grid-template-columns: auto 1fr auto auto auto auto; align-items: center; gap: 6px; border-bottom: 2px solid var(--ink); }
input.nc-title { font-family: var(--serif); font-size: 20px; font-weight: 700; height: 38px; color: var(--ink); }
.nc-count { font-size: 12px; color: var(--muted); }
.nc-move { width: 30px; height: 34px; display: grid; place-items: center; border: 0; background: none; border-radius: 8px; color: var(--muted); font-size: 18px; line-height: 1; }
.nc-move:hover:not(:disabled) { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.nc-move:disabled { opacity: .25; }
.nc-list { list-style: none; margin: 0; padding: 0; }
.nc-fold { width: 26px; height: 34px; display: grid; place-items: center; border: 0; background: none; padding: 0; color: var(--muted); font-size: 16px; line-height: 1; }
.note-cat.min .nc-list, .note-cat.min .task.new { display: none; }
.note-cat.min .nc-head { border-bottom-style: dashed; }

/* ---------- Cor / Fonte ---------- */
.set-row { display: grid; grid-template-columns: 200px 1fr; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.set-lbl { font-size: 14px; font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; justify-self: start; }
.seg button { border: 0; background: none; padding: 9px 14px; font-size: 14px; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button.on { background: var(--ink); color: var(--paper); font-weight: 600; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sw { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--rule); padding: 0; cursor: pointer; }
.sw.on { outline: 3px solid var(--ink); outline-offset: 2px; }
.sw-custom {
  position: relative; display: grid; place-items: center; overflow: hidden;
  background: conic-gradient(#e03131, #f59f00, #fcc419, #2f9e44, #1c7ed6, #7048e8, #e03131);
  color: #fff; font-weight: 700; font-size: 18px; text-shadow: 0 0 3px rgba(0,0,0,.6);
}
.sw-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.fonts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.font-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; background: none; text-align: left; }
.font-opt b { font-size: 17px; }
.font-opt small { font-size: 13px; color: var(--muted); }
.font-opt.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.menu [data-action="reset-settings"] { margin-top: 14px; }
@media (max-width: 760px) {
  .set-row { grid-template-columns: 1fr; gap: 8px; }
}

/* texto sempre legível sobre a cor de destaque (clara) */
.mini td.hl a, .mrow.hl .md b, .hl-btn.on { color: #1b1b1b; }

/* ---------- página de menu ---------- */
.menu .m-sec { margin-bottom: 26px; }
.menu h2 { font-family: var(--serif); font-size: 20px; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--band-2); }
.menu p { margin: 0 0 12px; line-height: 1.55; }
.m-ok { color: var(--ok); font-weight: 600; }
.m-note { color: var(--muted); font-size: 14px; }
.m-steps { margin: 0 0 12px; padding-left: 22px; line-height: 1.7; }
.btn.big { display: block; width: 100%; padding: 14px; font-size: 16px; text-align: center; margin: 4px 0 14px; }
.m-links { display: flex; flex-direction: column; }
.m-links a { display: flex; flex-direction: column; gap: 2px; padding: 12px 4px; border-bottom: 1px solid var(--rule); }
.m-links a:hover b { color: var(--pen); }
.m-links b { font-size: 16px; }
.m-links span { font-size: 13px; color: var(--muted); }
.menu .sheet-foot a { text-decoration: underline; }
.tabs { display: flex; gap: 4px; margin: 0 auto; }
.tabs a {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 8px; font-size: 14px;
  color: color-mix(in srgb, var(--bar-ink) 65%, transparent);
}
.tabs a:hover { color: var(--bar-ink); }
.tabs a.on { background: rgba(255,255,255,.12); color: var(--bar-ink); }
.tabs svg { width: 18px; height: 18px; }
.sync {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.1); border: 0; border-radius: 999px;
  padding: 6px 12px; font-size: 13px; color: var(--bar-ink);
}
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: #8a8a8a; }
.dot.ok { background: #5bd26a; }
.dot.warn { background: #f0a847; }
.dot.err { background: #ff6b6b; }
.dot.busy { background: #6aa8ff; animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .35; } }
/* troca de dia/mês arrastando o dedo */
@keyframes enter-next { from { opacity: .3; transform: translateX(40px); } }
@keyframes enter-prev { from { opacity: .3; transform: translateX(-40px); } }
.sheet.enter-next { animation: enter-next .22s ease-out; }
.sheet.enter-prev { animation: enter-prev .22s ease-out; }
@media (prefers-reduced-motion: reduce) { .sheet.enter-next, .sheet.enter-prev { animation: none; } }

/* ---------- aviso Google Agenda + painel da conta ---------- */
.gbar {
  position: sticky; top: 52px; z-index: 9;
  width: 100%; display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; border: 0; background: #fff4d6; color: #5c4400; font-size: 13px;
}
.gbar[hidden] { display: none; }
.gbar b { text-decoration: underline; }
.account {
  width: min(420px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 14px;
  background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.account::backdrop { background: rgba(0,0,0,.45); }
.acct-body { padding: 22px 22px 18px; }
.account h2 { font-family: var(--serif); font-size: 22px; margin: 0; }
.account h3 { font-family: var(--serif); font-size: 18px; margin: 20px 0 4px; padding-top: 16px; border-top: 1px solid var(--rule); }
.acct-email { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.acct-help { margin: 0 0 10px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.acct-status { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 14px; }
.acct-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #8a8a8a; flex: none; }
.acct-actions, .acct-foot { display: flex; flex-wrap: wrap; gap: 8px; }
.acct-foot { justify-content: space-between; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--rule); }
.btn { border: 1px solid var(--rule); background: var(--paper); border-radius: 10px; padding: 9px 14px; font-size: 14px; font-weight: 500; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--pen); border-color: var(--pen); color: var(--paper); }
.btn.danger { color: var(--hol); }

/* ---------- barra de navegação da página ---------- */
.toolbar {
  max-width: 210mm; margin: 20px auto 0;
  display: flex; align-items: center; gap: 8px;
}
.tb-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 10px; background: var(--paper); border: 1px solid var(--rule);
  font-size: 22px; line-height: 1;
}
.tb-btn:hover { border-color: var(--muted); }
.tb-title {
  flex: 1; text-align: center; background: none; border: 0;
  font-family: var(--serif); font-size: 20px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.tb-title .caret { font-size: 12px; color: var(--muted); }
.tb-today {
  padding: 0 16px; height: 40px; display: grid; place-items: center;
  border-radius: 10px; background: var(--ink); color: var(--paper);
  font-size: 14px; font-weight: 500;
}
.sr-date { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------- folha A4 ---------- */
.sheet {
  max-width: 210mm; min-height: 297mm;
  margin: 12px auto 48px; padding: 13mm 14mm 10mm;
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 10px 30px rgba(0,0,0,.08);
  display: flex; flex-direction: column;
}
.page-title {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-size: 26px; font-weight: 700; margin: 0 0 18px;
}
.page-title::before { content: ""; width: 10px; height: 10px; background: var(--band-2); }
.page-title::after { content: ""; flex: 1; height: 10px; background: var(--band); }
.sheet-foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 11px; color: var(--muted); margin-top: 14px;
}

/* ---------- página do dia ---------- */
.day-head {
  display: grid; grid-template-columns: auto 1fr auto 1fr auto;
  align-items: end; gap: 14px;
}
.dh-month, .dh-wd { font-family: var(--serif); font-size: 26px; font-weight: 700; }
.dh-num { font-family: var(--serif); font-size: 64px; font-weight: 600; line-height: .85; }
.dh-bar { height: 8px; background: var(--band-2); margin-bottom: 9px; }
.day-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 34px; margin: 12px 0 10px; }
.chip { font-size: 12px; padding: 5px 10px; border-radius: 999px; background: var(--band); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.today { background: var(--ink); color: var(--paper); }
.chip.hol { color: var(--hol); background: color-mix(in srgb, var(--hol) 10%, transparent); }
.chip.plan { color: var(--pen); }
.chip.plan small { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: 10px; margin-right: 4px; }
.hl-btn {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--rule); border-radius: 999px;
  padding: 4px 12px 4px 9px; font-size: 12px; color: var(--muted);
}
.hl-btn svg { width: 16px; height: 16px; }
.hl-btn.on { background: var(--hl); border-color: var(--hl); color: var(--ink); }

.day-grid { display: grid; grid-template-columns: 1.65fr 1fr; gap: 24px; flex: 1; }
.hours { border-top: 1px solid var(--band-2); overflow-x: clip; }
.hour { display: grid; grid-template-columns: 26px 1fr; }
.hour .h { grid-row: span 2; font-size: 11px; color: var(--muted); padding-top: 5px; }
.hour input { height: var(--line); border-bottom: 1px solid var(--rule); font-size: 14px; }
.hour input:not(.half) { border-bottom-style: dotted; }
.hour input.half { border-bottom-color: var(--band-2); }
.rem-box {
  margin: 4px 0 14px; padding: 8px 12px 6px; border: 1.5px solid color-mix(in srgb, var(--hol) 45%, var(--rule));
  border-radius: 10px; background: color-mix(in srgb, #000 var(--frame), var(--paper));
  box-shadow: inset 0 1px 3px rgba(0,0,0,.12);
}
.rem-title { margin: 0 0 4px; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--hol); display: flex; align-items: center; gap: 6px; }
.rem-title span { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--muted); }
.rem { list-style: none; margin: 0; padding: 0; }
.rem li { display: flex; align-items: center; gap: 8px; min-height: 34px; font-size: 14px; color: var(--hol); border-top: 1px dotted var(--rule); }
.rem li:first-child { border-top: 0; }
.rem li input[type="checkbox"] { flex: none; }
.rem .urg { color: var(--hol); font-weight: 800; }
.rem .rem-text { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.rem .rem-cat { flex: none; font-size: 11px; color: var(--muted); text-decoration: none; }

.col-title {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--serif); font-size: 18px; margin: 0; padding-bottom: 4px;
  border-bottom: 1px solid var(--band-2);
}
.tasks-count { font-family: var(--sans); font-size: 12px; font-weight: 500; color: var(--muted); }
.task-list { list-style: none; margin: 0; padding: 0; }
.task { display: grid; grid-template-columns: 22px 1fr 26px; align-items: center; border-bottom: 1px solid var(--rule); min-height: 34px; }
.task input[type="text"] { height: 33px; font-size: 14px; }
.task.done input[type="text"] { text-decoration: line-through; color: var(--muted); }
.task .x { border: 0; background: none; color: var(--muted); font-size: 18px; opacity: 0; height: 30px; }
.task:hover .x, .task:focus-within .x { opacity: 1; }
.task .x:hover { color: var(--hol); }
@media (hover: none) { .task .x { opacity: .6; } }
.task.new { grid-template-columns: 22px 1fr; border-bottom-style: dashed; color: var(--muted); }
.task.new svg { width: 15px; height: 15px; }

.notes { margin-top: 20px; background: var(--band); padding: 8px 12px 10px; }
.notes .lbl, .g-h { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.notes textarea.ruled { background-image: linear-gradient(to bottom, transparent calc(var(--l) - 1px), var(--band-2) calc(var(--l) - 1px)); }

/* ---------- planejamento do mês ---------- */
.month-name { font-family: var(--serif); font-size: 24px; font-weight: 600; text-align: center; margin: 0 0 10px; }
.month-list { flex: 1; display: flex; flex-direction: column; border-top: 1px solid var(--band-2); }
.mrow {
  flex: 1; min-height: 30px;
  display: grid; grid-template-columns: 74px 1fr auto; align-items: center;
  border-bottom: 1px solid var(--rule);
}
.mrow.sun { background: var(--band); }
.mrow input { height: 29px; font-size: 14px; }
.md { display: flex; align-items: baseline; gap: 6px; padding-left: 6px; height: 100%; align-items: center; }
.md b { font-family: var(--serif); font-size: 17px; min-width: 22px; text-align: right; }
.md span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; width: 26px; }
.md .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--pen); }
.md:hover b { color: var(--pen); text-decoration: underline; }
.mrow.hl .md b { background: var(--hl); padding: 0 2px; }
.mrow.today .md b { color: var(--pen); text-decoration: underline 2px; text-underline-offset: 3px; }
.mrow .tag { font-size: 11px; color: var(--hol); padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }

/* ---------- calendário anual ---------- */
.year-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 28px; flex: 1; align-content: start; }
.mini h3 { font-family: var(--serif); font-size: 17px; font-weight: 700; text-align: center; margin: 0 0 4px; padding-bottom: 3px; border-bottom: 1px solid var(--rule); }
.mini h3 a:hover { color: var(--pen); }
.mini table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; text-align: center; }
.mini th { background: var(--band); font-weight: 600; font-size: 10.5px; padding: 2px 0; }
.mini td { padding: 0; }
.mini td a { display: block; margin: 1px auto; width: 22px; height: 22px; line-height: 22px; border-radius: 50%; font-variant-numeric: tabular-nums; }
.mini td a:hover { background: var(--band); }
.mini td.we a { font-weight: 700; }
.mini td.hol a { color: var(--hol); font-weight: 700; }
.mini td.hl a { background: var(--hl); border-radius: 4px; }
.mini td.has a { text-decoration: underline 2px var(--pen); text-underline-offset: 3px; }
.mini td.today a { box-shadow: inset 0 0 0 2px var(--pen); }
.mini ul { list-style: none; margin: 6px 0 0; padding: 0; font-size: 11px; line-height: 1.5; color: var(--muted); }
.mini li b { display: inline-block; width: 20px; color: var(--ink); font-weight: 600; }
.legend { justify-content: flex-start; gap: 18px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.lg { width: 14px; height: 14px; display: inline-block; border-radius: 3px; }
.lg.hl { background: var(--hl); }
.lg.has { border-bottom: 2px solid var(--pen); border-radius: 0; height: 10px; }
.lg.today { border-radius: 50%; box-shadow: inset 0 0 0 2px var(--pen); }

/* ---------- objetivos ---------- */
.goals-sum { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: -6px 0 22px; }
.g-prog { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.bar { width: 110px; height: 6px; background: var(--band); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; transition: width .25s; }
.goal { margin-bottom: 34px; }
.g-title { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; }
.g-lbl { display: flex; align-items: center; gap: 7px; font-family: var(--serif); font-size: 20px; font-weight: 700; line-height: 32px; }
.g-lbl::before { content: ""; width: 9px; height: 9px; background: var(--band-2); }
.g-title textarea.ruled { --l: 32px; font-size: 18px; font-weight: 500; }
.g-del { width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: none; border-radius: 8px; color: var(--muted); }
.g-del svg { width: 18px; height: 18px; }
.g-del:hover { color: var(--hol); background: color-mix(in srgb, var(--hol) 10%, transparent); }
.g-sub { display: flex; justify-content: space-between; align-items: center; margin: 14px 0 2px; }
.g-steps { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, auto); grid-auto-flow: column; column-gap: 28px; }
.step { display: grid; grid-template-columns: 22px 1fr; align-items: center; height: 34px; border-bottom: 1px solid var(--rule); }
.step input[type="text"] { height: 33px; font-size: 14px; }
.step.done input[type="text"] { text-decoration: line-through; color: var(--muted); }
.g-dates { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; margin: 12px 0 14px; }
.g-dates label { display: flex; align-items: baseline; gap: 8px; border-bottom: 1px solid var(--muted); }
.g-dates label span { font-family: var(--serif); font-size: 15px; font-weight: 600; }
.g-dates input { height: 30px; font-size: 14px; }
.g-box { background: var(--band); padding: 4px 12px 10px; }
.g-box textarea.ruled { --l: 38px; background-image: linear-gradient(to bottom, transparent calc(var(--l) - 1px), var(--band-2) calc(var(--l) - 1px)); }
.add-goal {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 18px; border: 2px dashed var(--band-2); border-radius: 12px; background: none;
  font-size: 15px; font-weight: 500; color: var(--muted);
}
.add-goal svg { width: 20px; height: 20px; }
.add-goal:hover { color: var(--pen); border-color: var(--pen); }

/* ---------- celular ---------- */
@media (max-width: 760px) {
  body { background: var(--paper); }
  .appbar { padding-left: 16px; padding-right: 16px; }
  .brand { font-size: 20px; }
  .sync { margin-left: auto; }
  .sync:not(.s-signed-out):not(.s-local) .lbl { display: none; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; margin: 0;
    justify-content: space-around; background: var(--bar);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255,255,255,.08);
  }
  .tabs a { flex-direction: column; gap: 3px; font-size: 10.5px; padding: 6px 4px; min-width: 0; flex: 1; }
  .note-cats { grid-template-columns: 1fr; }
  .tabs svg { width: 22px; height: 22px; }
  #app { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }

  .toolbar { margin: 12px 16px 0; }
  .tb-title { font-size: 18px; }
  .sheet { margin: 0; min-height: 0; padding: 14px 16px 20px; box-shadow: none; }
  .page-title { font-size: 22px; }

  .day-head { gap: 10px; }
  .dh-month, .dh-wd { font-size: 22px; }
  .dh-num { font-size: 52px; }
  .day-grid { grid-template-columns: 1fr; gap: 22px; }
  .tasks { order: -1; }
  :root { --line: 30px; }
  .hour input { font-size: 15px; }
  .task input[type="text"], .step input[type="text"], .mrow input { font-size: 15px; }

  .mrow { grid-template-columns: 66px 1fr auto; min-height: 38px; }
  .mrow input { height: 37px; }
  .mrow .tag { max-width: 110px; }

  .year-grid { grid-template-columns: repeat(2, 1fr); gap: 20px 18px; }
  .mini td a { width: 21px; height: 21px; line-height: 21px; }
}
@media (max-width: 440px) {
  .g-steps { grid-template-columns: 1fr; grid-template-rows: repeat(6, auto); }
  .g-dates { column-gap: 14px; }
  .g-title textarea.ruled { font-size: 16px; }
}
@media (max-width: 370px) {
  .year-grid { gap: 18px 10px; }
  .mini table { font-size: 11px; }
  .mini td a { width: 19px; height: 19px; line-height: 19px; }
}

/* ---------- impressão ---------- */
@page { size: A4; margin: 0; }
@media print {
  .appbar, .toolbar, .add-goal, .g-del, .nc-move, .nc-fold, .hl-btn, .task .x { display: none !important; }
  .note-cat.min .nc-list { display: revert !important; }
  body { background: #fff; }
  .sheet { margin: 0; box-shadow: none; min-height: 297mm; }
}

/* ---------- arrastar afazer para o dia seguinte (Hoje) ---------- */
.nd-hint {
  position: fixed; right: 0; top: 50%; z-index: 30; transform: translate(100%, -50%);
  padding: 14px 18px; border-radius: 12px 0 0 12px; background: var(--pen); color: var(--paper);
  font: 700 15px/1 var(--sans, system-ui); letter-spacing: .02em; box-shadow: 0 6px 18px rgba(0,0,0,.25);
  transition: transform .18s ease-out; pointer-events: none;
}
.nd-hint.on { transform: translate(0, -50%); }
.hour .slot.to-next { opacity: .8; }
.hour .slot.to-next input { background-color: color-mix(in srgb, var(--pen) 25%, transparent) !important; }
.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 40; transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--paper);
  font-size: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.25); animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
