/* ==========================================================================
   Nexos — Espaços (#/espaco e #/espaco/:id) + modais Novo/Editar espaço.
   Prefixo exclusivo: .esp-   ·   Só variáveis de tokens.css.
   ========================================================================== */

/* ---------- Capa ilustrada (compartilhada) ---------- */
.esp-cover, .esp-scard-cover {
  position: relative; overflow: hidden;
  background: radial-gradient(130% 160% at 0% 0%, var(--c-bg), color-mix(in srgb, var(--c-s) 40%, var(--c-bg)));
}
.esp-cover { border-radius: var(--r-xl); }
.esp-deco { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.esp-d-l1 { fill: var(--c-s); opacity: .22; }
.esp-d-l2 { fill: var(--c-s); opacity: .4; }
.esp-d-sun { fill: color-mix(in srgb, var(--surface) 72%, var(--c-s)); opacity: .75; }
.esp-d-snow { fill: var(--surface); opacity: .7; }
.esp-d-trail { fill: none; stroke: var(--c-ink); stroke-width: 2.2; stroke-dasharray: 2 9; stroke-linecap: round; opacity: .32; }
.esp-d-ring { fill: none; stroke: var(--c-s); stroke-width: 12; opacity: .13; }
.esp-d-dot { fill: var(--c-s); opacity: .5; }
.esp-d-house { fill: var(--c-s); opacity: .42; fill-rule: evenodd; }
.esp-d-line { stroke: var(--c-s); stroke-width: 1.5; opacity: .18; }
.esp-d-margin { stroke: var(--c-pink-s); stroke-width: 2; opacity: .35; }
.esp-d-block { fill: var(--c-s); opacity: .2; }
.esp-d-block2 { fill: var(--c-s); opacity: .36; }
.esp-d-c1 { fill: var(--c-yellow-s); opacity: .7; }
.esp-d-c2 { fill: var(--c-pink-s); opacity: .6; }
.esp-d-c3 { fill: var(--c-sky-s); opacity: .6; }
.esp-d-c4 { fill: var(--c-mint-s); opacity: .6; }
.esp-d-c5 { fill: var(--c-lilac-s); opacity: .6; }
.esp-cover-emoji { position: absolute; left: 20px; bottom: 14px; font-size: 42px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .15)); }

/* ---------- Animação de entrada (só no primeiro desenho) ---------- */
.esp-anim > * { animation: espUp .5s var(--ease) backwards; }
.esp-anim > :nth-child(2) { animation-delay: .05s; }
.esp-anim > :nth-child(3) { animation-delay: .1s; }
.esp-anim > :nth-child(4) { animation-delay: .14s; }
.esp-anim > :nth-child(5) { animation-delay: .18s; }
.esp-anim > :nth-child(6) { animation-delay: .22s; }
.esp-anim > :nth-child(n+7) { animation-delay: .26s; }
.esp-anim .esp-scard { animation: espUp .5s var(--ease) backwards; }
.esp-anim .esp-scard:nth-child(2) { animation-delay: .05s; }
.esp-anim .esp-scard:nth-child(3) { animation-delay: .1s; }
.esp-anim .esp-scard:nth-child(4) { animation-delay: .15s; }
.esp-anim .esp-scard:nth-child(n+5) { animation-delay: .2s; }
@keyframes espUp { from { opacity: 0; transform: translateY(10px); } }

/* ==========================================================================
   Página do espaço
   ========================================================================== */
.esp { padding-top: 22px; }

