/* Achadinhos Inteligentes — identidade azul, preto e branco */
:root {
  --ink: #0A0F1C;
  --ink-2: #111827;
  --ink-3: #1F2937;
  --line-dark: #1E293B;
  --bg: #F4F6FA;
  --card: #FFFFFF;
  --line: #E4E8EF;
  --text: #0B1220;
  --muted: #5B6475;
  --faint: #8A93A3;
  --blue: #1D4ED8;
  --blue-2: #2563EB;
  --blue-soft: #E8EFFE;
  --blue-ink: #1E3A8A;
  --ok: #047857;
  --ok-soft: #E7F6EF;
  --warn: #B45309;
  --warn-soft: #FEF3E2;
  --bad: #B91C1C;
  --bad-soft: #FDECEC;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(10, 15, 28, .04), 0 4px 16px rgba(10, 15, 28, .04);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Manrope', 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--blue-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #CBD5E1; padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; color: #fff; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--blue-2); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 15px; color: #fff; letter-spacing: -.04em; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 15px; line-height: 1.15; }
.brand-name small { display: block; font-family: var(--font); font-weight: 500; font-size: 11px; color: #7C8AA5; letter-spacing: .02em; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #5E6B84; padding: 14px 10px 6px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #CBD5E1; font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--ink-3); color: #fff; }
.nav a.active { background: var(--blue-2); color: #fff; }
.nav a .ico { width: 18px; text-align: center; opacity: .9; }
.nav a .count { margin-left: auto; background: rgba(255,255,255,.12); border-radius: 99px; padding: 0 7px; font-size: 11.5px; font-weight: 600; }
.nav a.active .count { background: rgba(255,255,255,.25); }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line-dark); font-size: 12.5px; }
.side-foot .who { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.side-foot button { background: none; border: 0; color: #93A3BD; padding: 0; cursor: pointer; margin-top: 4px; }
.side-foot button:hover { color: #fff; }

.main { min-width: 0; }
.topbar { display: none; }
.page { padding: 28px 32px 64px; max-width: 1360px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); gap: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 24px; }

/* ---------- KPIs ---------- */
.kpi { padding: 16px 18px; }
.kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi-value { font-family: var(--display); font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-note { font-size: 12px; color: var(--faint); margin-top: 2px; }
.kpi.accent { background: var(--ink); color: #fff; border-color: var(--ink); }
.kpi.accent .kpi-label { color: #9FB0CC; }
.kpi.accent .kpi-note { color: #7C8AA5; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s; }
.btn:hover { border-color: #C7CEDA; background: #FAFBFD; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--blue-2); border-color: var(--blue-2); color: #fff; }
.btn.primary:hover { background: var(--blue); border-color: var(--blue); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: var(--ink-3); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: #F5C2C2; }
.btn.wa { background: #128C4A; border-color: #128C4A; color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #EEF1F6; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.block { width: 100%; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12.5px; font-weight: 600; color: #2B3445; }
.field small { color: var(--faint); font-size: 12px; }
.input, select.input, textarea.input { height: 38px; border: 1px solid #D5DBE5; border-radius: var(--radius-sm); padding: 0 11px; background: #fff; width: 100%; outline: none; }
textarea.input { height: auto; min-height: 90px; padding: 10px 11px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--blue-2); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--blue-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: #EEF1F6; color: #3A4456; white-space: nowrap; }
.badge.blue { background: var(--blue-soft); color: var(--blue-ink); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.dark { background: var(--ink); color: #fff; }
.tags { display: flex; gap: 5px; flex-wrap: wrap; }

/* ---------- Score ---------- */
.score { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; font-family: var(--display); font-weight: 800; font-size: 15px; color: var(--ink); background: conic-gradient(var(--blue-2) calc(var(--v) * 1%), #E5E9F0 0); position: relative; flex: none; }
.score::before { content: ''; position: absolute; inset: 4px; background: #fff; border-radius: 50%; }
.score span { position: relative; }
.bar { height: 6px; border-radius: 99px; background: #E9EDF3; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--blue-2); border-radius: inherit; }

/* ---------- Products ---------- */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.pcard { display: flex; flex-direction: column; overflow: hidden; cursor: pointer; transition: border-color .12s, transform .12s; }
.pcard:hover { border-color: #B9C7E3; }
.pcard .thumb { aspect-ratio: 1 / 1; background: #F1F3F7; display: grid; place-items: center; position: relative; }
.pcard .thumb img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.pcard .thumb .score { position: absolute; top: 10px; right: 10px; box-shadow: var(--shadow); }
.pcard .thumb .fav { position: absolute; top: 10px; left: 10px; }
.pcard .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pcard .title { font-weight: 600; font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px; }
.price { font-family: var(--display); font-weight: 800; font-size: 19px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.price s { font-family: var(--font); font-weight: 500; font-size: 12.5px; color: var(--faint); margin-left: 6px; }
.pcard .foot { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 11px 16px; border-bottom: 1px solid #EEF1F5; vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: #F8FAFD; }
.mini-thumb { width: 40px; height: 40px; border-radius: 8px; background: #F1F3F7; object-fit: contain; flex: none; }

/* ---------- Tabs / chips ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 10px 12px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--blue-2); }
.tabs button .n { font-size: 11px; background: #EEF1F6; border-radius: 99px; padding: 1px 6px; margin-left: 4px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar .input { width: auto; min-width: 160px; }
.toolbar .grow { flex: 1; min-width: 200px; }

/* ---------- Drawer & modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 15, 28, .45); z-index: 40; display: flex; justify-content: flex-end; animation: fade .15s ease; }
.drawer { width: min(760px, 100%); height: 100%; background: var(--bg); overflow-y: auto; box-shadow: -10px 0 40px rgba(0,0,0,.15); animation: slide .18s ease; }
.drawer-head { position: sticky; top: 0; z-index: 2; background: #fff; border-bottom: 1px solid var(--line); padding: 14px 20px; display: flex; align-items: center; gap: 12px; }
.drawer-head h2 { flex: 1; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.modal-wrap { position: fixed; inset: 0; background: rgba(10, 15, 28, .45); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fade .15s ease; }
.modal { background: #fff; border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(820px, 100%); }
.modal-head { padding: 18px 22px 0; }
.modal-body { padding: 16px 22px; }
.modal-foot { padding: 0 22px 18px; display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: .6; } }

/* ---------- Publication preview (estilo mensagem) ---------- */
.msg { background: #E9F6EE; border: 1px solid #CDE9D7; border-radius: 12px; padding: 12px 14px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.5; word-break: break-word; }
.msg em { font-style: italic; color: #4B5563; }
.variants { display: grid; gap: 10px; }
.variant { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; background: #fff; }
.variant.on { border-color: var(--blue-2); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.variant .vtext { white-space: pre-wrap; font-size: 12.5px; color: #374151; max-height: 120px; overflow: hidden; mask-image: linear-gradient(#000 70%, transparent); }

/* ---------- Misc ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.notice { border-radius: 10px; padding: 11px 14px; background: var(--blue-soft); color: var(--blue-ink); font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.notice.warn { background: var(--warn-soft); color: #7C3A06; }
.notice.bad { background: var(--bad-soft); color: #7F1D1D; }
.notice.ok { background: var(--ok-soft); color: #064E3B; }
.notice b { font-weight: 700; }
.list-plain { margin: 0; padding-left: 18px; }
.list-plain li { margin: 2px 0; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.chart { width: 100%; height: 180px; }
.spinner { width: 18px; height: 18px; border: 2px solid #CBD5E1; border-top-color: var(--blue-2); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 60px; text-align: center; color: var(--muted); }
.toast-box { position: fixed; bottom: 18px; right: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: 13.5px; animation: fade .15s; }
.toast.bad { background: #7F1D1D; }
.toast.ok { background: #064E3B; }
.step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; }
.gcolor { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: ''; position: absolute; width: 520px; height: 520px; right: -160px; bottom: -200px; border-radius: 50%; background: radial-gradient(circle, rgba(37,99,235,.55), transparent 65%); }
.login-art h1 { font-size: 40px; line-height: 1.08; max-width: 480px; position: relative; z-index: 1; }
.login-art p { color: #9FB0CC; max-width: 440px; position: relative; z-index: 1; }
.login-form { display: grid; place-items: center; padding: 32px 20px; }
.login-form .card { width: min(380px, 100%); padding: 28px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 45; left: 0; top: 0; width: 264px; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; box-shadow: 10px 0 40px rgba(0,0,0,.3); }
  .shell.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(10,15,28,.4); z-index: 44; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 30; }
  .topbar button { background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; padding: 2px 6px; }
  .topbar .brand-name { font-size: 14px; }
  .page { padding: 18px 16px 48px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 32px 20px; min-height: 260px; }
  .login-art h1 { font-size: 28px; }
  .kv { grid-template-columns: 1fr; gap: 0 0; }
  .kv dt { margin-top: 8px; }
  h1 { font-size: 21px; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-value { font-size: 22px; }
  .products { grid-template-columns: 1fr 1fr; gap: 10px; }
  .pcard .body { padding: 10px; }
  .price { font-size: 16px; }
  .toolbar .input, .toolbar .grow { min-width: 0; width: 100%; flex: 1 1 100%; }
}
