/* ==========================================================================
   Nexos — Base: reset, shell do app e componentes compartilhados.
   Telas específicas ficam em css/views/<tela>.css.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; }
::selection { background: var(--accent-ring); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

svg.lucide { width: 18px; height: 18px; stroke-width: 1.9; flex-shrink: 0; }
i[data-lucide] { display: inline-block; width: 18px; height: 18px; flex-shrink: 0; }

/* scrollbars discretas */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

/* ==========================================================================
   Shell
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  transition: grid-template-columns .25s var(--ease);
}
.app.sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.app.sidebar-collapsed .sidebar { visibility: hidden; }
.app.bare { grid-template-columns: minmax(0, 1fr); }
.app.bare .sidebar, .app.bare .topbar, .app.bare .bottom-nav, .app.bare .fab { display: none; }

/* ---- Sidebar ---- */
.sidebar {
  background: var(--bg-sub);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 10px 10px 8px; display: flex; flex-direction: column; gap: 1px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 14px 8px 16px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center;
  box-shadow: 0 4px 12px var(--accent-ring);
}
.brand-name { font-weight: 750; font-size: 17px; letter-spacing: -.02em; }
.brand-tag { font-size: 10.5px; font-weight: 650; color: var(--accent); background: var(--accent-soft); padding: 1px 7px; border-radius: 999px; }
.brand .btn-icon { margin-left: auto; }

.search-trigger {
  display: flex; align-items: center; gap: 9px;
  margin: 6px 0 10px; height: 36px; padding: 0 10px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-3);
  font-size: 13.5px; text-align: left; width: 100%;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.search-trigger:hover { border-color: var(--border-2); box-shadow: var(--shadow-sm); }
.search-trigger .kbd { margin-left: auto; }
.search-trigger > span:not(.kbd) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-row .me-sub, .me-row .me-name { white-space: nowrap; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  min-height: 34px; padding: 6px 10px;
  border-radius: 9px; color: var(--text-2);
  font-weight: 520; font-size: 13.8px;
  cursor: pointer; user-select: none; width: 100%; text-align: left;
  transition: background var(--dur), color var(--dur);
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }
.nav-item .nav-emoji { width: 20px; text-align: center; font-size: 15px; line-height: 1; }
.nav-item .nav-count { margin-left: auto; font-size: 12px; color: var(--text-3); font-weight: 550; }
.nav-item .nav-count.hot { color: var(--on-accent); background: var(--accent); padding: 0 7px; border-radius: 999px; line-height: 18px; }
.nav-item .nav-shared { margin-left: auto; color: var(--text-3); display: inline-flex; }
.nav-section {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3); padding: 18px 10px 6px;
}
.nav-section .btn-icon { width: 22px; height: 22px; border-radius: 6px; }
.nav-new { color: var(--text-3); }

.sidebar-foot { padding: 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.level-switch { display: flex; flex-direction: column; gap: 6px; }
.level-switch-label { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--text-3); font-weight: 600; padding: 0 4px; }
.level-switch .seg { width: 100%; }
.level-switch .seg button { flex: 1; }
.me-row { display: flex; align-items: center; gap: 9px; padding: 4px 4px 2px; }
.me-row .me-name { font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.me-row .me-sub { font-size: 11.5px; color: var(--text-3); }
.claude-status { display: inline-flex; align-items: center; gap: 6px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 22%, transparent); }