/* ---- Cabeçalho com capa viva ---- */
.esp-head { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "cover" "title"; margin-bottom: 18px; }
.esp-cover-main { grid-area: cover; height: 204px; }
.esp-cover-btn {
  grid-area: cover; align-self: start; justify-self: end; margin: 12px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 9px;
  background: var(--glass); backdrop-filter: blur(10px); box-shadow: var(--shadow-sm);
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  opacity: 0; transform: translateY(-3px); transition: opacity .18s, transform .18s, color .15s;
}
.esp-cover-btn svg.lucide { width: 15px; height: 15px; }
.esp-head:hover .esp-cover-btn, .esp-cover-btn:focus-visible { opacity: 1; transform: none; }
.esp-cover-btn:hover { color: var(--text); }
.esp-emoji {
  grid-area: cover; align-self: end; justify-self: start; z-index: 3;
  margin: 0 0 -42px 26px; width: 86px; height: 86px; border-radius: 26px;
  display: grid; place-items: center; font-size: 52px; line-height: 1;
  background: var(--surface); box-shadow: var(--shadow), 0 0 0 4px var(--bg);
  transition: transform .25s var(--spring);
}
.esp-emoji:hover { transform: scale(1.06) rotate(-4deg); }
.esp-stats {
  grid-area: cover; align-self: end; justify-self: end; z-index: 2;
  margin: 0 14px 14px; display: flex; gap: 10px; max-width: calc(100% - 150px);
}
.esp-stat {
  display: flex; align-items: center; gap: 10px; min-width: 0; text-align: left;
  padding: 9px 14px 9px 9px; border-radius: var(--r-lg);
  background: var(--glass); backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid color-mix(in srgb, var(--surface) 60%, transparent);
  box-shadow: var(--shadow-sm); color: var(--text);
  transition: transform .18s var(--ease), box-shadow .18s;
}
button.esp-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.esp-stat-ico {
  width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--c-s) 20%, var(--surface)); color: var(--c-ink);
}
.esp-stat-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.esp-stat-k { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.esp-stat-big { font-size: 18px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.esp-stat-sub { font-size: 11.8px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.esp-stat-empty { border-style: dashed; border-color: color-mix(in srgb, var(--c-ink) 30%, transparent); }
.esp-stat-empty .esp-stat-big { font-size: 15px; }

.esp-ring { flex-shrink: 0; overflow: visible; }
.esp-ring-trk { fill: none; stroke: color-mix(in srgb, var(--c-s) 24%, transparent); stroke-width: 5; }
.esp-ring-val { fill: none; stroke: var(--c-s); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease); }
.esp-ring.over .esp-ring-val { stroke: var(--danger); }
.esp-ring-txt { font-family: var(--font-ui); font-size: 10.5px; font-weight: 750; fill: var(--text); text-anchor: middle; dominant-baseline: middle; }
.esp-anim .esp-ring-val { animation: espRing 1.1s var(--ease) .2s backwards; }
@keyframes espRing { from { stroke-dashoffset: var(--len); } }

.esp-titlebox { grid-area: title; padding: 56px 2px 0; min-width: 0; }
.esp-name {
  font-family: var(--font-display); font-size: var(--fs-3xl); font-weight: 600; letter-spacing: -.02em; line-height: 1.15;
  padding: 2px 8px; margin: 0 -8px; border-radius: 10px; outline: none; cursor: text; word-break: break-word;
  transition: background .15s, box-shadow .15s;
}
.esp-name:hover { background: var(--hover); }
.esp-name:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--accent-ring); }
.esp-desc {
  color: var(--text-2); font-size: var(--fs-md); min-height: 1.6em;
  margin: 4px -8px 0; padding: 3px 8px; border-radius: 8px; outline: none; cursor: text;
  transition: background .15s, box-shadow .15s;
}
.esp-desc:hover { background: var(--hover); }
.esp-desc:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--accent-ring); color: var(--text); }
.esp-desc:empty::before { content: attr(data-placeholder); color: var(--text-3); }
.esp-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.esp-members { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px 9px; min-width: 0; }
.esp-members .avatar-stack .avatar { box-shadow: 0 0 0 2px var(--bg); }
.esp-here { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--success); }
.esp-here .status-dot { animation: espPulse 1.8s ease-in-out infinite; }
@keyframes espPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.esp-role { height: 24px; font-size: 11.8px; gap: 5px; }
.esp-invite {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px 0 4px; border-radius: var(--r-full);
  border: 1px dashed var(--border-2); color: var(--text-2); font-size: 12.5px; font-weight: 600;
  transition: border-color var(--dur), background var(--dur), color var(--dur);
}
.esp-invite:hover { border-style: solid; border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.esp-share-group { display: inline-flex; }
.esp-share-group .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.esp-share-group .btn + .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; width: 32px; }

