/* Gestor de Decisões — visual minimalista: fundo branco, lilás e azul */
:root {
  --bg: #ffffff;
  --bg-soft: #faf9ff;
  --line: #ebe8f7;
  --line-strong: #dcd7f2;
  --text: #24223a;
  --muted: #6e6a8c;
  --faint: #9a97b5;
  --lilac: #8b7cf6;
  --lilac-600: #6d5df0;
  --lilac-700: #5646d6;
  --lilac-50: #f4f2fe;
  --lilac-100: #e9e5fd;
  --blue: #4f7cf7;
  --blue-600: #3563e9;
  --blue-50: #eef3ff;
  --green: #16a34a; --green-50: #ecfdf3;
  --amber: #b45309; --amber-50: #fff7e6;
  --red: #dc2626; --red-50: #fef2f2;
  --gray-50: #f5f5f8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(40, 30, 110, .04), 0 4px 16px rgba(40, 30, 110, .05);
  --grad: linear-gradient(135deg, #9b8cf8 0%, #4f7cf7 100%);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--lilac-600); text-decoration: none; }
a:hover { color: var(--lilac-700); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--lilac-100); }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; background: var(--bg); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--grad); display: grid; place-items: center; color: #fff; flex: none; }
.brand-mark svg { width: 16px; height: 16px; }
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.15; }
.brand-name small { display: block; font-weight: 500; color: var(--faint); font-size: 11px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 14px 10px 6px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: var(--bg-soft); color: var(--text); }
.nav a.active { background: var(--lilac-50); color: var(--lilac-700); }
.nav a .count { margin-left: auto; background: var(--lilac-600); color: #fff; font-size: 11px; border-radius: 10px; padding: 0 7px; line-height: 18px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; color: var(--text); }
.me:hover { background: var(--bg-soft); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--lilac-100); color: var(--lilac-700); display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.me-info { min-width: 0; }
.me-info b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-info span { font-size: 12px; color: var(--faint); }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 22px 32px 18px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 20px; }
.topbar .crumbs { font-size: 12px; color: var(--faint); margin-bottom: 2px; }
.topbar .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.content { padding: 24px 32px 48px; max-width: 1280px; }
.btn.mobile-toggle { display: none; }