/* ---- Main ---- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  position: relative; z-index: 20;
}
.topbar-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 650; font-size: 15px; }
.topbar-title .tt-emoji { font-size: 18px; line-height: 1; }
.topbar-title .tt-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title .tt-crumb { color: var(--text-3); font-weight: 500; white-space: nowrap; }
.topbar-tabs { display: flex; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: 11px; margin-left: 8px; overflow-x: auto; scrollbar-width: none; }
.topbar-tabs::-webkit-scrollbar { display: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.topbar-view-actions { display: flex; align-items: center; gap: 6px; }

.view { flex: 1; min-height: 0; overflow: auto; position: relative; overscroll-behavior: contain; }
.view.view-full { overflow: hidden; }
.view-enter { animation: viewIn .28s var(--ease); }

/* Papéis de parede (aplicados na área principal) */
:root[data-wallpaper="pontos"] .main { background-image: radial-gradient(var(--dot) 1.1px, transparent 1.3px); background-size: 22px 22px; }
:root[data-wallpaper="aurora"] .main {
  background:
    radial-gradient(900px 480px at 8% -8%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(700px 420px at 100% 0%, color-mix(in srgb, var(--c-sky-s) 14%, transparent), transparent 70%),
    radial-gradient(800px 500px at 60% 110%, color-mix(in srgb, var(--c-mint-s) 12%, transparent), transparent 70%),
    var(--bg);
}
:root[data-wallpaper="grade"] .main {
  background-image: linear-gradient(var(--dot) 1px, transparent 1px), linear-gradient(90deg, var(--dot) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ---- Páginas (layout padded) ---- */
.page { max-width: 1100px; margin: 0 auto; padding: 28px 32px 140px; }
.page-narrow { max-width: 780px; }
.page-wide { max-width: 1380px; }

/* ---- FAB de captura ---- */
.fab {
  position: fixed; right: 26px; bottom: 26px; z-index: var(--z-fab);
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center;
  box-shadow: 0 10px 28px var(--accent-ring), var(--shadow);
  transition: transform .22s var(--spring), box-shadow .2s;
}
.fab:hover { transform: translateY(-2px) scale(1.04); }
.app.full .fab { display: none; }
.fab:active { transform: scale(.95); }
.fab svg.lucide { width: 24px; height: 24px; stroke-width: 2.2; }

/* ---- Navegação inferior (mobile) ---- */
.bottom-nav { display: none; }
.scrim { display: none; }
.show-mobile { display: none !important; }
.topbar .claude-btn { gap: 6px; }
.topbar .claude-btn .badge-dot { min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 10.5px; font-weight: 700; display: inline-grid; place-items: center; }

/* ==========================================================================
   Componentes
   ========================================================================== */

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: 10px;
  font-weight: 560; font-size: 13.5px; white-space: nowrap; user-select: none;
  color: var(--text);
  transition: background var(--dur), color var(--dur), box-shadow var(--dur), transform .08s, border-color var(--dur);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn svg.lucide { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.14); }
.btn-primary:hover { background: var(--accent-2); }
.btn-soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn-soft:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-outline { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.btn-outline:hover { border-color: var(--border-2); background: var(--surface-2); }
.btn-danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 20%, transparent); }
.btn-icon { width: 34px; padding: 0; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; gap: 5px; }
.btn-sm.btn-icon { width: 28px; padding: 0; }
.btn-sm svg.lucide { width: 15px; height: 15px; }
.btn-lg { height: 44px; padding: 0 18px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn.is-on { background: var(--accent-soft); color: var(--accent-ink); }

/* Campos */
.input {
  height: 38px; width: 100%; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); outline: none;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.input::placeholder { color: var(--text-3); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input-plain { border: 0; background: transparent; outline: none; width: 100%; padding: 0; }
.input-plain::placeholder { color: var(--text-3); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }

/* Cartões */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: var(--pad); }
.card-hover { transition: transform .18s var(--ease), box-shadow .18s, border-color .18s; cursor: pointer; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-2); }
.tint { background: var(--c-bg); color: var(--c-ink); border-color: transparent; }

/* Chips / etiquetas */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 11.8px; font-weight: 560; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.chip svg.lucide { width: 12px; height: 12px; }
.chip.tint { background: var(--c-bg); color: var(--c-ink); }
.chip-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c-s, var(--accent)); }
.chip-accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip-late { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.chip-today { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.chip-lg { height: 28px; padding: 0 11px; font-size: 13px; }
button.chip { cursor: pointer; transition: background var(--dur), transform .08s; }
button.chip:hover { background: var(--active); }
button.chip:active { transform: scale(.96); }

/* Avatares */
.avatar {
  --size: 28px;
  width: var(--size); height: var(--size); border-radius: 50%;
  display: inline-grid; place-items: center; flex-shrink: 0;
  font-size: calc(var(--size) * .42); font-weight: 680; color: #fff;
  background: var(--av, #888); position: relative; user-select: none;
}
.avatar-ring { box-shadow: 0 0 0 2px var(--bg); }
.avatar.online::after {
  content: ""; position: absolute; right: -1px; bottom: -1px;
  width: calc(var(--size) * .32); height: calc(var(--size) * .32);
  border-radius: 50%; background: var(--success); box-shadow: 0 0 0 2px var(--surface);
}
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar + .avatar { margin-left: -7px; }

/* Checkbox redondo */
.check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.8px solid var(--border-2); background: var(--surface);
  display: inline-grid; place-items: center; flex-shrink: 0; cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s var(--spring);
}
.check:hover { border-color: var(--accent); }
.check.on { background: var(--accent); border-color: var(--accent); animation: checkPop .3s var(--spring); }
.check.on::after {
  content: ""; width: 5px; height: 9px; margin-top: -2px;
  border: solid var(--on-accent); border-width: 0 2.2px 2.2px 0; transform: rotate(45deg);
}
.check.square { border-radius: 6px; }
.check.lg { width: 26px; height: 26px; }
.check.lg.on::after { width: 7px; height: 12px; }

/* Interruptor */
.switch {
  position: relative; width: 40px; height: 23px; border-radius: 999px; flex-shrink: 0;
  background: var(--border-2); transition: background .2s; cursor: pointer;
}
.switch::after {
  content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .22s var(--spring);
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(17px); }

/* Controle segmentado e abas */
.seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  height: 28px; padding: 0 11px; border-radius: 8px;
  font-size: 12.8px; font-weight: 560; color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background var(--dur), color var(--dur), box-shadow var(--dur);
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button svg.lucide { width: 15px; height: 15px; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: 8px; color: var(--text-2); font-weight: 560; font-size: 13px; white-space: nowrap;
  transition: background var(--dur), color var(--dur);
}
.tab:hover { color: var(--text); }
.tab.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tab svg.lucide { width: 15px; height: 15px; }

/* Barra de progresso */
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--c-s, var(--accent)); transition: width .4s var(--ease); }

