/* ============================================================
   RML App · Painel de Licenças — Design System
   ============================================================ */
:root {
  --bg: #070b14;
  --bg-soft: #0b1220;
  --panel: #0f172a;
  --panel-2: #131d33;
  --line: #1e2b45;
  --line-soft: #17223a;
  --text: #e8eefc;
  --muted: #8b9ab8;
  --muted-2: #64748b;
  --brand: #22d3a7;
  --brand-2: #0ea5e9;
  --brand-3: #6366f1;
  --danger: #f43f5e;
  --warn: #f59e0b;
  --ok: #22c55e;
  --radius: 14px;
  --shadow: 0 18px 45px -18px rgba(0, 0, 0, .85);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1100px 600px at 88% -10%, rgba(14, 165, 233, .16), transparent 60%),
    radial-gradient(900px 520px at -10% 110%, rgba(34, 211, 167, .12), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.02em; }
small { color: var(--muted); }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 264px;
  flex: 0 0 264px;
  background: linear-gradient(180deg, rgba(15, 23, 42, .96), rgba(8, 12, 22, .98));
  border-right: 1px solid var(--line-soft);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 14px; border-bottom: 1px solid var(--line-soft); }
.logo {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 19px; color: #04140f;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 22px -8px rgba(34, 211, 167, .8);
}
.brand strong { display: block; font-size: 15px; }
.brand small { font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted-2); padding: 10px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 500; font-size: 13.5px;
  text-decoration: none; border: 1px solid transparent;
  transition: .15s ease;
}
.nav a:hover { background: rgba(255, 255, 255, .04); color: var(--text); text-decoration: none; }
.nav a.active {
  background: linear-gradient(90deg, rgba(34, 211, 167, .16), rgba(14, 165, 233, .07));
  border-color: rgba(34, 211, 167, .28);
  color: #d6fff4;
}
.nav a .ico { width: 18px; text-align: center; opacity: .9; font-size: 15px; }
.nav .count {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 20px;
}
.sidebar-foot { border-top: 1px solid var(--line-soft); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.who { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(99, 102, 241, .18); color: #c7d2fe; font-weight: 700;
}
.who strong { display: block; font-size: 13px; }
.who small { font-size: 11px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 30px; border-bottom: 1px solid var(--line-soft);
  background: rgba(7, 11, 20, .72); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 20px; }
.topbar .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.content { padding: 26px 30px 60px; max-width: 1400px; width: 100%; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: linear-gradient(180deg, rgba(19, 29, 51, .92), rgba(13, 20, 36, .92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line-soft);
}
.card-head h2 { font-size: 14.5px; }
.card-head .hint { font-size: 12px; color: var(--muted); }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.stat { padding: 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.stat::after {
  content: ""; position: absolute; inset: auto -30px -40px auto; width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(34, 211, 167, .16), transparent 70%);
}
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.stat .v { font-size: 30px; font-weight: 750; letter-spacing: -.03em; }
.stat .d { font-size: 12px; color: var(--muted); }
.stat.ok .v { color: var(--brand); }
.stat.warn .v { color: var(--warn); }
.stat.bad .v { color: var(--danger); }
.stat.info .v { color: #7dd3fc; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted-2); font-weight: 600; padding: 11px 16px;
  border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .015);
  white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:hover { background: rgba(255, 255, 255, .022); }
tbody tr:last-child td { border-bottom: none; }
.mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.3px; letter-spacing: .02em; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.actions .btn { flex: 0 0 auto; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 650;
  border: 1px solid transparent; white-space: nowrap;
}
.badge.ok { background: rgba(34, 197, 94, .13); color: #6ee7a8; border-color: rgba(34, 197, 94, .3); }
.badge.warn { background: rgba(245, 158, 11, .13); color: #fcd34d; border-color: rgba(245, 158, 11, .3); }
.badge.bad { background: rgba(244, 63, 94, .13); color: #fda4af; border-color: rgba(244, 63, 94, .3); }
.badge.info { background: rgba(14, 165, 233, .13); color: #7dd3fc; border-color: rgba(14, 165, 233, .3); }
.badge.neutral { background: rgba(148, 163, 184, .12); color: #cbd5e1; border-color: rgba(148, 163, 184, .25); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04); color: var(--text);
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: .15s ease; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }
.btn.primary {
  background: linear-gradient(135deg, var(--brand), #14b8a6);
  border-color: transparent; color: #04211a;
  box-shadow: 0 10px 24px -12px rgba(34, 211, 167, .9);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.blue { background: linear-gradient(135deg, #38bdf8, #6366f1); border-color: transparent; color: #06121f; }
.btn.danger { background: rgba(244, 63, 94, .12); border-color: rgba(244, 63, 94, .35); color: #fda4af; }
.btn.danger:hover { background: rgba(244, 63, 94, .22); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: #c3cee4; }
.field .help { font-size: 11.5px; color: var(--muted-2); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=tel], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  background: #0a1120; border: 1px solid var(--line); color: var(--text);
  font-family: inherit; font-size: 13.5px; outline: none; transition: .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(34, 211, 167, .6);
  box-shadow: 0 0 0 3px rgba(34, 211, 167, .12);
}
textarea { min-height: 96px; resize: vertical; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12.5px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; flex-wrap: wrap; }
.inline-form { display: inline; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 15px; border-radius: 11px; font-size: 13px; border: 1px solid; margin-bottom: 16px; }
.alert.ok { background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .3); color: #86efac; }
.alert.err { background: rgba(244, 63, 94, .1); border-color: rgba(244, 63, 94, .3); color: #fda4af; }
.alert.warn { background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .3); color: #fcd34d; }
.alert.info { background: rgba(14, 165, 233, .1); border-color: rgba(14, 165, 233, .3); color: #7dd3fc; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 160px; }
.filters .grow { flex: 1; min-width: 220px; }

/* ---------- Empty state ---------- */
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty .big { font-size: 34px; opacity: .5; margin-bottom: 8px; }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 410px; padding: 34px;
  background: linear-gradient(180deg, rgba(19, 29, 51, .96), rgba(10, 16, 30, .98));
  border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
}
.auth-card .logo { width: 52px; height: 52px; font-size: 23px; margin-bottom: 18px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card p.sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.auth-foot { text-align: center; font-size: 11.5px; color: var(--muted-2); margin-top: 22px; }

/* ---------- Public activation ---------- */
.pub-wrap { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; }
.pub-card {
  width: 100%; max-width: 560px;
  background: linear-gradient(180deg, rgba(19, 29, 51, .97), rgba(9, 14, 26, .99));
  border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  overflow: hidden;
}
.pub-head { padding: 26px 28px 20px; border-bottom: 1px solid var(--line-soft); display: flex; gap: 14px; align-items: center; }
.pub-body { padding: 26px 28px 30px; }
.pub-body h2 { font-size: 18px; margin-bottom: 6px; }
.pub-body p.lead { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; }
.price-tag { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 18px; }
.price-tag .val { font-size: 34px; font-weight: 800; letter-spacing: -.03em; color: var(--brand); }
.price-tag .per { color: var(--muted); font-size: 13px; }
.pix-box { background: #fff; border-radius: 16px; padding: 14px; display: grid; place-items: center; margin: 0 auto 16px; width: fit-content; }
.pix-box img { display: block; width: 220px; height: 220px; }
.copy-row { display: flex; gap: 8px; margin-bottom: 14px; }
.copy-row input { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11.5px; }
.steps { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.step { display: flex; gap: 12px; align-items: flex-start; font-size: 13px; color: #cbd5e1; }
.step .n {
  flex: 0 0 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(34, 211, 167, .14); color: var(--brand); font-size: 11.5px; font-weight: 700;
  border: 1px solid rgba(34, 211, 167, .3);
}
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; margin: 14px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; font-size: 12px; font-weight: 650; }
.status-pill.pending { background: rgba(245, 158, 11, .12); color: #fcd34d; border: 1px solid rgba(245, 158, 11, .3); }
.status-pill.approved { background: rgba(34, 197, 94, .12); color: #86efac; border: 1px solid rgba(34, 197, 94, .3); }
.status-pill.rejected { background: rgba(244, 63, 94, .12); color: #fda4af; border: 1px solid rgba(244, 63, 94, .3); }
.divider { height: 1px; background: var(--line-soft); margin: 20px 0; }

/* ---------- Misc ---------- */
.kbd { font-family: ui-monospace, monospace; background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 11.5px; }
.code-block {
  background: #060b14; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; overflow-x: auto; font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px; line-height: 1.65; color: #a5f3e0; white-space: pre;
}
.secret { display: flex; gap: 6px; align-items: center; }
.secret .val { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--muted); }
.reveal { cursor: pointer; color: var(--brand); font-size: 11px; font-weight: 600; background: none; border: none; padding: 0; }
.progress { height: 7px; border-radius: 6px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.bar-row { display: grid; grid-template-columns: 120px 1fr 46px; gap: 10px; align-items: center; font-size: 12.5px; margin-bottom: 9px; }
.bar-row .bar { height: 8px; border-radius: 6px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.bar-row .bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-3), var(--brand-2)); }
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.feed-item:last-child { border-bottom: none; }
.feed-item .ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.05); font-size: 12px; flex: 0 0 26px; }
.feed-item .t { color: var(--muted-2); font-size: 11px; margin-top: 1px; }
.toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 100;
  background: #0f1e33; border: 1px solid rgba(34, 211, 167, .4); color: #d1fae5;
  padding: 12px 18px; border-radius: 12px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); transition: .25s;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1080px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand { border: none; padding: 0; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; }
  .nav-label { display: none; }
  .sidebar-foot { border: none; padding: 0; flex-direction: row; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .form-grid { grid-template-columns: 1fr; }
}
