/* ArteEmMinuto — painel administrativo */
:root {
  --bg: #F4F3F7;
  --card: #FFFFFF;
  --ink: #1C1A24;
  --muted: #625E6E;
  --line: #E3E1EA;
  --soft: #F7F6FA;
  --brand: #6D4AFF;
  --brand-ink: #4B2FD6;
  --brand-wash: #EFEBFF;
  --good: #1A7F37;
  --good-bg: #E6F4EA;
  --warn: #8A5300;
  --warn-bg: #FFF1D6;
  --bad: #B42318;
  --bad-bg: #FDECEA;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 14px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1 { font-size: 24px; line-height: 1.2; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 16px; line-height: 1.3; margin: 0 0 4px; }
p { margin: 0; }
a { color: var(--brand-ink); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.lead { margin: 0 0 18px; max-width: 64ch; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* topo */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 10px 20px; min-height: 58px; background: var(--ink); color: #fff; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 800; letter-spacing: -.02em; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; }
.logo-sub { font-weight: 500; color: #BDB6D6; margin-left: 2px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; color: #CFC9E3; font: 600 14px var(--font); padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; min-height: 40px; }
.tabs button:hover { color: #fff; background: rgba(255,255,255,.07); }
.tabs button[aria-current='page'] { color: #fff; background: rgba(255,255,255,.12); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.who { font-size: 13px; color: #BDB6D6; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-link { background: none; border: 0; color: #fff; font: 600 14px var(--font); cursor: pointer; text-decoration: none; padding: 8px 2px; min-height: 40px; display: inline-flex; align-items: center; }
.top-link:hover { text-decoration: underline; }

/* estrutura */
.main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 80px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 460px; margin: 48px auto; padding: 28px; }
.card.narrow h1 { margin-bottom: 8px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 > .card { margin-bottom: 0; }
.center-box { text-align: center; padding: 80px 0; display: grid; gap: 12px; justify-items: center; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.stack { display: grid; gap: 14px; margin-top: 18px; }

/* botões e campos */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 700 14px var(--font); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: #C9C5D6; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.danger { color: var(--bad); border-color: #F1C4BF; }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: wait; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
.field.wide { grid-column: 1 / -1; }
input[type='email'], input[type='text'], input[type='search'], select {
  width: 100%; min-height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font: 500 15px var(--font); color: var(--ink);
}
input:focus, select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-wash); }
.note { font-size: 14px; padding: 10px 12px; border-radius: 10px; }
.note.ok { background: var(--good-bg); color: var(--good); }

/* números */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: clamp(22px, 1.9vw, 28px); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* gráfico */
.chart { position: relative; width: 100%; height: 240px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: #ECEAF1; stroke-width: 1; }
.chart .axis text { fill: var(--muted); font: 500 11px var(--font); font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--brand); }
.chart .bar.dim { fill: #C9BEFF; }
.chart .hit { fill: transparent; cursor: default; }
.chart-empty { height: 100%; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 0 20px; }
.chart-tip { position: fixed; z-index: 40; pointer-events: none; background: var(--ink); color: #fff; padding: 8px 10px; border-radius: 8px; font-size: 13px; line-height: 1.35; box-shadow: 0 8px 24px rgba(28,26,36,.25); }
.chart-tip strong { display: block; font-size: 15px; }

/* tabelas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--soft); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid #EFEDF3; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: #FAF9FD; }
.cell-main { font-weight: 700; word-break: break-all; }
.cell-sub { font-size: 12px; color: var(--muted); }
.empty { padding: 28px 18px; color: var(--muted); text-align: center; }

/* etiquetas de status (sempre com texto) */
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.good { color: var(--good); background: var(--good-bg); }
.tag.warn { color: var(--warn); background: var(--warn-bg); }
.tag.bad { color: var(--bad); background: var(--bad-bg); }
.tag.neutral { color: var(--muted); background: #EEEDF2; }
.tag.brand { color: var(--brand-ink); background: var(--brand-wash); }

/* filtros */
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pills button { border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 600 13px var(--font); padding: 7px 12px; border-radius: 999px; cursor: pointer; min-height: 36px; }
.pills button[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: #fff; }
.search { flex: 0 1 300px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); gap: 10px; }
.pager:empty { display: none; }

.grant-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-top: 14px; }

/* detalhe do cliente */
.back { background: none; border: 0; color: var(--brand-ink); font: 700 14px var(--font); cursor: pointer; padding: 6px 0; margin-bottom: 10px; min-height: 40px; }
.back::before { content: '‹ '; }
.detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.detail-head h1 { word-break: break-all; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px 20px; margin-top: 16px; }
.fact dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.fact dd { margin: 2px 0 0; font-weight: 700; word-break: break-word; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; border: 1px solid rgba(0,0,0,.12); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.confirm { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; margin-top: 12px; }

/* cenários */
.scenario-group { margin-bottom: 22px; }
.scenario-group > h2 { font-size: 15px; margin: 0 0 10px; }
.scenario { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 8px; }
.scenario h3 { font-size: 15px; margin: 0; }
.scenario p { font-size: 14px; color: var(--muted); grid-column: 1; }
.scenario .actions { grid-row: 1 / span 2; grid-column: 2; justify-content: flex-end; }
.result-line { grid-column: 1 / -1; font-size: 13px; margin-top: 4px; }

/* diagnóstico */
.check { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #EFEDF3; align-items: center; }
.check:last-child { border-bottom: 0; }
.check-detail { font-size: 12px; color: var(--muted); }

/* avisos */
.banner { background: var(--warn-bg); color: var(--warn); border: 1px solid #F3D9A6; padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; font-size: 14px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(28,26,36,.3); }
.toast.error { background: var(--bad); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .top { padding: 10px 14px; gap: 8px; }
  .tabs { order: 3; width: 100%; }
  .who { display: none; }
  .main { padding: 18px 14px 80px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .grant-grid { grid-template-columns: 1fr; }
  .search { flex-basis: 100%; }
  .scenario { grid-template-columns: 1fr; }
  .scenario .actions { grid-row: auto; grid-column: 1; justify-content: flex-start; }
  .chart { height: 200px; }
  .hide-sm { display: none; }
}