/* Teclas */
.kbd {
  white-space: nowrap;
  font-family: var(--font-mono); font-size: 10.5px; line-height: 1;
  padding: 3px 6px; border-radius: 5px;
  border: 1px solid var(--border); border-bottom-width: 2px;
  background: var(--surface-2); color: var(--text-3);
}

/* Tipografia utilitária */
.h1 { font-family: var(--font-display); font-size: var(--fs-3xl); font-weight: 600; letter-spacing: -.02em; line-height: 1.12; }
.h2 { font-size: var(--fs-xl); font-weight: 680; letter-spacing: -.015em; line-height: 1.25; }
.h3 { font-size: var(--fs-md); font-weight: 650; line-height: 1.35; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.tiny { font-size: var(--fs-xs); }
.strong { font-weight: 650; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 650; color: var(--text-2);
  margin: 30px 0 12px;
}
.section-title .btn { margin-left: auto; }
.section-title svg.lucide { width: 16px; height: 16px; color: var(--text-3); }

/* Layout utilitário */
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.grid { display: grid; gap: var(--gap); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(var(--min, 230px), 1fr)); }
.masonry { columns: var(--cols, 4) 230px; column-gap: var(--gap); }
.masonry > * { break-inside: avoid; margin-bottom: var(--gap); }
.divider { height: 1px; background: var(--border); margin: 12px 0; border: 0; }

/* Estado vazio */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  padding: 48px 24px; color: var(--text-2);
}
.empty-icon { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty-icon svg.lucide { width: 26px; height: 26px; }
.empty-title { font-weight: 650; color: var(--text); font-size: 16px; }
.empty-text { max-width: 380px; font-size: 13.5px; }

/* Tooltip simples: <button data-tip="Texto"> */
[data-tip] { position: relative; }
@media (hover: hover) {
  [data-tip]:hover::after {
    content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 7px); transform: translateX(-50%);
    background: var(--text); color: var(--bg); font-size: 11.5px; font-weight: 550; line-height: 1.3;
    padding: 5px 8px; border-radius: 7px; white-space: nowrap; pointer-events: none; z-index: 50;
    animation: fade .12s .35s both;
  }
  [data-tip-pos="top"]:hover::after { top: auto; bottom: calc(100% + 7px); }
  [data-tip-pos="right"]:hover::after { left: calc(100% + 8px); top: 50%; transform: translateY(-50%); }
}

