@font-face { font-family: "Poppins"; font-weight: 400; font-display: swap; src: url("fonts/poppins-400.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 500; font-display: swap; src: url("fonts/poppins-500.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-display: swap; src: url("fonts/poppins-600.woff2") format("woff2"); }

/* ---------- Temas (sempre escuro). Cada projeto troca só estes tokens. ---------- */
:root, [data-theme="mudasell"] {
  --bg: oklch(0.155 0.014 262); --surface: oklch(0.195 0.016 262); --surface-2: oklch(0.235 0.018 262); --surface-3: oklch(0.285 0.02 262);
  --line: oklch(0.31 0.018 262); --ink: oklch(0.96 0.004 262); --ink-2: oklch(0.80 0.012 262); --ink-3: oklch(0.68 0.016 262);
  --accent: oklch(0.70 0.15 262); --accent-strong: oklch(0.62 0.19 264); --accent-ink: oklch(0.15 0.03 262); --accent-soft: oklch(0.30 0.07 262);
  --grad-a: oklch(0.60 0.20 270); --grad-b: oklch(0.74 0.13 225);
  --grad: linear-gradient(95deg, var(--grad-a), var(--grad-b));
}
[data-theme="laura"] {
  --bg: oklch(0.15 0.014 350); --surface: oklch(0.19 0.017 350); --surface-2: oklch(0.23 0.02 350); --surface-3: oklch(0.28 0.024 350);
  --line: oklch(0.31 0.024 350); --ink: oklch(0.965 0.005 350); --ink-2: oklch(0.81 0.015 350); --ink-3: oklch(0.69 0.02 350);
  --accent: oklch(0.72 0.19 2); --accent-strong: oklch(0.66 0.23 2); --accent-ink: oklch(0.16 0.04 2); --accent-soft: oklch(0.31 0.09 2);
  --grad-a: oklch(0.76 0.17 52); --grad-b: oklch(0.66 0.24 358);
  --grad: linear-gradient(95deg, var(--grad-a), var(--grad-b));
}
:root {
  --ok: oklch(0.74 0.17 150); --ok-soft: oklch(0.29 0.07 150); --danger: oklch(0.72 0.17 25); --danger-soft: oklch(0.29 0.08 25);
  --warn: oklch(0.82 0.13 85);
  --r-sm: 8px; --r: 12px; --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --z-side: 20; --z-scrim: 19; --z-wipe: 40; --z-toast: 50;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.55 "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { text-wrap: balance; margin: 0; font-weight: 600; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 14px; transition: background .15s, border-color .15s, transform .1s; }
button:hover { background: var(--surface-3); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: default; transform: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
button.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
button.ghost:hover { background: var(--surface-2); color: var(--ink); }
button.danger { color: var(--danger); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, textarea, select { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 11px; min-width: 0; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, textarea:hover, select:hover { border-color: var(--surface-3); }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Login / troca de senha ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 16px; background: radial-gradient(60rem 30rem at 85% -10%, color-mix(in oklch, var(--grad-a) 22%, transparent), transparent 70%), var(--bg); }
.auth form { width: 100%; max-width: 384px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; }
.auth .mark { width: 40px; height: 6px; border-radius: 99px; background: var(--grad); margin-bottom: 20px; }
.auth h1 { font-size: 22px; margin-bottom: 4px; }
.auth p { margin: 0 0 20px; color: var(--ink-2); font-size: 14px; }
.auth label { display: block; font-size: 13px; font-weight: 500; margin: 14px 0 6px; color: var(--ink-2); }
.auth input { width: 100%; }
.auth button { width: 100%; margin-top: 22px; padding: 11px; }
.msg-error { color: var(--danger); font-size: 14px; min-height: 21px; margin-top: 12px; }

/* ---------- Estrutura ---------- */
.shell { height: 100%; display: grid; grid-template-rows: 56px 1fr; }
.topbar { display: flex; align-items: center; gap: 20px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); min-width: 0; }
.brand { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.brand::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--grad); }
.tabs { display: flex; gap: 4px; align-self: stretch; overflow-x: auto; scrollbar-width: none; }
.tab { position: relative; border: 0; border-radius: 0; background: transparent; padding: 0 14px; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.tab:hover { background: transparent; color: var(--ink); }
.tab::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--grad); transform: scaleX(0); transition: transform .25s var(--ease); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after { transform: scaleX(1); }
.me { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; }
.me .avatar { width: 28px; height: 28px; }
.menu-btn { display: none; padding: 7px; }

.body { display: grid; grid-template-columns: 272px 1fr; min-height: 0; }
.side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; padding: 12px 10px; gap: 2px; overflow-y: auto; }
.side h2 { font-size: 12px; font-weight: 500; color: var(--ink-3); margin: 18px 10px 6px; display: flex; align-items: center; justify-content: space-between; }
.side h2 button { padding: 3px 8px; font-size: 12px; }
.nav { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 10px; color: var(--ink-2); border-radius: var(--r-sm); min-width: 0; }
.nav span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.nav:hover { background: var(--surface-2); color: var(--ink); }
.nav[aria-current="true"] { background: var(--accent-soft); color: var(--ink); font-weight: 500; }
.nav:disabled { opacity: 1; color: var(--ink-3); cursor: default; background: transparent; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); color: var(--ink-3); }
.side .hint { color: var(--ink-3); font-size: 13px; padding: 4px 10px; }
.scrim { display: none; }

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

