:root {
  color-scheme: dark;
  --bg: #0b0d14; --surface: #141826; --surface-2: #1c2133; --line: rgba(255, 255, 255, .09);
  --text: #eef0f6; --muted: #9aa3b8; --accent: #8b6dff; --accent-2: #22d3ee;
  --ok: #34d399; --warn: #fbbf24; --bad: #f87171; --radius: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-image: radial-gradient(60rem 30rem at 85% -10%, rgba(139, 109, 255, .16), transparent 60%),
                    radial-gradient(40rem 24rem at -10% 0%, rgba(34, 211, 238, .10), transparent 60%);
  background-attachment: fixed;
}
h1, h2, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.error { color: var(--bad); font-size: 14px; }
.error:empty { display: none; }
[hidden] { display: none !important; }
.ok { color: var(--ok); }
.notice { padding: 10px 14px; border-radius: 12px; font-size: 14px; background: rgba(34, 211, 238, .10); border: 1px solid rgba(34, 211, 238, .25); }
.notice:empty { display: none; }
.people { color: var(--accent-2); font-weight: 600; }
.dot.ask { background: var(--accent-2); }
.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; margin-top: 6px; }
.poster-md { width: 84px; }
.picked.top { align-items: flex-start; }
.segmented.wide { display: grid; grid-auto-columns: 1fr; justify-self: stretch; }