/* ==========================================================================
   Cartões de item (ui.itemCard) e linhas de tarefa (ui.taskRow)
   ========================================================================== */
.item-card {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 14px 14px 12px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  cursor: pointer; user-select: none;
  transition: transform .18s var(--ease), box-shadow .18s, border-color .18s;
}
.item-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-2); }
.item-card.tinted { background: var(--c-bg); border-color: transparent; }
.item-card.tinted .ic-title { color: var(--c-ink); }
.item-card.tinted .ic-body, .item-card.tinted .ic-foot { color: color-mix(in srgb, var(--c-ink) 78%, transparent); }
.item-card.compact { padding: 10px 12px; gap: 5px; }
.item-card.tinted .chip { background: color-mix(in srgb, var(--surface) 55%, transparent); color: var(--c-ink); }
.item-card.tinted .check { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.ic-top { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); font-weight: 560; }
.ic-top svg.lucide { width: 14px; height: 14px; }
.ic-top .ic-pin { margin-left: auto; color: var(--accent); }
.ic-title { font-weight: 650; font-size: 14.5px; line-height: 1.35; color: var(--text); word-break: break-word; }
.ic-emoji { margin-right: 4px; }
.ic-body { font-size: 13px; color: var(--text-2); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ic-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-3); }
.ic-foot .ic-links { display: inline-flex; align-items: center; gap: 3px; }
.ic-foot .ic-links svg.lucide { width: 12px; height: 12px; }
.ic-foot .avatar { margin-left: auto; }
.ic-link { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-3); font-size: 12.5px; color: var(--text-2); }
.item-card.tinted .ic-link { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.ic-check { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.ic-check-row { display: flex; align-items: center; gap: 7px; }
.ic-check-row.done { color: var(--text-3); text-decoration: line-through; }
.ic-mini-check { width: 13px; height: 13px; border-radius: 4px; border: 1.5px solid currentColor; opacity: .7; flex-shrink: 0; }
.ic-check-row.done .ic-mini-check { background: currentColor; }
.ic-event { display: flex; align-items: center; gap: 10px; }
.ic-date { width: 42px; height: 46px; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; flex-shrink: 0; }
.ic-date b { font-size: 17px; color: var(--text); }
.ic-date span { font-size: 10px; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.ic-image { height: 110px; border-radius: 10px; display: grid; place-items: center; font-size: 42px; background: linear-gradient(135deg, var(--c-bg, var(--surface-3)), color-mix(in srgb, var(--c-s, var(--accent)) 30%, var(--surface))); }

.task-row {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 11px;
  transition: background var(--dur);
}
.task-row:hover { background: var(--hover); }
.task-row .tr-main { flex: 1; min-width: 0; cursor: pointer; }
.task-row .tr-title { font-weight: 520; line-height: 1.35; }
.task-row .tr-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.task-row .tr-meta:empty { display: none; }
.task-row.done .tr-title { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--border-2); }

/* ==========================================================================
   Overlays: menus, modais, toasts, janelas flutuantes
   ========================================================================== */
.menu {
  position: fixed; z-index: var(--z-menu); min-width: 210px; max-width: 320px; max-height: 70vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 13px;
  box-shadow: var(--shadow-lg); padding: 5px; animation: pop .14s var(--ease);
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 9px; border-radius: 8px; font-size: 13.5px; text-align: left; color: var(--text);
}
.menu-item:hover, .menu-item.hl { background: var(--hover); }
.menu-item svg.lucide { width: 16px; height: 16px; color: var(--text-2); }
.menu-item .kbd { margin-left: auto; }
.menu-item .menu-check { margin-left: auto; color: var(--accent); }
.menu-item.danger, .menu-item.danger svg.lucide { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.menu-label { font-size: 11px; color: var(--text-3); padding: 7px 9px 3px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }

.popover {
  position: fixed; z-index: var(--z-menu);
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 10px; animation: pop .14s var(--ease);
}
.swatches { display: grid; grid-template-columns: repeat(8, 26px); gap: 6px; }
.swatch { width: 26px; height: 26px; border-radius: 8px; background: var(--c-bg); box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); display: grid; place-items: center; }
.swatch::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c-s); }
.swatch.on { outline: 2px solid var(--accent); outline-offset: 2px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 32px); gap: 2px; max-height: 220px; overflow: auto; }
.emoji-grid button { width: 32px; height: 32px; border-radius: 8px; font-size: 18px; }
.emoji-grid button:hover { background: var(--hover); }

