@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@500;600;700;800&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

:root {
  --bg: #050508;
  --bg2: #0b0b10;
  --panel: #121218;
  --panel2: #18181f;
  --elevated: #1c1c26;
  --line: rgba(255,255,255,.08);
  --line2: rgba(168,85,247,.28);
  --text: #f5f3ff;
  --muted: #a1a1b5;
  --dim: #6e6e86;
  --purple: #8b5cf6;
  --purple2: #a855f7;
  --purple3: #c084fc;
  --cyan: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 48px rgba(0,0,0,.5);
  --sidebar: 268px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Outfit", "DM Sans", sans-serif;
  --accent: var(--purple2);
  --accent-dim: rgba(168,85,247,.16);
  --grad: linear-gradient(135deg, #22d3ee, #8b5cf6 45%, #a855f7 75%, #d946ef);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  background:
    radial-gradient(1000px 520px at 8% -8%, rgba(139,92,246,.28), transparent 55%),
    radial-gradient(800px 420px at 100% 0%, rgba(34,211,238,.12), transparent 42%),
    radial-gradient(600px 400px at 70% 100%, rgba(168,85,247,.08), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--purple3); text-decoration: none; }
a:hover { color: #e9d5ff; }
.muted { color: var(--muted); }
.soft { color: var(--dim); font-size: .84rem; margin-top: 28px; text-align: center; }

/* AUTH (legacy single card) */
.auth-body {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, rgba(139,92,246,.35), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(34,211,238,.15), transparent 35%),
    #030306;
}
.auth-card {
  width: 100%; max-width: 420px; padding: 36px 32px;
  background: linear-gradient(180deg, #16161f, #0e0e14);
  border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.auth-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--grad);
}
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.auth-brand img {
  width: 58px; height: 58px; border-radius: 16px; object-fit: cover;
  box-shadow: 0 0 24px rgba(168,85,247,.35);
}
.auth-card h1 {
  margin: 0; font-family: var(--display); font-size: 1.9rem; letter-spacing: .12em;
  font-weight: 800;
}
.auth-card h1 span {
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.auth-card .tagline { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }

/* LOGIN UNIFICADO (estilo Astra / REPLAY) */
.login-page {
  min-height: 100vh; margin: 0; color: var(--text);
  font-family: var(--font);
  background: #030306;
}
.login-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 480px at 12% 0%, rgba(139,92,246,.38), transparent 55%),
    radial-gradient(700px 420px at 95% 90%, rgba(34,211,238,.16), transparent 45%),
    radial-gradient(500px 300px at 50% 110%, rgba(168,85,247,.12), transparent 50%),
    #030306;
}
.login-wrap {
  position: relative; z-index: 1;
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr;
  gap: 32px; align-items: center; max-width: 1080px; margin: 0 auto; padding: 40px 28px;
}
.login-showcase { padding: 12px 8px 12px 20px; }
.login-wordmark {
  width: 88px; height: 88px; border-radius: 22px; object-fit: cover;
  box-shadow: 0 12px 40px rgba(139,92,246,.4); margin-bottom: 22px;
}
.login-showcase h2 {
  margin: 0 0 12px; font-family: var(--display); font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 800; letter-spacing: -.02em; line-height: 1.15;
}
.login-showcase > p { color: var(--muted); font-size: 1.05rem; line-height: 1.55; max-width: 34ch; margin: 0 0 22px; }
.login-features { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.login-features li {
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255,255,255,.03); color: #ddd6fe; font-weight: 600; font-size: .92rem;
}
.login-features li::before { content: "✦ "; color: var(--purple3); }
.login-card {
  width: 100%; max-width: 420px; justify-self: end;
  padding: 32px 28px 28px;
  background: linear-gradient(180deg, #17171f, #0e0e14);
  border: 1px solid var(--line2); border-radius: 24px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.login-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad);
}
.login-card-head { text-align: center; margin-bottom: 20px; }
.login-card-logo {
  width: 56px; height: 56px; border-radius: 16px; object-fit: cover;
  box-shadow: 0 0 24px rgba(168,85,247,.35); margin-bottom: 12px;
}
.login-card-head h1 {
  margin: 0 0 8px; font-family: var(--display); font-size: 1.55rem; font-weight: 800;
}
.login-card .tag {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line2); background: var(--accent-dim);
  color: var(--purple3); font-size: .72rem; font-weight: 800; letter-spacing: .12em;
}
.password-field { position: relative; }
.password-field input { padding-right: 92px; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--purple3);
  font-weight: 700; font-size: .82rem; cursor: pointer; padding: 6px 10px;
}
.login-submit { width: 100%; margin-top: 8px; padding: 14px 18px; font-size: 1rem; }
@media (max-width: 860px) {
  .login-wrap { grid-template-columns: 1fr; padding: 28px 18px 40px; }
  .login-showcase { display: none; }
  .login-card { justify-self: center; }
}