/* ---------- Componentes ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-strong); background: #fff; color: var(--text); padding: 8px 14px; border-radius: 8px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { background: var(--bg-soft); border-color: var(--lilac); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--lilac-600); border-color: var(--lilac-600); color: #fff; }
.btn.primary:hover { background: var(--lilac-700); border-color: var(--lilac-700); }
.btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.blue:hover { background: var(--blue-600); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--lilac-50); color: var(--lilac-700); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); background: var(--red-50); }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 14px; }
.card-head .sub { color: var(--faint); font-size: 12px; font-weight: 400; }
.section-title { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin: 26px 0 10px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }

.kpi { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi .value { font-size: 28px; font-weight: 600; margin-top: 4px; letter-spacing: -0.02em; }
.kpi.accent { background: var(--lilac-50); border-color: var(--lilac-100); }
.kpi.accent .value { color: var(--lilac-700); }
.kpi.warn .value { color: var(--red); }
.kpi.info .value { color: var(--blue-600); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li .grow { flex: 1; min-width: 0; }
.list li .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; color: var(--text); }
.list li a.t:hover { color: var(--lilac-700); }
.list li .s { font-size: 12px; color: var(--faint); }
.empty { padding: 28px 20px; text-align: center; color: var(--faint); font-size: 13px; }
.empty b { display: block; color: var(--muted); font-weight: 500; margin-bottom: 2px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--gray-50); color: var(--muted); border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.lilac { background: var(--lilac-50); color: var(--lilac-700); }
.badge.blue { background: var(--blue-50); color: var(--blue-600); }
.badge.green { background: var(--green-50); color: var(--green); }
.badge.amber { background: var(--amber-50); color: var(--amber); }
.badge.red { background: var(--red-50); color: var(--red); }
.badge.plain::before { display: none; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 4px; background: var(--gray-50); color: var(--muted); font-weight: 500; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--faint); padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg-soft); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--bg-soft); }
.table .t { font-weight: 500; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { max-width: 100%; overflow-x: auto; display: inline-flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.tabs button { flex: none; border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; color: var(--muted); font-weight: 500; cursor: pointer; }
.tabs button.active { background: #fff; color: var(--lilac-700); box-shadow: 0 1px 2px rgba(40,30,110,.08); }
.search { position: relative; }
.search input { padding-left: 32px; width: 240px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); }

/* ---------- Formulários ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label, .label { font-size: 12px; font-weight: 500; color: var(--muted); }
.field label .req { color: var(--lilac-600); }
.field .hint { font-size: 12px; color: var(--faint); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { border-color: var(--lilac); box-shadow: 0 0 0 3px var(--lilac-50); }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--lilac-600); }
.multi { border: 1px solid var(--line-strong); border-radius: 8px; max-height: 180px; overflow: auto; padding: 6px 10px; }
.multi .check { padding: 4px 0; }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 14px; }
.choice { border: 1px solid var(--line-strong); border-radius: 9px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; transition: all .15s; }
.choice input { display: none; }
.choice b { font-size: 13px; font-weight: 600; }
.choice span { font-size: 11.5px; color: var(--faint); line-height: 1.35; }
.choice:hover { border-color: var(--lilac); }
.choice.on { border-color: var(--lilac-600); background: var(--lilac-50); box-shadow: 0 0 0 3px var(--lilac-50); }
.choice.on b { color: var(--lilac-700); }

.task-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.task-row { border: 1px dashed var(--line-strong); border-radius: 9px; padding: 12px 12px 0; position: relative; background: var(--bg-soft); }
.task-row .rm { position: absolute; top: 6px; right: 6px; }
.task-row .field { margin-bottom: 10px; }
.cond { display: none; }
.cond.show { display: block; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(36, 30, 80, .28); backdrop-filter: blur(2px); display: grid; place-items: start center; padding: 6vh 16px; z-index: 50; overflow-y: auto; animation: fade .15s; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(40, 30, 110, .2); animation: pop .18s ease-out; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 20px 22px 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--bg-soft); border-radius: 0 0 14px 14px; }
.x { border: 0; background: transparent; cursor: pointer; color: var(--faint); font-size: 22px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.x:hover { background: var(--bg-soft); color: var(--text); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--lilac-600); padding: 11px 16px; border-radius: 9px; box-shadow: var(--shadow); max-width: 380px; animation: pop .2s; }
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }

/* ---------- Detalhes ---------- */
.detail-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.meta > div { padding: 12px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.meta .k { font-size: 11.5px; color: var(--faint); font-weight: 500; }
.meta .v { font-weight: 500; margin-top: 2px; }
.prose { white-space: pre-wrap; color: var(--text); }
.journey { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.journey .step { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 12px; color: var(--muted); }
.journey .step.on { background: var(--grad); color: #fff; border-color: transparent; }
.journey .arrow { color: var(--faint); font-size: 12px; }

.timeline { list-style: none; margin: 0; padding: 4px 20px 8px; }
.timeline li { position: relative; padding: 10px 0 10px 22px; border-left: 2px solid var(--lilac-100); margin-left: 5px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 15px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--lilac); }
.timeline li:first-child::before { background: var(--lilac); }
.timeline .ev { font-weight: 500; }
.timeline .when { font-size: 12px; color: var(--faint); }
.timeline .det { font-size: 13px; color: var(--muted); margin-top: 2px; }

.pauta { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; gap: 16px; align-items: flex-start; }
.pauta:last-child { border-bottom: 0; }
.pauta .num { width: 26px; height: 26px; border-radius: 50%; background: var(--lilac-50); color: var(--lilac-700); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.pauta .body { flex: 1; min-width: 0; }
.pauta .title { font-weight: 600; }
.pauta .desc { color: var(--muted); font-size: 13px; margin-top: 3px; }
.pauta .actions { display: flex; gap: 6px; flex-wrap: wrap; flex: none; }
.outcome { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--bg-soft); border: 1px solid var(--line); font-size: 13px; }
.outcome .mini { margin: 6px 0 0; padding-left: 18px; }

.progress { height: 6px; border-radius: 6px; background: var(--lilac-50); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--grad); border-radius: 6px; }

/* Kanban */
.board { display: grid; grid-template-columns: repeat(5, minmax(180px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-height: 200px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-weight: 600; font-size: 13px; }
.col-head .dot { width: 8px; height: 8px; border-radius: 50%; }
.col-head .n { margin-left: auto; color: var(--faint); font-weight: 500; font-size: 12px; }
.kcard { display: block; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; margin-bottom: 8px; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.kcard:hover { border-color: var(--lilac); box-shadow: var(--shadow); color: var(--text); }
.kcard .t { font-weight: 500; font-size: 13.5px; }
.kcard .m { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--faint); flex-wrap: wrap; }
.kcard.late { border-left: 3px solid var(--red); }

.w5h2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.w5h2 > div { padding: 12px 18px; border-bottom: 1px solid var(--line); }
.w5h2 > div:nth-child(odd) { border-right: 1px solid var(--line); }
.w5h2 .q { font-size: 11px; color: var(--lilac-600); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.w5h2 .a { margin-top: 3px; white-space: pre-wrap; }
.subs { list-style: none; margin: 0; padding: 6px 20px 10px; }
.subs li { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.subs li.done span { text-decoration: line-through; color: var(--faint); }
.subs li .del { margin-left: auto; opacity: 0; }
.subs li:hover .del { opacity: 1; }

.callout { padding: 12px 14px; border-radius: 9px; background: var(--lilac-50); border: 1px solid var(--lilac-100); color: var(--lilac-700); font-size: 13px; margin-bottom: 16px; }
.callout.blue { background: var(--blue-50); border-color: #dbe5ff; color: var(--blue-600); }
.callout.amber { background: var(--amber-50); border-color: #fde9c3; color: var(--amber); }
.ata-box { padding: 24px 28px; }

/* ---------- Autenticação ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: var(--grad); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); right: -180px; bottom: -180px; }
.auth-side::before { content: ""; position: absolute; width: 340px; height: 340px; border-radius: 50%; border: 1px solid rgba(255,255,255,.14); right: -60px; bottom: -60px; }
.auth-side h2 { font-size: 30px; line-height: 1.2; font-weight: 600; max-width: 420px; letter-spacing: -0.02em; }
.auth-side p { opacity: .85; max-width: 400px; }
.cycle { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.cycle span { background: rgba(255,255,255,.16); padding: 5px 12px; border-radius: 999px; font-size: 13px; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); margin-bottom: 26px; }
.auth-card .btn { width: 100%; padding: 11px; }
.auth-links { margin-top: 18px; text-align: center; font-size: 13px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s; z-index: 40; box-shadow: var(--shadow); }
  .shell.open .sidebar { transform: none; }
  .btn.mobile-toggle { display: inline-flex; }
  .topbar { padding: 14px 16px; flex-wrap: wrap; }
  .content { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .search input { width: 100%; }
  .w5h2 { grid-template-columns: 1fr; }
  .w5h2 > div:nth-child(odd) { border-right: 0; }
  .pauta { flex-wrap: wrap; }
}

/* ---------- Impressão (ata) ---------- */
@media print {
  .sidebar, .topbar, .no-print, #toasts { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  .card { border: 0; }
  body { font-size: 12px; }
}