/* ---- Sugestões do Claude (cartões-fantasma) ---- */
.esp-ghosts {
  margin: 4px 0 18px; padding: 14px; border-radius: var(--r-xl);
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  border: 1.5px dashed var(--accent-ring);
}
.esp-ghosts-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.esp-ghosts-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.esp-ghost-list { display: grid; gap: 8px; }
.esp-ghost {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px;
  border-radius: var(--r-lg); border: 1.5px dashed var(--accent-ring); background: var(--surface);
  transition: opacity .2s, transform .25s var(--ease), border-color .2s, background .2s;
}
.esp-ghost:hover { border-color: var(--accent); }
.esp-ghost-ico { width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.esp-ghost-main { flex: 1; min-width: 0; }
.esp-ghost-text { font-weight: 580; line-height: 1.35; }
.esp-ghost-why { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.esp-ghost-link { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; color: var(--text-3); }
.esp-ghost-btns { display: flex; gap: 6px; flex-shrink: 0; }
.esp-ghost-ok { border-style: solid; border-color: var(--success); background: color-mix(in srgb, var(--success) 8%, var(--surface)); transform: scale(.985); }
.esp-ghost-out { opacity: 0; transform: translateX(14px); }

/* ---- Adicionar a este espaço ---- */
.esp-add {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm); padding: 6px 6px 11px; margin-bottom: 8px;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.esp-add:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.esp-add-field { display: flex; align-items: center; gap: 11px; padding: 8px 10px; cursor: text; }
.esp-add-plus { width: 30px; height: 30px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); box-shadow: 0 4px 12px var(--accent-ring); }
.esp-add-field .input-plain { height: 30px; font-size: var(--fs-md); }
.esp-add-types { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 0 10px; }
.esp-add-label { font-size: 12px; color: var(--text-3); margin-right: 2px; white-space: nowrap; }
.esp-type { transition: transform .15s var(--spring), box-shadow .15s, background .15s; }
.esp button.chip.tint:hover, .esp-home button.chip.tint:hover { background: color-mix(in srgb, var(--c-s) 22%, var(--c-bg)); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.esp-count { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 650; color: var(--text-3); background: var(--surface-3); }

/* ---- Fixados ---- */
.esp-pinned { margin-top: 22px; padding: 14px 14px 0; border-radius: var(--r-xl); background: color-mix(in srgb, var(--c-bg) 60%, transparent); }
.esp-pinned-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 680; color: var(--c-ink); margin: 0 2px 12px; }
.esp-pinned-head .esp-count { background: color-mix(in srgb, var(--surface) 60%, transparent); color: var(--c-ink); }
.esp-pin-card { padding: 16px 16px 14px; }
.esp-pin-card .ic-title { font-size: 16px; }

/* ---- Seções recolhíveis ---- */
.esp-sec { margin-top: 26px; }
.esp-sec-head { display: flex; align-items: center; gap: 8px; min-height: 34px; margin-bottom: 10px; }
.esp-sec-toggle {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0;
  padding: 5px 9px 5px 4px; margin-left: -4px; border-radius: 9px;
  font-size: 14.5px; font-weight: 680; color: var(--text); transition: background var(--dur);
}
.esp-sec-toggle:hover { background: var(--hover); }
.esp-sec-toggle > svg.lucide { width: 16px; height: 16px; color: var(--text-3); }
.esp-sec-chev { display: inline-grid; color: var(--text-3); transition: transform .22s var(--ease); }
.esp-sec.collapsed .esp-sec-chev { transform: rotate(-90deg); }
.esp-sec-prog { display: inline-flex; align-items: center; gap: 8px; margin-left: 4px; }
.esp-sec-prog .progress { width: 90px; }
.esp-sec-add { margin-left: auto; color: var(--text-3); }
.esp-sec-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .3s var(--ease); }
.esp-sec-inner { min-height: 0; }
.esp-sec.collapsed .esp-sec-body { grid-template-rows: 0fr; }
.esp-sec.collapsed .esp-sec-inner, .esp-sec-anim .esp-sec-inner { overflow: hidden; }
.esp-sec.collapsed .esp-sec-inner { visibility: hidden; transition: visibility 0s .3s; }

/* ---- Grades ---- */
.esp-masonry {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(var(--esp-min, 230px), 100%), 1fr));
  grid-auto-rows: 1px; column-gap: var(--gap); row-gap: 0; align-items: start;
}
.esp-masonry > * { align-self: start; margin: 0; }
.esp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(var(--min, 240px), 100%), 1fr)); gap: var(--gap); }