/* MODAIS (criar/editar) */
.wa-overlay {
  position: fixed; inset: 0; z-index: 80; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(0,0,0,.62); backdrop-filter: blur(8px);
}
.wa-overlay.open { display: flex; }
.wa-modal {
  width: 100%; max-width: 560px; max-height: min(90vh, 820px); overflow: auto;
  background: linear-gradient(180deg, #1a1a24, #121218);
  border: 1px solid var(--line2); border-radius: 22px; box-shadow: var(--shadow);
  padding: 22px;
}
.wa-modal.form-modal { max-width: 640px; }
.wa-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  margin-bottom: 16px;
}
.wa-head h3 { margin: 6px 0 0; font-family: var(--display); font-size: 1.35rem; }
.wa-badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-dim); color: var(--purple3); border: 1px solid var(--line2);
  font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}
.wa-close {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border-radius: 12px; border: 1px solid var(--line); background: transparent;
  color: var(--muted); cursor: pointer; font-size: 1rem; text-decoration: none;
}
.wa-close:hover { color: #fff; border-color: var(--line2); }
.wa-actions {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
}
.wa-creds {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px;
}
.wa-creds > div {
  padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
}
.wa-creds span {
  display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); font-weight: 700; margin-bottom: 4px;
}
.wa-creds b { font-size: 1rem; word-break: break-all; }
.wa-body {
  white-space: pre-wrap; line-height: 1.55; padding: 14px 16px;
  border-radius: 14px; border: 1px solid var(--line);
  background: #0a0a10; color: #e9e5ff; font-size: .95rem;
  max-height: 40vh; overflow: auto;
  scrollbar-width: thin; scrollbar-color: rgba(168,85,247,.35) transparent;
}
input[readonly] { opacity: .75; cursor: default; }
textarea {
  width: 100%; background: #0a0a10; color: var(--text);
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  font: inherit; outline: none; resize: vertical; min-height: 80px;
}
textarea:focus {
  border-color: rgba(168,85,247,.6);
  box-shadow: 0 0 0 3px rgba(168,85,247,.18);
}

