/* ==========================================================================
   my.beaver
   ========================================================================== */

:root {
  --bg:          #f6f5f2;
  --surface:     #ffffff;
  --surface-2:   #f0eee9;
  --surface-3:   #e7e4dd;
  --border:      #e3dfd7;
  --border-soft: #eeebe4;
  --guide:       #e0dcd3;

  --text:        #221f1b;
  --text-dim:    #6d675f;
  --text-faint:  #9a948b;

  --accent:      #b96f2c;
  --accent-ink:  #ffffff;
  --accent-soft: #f6e7d6;

  --ok:      #2f7d52;
  --danger:  #b3392b;
  --warn:    #b45309;

  --imp-1: #c3b6a4;  --imp-2: #d08a2c;  --imp-3: #a8560f;
  --urg-1: #c9aeae;  --urg-2: #d55a4a;  --urg-3: #a92a1c;

  --radius:  8px;
  --radius-s: 6px;
  --indent: 22px;
  --row-font: 14.5px;

  --shadow: 0 8px 28px rgba(30, 25, 18, .14);
  --shadow-s: 0 2px 8px rgba(30, 25, 18, .10);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #16161a;
    --surface:     #1d1e23;
    --surface-2:   #24252b;
    --surface-3:   #2d2e35;
    --border:      #32333b;
    --border-soft: #292a31;
    --guide:       #2f3038;

    --text:        #e9e6e1;
    --text-dim:    #a19b93;
    --text-faint:  #6f6a63;

    --accent:      #d98c46;
    --accent-ink:  #211a12;
    --accent-soft: #3a2c1e;

    --ok:      #4fae7a;
    --danger:  #e0685a;
    --warn:    #d99341;

    --imp-1: #6b6357;  --imp-2: #d29b47;  --imp-3: #e0873a;
    --urg-1: #6f5b5b;  --urg-2: #e0705f;  --urg-3: #ef6a55;

    --shadow: 0 10px 34px rgba(0, 0, 0, .5);
    --shadow-s: 0 2px 10px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

/* O navegador esconde [hidden] com uma regra propria, mas qualquer regra nossa
   que defina display vence essa - basta um `.field { display: block }` para o
   atributo deixar de ter efeito, sem aviso nenhum. Como o app inteiro liga e
   desliga painel, barra e campos por `el.hidden`, a garantia precisa vir daqui
   e precisa ser mais forte que as regras de layout. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100vh; }

.ico {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

kbd {
  font: inherit;
  font-size: .85em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
}

/* ---------------------------------------------------------------- botoes */

button { font: inherit; color: inherit; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--text-dim);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: .86em;
}
.link-btn:hover { color: var(--text); }
.link-btn.is-danger, .popup-menu .is-danger { color: var(--danger); }

.btn-primary {
  border: 0;
  border-radius: var(--radius-s);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  padding: 9px 16px;
  cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: .6; cursor: default; }

.btn-small { padding: 5px 11px; font-size: .88em; border-radius: var(--radius-s); }
button.btn-small:not(.btn-primary) {
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  padding: 5px 11px;
  cursor: pointer;
  font-size: .88em;
  flex: none;
}
.chip-btn:hover { color: var(--text); }
.chip-btn.is-on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.filter-count {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  min-width: 17px;
  padding: 0 5px;
  font-size: .78em;
  font-weight: 700;
  text-align: center;
}

/* ==========================================================================
   Login
   ========================================================================== */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 100vh;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 30px 28px 26px;
}

.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 15px;
  background: var(--accent);
  color: var(--accent-ink);
  margin-bottom: 12px;
}
.auth-brand h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.02em; }
.auth-brand h1 span { color: var(--accent); }
.auth-brand p { margin: 6px 0 0; color: var(--text-dim); font-size: .9rem; }

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 18px;
}
.auth-tabs button {
  flex: 1;
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--text-dim);
  padding: 8px;
  cursor: pointer;
  font-size: .92rem;
}
.auth-tabs button.is-active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-s);
}

.field { display: block; margin-bottom: 14px; }
.field span {
  display: block;
  font-size: .82rem;
  color: var(--text-dim);
  margin-bottom: 5px;
}
.field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--bg);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}
.field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  background: var(--surface);
}

.auth-error {
  margin: 0 0 12px;
  padding: 9px 11px;
  border-radius: var(--radius-s);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger);
  font-size: .87rem;
}

#authForm .btn-primary { width: 100%; padding: 11px; }
.is-busy { opacity: .7; }

