/* Hypex Ai — tema claro/escuro */
:root {
  --bg: #f6f5fb;
  --surface: #ffffff;
  --surface-2: #f1eff8;
  --border: #e4e1ee;
  --text: #16131f;
  --muted: #6b6680;
  --accent: #7c3aed;
  --accent-2: #a855f7;
  --accent-soft: #efe7fe;
  --accent-text: #ffffff;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --err: #b91c1c;
  --err-soft: #fdeaea;
  --info: #1d4ed8;
  --info-soft: #e8eefc;
  --shadow: 0 1px 2px rgba(20, 10, 40, .04), 0 4px 16px rgba(20, 10, 40, .05);
  --radius: 14px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0a10;
  --surface: #14121c;
  --surface-2: #1c1927;
  --border: #2a2638;
  --text: #f2f0f8;
  --muted: #9a94ae;
  --accent: #8b5cf6;
  --accent-2: #c084fc;
  --accent-soft: #241a3d;
  --ok: #4ade80;
  --ok-soft: #10261a;
  --warn: #fbbf24;
  --warn-soft: #2a2110;
  --err: #f87171;
  --err-soft: #2c1515;
  --info: #93b4ff;
  --info-soft: #141d33;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 17px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.logo {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 900; font-size: 15px; letter-spacing: -.04em;
}

/* ---------- botao de tema ---------- */
.theme-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; height: 36px; padding: 0 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px;
}
.theme-btn:hover { border-color: var(--accent); }
.theme-btn svg { width: 16px; height: 16px; }
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }

/* ---------- componentes ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.ghost:hover { border-color: var(--accent); filter: none; }
.btn.danger { background: var(--err); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; height: 50px; font-size: 16px; }
.btn[disabled] { opacity: .6; cursor: wait; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted);
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

.alert { border-radius: 12px; padding: 14px 16px; display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.alert svg { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.alert.info { background: var(--info-soft); color: var(--info); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.err { background: var(--err-soft); color: var(--err); }

input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
}
textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field { margin-bottom: 14px; }

.linkbox {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; word-break: break-all; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px;
}

/* ---------- pagina do comprador ---------- */
.pub-top { background: #0f0b1e; color: #fff; }
.pub-top .inner { max-width: 560px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; }
.pub-top .brand { color: #fff; }
.pub-top .theme-btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.2); }
.pub-wrap { max-width: 560px; margin: 0 auto; padding: 22px 16px 48px; display: grid; gap: 16px; }
.pub-card { position: relative; overflow: hidden; padding: 24px; }
.pub-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), #ec4899);
}
.pub-title { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; }
.pub-title svg { width: 24px; height: 24px; color: var(--accent); flex: none; }
.pub-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border-top: 1px solid var(--border); padding-top: 16px; margin-top: 18px; }
.pub-meta div span { display: block; font-size: 12px; color: var(--muted); }
.pub-meta div strong { font-size: 14px; }
.steps { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 12px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.steps .n {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px;
}
.stack { display: grid; gap: 12px; }
.center { text-align: center; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin .8s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.item-list { display: grid; gap: 10px; }

/* ---------- painel ---------- */
.admin { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--border); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.side .brand { padding: 0 8px 18px; }
.side .group { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; margin: 16px 10px 6px; }
.side nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  color: var(--text); font-size: 14px; font-weight: 500;
}
.side nav a svg { width: 17px; height: 17px; color: var(--muted); }
.side nav a:hover { background: var(--surface-2); text-decoration: none; }
.side nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side nav a.active svg { color: var(--accent); }
.side .side-foot { margin-top: 20px; padding: 0 8px; display: grid; gap: 8px; }
.main { padding: 28px 32px 60px; min-width: 0; }
.main-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.kpi .label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.kpi .ico { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.kpi .ico svg { width: 16px; height: 16px; }
.kpi .val { font-size: 26px; font-weight: 800; margin-top: 8px; letter-spacing: -.02em; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg a { padding: 6px 12px; border-radius: 7px; color: var(--muted); font-size: 13px; font-weight: 600; }
.seg a.on { background: var(--accent); color: #fff; }
.seg a:hover { text-decoration: none; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 180px; padding-top: 10px; }
.bars .b { flex: 1; background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars .b:hover::after {
  content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -6px);
  background: var(--text); color: var(--bg); font-size: 11px; padding: 3px 7px; border-radius: 6px; white-space: nowrap; z-index: 2;
}
.bars-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }
.status-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 10px; }
.status-row:last-child { border-bottom: 0; }
.list { display: grid; gap: 12px; }
.row-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-head strong { font-size: 15px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.err-text { color: var(--err); font-size: 13px; margin-top: 6px; word-break: break-word; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.t td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.search { display: flex; gap: 8px; margin-bottom: 18px; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; margin: 22px 0 10px; }
.mobile-top { display: none; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; }

@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .admin { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); display: none; }
  .side.open { display: block; }
  .mobile-top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .main { padding: 20px 16px 48px; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .kpi .val { font-size: 21px; }
  .pub-meta { grid-template-columns: 1fr; }
}