/* marca e login */
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 26px; letter-spacing: -.02em; }
.logo {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; font-size: 16px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.brand.small .logo { width: 28px; height: 28px; border-radius: 9px; font-size: 12px; }
.login { max-width: 420px; margin: 0 auto; padding: 12vh 20px 40px; display: grid; gap: 18px; }
.lead { color: var(--muted); font-size: 17px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.form { display: grid; gap: 8px; }
label, .label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-top: 10px; }
input, select, textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2);
}
textarea { resize: vertical; min-height: 46px; }
input::placeholder, textarea::placeholder { color: #6f7890; }

/* botoes */
.btn {
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2);
  font-weight: 600; transition: transform .12s, opacity .12s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { border: 0; color: #0b0d14; background: linear-gradient(135deg, #a996ff, var(--accent-2)); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 0 10px; }
.form .btn { margin-top: 12px; }

/* cabecalhos */
.topbar, .bar {
  position: sticky; top: 0; z-index: 5; background: rgba(11, 13, 20, .86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 12px; padding: 10px 16px 0; }
.user { display: flex; align-items: center; gap: 4px; font-size: 14px; }
.tabs { grid-column: 1 / -1; display: flex; gap: 4px; }
.tabs button {
  flex: 1; min-height: 44px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; }
.page { max-width: 760px; margin: 0 auto; padding: 18px 16px 40px; display: grid; gap: 14px; }
.title { font-size: 22px; letter-spacing: -.01em; }

/* catalogo */
.segmented { display: inline-grid; grid-auto-flow: column; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface); justify-self: start; }
.segmented button { min-height: 40px; padding: 0 20px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-weight: 600; }
.segmented button.active { background: var(--surface-2); color: var(--text); }
.search { border-radius: 14px; }
.hint:empty { display: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
.tile { display: grid; gap: 6px; padding: 0; border: 0; background: none; text-align: left; align-content: start; }
.tile-name { font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile:hover .poster, .tile:focus-visible .poster { border-color: var(--accent); }
.skeleton { aspect-ratio: 2 / 3; border-radius: 12px; background: var(--surface); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

.poster {
  position: relative; aspect-ratio: 2 / 3; width: 100%; border-radius: 12px; overflow: hidden; background: var(--surface-2);
  border: 1px solid var(--line); flex: none;
}
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster-fallback { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; font-weight: 700; color: var(--muted); }
.poster-sm { width: 48px; border-radius: 8px; }
.poster-sm .poster-fallback { font-size: 16px; }
.poster-lg { width: 104px; }

/* listas de reports */
.list { display: grid; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.row.selected { border-color: var(--accent); }
.row.unread { border-left: 3px solid var(--accent-2); }
.row.unread strong::after { content: " •"; color: var(--accent-2); }
.row-main { flex: 1; min-width: 0; display: grid; }
.row-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { display: grid; justify-items: end; gap: 4px; flex: none; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.status-open { color: var(--accent-2); }
.status-review { color: var(--warn); }
.status-fixed { color: var(--ok); }
.status-rejected { color: var(--bad); }
.empty { display: grid; gap: 14px; justify-items: center; text-align: center; padding: 40px 16px; color: var(--muted); grid-column: 1 / -1; }

/* novo report */
.picked { display: flex; gap: 12px; align-items: center; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; }
.chip[aria-pressed="true"] { border-color: transparent; color: #0b0d14; font-weight: 700; background: linear-gradient(135deg, #a996ff, var(--accent-2)); }

/* conversa */
.thread { padding-bottom: 110px; }
.thread-top { display: grid; gap: 14px; }
.hero { position: relative; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .22; filter: blur(2px); }
.hero-body { position: relative; display: flex; gap: 14px; padding: 16px; }
.hero-text { min-width: 0; display: grid; gap: 6px; align-content: start; }
.hero h2 { font-size: 20px; line-height: 1.2; letter-spacing: -.01em; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.meta span { padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .08); }
.problem { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); flex: none; }
.overview { position: relative; padding: 0 16px 16px; font-size: 14px; color: #c8cede; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.source { word-break: break-word; }
.missing { position: relative; padding: 0 16px 16px; font-size: 14px; }
.missing ul { margin: 6px 0 0; padding-left: 18px; max-height: 190px; overflow-y: auto; color: #c8cede; }
.fix { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fix input { width: 170px; padding: 8px 12px; }
.fix .btn { min-height: 38px; }
.gaps { display: grid; gap: 12px; }
.gaps .label { margin-top: 0; color: var(--text); font-size: 16px; }
.gap-season { display: grid; gap: 6px; }
.chip.gap { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); }
.timeline li { position: relative; display: grid; justify-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.timeline li::before { content: ""; position: absolute; top: 7px; right: 50%; width: 100%; height: 2px; background: var(--line); }
.timeline li:first-child::before { display: none; }
.step-dot { position: relative; width: 16px; height: 16px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--line); }
.timeline .done, .timeline .current { color: var(--text); }
.timeline .done::before, .timeline .current::before { background: var(--accent); }
.timeline .done .step-dot { background: var(--accent); border-color: var(--accent); }
.timeline .current .step-dot { background: var(--accent-2); border-color: var(--accent-2); box-shadow: 0 0 0 5px rgba(34, 211, 238, .18); }
.timeline .current .step-label { font-weight: 700; }
.timeline.is-rejected .current .step-dot { background: var(--bad); border-color: var(--bad); box-shadow: 0 0 0 5px rgba(248, 113, 113, .18); }

.messages { display: grid; gap: 8px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); justify-self: start; }
.msg p { white-space: pre-wrap; overflow-wrap: anywhere; }
.messages > * { scroll-margin-bottom: 130px; }
.msg time { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.msg .who { display: block; font-size: 12px; font-weight: 700; color: var(--accent-2); }
.msg.mine { justify-self: end; border: 0; background: linear-gradient(135deg, #6f55e8, #3f7fd6); border-bottom-right-radius: 6px; }
.msg.mine time { color: rgba(255, 255, 255, .75); text-align: right; }
.msg.theirs { border-bottom-left-radius: 6px; }
.msg.system { justify-self: center; max-width: 100%; padding: 4px 12px; font-size: 13px; color: var(--muted); background: none; border-style: dashed; text-align: center; }
.msg.system time { display: inline; margin-left: 8px; }

.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; gap: 8px; align-items: end;
  padding: 10px max(12px, calc((100vw - 760px) / 2 + 16px)) calc(10px + env(safe-area-inset-bottom));
  background: rgba(11, 13, 20, .92); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.composer textarea { flex: 1; resize: none; max-height: 120px; }
.footer { text-align: center; padding: 16px; font-size: 12px; color: #6f7890; }

/* painel da equipe */
.desk { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; height: 100vh; }
.desk-list { display: grid; grid-template-rows: auto auto auto auto 1fr; gap: 10px; padding: 12px; border-right: 1px solid var(--line); overflow: hidden; }
.desk-list .list { overflow-y: auto; align-content: start; }
.desk-head { display: flex; justify-content: space-between; align-items: center; }
.desk-pane { position: relative; overflow-y: auto; display: flex; flex-direction: column; }
.desk-pane .page { width: 100%; flex: 1; align-content: start; padding-bottom: 28px; }
.desk-pane .composer { position: sticky; padding: 10px 16px; }
.desk .back { display: none; }
@media (max-width: 800px) {
  .desk { grid-template-columns: 1fr; }
  .desk-pane { display: none; }
  .desk.has-thread .desk-list { display: none; }
  .desk.has-thread .desk-pane { display: flex; height: 100vh; }
  .desk .back { display: inline-block; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