/* ==========================================================================
   Estrutura
   ========================================================================== */

.app { display: flex; min-height: 100vh; }

/* ---------------------------------------------------------------- pastas */

.sidebar {
  width: 232px;
  flex: none;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 10px 12px 16px;
}
.brand { font-weight: 700; letter-spacing: -.02em; }
.brand span { color: var(--accent); }

.folder-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.folder-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  border-radius: var(--radius-s);
  padding: 7px 10px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: .93em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.folder-item:hover { background: var(--surface-3); color: var(--text); }
.folder-item.is-current {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-s);
}
.sidebar-hint { color: var(--text-faint); font-size: .85em; padding: 8px 10px; margin: 0; }

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.user-chip {
  font-size: .82em;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logout-form { margin: 0; }

.sidebar-veil, .detail-veil {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  z-index: 40;
}

/* ---------------------------------------------------------------- topo */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
}

.folder-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 1.06rem;
  font-weight: 650;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
}

.sync-state {
  font-size: .8em;
  color: var(--text-faint);
  white-space: nowrap;
  transition: opacity .2s;
}
.sync-state.is-offline { color: var(--danger); }

/* ---------------------------------------------------------------- resumo */

.summary { padding: 12px 20px 6px; }
.summary-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}
.summary-pct { font-size: 1.25rem; letter-spacing: -.02em; }
.summary-detail { color: var(--text-dim); font-size: .88em; }
.summary-tag {
  font-size: .78em;
  color: var(--text-dim);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 2px 9px;
}
.summary-tag.is-late {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 13%, transparent);
}
.summary-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.summary-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .25s ease;
}

/* ==========================================================================
   Lista de tarefas
   ========================================================================== */

.outline-wrap {
  flex: 1;
  padding: 8px 20px 140px;
  min-height: 320px;
}

.outline { max-width: 1080px; }

.row { --depth: 0; }

.row-main {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  padding-left: calc(var(--depth) * var(--indent));
  border-radius: var(--radius-s);
  min-height: 30px;

  /* guias verticais de indentacao, uma a cada nivel */
  background-image: repeating-linear-gradient(
    to right, var(--guide) 0 1px, transparent 1px var(--indent));
  background-size: calc(var(--depth) * var(--indent)) 100%;
  background-position: 12px 0;
  background-repeat: no-repeat;
}
.row.is-active > .row-main { background-color: var(--surface-2); }
.row:hover > .row-main { background-color: var(--border-soft); }

.row.is-context { opacity: .42; }
.row.is-context:hover { opacity: .75; }

/* ---- recolher */

.twisty {
  width: 20px;
  height: 27px;
  margin-top: 1px;
  border: 0;
  background: none;
  padding: 0;
  color: var(--text-faint);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  transition: transform .12s ease;
}
.twisty .ico { width: 13px; height: 13px; stroke-width: 2.4; }
.twisty.is-open { transform: rotate(90deg); }
.twisty.is-hidden { visibility: hidden; }
.twisty:hover { color: var(--text); }

/* ---- checkbox */

.check {
  width: 19px;
  height: 19px;
  margin: 4px 6px 0 0;
  padding: 0;
  flex: none;
  border: 1.6px solid var(--text-faint);
  border-radius: 5px;
  background: transparent;
  color: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, border-color .12s;
}
.check .ico { width: 13px; height: 13px; stroke-width: 3; }
.check:hover { border-color: var(--accent); }

.row.is-done > .row-main > .check {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.check.is-partial {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent-soft) 50%, transparent 50%);
}
.check.is-derived { cursor: default; border-style: dashed; }
.row.is-done > .row-main > .check.is-derived { border-style: solid; }

/* ---- texto */

/* O texto ocupa so o que precisa: assim a barra de progresso e os chips ficam
   colados nele, e nao perdidos na margem direita da tela. */