/* ---- Ferramentas no cartão (fixar / mais) ---- */
.esp-it { position: relative; }
.esp-tools {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: flex; gap: 2px; padding: 2px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  opacity: 0; transform: translateY(-2px); transition: opacity .15s, transform .15s;
}
.esp-it:hover > .esp-tools, .esp-it:focus-within > .esp-tools { opacity: 1; transform: none; }
.esp-tool { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--text-2); }
.esp-tool:hover { background: var(--hover); color: var(--text); }
.esp-tool.on { color: var(--accent); }
.esp-secret { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text-2); }
.esp-flash { animation: espFlash 1.8s var(--ease); }
@keyframes espFlash { 0%, 30% { box-shadow: 0 0 0 4px var(--accent-ring), var(--shadow); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---- Tarefas ---- */
.esp-tasks { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 6px; }
.esp-task-list { min-height: 2px; }
.esp-tasks .task-row { padding-left: 4px; }
.esp-tasks .task-row .drag-handle { width: 18px; }
.esp-row-more { opacity: 0; color: var(--text-3); flex-shrink: 0; }
.task-row:hover .esp-row-more, .esp-event:hover .esp-row-more, .esp-row-more:focus-visible { opacity: 1; }
.esp-task-add { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 11px; color: var(--text-3); cursor: text; transition: background var(--dur); }
.esp-task-add:hover { background: var(--hover); }
.esp-task-add:focus-within { background: var(--surface-2); color: var(--text); }
.esp-task-add-ico { width: 20px; height: 20px; border-radius: 50%; border: 1.8px dashed var(--border-2); display: grid; place-items: center; flex-shrink: 0; }
.esp-task-add-ico svg.lucide { width: 12px; height: 12px; }
.esp-done-toggle { display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 10px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--text-3); text-align: left; }
.esp-done-toggle:hover { background: var(--hover); color: var(--text-2); }
.esp-done-toggle > svg.lucide:first-child { transition: transform .2s var(--ease); }
.esp-done-toggle[aria-expanded="true"] > svg.lucide:first-child { transform: rotate(90deg); }
.esp-task-done { border-top: 1px dashed var(--border); padding-top: 2px; }
.esp-alldone { display: flex; align-items: center; gap: 10px; padding: 12px; font-size: 13.5px; color: var(--text-2); }
.esp-alldone svg.lucide { color: var(--accent); }

/* ---- Listas (checáveis direto no cartão) ---- */
.esp-list {
  display: flex; flex-direction: column; gap: 8px; padding: 12px 12px 8px;
  border-radius: var(--r-lg); background: var(--c-bg); color: var(--c-ink);
  box-shadow: var(--shadow-sm); transition: box-shadow .18s, transform .18s var(--ease);
}
.esp-list:hover { box-shadow: var(--shadow); }
.esp-list-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px; border-radius: 8px; text-align: left; font-weight: 680; font-size: 14.5px; color: var(--c-ink); }
.esp-list-head:hover .esp-list-title { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--c-ink) 35%, transparent); }
.esp-list-emoji { font-size: 17px; line-height: 1; }
.esp-list-title { flex: 1; min-width: 0; }
.esp-list-count { font-size: 12px; font-weight: 650; opacity: .75; font-variant-numeric: tabular-nums; }
.esp-list .progress { height: 5px; margin: 0 4px; background: color-mix(in srgb, var(--surface) 55%, transparent); }
.esp-li-rows { display: flex; flex-direction: column; }
.esp-li { display: flex; align-items: center; gap: 9px; padding: 5px 4px; border-radius: 8px; font-size: 13.5px; cursor: pointer; user-select: none; transition: background var(--dur); }
.esp-li:hover { background: color-mix(in srgb, var(--surface) 45%, transparent); }
.esp-li .check { width: 18px; height: 18px; background: color-mix(in srgb, var(--surface) 75%, transparent); border-color: color-mix(in srgb, var(--c-ink) 35%, transparent); }
.esp-li .check.on { background: var(--accent); border-color: var(--accent); }
.esp-li-text { min-width: 0; word-break: break-word; }
.esp-li.done .esp-li-text { text-decoration: line-through; opacity: .55; }
.esp-li-more { align-self: flex-start; padding: 2px 4px; font-size: 12px; font-weight: 650; color: var(--c-ink); opacity: .8; }
.esp-li-more:hover { opacity: 1; text-decoration: underline; }
.esp-li-add { display: flex; align-items: center; gap: 9px; padding: 7px 4px 4px; margin-top: 2px; border-top: 1px dashed color-mix(in srgb, var(--c-ink) 22%, transparent); opacity: .72; cursor: text; transition: opacity var(--dur); }
.esp-li-add:focus-within, .esp-li-add:hover { opacity: 1; }
.esp-li-add .input-plain { color: var(--c-ink); font-size: 13.5px; }
.esp-li-add .input-plain::placeholder { color: color-mix(in srgb, var(--c-ink) 60%, transparent); }
.esp-list-foot { display: flex; padding: 0 2px 4px; }

