:root {
  --bg: #f4f5f8; --panel: #ffffff; --ink: #0f172a; --muted: #64748b; --line: #e7e9ef;
  --brand: #4f46e5; --brand-soft: #eef0ff;
  --red: #e5484d; --red-soft: #fff0f0; --red-line: #ffd3d4; --red-track: #fde2e2;
  --amb: #e8a317; --amb-ink: #b7791f; --amb-soft: #fff7e6; --amb-line: #fde6b3; --amb-track: #fdf0d5;
  --grn: #18a058; --grn-soft: #eafaf1; --grn-line: #c6efd6; --grn-track: #dff5e8;
  --gray: #94a3b8; --gray-soft: #f1f5f9; --gray-track: #e2e8f0;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }

/* estados de tela inteira */
.tela-centro { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.tela-centro h1 { font-size: 22px; margin: 12px 0 6px; }
.tela-centro p { color: var(--muted); margin: 0; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--brand); animation: gira 0.8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

.app { display: grid; grid-template-columns: 232px 1fr 340px; min-height: 100vh; }

/* menu lateral */
.side { background: #0f172a; color: #cbd5e1; padding: 22px 16px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 16px; margin-bottom: 22px; }
.logo i { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #6366f1, #22d3ee); display: inline-block; flex: none; }
.nav { padding: 9px 12px; border-radius: 10px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; background: none; border: 0; color: inherit; text-align: left; width: 100%; }
.nav:hover { background: rgba(255, 255, 255, .05); }
.nav.on { background: rgba(255, 255, 255, .1); color: #fff; }
.nav b { background: rgba(255, 255, 255, .12); border-radius: 20px; padding: 0 8px; font-size: 12px; font-weight: 600; }
.nav.so-celular { display: none; }
.side .foot { margin-top: auto; font-size: 12px; color: #64748b; line-height: 1.5; }

/* coluna principal */
main { padding: 28px 32px; min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
h1 { font-size: 24px; margin: 0; font-weight: 800; letter-spacing: -.02em; }
.sub { color: var(--muted); margin-top: 4px; }
.busca { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; width: 280px; max-width: 100%; font: inherit; color: var(--ink); }
.busca:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.kpi .l { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi .v { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; white-space: nowrap; }
.kpi .v small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.kpi.alerta .v { color: var(--red); }

.filtros { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.grupo { display: inline-flex; flex-wrap: wrap; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.grupo .pill { border: 0; }
.pill { padding: 6px 13px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-weight: 500; color: #334155; font-size: 13px; }
.pill.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.ordem { padding: 7px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font: inherit; font-size: 13px; color: #334155; }

/* cartões */
.vazio { background: var(--panel); border: 1px dashed var(--line); border-radius: 18px; padding: 40px 20px; text-align: center; color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; margin-bottom: 14px; display: grid; grid-template-columns: 1fr auto; gap: 16px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); transition: box-shadow .15s; }
.card:hover { box-shadow: 0 8px 24px rgba(15, 23, 42, .08); }
.card.destaque { border-color: #c7c4fb; }
.badges { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.b { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; letter-spacing: .02em; }
.b.nova { background: var(--brand-soft); color: var(--brand); }
.b.verificar { background: var(--amb-soft); color: #9a6700; }
.b.disputar { background: #fef3c7; color: #92400e; }
.b.alterado { background: #e0f2fe; color: #075985; }
.b.grande { background: var(--gray-soft); color: #475569; }
.faixa { background: var(--red-soft); color: #9b1c1f; border: 1px solid var(--red-line); border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.t { font-size: 16px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 6px; line-height: 1.35; }
.m { color: var(--muted); font-size: 13px; display: flex; gap: 6px 14px; flex-wrap: wrap; }
.m span + span::before { content: ""; display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: #cbd5e1; margin-right: 8px; vertical-align: middle; }
.val { font-weight: 700; color: var(--ink); }
.orgao { color: var(--muted); font-size: 12px; margin-top: 4px; }

.deadlines { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; margin-top: 14px; }
.dl { border-radius: 12px; padding: 10px 12px; background: var(--gray-soft); border: 1px solid var(--line); position: relative; }
.dl .k { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding-right: 18px; }
.dl .d { font-weight: 600; margin-top: 2px; }
.dl .c { font-size: 12px; font-weight: 700; margin-top: 6px; }
.bar { height: 4px; border-radius: 4px; background: var(--gray-track); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; }
.dl.vermelho { background: var(--red-soft); border-color: var(--red-line); } .dl.vermelho .c { color: var(--red); } .dl.vermelho .bar i { background: var(--red); }
.dl.amarelo { background: var(--amb-soft); border-color: var(--amb-line); } .dl.amarelo .c { color: var(--amb-ink); } .dl.amarelo .bar i { background: var(--amb); }
.dl.verde { background: var(--grn-soft); border-color: var(--grn-line); } .dl.verde .c { color: var(--grn); } .dl.verde .bar i { background: var(--grn); }
.dl.cinza .c { color: var(--gray); } .dl.cinza .d { color: var(--muted); }
.dl .x { position: absolute; top: 6px; right: 6px; border: 0; background: none; color: var(--muted); font-size: 14px; line-height: 1; padding: 2px 4px; border-radius: 6px; }
.dl .x:hover { background: rgba(15, 23, 42, .06); color: var(--ink); }

.form-prazo { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; background: var(--gray-soft); border-radius: 12px; padding: 10px; }
.form-prazo input { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; background: #fff; }
.form-prazo input[name=nome] { flex: 1 1 180px; }

.ring { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; text-align: center; margin: 0 auto; }
.ring > div { width: 66px; height: 66px; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.ring b { font-size: 22px; font-weight: 800; line-height: 1; display: block; }
.ring small { font-size: 10px; color: var(--muted); font-weight: 600; }
.actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: 150px; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 12px; font-weight: 600; font-size: 12px; text-align: center; color: #334155; text-decoration: none; }
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn.pri { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.on-disputar { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.btn.on-descartar { background: var(--gray-soft); border-color: #cbd5e1; color: #475569; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.links { display: flex; gap: 8px; }
.links .btn { flex: 1; white-space: nowrap; padding-left: 8px; padding-right: 8px; }

.cor-vermelho { color: var(--red); } .cor-amarelo { color: var(--amb); } .cor-verde { color: var(--grn); } .cor-cinza { color: var(--gray); }

/* agenda */
aside { background: var(--panel); border-left: 1px solid var(--line); padding: 28px 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
aside h3 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
aside .sub { margin-bottom: 18px; font-size: 12px; }
.ag { position: relative; padding-left: 22px; margin-bottom: 18px; }
.ag::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: -18px; width: 2px; background: var(--line); }
.ag:last-child::before { display: none; }
.ag .dot { position: absolute; left: 0; top: 3px; width: 12px; height: 12px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px currentColor; background: currentColor; }
.ag .dia { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ag .it { margin-top: 6px; background: #f8fafc; border-radius: 10px; padding: 8px 10px; font-size: 13px; color: var(--ink); display: block; width: 100%; text-align: left; border: 0; }
.ag .it:hover { background: var(--brand-soft); }
.ag .it b { display: block; font-size: 12px; }
.ag .it span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nota { margin-top: 22px; font-size: 11px; color: var(--muted); background: #f8fafc; border-radius: 10px; padding: 10px 12px; line-height: 1.5; }
.realce { animation: realce 1.6s ease; }
@keyframes realce { 0%, 40% { box-shadow: 0 0 0 3px var(--brand); } 100% { box-shadow: 0 1px 2px rgba(15, 23, 42, .04); } }

.aviso { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(15, 23, 42, .25); z-index: 10; }

/* telas médias: agenda some da lateral, vira aba */
@media (max-width: 1200px) {
  .app { grid-template-columns: 220px 1fr; }
  aside { display: none; }
  .nav.so-celular { display: flex; }
  body.ver-agenda aside { display: block; position: static; height: auto; border-left: 0; background: transparent; padding: 28px 32px; }
  body.ver-agenda main { display: none; }
}

/* celular */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; overflow-x: auto; padding: 10px 12px; gap: 6px; }
  .logo { display: none; }
  .nav { white-space: nowrap; width: auto; gap: 8px; flex: none; }
  .side .foot { display: none; }
  main, body.ver-agenda aside { padding: 18px 14px; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi .v { font-size: 22px; }
  .busca { width: 100%; }
  .top > div:first-child { width: 100%; }
  .grupo { border-radius: 16px; }
  .ordem { max-width: 100%; }
  .deadlines { grid-template-columns: 1fr 1fr; }
  .card { grid-template-columns: 1fr; padding: 16px; }
  .actions { flex-direction: row; flex-wrap: wrap; align-items: center; min-width: 0; }
  .actions .ring { width: 64px; height: 64px; margin: 0; }
  .actions .ring > div { width: 50px; height: 50px; }
  .actions .ring b { font-size: 18px; }
  .actions .btn { flex: 1 1 120px; }
  .links { flex: 1 1 100%; }
}