/* ---------- Visão geral ---------- */
.overview { overflow-y: auto; padding: 36px 28px 64px; background: radial-gradient(52rem 20rem at 100% -6rem, color-mix(in oklch, var(--grad-b) 20%, transparent), transparent 70%), radial-gradient(40rem 16rem at 55% -8rem, color-mix(in oklch, var(--grad-a) 14%, transparent), transparent 70%); background-attachment: local; }
.ov-inner { max-width: 980px; margin: 0 auto; }
.ov-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 32px; margin-bottom: 24px; }
.ov-head h1 { font-size: 32px; letter-spacing: -0.02em; line-height: 1.2; }
.ov-head p { margin: 2px 0 0; color: var(--ink-2); }
.progress { margin-left: auto; min-width: 240px; flex: 0 1 320px; }
.progress .label { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.progress .label strong { color: var(--ink); font-weight: 600; }
.bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 100%; background: var(--grad); border-radius: 99px; transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform .5s var(--ease); }

.add { display: grid; grid-template-columns: minmax(200px, 1fr) 150px 140px 150px auto; gap: 8px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 20px; margin: 0 4px 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; color: var(--ink-3); font-size: 13px; }
.filters select { padding: 6px 9px; font-size: 13px; background: var(--surface); }

.group { margin-top: 22px; }
.group > h2, .group > summary { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--ink-2); }
.group > summary { cursor: pointer; list-style: none; width: fit-content; border-radius: var(--r-sm); }
.group > summary::-webkit-details-marker { display: none; }
.group > summary::before { content: "›"; display: inline-block; transition: transform .2s var(--ease); }
.group[open] > summary::before { transform: rotate(90deg); }
.count { font-weight: 500; font-size: 12px; padding: 0 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.group.late > h2 { color: var(--danger); }
.group.late .count { background: var(--danger-soft); color: var(--danger); }
.tasks { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.task { display: grid; grid-template-columns: 22px minmax(0, 1fr) 128px 132px 84px 34px; align-items: center; gap: 6px 14px; padding: 11px 14px; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.task:hover { background: color-mix(in oklch, var(--surface-2) 55%, transparent); }
.task .title { font-weight: 500; overflow-wrap: anywhere; }
.task .details { display: block; font-weight: 400; font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task.done .title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line); }
.chip { font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.person { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--ink); flex: none; }
.due { font-size: 13px; color: var(--ink-2); white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.due small { display: block; font-size: 12px; color: var(--ink-3); }
.due.late, .due.late small { color: var(--danger); }
.due.soon small { color: var(--warn); }
.task .edit { padding: 6px; opacity: .55; }
.task:hover .edit, .task .edit:focus-visible { opacity: 1; }

.check { appearance: none; width: 20px; height: 20px; padding: 0; margin: 0; border: 1.5px solid var(--ink-3); border-radius: 6px; background: transparent; cursor: pointer; display: grid; place-items: center; transition: background .15s, border-color .15s; }
.check:hover { border-color: var(--ok); }
.check::after { content: ""; width: 10px; height: 6px; border-left: 2px solid var(--bg); border-bottom: 2px solid var(--bg); transform: rotate(-45deg) scale(0); margin-top: -2px; transition: transform .2s var(--ease); }
.check:checked { background: var(--ok); border-color: var(--ok); }
.check:checked::after { transform: rotate(-45deg) scale(1); }

.editor { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 6px 0 4px; }
.editor .full { grid-column: 1 / -1; }
.editor textarea { resize: vertical; min-height: 64px; }
.editor .actions { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; }
.editor .actions .spacer { flex: 1; }
.editor label { font-size: 12px; color: var(--ink-3); display: grid; gap: 4px; }

.empty { border: 1px dashed var(--line); border-radius: var(--r); padding: 32px 24px; color: var(--ink-2); text-align: center; }
.empty strong { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.skeleton { height: 46px; border-radius: var(--r); background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; margin-bottom: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Chat ---------- */
.chat-head { padding: 14px 24px; border-bottom: 1px solid var(--line); }
.chat-head h1 { font-size: 17px; }
.chat-head p { margin: 0; color: var(--ink-3); font-size: 13px; }
.thread { flex: 1; overflow-y: auto; padding: 24px; min-height: 0; }
.thread-inner { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.bubble { max-width: 100%; overflow-wrap: anywhere; line-height: 1.65; }
.bubble.user { align-self: flex-end; background: var(--accent-soft); border-radius: 14px 14px 4px 14px; padding: 10px 14px; max-width: 85%; white-space: pre-wrap; }
.bubble.assistant p { margin: 0 0 12px; text-wrap: pretty; }
.bubble.assistant > .md > :last-child { margin-bottom: 0; }
.bubble.assistant h3 { margin: 20px 0 8px; font-size: 17px; }
.bubble.assistant h4 { margin: 16px 0 6px; font-size: 15px; }
.bubble.assistant ul, .bubble.assistant ol { margin: 0 0 12px; padding-left: 22px; }
.bubble.assistant li { margin: 3px 0; }
.bubble.assistant pre { background: var(--surface); border: 1px solid var(--line); padding: 12px; border-radius: var(--r-sm); overflow-x: auto; font: 13px/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; }
.bubble.assistant code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font: .9em ui-monospace, "Cascadia Code", Consolas, monospace; }
.bubble.assistant pre code { padding: 0; background: none; }
.bubble.assistant a { color: var(--accent); }
.bubble.assistant table { border-collapse: collapse; margin: 0 0 12px; font-size: 14px; display: block; overflow-x: auto; }
.bubble.assistant th, .bubble.assistant td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.bubble.assistant th { background: var(--surface); font-weight: 600; }
.tools { font-size: 12.5px; color: var(--ink-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; margin-bottom: 12px; }
.tools div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note { font-size: 13px; color: var(--ink-3); text-align: center; }
.note.error { color: var(--danger); }
.md.typing:empty::before, .md.typing::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1s ease-in-out infinite; vertical-align: middle; margin-left: 4px; }
.md.typing:empty::after { display: none; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.8); } }
.chat-empty { margin: 10vh auto 0; max-width: 460px; text-align: center; color: var(--ink-2); }
.chat-empty strong { display: block; color: var(--ink); font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.suggest button { font-size: 13px; border-radius: 99px; background: var(--surface); }

.composer { padding: 12px 24px 20px; }
.composer form { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px; transition: border-color .15s; }
.composer form.drag { border-color: var(--accent); background: var(--surface-2); }
.toolbar { display: flex; align-items: center; gap: 6px; min-width: 0; }
.toolbar .spacer { flex: 1; }
.toolbar select { padding: 6px 8px; font-size: 13px; background: transparent; border-color: transparent; color: var(--ink-2); max-width: 44%; }
.toolbar select:hover, .toolbar select:focus-visible { border-color: var(--line); color: var(--ink); }
.toolbar option { background: var(--surface-2); color: var(--ink); }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 4px 0; }
.thumb { position: relative; width: 64px; height: 64px; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.loading img { opacity: .4; }
.thumb button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 0; background: oklch(0 0 0 / .7); color: #fff; font-size: 13px; line-height: 20px; }
.bubble.user .shots { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; justify-content: flex-end; }
.bubble.user .shots img { max-width: 220px; max-height: 180px; border-radius: var(--r-sm); display: block; }
.composer form:focus-within { border-color: var(--accent); }
.composer textarea { width: 100%; resize: none; max-height: 220px; min-height: 40px; border: 0; background: transparent; padding: 8px 8px; outline: none; }
.composer button { padding: 9px 12px; display: flex; align-items: center; gap: 6px; }

/* ---------- Transição de tema entre projetos ---------- */
.wipe { position: fixed; inset: 0; z-index: var(--z-wipe); pointer-events: none; background: var(--wipe, var(--grad)); clip-path: circle(0 at var(--x, 50%) var(--y, 0)); opacity: 1; }
.wipe.in { clip-path: circle(150vmax at var(--x, 50%) var(--y, 0)); transition: clip-path .42s var(--ease); }
.wipe.out { clip-path: circle(150vmax at var(--x, 50%) var(--y, 0)); opacity: 0; transition: opacity .3s ease-out; }
.enter > * { animation: rise .35s var(--ease) both; }
.enter > :nth-child(2) { animation-delay: .04s; } .enter > :nth-child(3) { animation-delay: .08s; } .enter > :nth-child(n+4) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: var(--z-toast); background: var(--surface-3); border: 1px solid var(--line); padding: 10px 16px; border-radius: 99px; font-size: 14px; display: flex; gap: 12px; align-items: center; }
.toast button { padding: 2px 10px; font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .wipe.in { transition: none; opacity: 0; }
}

@media (max-width: 860px) {
  .body { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex; }
  .side { position: fixed; top: 56px; bottom: 0; left: 0; width: min(300px, 84vw); z-index: var(--z-side); transform: translateX(-102%); transition: transform .25s var(--ease); }
  .side.open { transform: none; }
  .side.open + .scrim { display: block; position: fixed; inset: 56px 0 0 0; background: oklch(0 0 0 / .5); z-index: var(--z-scrim); }
  .me .name { display: none; }
  .overview { padding: 20px 16px 48px; }
  .add { grid-template-columns: 1fr 1fr; } .add input[name="title"] { grid-column: 1 / -1; } .add button { grid-column: 1 / -1; }
  .task { grid-template-columns: 22px minmax(0, 1fr) 34px; }
  .task .chip, .task .person, .task .due { grid-column: 2; justify-self: start; text-align: left; }
  .task .due small { display: inline; margin-left: 6px; }
  .task .edit { grid-column: 3; grid-row: 1; }
  .editor { grid-template-columns: 1fr; }
  .progress { margin-left: 0; flex: 1 1 100%; }
  .thread, .composer { padding-left: 14px; padding-right: 14px; }
}