.backdrop {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: var(--overlay); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
  animation: fade .16s ease;
}
.modal {
  width: min(var(--w, 520px), 100%); max-height: min(88vh, 920px);
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  animation: pop .22s var(--spring);
}
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 18px 6px 22px; }
.modal-head .modal-icon { width: 34px; height: 34px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.modal-title { font-size: 17px; font-weight: 680; letter-spacing: -.01em; flex: 1; min-width: 0; }
.modal-sub { font-size: 13px; color: var(--text-2); }
.modal-body { padding: 10px 22px 22px; overflow: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }
.modal-grip { display: none; }

.toasts {
  position: fixed; left: 12px; right: 12px; bottom: 26px; z-index: var(--z-toast);
  display: flex; flex-direction: column-reverse; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  max-width: min(92vw, 460px);
  background: var(--text); color: var(--bg);
  padding: 10px 12px 10px 14px; border-radius: 13px; box-shadow: var(--shadow-lg);
  font-size: 13.5px; font-weight: 520; animation: toastIn .3s var(--spring);
}
.toast.out { animation: toastOut .2s ease forwards; }
.toast svg.lucide { width: 17px; height: 17px; }
.toast .toast-action { color: var(--accent); font-weight: 700; padding: 3px 8px; border-radius: 7px; filter: brightness(1.15); }
.toast .toast-action:hover { background: rgba(127,127,127,.18); }
.toast .avatar { box-shadow: none; }

/* Janelas flutuantes */
.windows { position: fixed; inset: 0; pointer-events: none; z-index: var(--z-window); }
.window {
  position: absolute; pointer-events: auto;
  display: flex; flex-direction: column; overflow: hidden;
  min-width: 300px; min-height: 180px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 15px;
  box-shadow: var(--shadow-window);
  animation: pop .2s var(--spring);
}
.window.focused { border-color: var(--border-2); }
.window:not(.focused) { box-shadow: var(--shadow-lg); }
.window.closing { animation: popOut .15s ease forwards; }
.window.minimizing { animation: minimize .22s ease forwards; }
.window.animating { transition: left .2s var(--ease), top .2s var(--ease), width .2s var(--ease), height .2s var(--ease); }
.window-head {
  height: 42px; flex-shrink: 0;
  display: flex; align-items: center; gap: 8px; padding: 0 6px 0 12px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  cursor: grab; user-select: none; touch-action: none;
}
.window-head:active { cursor: grabbing; }
.window-title { flex: 1; min-width: 0; font-weight: 640; font-size: 13.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 7px; }
.window-title .w-emoji { font-size: 15px; }
.window-btns { display: flex; gap: 1px; }
.window-btns .btn-icon { width: 28px; height: 28px; border-radius: 8px; color: var(--text-3); }
.window-btns .btn-icon:hover { color: var(--text); }
.window-btns .w-close:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.window-body { flex: 1; min-height: 0; overflow: auto; position: relative; }
.window-resize { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; touch-action: none; }
.window-resize::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 7px; height: 7px; border-right: 2px solid var(--border-2); border-bottom: 2px solid var(--border-2); border-radius: 0 0 3px 0; }
.snap-preview { position: fixed; z-index: calc(var(--z-window) - 1); border-radius: 16px; background: var(--accent-soft); border: 2px dashed var(--accent-ring); pointer-events: none; transition: all .14s var(--ease); }