/* SHELL (estilo Astra — sidebar fixa limpa + main scrollável) */
:root { --side: 272px; }
html { scrollbar-width: thin; scrollbar-color: rgba(168,85,247,.35) rgba(255,255,255,.04); }
html::-webkit-scrollbar { width: 10px; }
html::-webkit-scrollbar-track { background: rgba(255,255,255,.03); }
html::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(168,85,247,.45), rgba(34,211,238,.25));
  border-radius: 999px;
}
body.no-scroll { overflow: hidden; }
.shell { display: flex; min-height: 100vh; position: relative; }
.side-backdrop {
  display: none; position: fixed; inset: 0; z-index: 35;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
}
.shell.side-open .side-backdrop { display: block; }
.side {
  width: var(--side); position: fixed; left: 0; top: 0; height: 100vh; z-index: 40;
  display: flex; flex-direction: column; padding: 0;
  background: linear-gradient(180deg, #08080e 0%, #0c0c14 55%, #090910 100%);
  border-right: 1px solid var(--line);
  transform: translateX(0); transition: transform .28s ease;
}
.brand {
  display: flex; gap: 12px; align-items: center;
  padding: 20px 16px 16px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.brand-logo {
  width: 48px; height: 48px; border-radius: 14px; object-fit: cover;
  box-shadow: 0 0 20px rgba(168,85,247,.4); background: #000;
  border: 1px solid rgba(168,85,247,.3);
}
.brand-text { min-width: 0; flex: 1; }
.brand-text strong {
  display: block; font-family: var(--display); font-size: 1.15rem; letter-spacing: .1em; font-weight: 800;
}
.brand-text strong span {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-text span {
  display: block; color: var(--purple3); font-size: .62rem; font-weight: 800;
  letter-spacing: .16em; text-transform: uppercase; margin-top: 2px;
}
.side-close {
  display: none; width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-size: 1.3rem; cursor: pointer;
}
.credit-pill {
  margin: 14px 14px 6px; padding: 14px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, rgba(168,85,247,.2), rgba(34,211,238,.06));
  border: 1px solid rgba(168,85,247,.3);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.credit-pill label {
  display: block; font-size: .65rem; text-transform: uppercase;
  letter-spacing: .14em; color: var(--muted); font-weight: 700;
}
.credit-pill b {
  display: block; margin-top: 4px; font-size: 1.45rem;
  color: var(--purple3); font-family: var(--display); font-weight: 800;
}
.nav-sec {
  margin: 16px 16px 6px; font-size: .62rem; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; color: var(--dim);
}
.side-nav {
  display: flex; flex-direction: column; gap: 2px;
  padding: 0 10px 12px; flex: 1; overflow-y: auto; min-height: 0;
  scrollbar-width: thin; scrollbar-color: rgba(168,85,247,.3) transparent;
}
.side-nav::-webkit-scrollbar { width: 5px; }
.side-nav::-webkit-scrollbar-thumb {
  background: rgba(168,85,247,.35); border-radius: 999px;
}
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--muted); font-weight: 600; font-size: .9rem;
  transition: background .15s, color .15s;
}
.side-nav a:hover { background: rgba(255,255,255,.045); color: #fff; }
.side-nav a.on {
  background: var(--accent-dim); color: #fff;
  box-shadow: inset 3px 0 0 var(--purple2);
}
.foot {
  border-top: 1px solid var(--line); padding: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  flex-shrink: 0; background: #090910;
}
.foot .who { min-width: 0; display: flex; align-items: center; gap: 10px; flex: 1; }
.who-av {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; overflow: hidden;
  background: #050508; border: 1px solid rgba(168,85,247,.3);
}
.who-av img { width: 100%; height: 100%; object-fit: cover; }
.foot .who p { margin: 0; font-weight: 700; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot .who small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.foot a.out {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); border: 1px solid var(--line); flex-shrink: 0; text-decoration: none;
}
.foot a.out:hover { color: #fff; border-color: var(--line2); background: rgba(255,255,255,.04); }

.main { flex: 1; min-width: 0; margin-left: var(--side); }

/* Revenda: uma tela por vez */
.rs-view { display: none; animation: rsFade .22s ease; }
.rs-view.is-active { display: block; }
@keyframes rsFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.rs-quick {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  margin: 16px 0;
}
.rs-quick-card {
  text-align: left; cursor: pointer; border: 1px solid var(--line);
  background: linear-gradient(180deg, #16161f, #101018);
  border-radius: 16px; padding: 18px 16px; color: var(--text);
  transition: border-color .15s, transform .15s, background .15s;
}
.rs-quick-card:hover {
  border-color: rgba(168,85,247,.45);
  background: linear-gradient(180deg, #1a1524, #121218);
  transform: translateY(-1px);
}
.rs-quick-card strong { display: block; font-size: 1.02rem; margin-bottom: 4px; }
.rs-quick-card span { color: var(--muted); font-size: .84rem; line-height: 1.35; }
.rs-form-panel { max-width: 560px; }
.client-list .col-actions { width: 56px; text-align: right; }
.row-menu { position: relative; display: inline-block; }
.row-menu-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255,255,255,.03); color: var(--text); cursor: pointer;
  font-size: 1.2rem; line-height: 1; padding: 0;
}
.row-menu-btn:hover { border-color: var(--line2); background: rgba(168,85,247,.12); color: #fff; }
.row-menu-pop {
  display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  min-width: 190px; max-height: min(70vh, 420px); overflow-y: auto;
  padding: 6px; border-radius: 14px;
  border: 1px solid var(--line2); background: #14141c;
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
}
.row-menu-pop.open { display: block; }
.row-menu-pop.is-fixed {
  position: fixed; z-index: 200; top: 0; left: 0; right: auto;
}
.table-wrap.client-list-wrap { overflow: visible; }
.client-list tbody td { overflow: visible; }
.row-menu-item {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  color: var(--text); padding: 10px 12px; border-radius: 10px; cursor: pointer;
  font: inherit; font-size: .88rem;
}
.row-menu-item:hover { background: rgba(168,85,247,.14); }
.row-menu-item.danger { color: #f87171; }
.row-menu-item.danger:hover { background: rgba(248,113,113,.12); }
.row-menu-form { margin: 0; padding: 0; }
.client-detail-body { display: grid; gap: 10px; margin-bottom: 8px; }
.detail-row {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255,255,255,.02); font-size: .9rem;
}
.detail-row span { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.detail-devices { margin-top: 4px; display: grid; gap: 8px; }
.detail-device {
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255,255,255,.02);
}
@media (max-width: 720px) {
  .row-menu-pop { right: auto; left: 0; }
}
.rs-help-list {
  margin: 0 0 16px; padding-left: 1.2rem; color: var(--muted); line-height: 1.55;
}
.rs-help-list li { margin-bottom: 10px; }
.rs-help-list strong { color: var(--text); }
.nav-count {
  margin-left: auto; font-style: normal; font-size: .72rem; font-weight: 800;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-dim); color: var(--purple3); border: 1px solid var(--line2);
}
.side-nav a { justify-content: flex-start; }
.side-nav a .nav-count { margin-left: auto; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 28px; border-bottom: 1px solid var(--line);
  background: rgba(5,5,8,.82); backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.menu-btn {
  display: none; width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font-size: 1.1rem; cursor: pointer; flex-shrink: 0;
}
.page-title {
  margin: 0; font-family: var(--display); font-size: 1.3rem; font-weight: 800;
  letter-spacing: -.02em;
}
.page-sub { margin: 2px 0 0; color: var(--muted); font-size: .84rem; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.topbar-logout { display: none; }
.breadcrumb {
  display: flex; align-items: center; gap: 6px; margin-bottom: 2px;
  font-size: .66rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--dim);
}
.breadcrumb i { font-style: normal; color: #3a3a4a; }
.page-content { padding: 22px 28px 56px; }
.flash {
  margin: 14px 28px 0; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--line); font-weight: 600;
}
.flash.ok { background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.28); color: #6ee7b7; }
.flash.warn { background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.28); color: #fcd34d; }
.flash.err { background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.3); color: #fca5a5; }
.user-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px; background: var(--panel);
  border: 1px solid var(--line2); color: var(--purple3); font-size: .86rem; font-weight: 600;
}
/* legacy aliases */
.layout { display: contents; }
.sidebar { display: none; }
.content { min-width: 0; }

/* CARDS */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.card {
  background: linear-gradient(160deg, #1a1a24, #121218);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.card::after {
  content: ""; position: absolute; right: -24px; top: -24px; width: 100px; height: 100px;
  background: radial-gradient(circle, rgba(168,85,247,.3), transparent 70%);
}
.card .label {
  color: var(--muted); font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
}
.card .value {
  font-family: var(--display); font-size: 1.9rem; font-weight: 800; margin-top: 8px;
}
.card .hint { color: var(--purple3); font-size: .8rem; margin-top: 6px; font-weight: 600; }
.accent-red, .accent-purple { color: var(--purple3); }
.accent-ok { color: var(--ok); }
.accent-gold, .accent-blue { color: var(--cyan); }

.panel {
  background: linear-gradient(180deg, #16161f, #111118);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-top: 16px; box-shadow: var(--shadow);
}
.panel h2, .panel h3 {
  margin: 0 0 14px; font-family: var(--display); letter-spacing: -.01em; font-weight: 750;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.panel-head h3 { margin: 0 0 4px; }
.panel-sub { color: var(--muted); font-size: .9rem; margin: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: .92rem; }
th {
  color: var(--dim); font-weight: 700; font-size: .74rem;
  text-transform: uppercase; letter-spacing: .08em;
}
tr:hover td { background: rgba(168,85,247,.05); }
.table-wrap { overflow: auto; border-radius: 14px; }
.empty-state {
  text-align: center; padding: 48px 20px; color: var(--muted);
}
.empty-state .icon {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  border: 1px solid var(--line2); display: grid; place-items: center;
  font-size: 1.4rem; color: var(--purple3); background: var(--accent-dim);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 999px; padding: 11px 18px; cursor: pointer;
  font-weight: 700; font-family: var(--font); color: #fff; background: #2a2a36;
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-primary {
  background: var(--grad); color: #fff;
  box-shadow: 0 8px 24px rgba(139,92,246,.35);
}
.btn-danger { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.btn-warn { background: linear-gradient(135deg, #f59e0b, #b45309); color: #111; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-sm { padding: 7px 12px; font-size: .84rem; }

.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 700; letter-spacing: .04em;
  border: 1px solid transparent;
}
.badge-ok { background: rgba(52,211,153,.12); color: #6ee7b7; border-color: rgba(52,211,153,.3); }
.badge-warn { background: rgba(251,191,36,.12); color: #fcd34d; border-color: rgba(251,191,36,.28); }
.badge-bad { background: rgba(248,113,113,.12); color: #fca5a5; border-color: rgba(248,113,113,.3); }
.badge-muted { background: rgba(255,255,255,.05); color: var(--muted); border-color: var(--line); }
.badge-accent { background: var(--accent-dim); color: var(--purple3); border-color: var(--line2); }

.act-menu { position: relative; display: inline-block; }
.act-menu > summary { list-style: none; cursor: pointer; }
.act-menu > summary::-webkit-details-marker { display: none; }
.act-menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  min-width: 180px; padding: 8px; border-radius: 14px;
  background: #12121a; border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
  display: flex; flex-direction: column; gap: 2px;
}
.act-menu-panel a, .act-menu-panel button, .act-menu-panel .linkish {
  display: block; width: 100%; text-align: left; padding: 10px 12px;
  border: 0; background: transparent; color: var(--text); font: inherit;
  border-radius: 10px; cursor: pointer; text-decoration: none;
}
.act-menu-panel a:hover, .act-menu-panel button:hover, .act-menu-panel .linkish:hover {
  background: rgba(168,85,247,.12);
}
.act-menu-panel .danger, .act-menu-panel button.danger { color: #fca5a5; }
.row-featured td { background: rgba(168,85,247,.06); }
.sc-fields { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.sc-field label { display: block; font-size: .72rem; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
.sc-field > div { display: flex; gap: 8px; align-items: center; justify-content: space-between; background: #0a0a10; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.sc-field code { font-size: .85rem; word-break: break-all; color: var(--purple3); }
table.apps-catalog td { vertical-align: middle; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; margin-bottom: 7px; color: var(--muted); font-size: .86rem; font-weight: 600; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=url],
input[type=search], select, textarea {
  width: 100%; background: #0a0a10; color: var(--text);
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  font: inherit; outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(168,85,247,.6);
  box-shadow: 0 0 0 3px rgba(168,85,247,.18);
}
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inline-search { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-search input { min-width: 220px; }
.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: .03em; }
.tiny { font-size: .78rem; margin-top: 2px; }
.filter-bar { margin-bottom: 12px; }
.form-actions { align-self: end; display: flex; align-items: end; }

.alert {
  padding: 12px 14px; border-radius: 14px; margin-bottom: 14px;
  border: 1px solid var(--line); font-weight: 600;
}
.alert-ok { background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.28); color: #6ee7b7; }
.alert-warn { background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.28); color: #fcd34d; }
.alert-bad { background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.3); color: #fca5a5; }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; margin: 12px 0; }
.bar {
  flex: 1; min-width: 18px; border-radius: 8px 8px 4px 4px;
  background: var(--grad);
}

.hero-strip {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 22px 24px; margin-bottom: 8px;
  border-radius: 22px; border: 1px solid var(--line2);
  background:
    linear-gradient(120deg, rgba(139,92,246,.22), transparent 55%),
    linear-gradient(180deg, #1a1524, #121218);
}
.hero-strip h2 { margin: 0 0 6px; font-family: var(--display); font-size: 1.55rem; }
.menu-toggle { display: none; }

.credits-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line2); background: var(--accent-dim);
  color: var(--purple3); font-weight: 700; font-size: .86rem;
}

.cards-compact { grid-template-columns: repeat(3, 1fr); }
.hide-mobile { display: inline-flex; }

@media (max-width: 980px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .side { transform: translateX(-105%); }
  .shell.side-open .side { transform: translateX(0); }
  .side-close, .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .main { margin-left: 0; }
  .page-content { padding: 16px 14px 72px; }
  .rs-quick { grid-template-columns: 1fr; }
  .flash { margin-left: 14px; margin-right: 14px; }
  .topbar { padding: 12px 14px; gap: 10px; }
  .page-title { font-size: 1.15rem; }
  .topbar-logout { display: inline-flex; }
  .hide-mobile { display: none !important; }
  .wa-creds { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cards-compact { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .card { padding: 14px; }
  .card .value { font-size: 1.35rem; }
  .hero-strip { padding: 16px; }
  .panel { padding: 16px; border-radius: 16px; }
  .actions { gap: 6px; }
  .btn { padding: 10px 14px; }
  .btn-sm { padding: 8px 10px; font-size: .8rem; }
  .table-wrap { margin: 0 -4px; }
  table.mobile-stack thead { display: none; }
  table.mobile-stack tr {
    display: block; margin-bottom: 10px; padding: 12px;
    border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.02);
  }
  table.mobile-stack td {
    display: flex; justify-content: space-between; gap: 10px;
    border: 0; padding: 6px 0; font-size: .9rem;
  }
  table.mobile-stack td::before {
    content: attr(data-label);
    color: var(--muted); font-weight: 700; font-size: .72rem;
    text-transform: uppercase; letter-spacing: .06em;
  }
  .inline-search { width: 100%; }
  .inline-search input { min-width: 0; flex: 1; }
  .wa-modal { max-height: 88dvh; padding: 16px; border-radius: 18px; }
  .wa-body { max-height: 36dvh; font-size: .9rem; }
}

@media (max-width: 520px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .top-actions .btn { padding: 8px 12px; font-size: .82rem; }
}