/* ---- Eventos ---- */
.esp-events { display: grid; gap: 2px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.esp-event { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; cursor: pointer; transition: background var(--dur); }
.esp-event:hover { background: var(--hover); }
.esp-event .ic-date { background: var(--surface-2); }
.esp-event-title { font-weight: 620; line-height: 1.3; }
.esp-event.past { opacity: .6; }

/* ---- Metas ---- */
.esp-goal {
  display: flex; flex-direction: column; gap: 10px; padding: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, border-color .18s;
}
.esp-goal:hover { box-shadow: var(--shadow); border-color: var(--border-2); }
.esp-goal.complete { background: color-mix(in srgb, var(--c-bg) 55%, var(--surface)); border-color: transparent; }
.esp-goal-top { display: flex; align-items: center; gap: 11px; padding-right: 60px; }
.esp-goal-emoji { width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0; display: grid; place-items: center; font-size: 22px; background: var(--c-bg); }
.esp-goal-title { font-weight: 650; text-align: left; line-height: 1.3; }
.esp-goal-title:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-2); }
.esp-goal-pct { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.esp-goal-pct b { font-size: 26px; font-weight: 750; letter-spacing: -.02em; color: var(--c-ink); font-variant-numeric: tabular-nums; }
.esp-goal-bar { height: 10px; border-radius: 999px; overflow: hidden; background: var(--c-bg); }
.esp-goal-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--c-s); transition: width .55s var(--spring); }
.esp-goal-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---- Espaço vazio ---- */
.esp-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 34px 8px 12px; text-align: center; }
.esp-empty-art {
  width: 96px; height: 96px; border-radius: 30px; display: grid; place-items: center; font-size: 48px; line-height: 1;
  background: var(--c-bg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-s) 30%, transparent), var(--shadow-sm);
}
.esp-empty-art span { animation: espFloat 4s ease-in-out infinite; }
@keyframes espFloat { 50% { transform: translateY(-5px) rotate(-3deg); } }
.esp-empty-title { font-size: 18px; font-weight: 700; margin-top: 4px; }
.esp-empty-text { max-width: 460px; color: var(--text-2); }
.esp-empty-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; width: 100%; max-width: 760px; margin: 12px 0 8px; }
.esp-mini-tpl {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; text-align: left;
  border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border);
  transition: border-color .15s, transform .15s var(--spring), box-shadow .15s;
}
.esp-mini-tpl:hover { border-color: var(--c-s); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.esp-mini-emoji { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center; font-size: 21px; background: var(--c-bg); }
.esp-mini-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.esp-mini-txt span { font-size: 11.5px; color: var(--text-3); }

/* ---- Atividade e dica ---- */
.esp-acts { display: grid; gap: 2px; }
.esp-act { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; font-size: 13.5px; }
.esp-act:hover { background: var(--hover); }
.esp-act-time { white-space: nowrap; }
.esp-hint { margin-top: 30px; flex-wrap: wrap; }
.esp-hint-btns { margin-left: auto; display: flex; gap: 6px; }
.esp-hint .esp-hint-btns .btn { margin-left: 0; }

/* ---- Popovers (data e orçamento) ---- */
.esp-pop { width: 290px; display: grid; gap: 10px; }
.esp-pop-title { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 13.5px; }
.esp-pop-title svg.lucide { color: var(--accent); }
.esp-pop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.esp-pop-quick { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.esp-pop-foot { display: flex; align-items: center; gap: 6px; }

.esp-shake { animation: espShake .38s; }
@keyframes espShake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }

/* ==========================================================================
   Grade "Seus espaços"
   ========================================================================== */
.esp-home { padding-top: 30px; }
.esp-home-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.esp-home-sub { margin-top: 6px; }
.esp-tpl-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.esp-tpl-label { font-size: 12.5px; color: var(--text-3); margin-right: 4px; white-space: nowrap; }
.esp-sgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 18px; }
.esp-scard {
  display: flex; flex-direction: column; overflow: hidden; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
}
.esp-scard:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-2); }
.esp-scard:focus-visible { outline-offset: 3px; border-radius: var(--r-xl); }
.esp-scard-cover { height: 108px; flex-shrink: 0; }
.esp-scard-emoji { position: absolute; left: 16px; bottom: 12px; font-size: 38px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .15)); transition: transform .25s var(--spring); }
.esp-scard:hover .esp-scard-emoji { transform: scale(1.08) rotate(-4deg); }
.esp-scard-shared {
  position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--glass); backdrop-filter: blur(8px); color: var(--text-2);
}
.esp-scard-body { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; }
.esp-scard-name { font-weight: 700; font-size: 16.5px; letter-spacing: -.01em; line-height: 1.3; }
.esp-scard-desc { font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.esp-live { display: flex; align-items: center; gap: 7px; margin-top: 4px; font-size: 12.5px; color: var(--c-ink); min-width: 0; }
.esp-live b { font-weight: 650; white-space: nowrap; }
.esp-live .faint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.esp-live svg.lucide { width: 14px; height: 14px; color: var(--c-s); }
.esp-live .progress { height: 6px; }
.esp-live-bar { display: flex; align-items: center; gap: 8px; }
.esp-scard-foot { display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-3); }
.esp-mini { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.esp-mini svg.lucide { width: 14px; height: 14px; }
.esp-scard-new {
  min-height: 252px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 2px dashed var(--border-2); border-radius: var(--r-xl); color: var(--text-2);
  transition: border-color .18s, color .18s, background .18s;
}
.esp-scard-new:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.esp-new-plus { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 4px; background: var(--accent-soft); color: var(--accent); transition: transform .25s var(--spring); }
.esp-scard-new:hover .esp-new-plus { transform: rotate(90deg) scale(1.05); }

/* ==========================================================================
   Modais: Novo espaço / Montar com o Claude / Editar
   ========================================================================== */
.esp-modal .modal-body { padding-top: 8px; }
.esp-steps { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 12.5px; color: var(--text-3); }
.esp-steps span { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.esp-steps b { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--surface-3); color: var(--text-2); }
.esp-steps b svg.lucide { width: 12px; height: 12px; }
.esp-steps span.on { color: var(--text); }
.esp-steps span.on b { background: var(--accent); color: var(--on-accent); }
.esp-steps span.ok b { background: var(--success); color: var(--on-accent); }
.esp-steps i { flex: 0 0 28px; height: 2px; border-radius: 2px; background: var(--border); }

.esp-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.esp-tpl {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px; text-align: left;
  border-radius: var(--r-lg); background: var(--surface-2); border: 1.5px solid var(--border);
  transition: border-color .15s, transform .15s var(--spring), box-shadow .15s, background .15s;
}
.esp-tpl:hover { border-color: var(--c-s); background: var(--surface); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.esp-tpl.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.esp-tpl-emoji { width: 42px; height: 42px; border-radius: 13px; margin-bottom: 6px; display: grid; place-items: center; font-size: 22px; background: var(--c-bg); transition: transform .25s var(--spring); }
.esp-tpl:hover .esp-tpl-emoji { transform: scale(1.08) rotate(-5deg); }
.esp-tpl-name { font-weight: 700; }
.esp-tpl-desc { font-size: 12px; color: var(--text-2); line-height: 1.35; }
.esp-tpl-sum { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.esp-or { display: flex; align-items: center; gap: 12px; margin: 16px 0; font-size: 12px; color: var(--text-3); }
.esp-or::before, .esp-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.esp-ai {
  padding: 14px; border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface-2);
  border: 1.5px dashed var(--accent-ring);
}
.esp-ai-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.esp-ai-ico { width: 34px; height: 34px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.esp-sim { flex-shrink: 0; height: 20px; font-size: 10.5px; background: transparent; border: 1px dashed var(--border-2); color: var(--text-3); }
.esp-ai-box { display: flex; align-items: flex-end; gap: 8px; }
.esp-ai-text { flex: 1; min-height: 46px; resize: none; }
.esp-ai-run { height: 46px; flex-shrink: 0; }
.esp-ai.busy .esp-ai-run { opacity: .6; pointer-events: none; }
.esp-ai-ex { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.esp-ai-ex .chip { cursor: pointer; background: var(--surface); border: 1px solid var(--border); height: 26px; }
.esp-ai-ex .chip:hover { border-color: var(--accent-ring); color: var(--text); background: var(--surface); }
.esp-ai-out { margin-top: 14px; }
.esp-ai-out:empty { display: none; }
.esp-ai-loading { display: flex; align-items: center; gap: 12px; }
.esp-ai-orb {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; color: var(--on-accent);
  background: conic-gradient(from 0deg, var(--accent), var(--c-lilac-s), var(--c-sky-s), var(--accent));
  animation: espSpin 1.6s linear infinite;
}
.esp-ai-orb svg.lucide { animation: espSpin 1.6s linear infinite reverse; }
@keyframes espSpin { to { transform: rotate(360deg); } }
.esp-ai-step { animation: fade .3s; }
.esp-ai-skel { display: grid; gap: 8px; margin-top: 12px; }
.esp-skel {
  height: 50px; padding: 0 14px; border-radius: 13px; display: flex; flex-direction: column; justify-content: center; gap: 7px;
  border: 1.5px dashed var(--accent-ring);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 10%, transparent), transparent) no-repeat, var(--surface);
  background-size: 220px 100%, auto;
  animation: shimmer 1.2s linear infinite, espUp .4s var(--ease) backwards;
}
.esp-skel span { height: 8px; width: 55%; border-radius: 6px; background: var(--surface-3); }
.esp-skel span + span { height: 6px; width: 30%; }
.esp-ai-res { display: grid; gap: 10px; }
.esp-ai-found { display: flex; gap: 6px; flex-wrap: wrap; }
.esp-ai-found .chip { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.esp-ai-hint { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.esp-gis { display: grid; gap: 8px; }
.esp-gi {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; width: 100%; text-align: left;
  border-radius: 13px; border: 1.5px dashed var(--accent-ring);
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
  transition: opacity .15s, border-color .15s, background .15s;
  animation: espGhostIn .42s var(--spring) backwards;
}
.esp-gi:hover { border-color: var(--accent); }
.esp-gi:not(.on) { opacity: .55; border-color: var(--border-2); background: var(--surface); }
.esp-gi:not(.on) .esp-gi-title { text-decoration: line-through; text-decoration-color: var(--text-3); }
@keyframes espGhostIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.esp-gi-ico { width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center; background: var(--c-bg); color: var(--c-ink); }
.esp-gi-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.esp-gi-title { font-weight: 600; line-height: 1.3; }
.esp-gi-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.esp-gi-type { flex-shrink: 0; }
.esp-ai-actions { display: flex; align-items: center; gap: 8px; }

.esp-n2 { display: grid; gap: 14px; }
.esp-n2-preview { position: relative; height: 112px; border-radius: var(--r-lg); overflow: hidden; }
.esp-n2-preview .esp-cover { position: absolute; inset: 0; border-radius: inherit; }
.esp-n2-emoji { position: absolute; z-index: 1; left: 18px; bottom: 14px; font-size: 42px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .15)); }
.esp-n2-name { position: absolute; z-index: 1; left: 76px; right: 16px; bottom: 20px; font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--c-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.esp-n2-row { display: flex; align-items: flex-end; gap: 12px; }
.esp-n2-emojibtn {
  width: 52px; height: 52px; border-radius: 15px; flex-shrink: 0; font-size: 26px; line-height: 1;
  background: var(--surface-2); border: 1px solid var(--border); transition: border-color .15s, transform .2s var(--spring);
}
.esp-n2-emojibtn:hover { border-color: var(--border-2); transform: scale(1.05); }
.esp-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.esp-swatches .swatch { width: 34px; height: 34px; border-radius: 11px; transition: transform .15s var(--spring); }
.esp-swatches .swatch:hover { transform: scale(1.08); }
.esp-share-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); }
.esp-share-list { display: flex; flex-direction: column; gap: 8px; }
.esp-share-list .field-label { margin-bottom: 0; }
.esp-share-list .esp-share-row { padding: 10px 12px; }
.esp-share-none { color: var(--text-2); }
.esp-share-none > svg.lucide { color: var(--text-3); flex-shrink: 0; }
.esp-share-more { padding: 0 4px; }
.esp-n2-sum { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; font-size: 13px; background: var(--accent-soft); color: var(--accent-ink); }
.esp-nfoot-tip { display: inline-flex; align-items: center; gap: 6px; }
.esp-edit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

/* ==========================================================================
   Responsivo
   ========================================================================== */
@media (max-width: 1060px) {
  .esp-head { grid-template-areas: "cover" "title" "stats"; }
  .esp-stats { grid-area: stats; justify-self: stretch; max-width: none; margin: 16px 0 0; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 6px; }
  .esp-stats::-webkit-scrollbar { display: none; }
  .esp-stat { flex: 0 0 auto; background: var(--surface); border-color: var(--border); backdrop-filter: none; }
}

@media (hover: none) {
  .esp-tools { display: none; }
  .esp-row-more { opacity: .7; }
  .esp .drag-handle { opacity: .45; }
  .esp-cover-btn { opacity: 1; transform: none; }
}

@media (max-width: 760px) {
  .esp { padding-top: 14px; }
  .esp-hide-sm { display: none !important; }
  .esp-cover-main { height: 128px; }
  .esp-emoji { width: 68px; height: 68px; border-radius: 21px; font-size: 40px; margin: 0 0 -32px 14px; }
  .esp-titlebox { padding-top: 42px; }
  .esp-name { font-size: 27px; }
  .esp-desc { font-size: var(--fs); }
  .esp-cover-btn { height: 34px; margin: 8px; }
  .esp-stats { margin: 14px -16px 0; padding: 2px 16px 6px; scroll-snap-type: x mandatory; }
  .esp-stat { scroll-snap-align: start; }
  .esp-meta { gap: 6px; }
  .esp-meta .btn-sm { height: 40px; padding: 0 13px; }
  .esp-meta .btn-sm.btn-icon { width: 40px; padding: 0; }
  .esp-share-group .btn + .btn { width: 40px; }
  .esp-meta > .esp-members { flex: 1 1 100%; }
  .esp-meta > .spacer { display: none; }
  .esp-members .small { max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .esp-add { padding: 4px 4px 10px; }
  .esp-add-types { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px 10px; }
  .esp-add-types::-webkit-scrollbar { display: none; }
  .esp .chip-lg, .esp-home .chip-lg { height: 38px; padding: 0 14px; font-size: 13.5px; flex-shrink: 0; }

  .esp-ghost { flex-wrap: wrap; }
  .esp-ghost-btns { width: 100%; justify-content: flex-end; }
  .esp-ghost-btns .btn { height: 40px; }

  .esp-masonry { --esp-min: 150px !important; }
  .esp-masonry[data-sort="lists"] { --esp-min: 280px !important; }
  .esp-pin-card { padding: 13px; }
  .esp-pin-card .ic-title { font-size: 15px; }
  .esp-sec-head { min-height: 40px; }
  .esp-sec-toggle { min-height: 40px; }
  .esp-sec-add { width: 40px; height: 40px; padding: 0; }

  .esp .check { position: relative; }
  .esp .check::before { content: ""; position: absolute; inset: -10px; }
  .esp-tasks .task-row { gap: 12px; padding: 10px 4px; }
  .esp-row-more { width: 36px !important; height: 36px; }
  .esp-task-add { min-height: 44px; }
  .esp-li { min-height: 40px; padding: 7px 4px; }
  .esp-li-add { min-height: 40px; }
  .esp-event { min-height: 56px; }
  .esp-goal-actions .btn { height: 40px; flex: 1; }
  .esp-hint { flex-direction: column; align-items: flex-start; }
  .esp-hint-btns { margin-left: 0; }
  .esp-hint-btns .btn { height: 40px; }
  .esp-empty-tpls { grid-template-columns: 1fr 1fr; }
  .esp-mini-tpl { flex-direction: column; align-items: flex-start; }

  .esp-home { padding-top: 18px; }
  .esp-tpl-strip { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 18px; padding: 2px 16px; }
  .esp-tpl-strip::-webkit-scrollbar { display: none; }
  .esp-sgrid { gap: 14px; }
  .esp-scard-new { min-height: 140px; }

  .esp-tpls { grid-template-columns: 1fr 1fr; }
  .esp-tpl-sum { display: none; }
  .esp-ai-box { flex-direction: column; align-items: stretch; }
  .esp-ai-run { height: 44px; }
  .esp-gi-type { display: none; }
  .esp-gi { min-height: 52px; }
  .esp-edit-grid { grid-template-columns: 1fr; }
  .esp-nfoot-tip { display: none; }
  .esp-nfoot .btn, .esp-modal .modal-foot .btn { height: 42px; }
  .esp-swatches .swatch { width: 40px; height: 40px; }
}