.text {
  flex: 0 1 auto;
  min-width: 90px;
  max-width: 100%;
  padding: 4px 4px 3px;
  margin: 0;
  font-size: var(--row-font);
  line-height: 1.5;
  outline: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  caret-color: var(--accent);
}
.text:empty::before {
  content: attr(data-placeholder);
  color: var(--text-faint);
}
.row.is-done > .row-main > .text {
  color: var(--text-faint);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* ---- meta da direita */

.row-meta {
  display: flex;
  align-items: center;
  gap: 3px;
  padding-top: 4px;
  flex: 1 1 auto;
  min-width: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  padding: 0 5px;
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-size: .78em;
  white-space: nowrap;
  transition: opacity .12s, background .12s;
}
.chip .ico { width: 14px; height: 14px; }
.chip:hover { background: var(--surface-3); color: var(--text); }

/* Chips ainda nao usados so aparecem quando a linha esta sob o cursor ou
   em edicao: sem isso a tela vira um mural de icones apagados. */
.chip-level.lvl-0, .chip-date:not(.is-set), .chip-note { opacity: 0; }
.row:hover .chip, .row.is-active .chip { opacity: 1; }

/* Sem cursor (celular/tablet) nao existe "passar o mouse": os chips vazios
   somem de vez e so voltam na linha em edicao, senao cada tarefa ocuparia
   duas linhas de tela so com icones apagados. */
@media (hover: none) {
  .chip-level.lvl-0, .chip-date:not(.is-set), .chip-note { display: none; }
  .row.is-active .chip-level.lvl-0,
  .row.is-active .chip-date:not(.is-set),
  .row.is-active .chip-note { display: inline-flex; opacity: 1; }
}

.chip-importance.lvl-1 { color: var(--imp-1); }
.chip-importance.lvl-2 { color: var(--imp-2); }
.chip-importance.lvl-3 { color: var(--imp-3); }
.chip-importance.lvl-3 .ico { fill: currentColor; }

.chip-urgency.lvl-1 { color: var(--urg-1); }
.chip-urgency.lvl-2 { color: var(--urg-2); }
.chip-urgency.lvl-3 { color: var(--urg-3); }
.chip-urgency.lvl-3 .ico { fill: currentColor; }

.lvl-dots { letter-spacing: -1px; font-size: 1.1em; line-height: 1; }

.chip-date.is-set { color: var(--text-dim); background: var(--surface-2); }
.chip-date.is-overdue {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

/* ---- progresso */

.progress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 6px;
  flex: none;
}
.progress .bar {
  width: 58px;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress .bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width .2s ease;
}
.progress .pct {
  font-size: .74em;
  color: var(--text-faint);
  min-width: 28px;
  font-variant-numeric: tabular-nums;
}
.progress.is-full .bar i { background: var(--ok); }
.progress.is-full .pct { color: var(--ok); }

/* ---- etiquetas na linha */

.row-tags { display: inline-flex; gap: 3px; margin-right: 4px; flex-wrap: wrap; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: .74em;
  font-weight: 600;
  white-space: nowrap;
  cursor: default;
}
button.tag { cursor: pointer; opacity: .55; }
button.tag.is-on { opacity: 1; }

.tag-slate  { background: #e6e5e2; color: #4a4741; }
.tag-red    { background: #f8dedb; color: #8c2f22; }
.tag-amber  { background: #fbeacd; color: #8a5a10; }
.tag-green  { background: #d9efdf; color: #245c39; }
.tag-teal   { background: #d3ecec; color: #1d5b5b; }
.tag-blue   { background: #dbe6f8; color: #24467f; }
.tag-violet { background: #e6ddf8; color: #4a2f83; }
.tag-pink   { background: #f9dcea; color: #86255a; }

@media (prefers-color-scheme: dark) {
  .tag-slate  { background: #3a3a40; color: #d3d1cc; }
  .tag-red    { background: #4a2622; color: #f3b5ab; }
  .tag-amber  { background: #48371c; color: #f0c988; }
  .tag-green  { background: #23402f; color: #a6dcb8; }
  .tag-teal   { background: #1f3d3d; color: #9ed6d6; }
  .tag-blue   { background: #263854; color: #adc6ec; }
  .tag-violet { background: #372a52; color: #c6b0ee; }
  .tag-pink   { background: #4a2438; color: #eeadcb; }
}

.tag-del { opacity: .5; font-weight: 700; padding-left: 1px; }
.tag-del:hover { opacity: 1; }

/* ---- vazio */

.empty-state {
  max-width: 520px;
  padding: 34px 8px;
  color: var(--text-dim);
}
.empty-state p { margin: 0 0 8px; }
.empty-state strong { color: var(--text); font-size: 1.05rem; }
.empty-help { font-size: .92em; margin-bottom: 18px !important; }
.empty-state.is-filtered .empty-help,
.empty-state.is-filtered .btn-primary { display: none; }

/* ==========================================================================
   Filtros
   ========================================================================== */

.filter-panel {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 14px 20px 12px;
}

.f-rows { display: flex; flex-wrap: wrap; gap: 18px 26px; }

.f-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: start;
  gap: 5px;
  flex: 1 1 200px;
  min-width: 0;
}
/* A matriz precisa de duas colunas legiveis, entao pesa mais na divisao. */
.f-group.f-priority { flex: 2 1 380px; }
.f-title {
  width: 100%;
  font-size: .74em;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
  font-weight: 700;
}
.f-line { display: flex; align-items: center; gap: 5px; width: 100%; flex-wrap: wrap; }
.f-label { font-size: .78em; color: var(--text-faint); min-width: 74px; }
.f-hint { font-size: .82em; color: var(--text-faint); }

.f-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  padding: 3px 11px;
  font-size: .82em;
  cursor: pointer;
}
.f-chip:hover { border-color: var(--text-faint); color: var(--text); }
.f-chip.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.f-chip.f-mode { border-style: dashed; }

.f-matrix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  width: 100%;
  margin-bottom: 4px;
}
.f-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface);
  padding: 6px 9px;
  cursor: pointer;
  color: var(--text-dim);
}
.f-cell strong { font-size: .84em; color: var(--text); }
.f-cell span { font-size: .72em; }
.f-cell.is-on { border-color: var(--accent); background: var(--accent-soft); }
.f-cell-iu strong { color: var(--danger); }
.f-cell-i strong  { color: var(--warn); }

.f-date {
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--text);
  padding: 3px 7px;
  font: inherit;
  font-size: .82em;
}

.f-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

/* ==========================================================================
   Painel de detalhes
   ========================================================================== */

.detail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 100vw;
  z-index: 50;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 12px 12px 18px;
  border-bottom: 1px solid var(--border);
}
.detail-title { flex: 1; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.detail-head .icon-btn { font-size: 1.4rem; line-height: 1; }

.detail-body { flex: 1; overflow-y: auto; padding: 4px 18px 28px; }

.d-section { padding: 16px 0; border-bottom: 1px solid var(--border-soft); }
.d-section:last-child { border-bottom: 0; }
.d-section h3 {
  margin: 0 0 10px;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
}
.d-empty { color: var(--text-faint); font-size: .87em; margin: 4px 0; }

.d-tag-list { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.d-tag-new { display: flex; gap: 6px; }
.d-tag-new input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--bg);
  color: var(--text);
  padding: 6px 9px;
  font: inherit;
  font-size: .88em;
}

.c-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.c-form textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--bg);
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
  font-size: .9em;
  resize: vertical;
}
.c-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.c-form .btn-primary { align-self: flex-end; }

.c-list, .f-list { list-style: none; margin: 0; padding: 0; }

.c-item {
  border-left: 2px solid var(--border);
  padding: 2px 0 12px 11px;
  margin-bottom: 4px;
}
.c-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: .76em;
  color: var(--text-faint);
  margin-bottom: 3px;
}
.c-body { font-size: .92em; white-space: pre-wrap; overflow-wrap: anywhere; }
.c-del { opacity: 0; }
.c-item:hover .c-del { opacity: 1; }

.file-drop {
  display: block;
  border: 1px dashed var(--border);
  border-radius: var(--radius-s);
  padding: 12px;
  text-align: center;
  color: var(--text-dim);
  font-size: .87em;
  cursor: pointer;
  margin-bottom: 10px;
}
.file-drop:hover { border-color: var(--accent); color: var(--accent); }

.f-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: .88em;
}
.f-item a { color: var(--text); flex: 1; overflow-wrap: anywhere; }
.f-size { color: var(--text-faint); font-size: .85em; white-space: nowrap; }

/* ==========================================================================
   Baloes
   ========================================================================== */

.date-pop, .popup-menu {
  position: absolute;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.date-pop { padding: 12px; display: flex; flex-direction: column; gap: 9px; width: 250px; }
.date-pop-title { font-size: .76em; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.date-pop input[type="date"], .date-pop input[type="datetime-local"] {
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--bg);
  color: var(--text);
  padding: 7px 9px;
  font: inherit;
  font-size: .9em;
  width: 100%;
}
.date-pop-time { display: flex; align-items: center; gap: 7px; font-size: .84em; color: var(--text-dim); }
.date-pop-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.popup-menu { padding: 5px; display: flex; flex-direction: column; min-width: 170px; }
.popup-menu button {
  text-align: left;
  border: 0;
  background: none;
  border-radius: var(--radius-s);
  padding: 8px 11px;
  cursor: pointer;
  font-size: .9em;
}
.popup-menu button:hover { background: var(--surface-2); }

.flash-tip {
  position: absolute;
  z-index: 70;
  max-width: 260px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-s);
  padding: 7px 10px;
  font-size: .82em;
  box-shadow: var(--shadow);
}

/* ==========================================================================
   Barra do celular
   ========================================================================== */

.mobile-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  display: flex;
  gap: 2px;
  padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 18px rgba(0, 0, 0, .12);
}
.mobile-bar button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border: 0;
  border-radius: var(--radius-s);
  background: var(--surface-2);
  color: var(--text-dim);
  cursor: pointer;
}
.mobile-bar button:active { background: var(--accent-soft); color: var(--accent); }
.mobile-bar .ico { width: 20px; height: 20px; }

/* ==========================================================================
   Responsivo
   ========================================================================== */

.only-narrow { display: none; }

@media (max-width: 760px) {
  .only-narrow { display: inline-flex; }
  .only-wide { display: none; }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  body.sidebar-open .sidebar { transform: none; }

  .topbar { padding: 8px 10px; }
  .summary { padding: 10px 14px 4px; }
  .outline-wrap { padding: 6px 12px 150px; }
  .filter-panel { padding: 12px 14px; }

  :root { --indent: 17px; --row-font: 15.5px; }

  .detail { width: 100%; border-left: 0; }

  /* Os enfeites acompanham o texto e so descem para a linha de baixo quando
     nao couberem - o texto e o checkbox nunca sao espremidos. */
  .row-main { flex-wrap: wrap; }
  .row-meta { padding-bottom: 2px; flex-wrap: wrap; }
  .chip { height: 27px; padding: 0 8px; }
  .check { width: 21px; height: 21px; }

  /* Barra menor: e o que faz os indicadores caberem numa linha so. */
  .progress { margin: 0 4px; }
  .progress .bar { width: 38px; }
  .progress .pct { min-width: 24px; }
}

@media (min-width: 761px) {
  .sidebar-veil { display: none; }
}

/* ==========================================================================
   Conta do usuario (conta.php)
   ========================================================================== */

.auth-ok {
  margin: 0 0 12px;
  padding: 9px 11px;
  border-radius: var(--radius-s);
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
  color: var(--ok);
  font-size: .87rem;
}

.account-card { max-width: 440px; }

.account-head { margin-bottom: 22px; }
.account-head h1 {
  margin: 12px 0 0;
  font-size: 1.35rem;
  letter-spacing: -.02em;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: -4px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: .87rem;
}
.back-link:hover { color: var(--accent); }
.back-link .ico { width: 17px; height: 17px; }

/* Cada bloco e separado por uma linha, para o formulario de senha nao parecer
   continuacao do de perfil. */
.account-block + .account-block {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.account-block h2 {
  margin: 0 0 14px;
  font-size: .96rem;
  font-weight: 600;
  color: var(--text);
}

.account-block .btn-primary { width: 100%; padding: 11px; }

.field input[readonly] {
  color: var(--text-dim);
  background: var(--surface-2);
  cursor: default;
}
.field-hint {
  margin: -8px 0 16px;
  font-size: .8rem;
  color: var(--text-faint);
}

.account-foot {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* O chip do usuario na barra lateral virou link para conta.php. */
a.user-chip {
  text-decoration: none;
  border-radius: var(--radius-s);
  padding: 3px 6px;
  margin: -3px -6px;
}
a.user-chip:hover {
  color: var(--accent);
  background: var(--surface-2);
}

/* ==========================================================================
   Selecao de blocos (linhas inteiras)
   ========================================================================== */

.row.is-selected {
  background: var(--accent-soft);
}

/* A faixa vaza para as laterais, senao a selecao termina no recuo e parece
   recortada nas subtarefas. */
.row.is-selected::before {
  content: "";
  position: absolute;
  inset: 0 -100vw;
  z-index: -1;
  background: var(--accent-soft);
}
.row { position: relative; }

/* Enquanto o arraste corre, o navegador ainda mantem a propria selecao de
   texto atravessando as linhas - visualmente uma bagunca. Ela fica invisivel
   e quem aparece e a marca de bloco. */
.outline.has-block-selection .text::selection { background: transparent; }
.outline.has-block-selection .text::-moz-selection { background: transparent; }

/* Sem cursor piscando: no modo bloco nenhuma linha esta sendo editada. */
.outline.has-block-selection .text { caret-color: transparent; }