.dock {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: var(--z-dock);
  display: flex; gap: 6px; padding: 6px;
  background: var(--glass); backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid var(--border); border-radius: 15px; box-shadow: var(--shadow-lg);
  animation: toastIn .25s var(--spring);
}
.dock:empty { display: none; }
.dock-item {
  display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px; max-width: 190px;
  border-radius: 10px; font-size: 12.8px; font-weight: 560; background: var(--surface); box-shadow: var(--shadow-sm);
}
.dock-item:hover { background: var(--surface-2); }
.dock-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Arrastar e soltar (ui.sortable / ui.drag) */
.drag-handle { cursor: grab; color: var(--text-3); opacity: 0; transition: opacity .15s; touch-action: none; display: inline-grid; place-items: center; }
*:hover > .drag-handle, .drag-handle:focus-visible { opacity: 1; }
.sort-ghost {
  position: fixed; z-index: var(--z-drag); pointer-events: none; margin: 0 !important;
  box-shadow: var(--shadow-lg) !important; transform: rotate(1.6deg) scale(1.02); opacity: .96;
  transition: transform .12s var(--ease);
}
.sort-placeholder { opacity: .35; outline: 2px dashed var(--accent-ring); outline-offset: -2px; border-radius: 12px; }
.sort-placeholder > * { visibility: hidden; }
.drop-target { background: var(--accent-soft) !important; box-shadow: inset 0 0 0 2px var(--accent-ring) !important; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none !important; }

/* Confete (ui.burst) */
.burst-dot { position: fixed; z-index: var(--z-toast); width: 7px; height: 7px; border-radius: 2px; pointer-events: none; animation: burst .7s var(--ease) forwards; }

/* Banner de dica */
.hint {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-lg);
  background: var(--accent-soft); color: var(--accent-ink); font-size: 13.5px;
}
.hint svg.lucide { flex-shrink: 0; }
.hint .btn { margin-left: auto; }

/* Cartões de nível (boas-vindas e Ajustes) */
.level-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.level-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  padding: 14px; border-radius: var(--r-lg); border: 1.5px solid var(--border); background: var(--surface-2);
  transition: border-color var(--dur), box-shadow var(--dur), transform .15s var(--ease);
}
.level-card:hover { border-color: var(--border-2); transform: translateY(-1px); }
.level-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); background: var(--surface); }
.level-card .lc-emoji { font-size: 26px; line-height: 1.2; }
.level-card .lc-name { font-weight: 700; font-size: 15px; }
.level-card .lc-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.4; }
@media (max-width: 760px) { .level-cards { grid-template-columns: 1fr; } .level-card { flex-direction: row; align-items: center; gap: 12px; } }

/* Bloqueio de módulo */
.locked { max-width: 520px; margin: 10vh auto 0; text-align: center; padding: 24px; }
.locked .empty-icon { margin: 0 auto 14px; }

/* ==========================================================================
   Animações
   ========================================================================== */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes popOut { to { opacity: 0; transform: scale(.96); } }
