/* me — design system mínimo, mobile-first. Claro/escuro automático. */
:root {
    --bg: #f5f6f8; --surface: #fff; --text: #0f172a; --muted: #64748b; --line: #e2e8f0;
    --brand: #4f46e5; --brand-ink: #fff; --ok: #16a34a; --err: #dc2626;
    --radius: 14px; --side: 220px; --nav-h: 62px;
}
@media (prefers-color-scheme: dark) {
    :root { --bg: #0b1020; --surface: #131a2e; --text: #e8ecf5; --muted: #8a96b0; --line: #243049; --brand: #818cf8; --brand-ink: #0b1020; }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; text-decoration: none; }
h1 { font-size: 1.6rem; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 1rem; margin: 0 0 .6rem; }
code { background: var(--line); padding: .1em .35em; border-radius: 6px; font-size: .85em; }
.muted { color: var(--muted); margin: .15rem 0 0; }
.small { font-size: .85rem; }
[hidden] { display: none !important; }

/* Layout: sidebar no desktop, barra inferior no celular */
.side { position: fixed; z-index: 10; inset: auto 0 0 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
.side .brand { display: none; }
.side nav { display: flex; height: 100%; }
.side nav a, .side nav form, .navbtn { flex: 1; }
.side nav a, .navbtn {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font-size: .72rem; color: var(--muted); background: none; border: 0; cursor: pointer; width: 100%; height: 100%; font-family: inherit;
}
.side nav i { font-size: 1.15rem; }
.side nav a.on { color: var(--brand); font-weight: 600; }
.main { padding: 1rem 1rem calc(var(--nav-h) + 1.5rem + env(safe-area-inset-bottom)); max-width: 1100px; margin: 0 auto; }

@media (min-width: 800px) {
    .side { inset: 0 auto 0 0; width: var(--side); height: auto; border-top: 0; border-right: 1px solid var(--line); padding: 1.2rem .8rem; }
    .side .brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.3rem; padding: 0 .6rem 1.2rem; color: var(--brand); }
    .side nav { flex-direction: column; gap: 2px; height: auto; }
    .side nav a, .navbtn { flex-direction: row; justify-content: flex-start; gap: .75rem; padding: .65rem .8rem; border-radius: 10px; font-size: .95rem; height: auto; }
    .side nav a:hover, .navbtn:hover { background: var(--bg); }
    .side nav a.on { background: color-mix(in srgb, var(--brand) 14%, transparent); }
    .side nav i { width: 1.3rem; text-align: center; font-size: 1rem; }
    .main { margin-left: var(--side); max-width: none; padding: 2rem 2.5rem; }
    .main > * { max-width: 1100px; }
}

/* Componentes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.page-head { display: flex; flex-wrap: wrap; gap: .8rem 1.5rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.4rem; }
.page-head input, .page-head select { max-width: 100%; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; }
input, select, textarea {
    font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line);
    border-radius: 10px; padding: .65rem .8rem; width: 100%; min-height: 44px;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.page-head input[type=search] { width: 260px; }
.filters select { width: auto; }
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .9rem; }
label input, label select, label textarea { margin-top: .3rem; font-weight: 400; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .6rem 1.1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn.block { width: 100%; }
.badge { display: inline-block; font-size: .7rem; font-weight: 600; padding: .1rem .55rem; border-radius: 99px; background: var(--line); color: var(--muted); }
.flash { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; background: color-mix(in srgb, var(--ok) 14%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); }
.flash.err { background: color-mix(in srgb, var(--err) 12%, transparent); border-color: color-mix(in srgb, var(--err) 40%, transparent); }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }

/* Painel */
.group { margin-bottom: 1.8rem; }
.group h2 { color: var(--c); display: flex; align-items: center; gap: .5rem; text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; }
.grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tile { display: flex; gap: .9rem; align-items: center; transition: transform .12s, border-color .12s; position: relative; }
.tile:hover { transform: translateY(-2px); border-color: var(--c); }
.tile-icon { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); font-size: 1.2rem; }
.tile-body { display: flex; flex-direction: column; min-width: 0; }
.tile-body small { color: var(--muted); line-height: 1.3; }
.tile .badge { position: absolute; top: .6rem; right: .6rem; }

/* Login / erro */
body.bare { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 1rem; }
.login { width: 100%; max-width: 380px; padding: 1.8rem; text-align: center; }
.login label { text-align: left; }
.login h1 { margin-top: .3rem; }
.login .muted { margin-bottom: 1.4rem; }
.login-logo { font-size: 2.2rem; color: var(--brand); }

/* Logs */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.4rem; border-left: 2px solid var(--line); }
.tl-item { position: relative; margin-bottom: .9rem; }
.tl-dot { position: absolute; left: calc(-1.4rem - 13px); top: .7rem; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; background: var(--brand); color: var(--brand-ink); }
.t-fix .tl-dot { background: #ea580c; } .t-security .tl-dot { background: var(--err); } .t-docs .tl-dot { background: #0d9488; }
.t-infra .tl-dot { background: #64748b; } .t-idea .tl-dot { background: #d97706; } .t-note .tl-dot { background: var(--muted); }
.tl-meta { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .35rem; }
.tl-meta time { margin-left: auto; font-size: .78rem; color: var(--muted); }
.md > *:first-child { margin-top: .3rem; } .md > *:last-child { margin-bottom: 0; } .md { color: var(--muted); font-size: .92rem; }
.md ul { padding-left: 1.2rem; }

/* Roadmap */
.board { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .board { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1150px) { .board { grid-template-columns: repeat(4, 1fr); } .main > .board { max-width: none; } }
.col h2 { display: flex; gap: .5rem; align-items: center; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.col .count { margin-left: auto; background: var(--line); border-radius: 99px; padding: 0 .55rem; }
.col .card { margin-bottom: .6rem; padding: .8rem; }
.col .card p { font-size: .85rem; margin: .2rem 0 .4rem; }
.col-done .card { opacity: .7; }

/* Formulários e utilitários */
.stack { display: grid; gap: 1rem; max-width: 640px; }
.stack .card h2 { display: flex; gap: .5rem; align-items: center; }
.form { margin-top: .6rem; }
.two { display: grid; gap: .6rem; grid-template-columns: 1fr 1fr; }
.row { display: inline-block; margin: .3rem .4rem .3rem 0; }
.inline { display: inline; margin-left: auto; }
.btn.small { min-height: 36px; padding: .3rem .8rem; font-size: .85rem; }
.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, var(--line)); }
.badge.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.err { background: color-mix(in srgb, var(--err) 16%, transparent); color: var(--err); }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; overflow-x: auto; font-size: .8rem; margin: .4rem 0 .8rem; }
pre code { background: none; padding: 0; }
.status-list { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .5rem; }
.status-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .6rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; }
.dot.on { background: var(--ok); }
.add { max-width: 640px; margin-bottom: 1.4rem; }
summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; gap: .5rem; }
details.edit { margin-top: .5rem; } details.edit summary { font-weight: 500; font-size: .8rem; color: var(--muted); }
details.edit form + form { margin-top: .5rem; }
.task { display: grid; gap: .4rem; }
.task-head { display: flex; gap: .6rem; align-items: center; justify-content: space-between; }
.out { max-height: 160px; white-space: pre-wrap; }
@media (max-width: 799px) { .navbtn { display: none; } .side nav form { display: none; } }