@keyframes minimize { to { opacity: 0; transform: translateY(40vh) scale(.3); } }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes checkPop { 0% { transform: scale(.8); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes burst { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes shimmer { from { background-position: -200px 0; } to { background-position: 200px 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Mobile (PWA)
   ========================================================================== */
@media (max-width: 760px) {
  .app, .app.sidebar-collapsed { grid-template-columns: minmax(0, 1fr); }
  .app.sidebar-collapsed .sidebar { visibility: visible; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: 86%; max-width: 330px; z-index: var(--z-drawer);
    transform: translateX(-102%); transition: transform .28s var(--ease); box-shadow: var(--shadow-lg);
  }
  .app.drawer-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: calc(var(--z-drawer) - 1); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .app.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .topbar { padding: 0 8px 0 6px; padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  .topbar-tabs { margin-left: 0; }
  .topbar .hide-mobile, .hide-mobile { display: none !important; }
  .show-mobile { display: inline-flex !important; }
  .topbar.has-tabs .tt-text, .topbar.has-tabs .tt-crumb { display: none; }
  .topbar .claude-btn span:not(.badge-dot) { display: none; }
  .view { padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); }
  .view.view-full { padding-bottom: 0; margin-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); }
  .app.bare .view, .app.bare .view.view-full { padding-bottom: 0; margin-bottom: 0; }
  .page { padding: 18px 16px 120px; }
  .h1 { font-size: 28px; }
  .fab { display: none; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-bottomnav);
    height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
    background: var(--glass); backdrop-filter: blur(18px) saturate(1.5);
    border-top: 1px solid var(--border);
    align-items: center; justify-content: space-around;
  }
  .bn-item {
    flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 10.5px; font-weight: 600; color: var(--text-3); position: relative;
  }
  .bn-item svg.lucide { width: 22px; height: 22px; }
  .bn-item.active { color: var(--accent); }
  .bn-item .bn-badge { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 10px; display: grid; place-items: center; }
  .bn-plus { flex: 0 0 auto; width: 52px; height: 52px; margin: 0 6px; border-radius: 17px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; box-shadow: 0 8px 22px var(--accent-ring); transform: translateY(-10px); }
  .bn-plus svg.lucide { width: 26px; height: 26px; stroke-width: 2.3; }
  .toasts { bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + 14px); }
  .dock { bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + 12px); max-width: 94vw; overflow-x: auto; }

  /* Modais viram "bottom sheets" */
  .backdrop { place-items: end stretch; padding: 0; }
  .modal { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; animation: sheetIn .3s var(--ease); padding-bottom: env(safe-area-inset-bottom); }
  .modal-grip { display: block; width: 38px; height: 5px; border-radius: 9px; background: var(--border-2); margin: 8px auto 0; }

  /* Janelas flutuantes viram telas cheias */
  .window { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; border: 0; }
  .window-head { cursor: default; padding-top: env(safe-area-inset-top); height: calc(48px + env(safe-area-inset-top)); }
  .window-resize, .window-btns .w-max { display: none; }
}

/* ==========================================================================
   App real: tela de carregamento e indicador de sincronização
   ========================================================================== */
.boot {
  position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center;
  background: var(--bg, #F6F4EF); color: var(--text, #1d1d1f);
  font-family: var(--font-ui, system-ui, sans-serif);
  transition: opacity .32s ease, visibility .32s;
}
.boot.boot-out { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 32px 24px; max-width: 360px; text-align: center; }
.boot-mark {
  width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; margin-bottom: 8px;
  background: var(--accent, #E0613F); color: var(--on-accent, #fff); box-shadow: 0 10px 30px -10px var(--accent, #E0613F);
  animation: bootPulse 1.8s ease-in-out infinite;
}
.boot-name { font-family: var(--font-display, Georgia, serif); font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.boot-msg { font-size: 15px; font-weight: 600; color: var(--text-2, #555); margin-top: 2px; }
.boot-sub { font-size: 13px; color: var(--text-3, #888); min-height: 1.2em; line-height: 1.45; }
.boot-bar { width: 140px; height: 4px; border-radius: 4px; overflow: hidden; background: var(--surface-3, rgba(0,0,0,.08)); margin-top: 12px; }
.boot-bar span { display: block; width: 40%; height: 100%; border-radius: 4px; background: var(--accent, #E0613F); animation: bootBar 1.1s ease-in-out infinite; }
.boot-retry {
  display: none; margin-top: 14px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border-2, #ddd);
  background: var(--surface, #fff); color: var(--text, #222); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.boot-retry:hover { background: var(--hover, #f3f3f3); }
.boot[data-kind="down"] .boot-retry { display: inline-flex; }
.boot[data-kind="down"] .boot-mark { animation: none; filter: grayscale(.6); opacity: .8; }
.boot[data-kind="denied"] .boot-bar, .boot[data-kind="denied"] .boot-retry { display: none; }
.boot[data-kind="denied"] .boot-mark { animation: none; background: var(--surface-3, #ddd); color: var(--text-2, #555); box-shadow: none; }
.boot[data-kind="denied"] .boot-msg { font-size: 18px; color: var(--text, #222); }
@keyframes bootPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes bootBar { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }

.sync-pill {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 50%; transform: translateX(-50%);
  z-index: calc(var(--z-toast, 900) + 1); display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px 5px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; line-height: 1.3;
  background: var(--surface, #fff); color: var(--text-2, #555); border: 1px solid var(--border, #e5e5e5);
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(0,0,0,.08)); max-width: calc(100vw - 32px);
  animation: fade .25s ease; pointer-events: none;
}
.sync-pill[hidden] { display: none; }
.sync-pill span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-pill[data-kind="offline"] { color: var(--warning, #b7791f); border-color: color-mix(in srgb, var(--warning, #b7791f) 35%, transparent); }
.sync-pill .spin, .boot .spin { animation: nxSpin 1s linear infinite; }
@keyframes nxSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .boot-mark, .boot-bar span, .sync-pill .spin { animation: none; }
}
