/* Tema escuro do painel — sem framework, sem build. */

:root {
  --bg: #0e1015;
  --bg-soft: #12151c;
  --panel: #161a22;
  --panel-2: #1b2029;
  --border: #262c38;
  --border-strong: #333b4a;
  --text: #e8eaf0;
  --muted: #98a1b3;
  --muted-2: #6f7889;
  --accent: #7c5cff;
  --accent-soft: rgba(124, 92, 255, 0.14);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --font: "Segoe UI", "Inter", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "Cascadia Code", "Consolas", "SFMono-Regular", ui-monospace, monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 480px at 82% -8%, rgba(124, 92, 255, 0.16), transparent 62%),
    radial-gradient(700px 420px at 0% 100%, rgba(52, 211, 153, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

button, input, textarea { font: inherit; color: inherit; }

a { color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* --- Login ---------------------------------------------------------------- */

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: min(400px, 100%);
  padding: 34px 32px 28px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: linear-gradient(140deg, #8f74ff, #5b3df0);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 8px 22px rgba(124, 92, 255, 0.35);
}

.brand-mark.small {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 12px;
}

.login-card h1 { margin-top: 18px; font-size: 24px; letter-spacing: -0.3px; }
.login-card > p { margin-top: 6px; font-size: 13.5px; }
.login-card .small { margin-top: 22px; }

#login-form { margin-top: 24px; }
#login-totp-form { margin-top: 24px; }
#login-totp-form .small { margin-top: 0; }

label {
  display: block;
  margin: 14px 0 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.2px;
}

input, textarea {
  width: 100%;
  padding: 11px 13px;
  background: #0c0f14;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea { resize: vertical; min-height: 46px; }

#login-form .btn,
#login-totp-form .btn { width: 100%; margin-top: 20px; }

.form-error {
  margin-top: 12px;
  padding: 9px 12px;
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: var(--radius-sm);
  color: #fecaca;
  font-size: 13px;
}

/* --- Layout --------------------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 16px 18px;
  background: rgba(14, 16, 21, 0.72);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 22px;
}

.brand-name { font-weight: 700; letter-spacing: -0.2px; }

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.nav-item:hover:not(:disabled) { background: var(--panel); color: var(--text); }

.nav-item.is-active {
  background: var(--accent-soft);
  border-color: rgba(124, 92, 255, 0.28);
  color: #dcd5ff;
}

.nav-item:disabled { color: var(--muted-2); cursor: not-allowed; }

.nav-icon { width: 18px; text-align: center; opacity: 0.9; }

.nav-item .badge { margin-left: auto; }

.soon {
  margin-left: auto;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 10px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--muted-2);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 10px 0;
  border-top: 1px solid var(--border);
}

.user-box { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  flex-shrink: 0;
}

.main {
  padding: 30px clamp(20px, 4vw, 46px) 60px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.topbar h1 { font-size: 26px; letter-spacing: -0.5px; }
.topbar p { margin-top: 3px; }

.env-chip {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.4px;
}

/* --- Botões e chips -------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: transform 0.05s, background 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn:hover:not(:disabled) { background: #232936; border-color: #3b4557; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, #8a6dff, #6a4bf0);
  border-color: #7b5cf6;
  color: #fff;
  box-shadow: 0 8px 20px rgba(124, 92, 255, 0.28);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #987fff, #7458f5); border-color: #8a6dff; }

.btn-ok { background: var(--ok-soft); border-color: rgba(52, 211, 153, 0.4); color: #a7f3d0; }
.btn-ok:hover:not(:disabled) { background: rgba(52, 211, 153, 0.2); }

.btn-danger { background: var(--danger-soft); border-color: rgba(248, 113, 113, 0.4); color: #fecaca; }
.btn-danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.2); }

.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: var(--text); }

.btn.small { padding: 6px 11px; font-size: 12.5px; }

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 99px;
  background: rgba(124, 92, 255, 0.2);
  color: #cdc2ff;
  font-size: 11.5px;
  font-weight: 700;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.chip.ok { border-color: rgba(52, 211, 153, 0.35); background: var(--ok-soft); color: #a7f3d0; }
.chip.danger { border-color: rgba(248, 113, 113, 0.35); background: var(--danger-soft); color: #fecaca; }
.chip.warn { border-color: rgba(251, 191, 36, 0.35); background: var(--warn-soft); color: #fde68a; }

/* --- Visão geral ----------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.stat {
  padding: 18px 20px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat-warn { border-color: rgba(251, 191, 36, 0.22); }

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.stat-value {
  display: block;
  margin: 10px 0 6px;
  font-size: 38px;
  line-height: 1;
  letter-spacing: -1.2px;
  font-variant-numeric: tabular-nums;
}

.stat-warn .stat-value { color: var(--warn); }

.stat-hint { color: var(--muted-2); font-size: 12px; }

.cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 18px 0;
  padding: 14px 18px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: rgba(124, 92, 255, 0.05);
  color: var(--muted);
  font-size: 13.5px;
}

.panel {
  margin-top: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 { font-size: 15px; letter-spacing: -0.1px; }

.feed { list-style: none; margin: 0; padding: 6px 0; }

.feed-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 20px;
  border-bottom: 1px solid rgba(38, 44, 56, 0.6);
}
.feed-item:last-child { border-bottom: none; }

.feed-dot {
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.feed-dot.ok { background: var(--ok); }
.feed-dot.danger { background: var(--danger); }
.feed-dot.warn { background: var(--warn); }

.feed-message { font-size: 13.5px; }
.feed-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 11.5px;
}

.empty {
  padding: 26px 20px;
  color: var(--muted-2);
  font-size: 13.5px;
  text-align: center;
}

/* --- Aprovações ------------------------------------------------------------ */

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: none;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}

.tab:hover { color: var(--text); }
.tab.is-active { background: var(--panel-2); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset; }

.approvals { display: flex; flex-direction: column; gap: 14px; }

.approval {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.approval.is-urgent { border-color: rgba(251, 191, 36, 0.3); }
.approval.is-target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.approval-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.approval-title {
  flex: 1 1 260px;
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.15px;
}

.approval-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 9px;
  color: var(--muted-2);
  font-size: 12px;
}

.approval-context {
  margin-top: 11px;
  color: #c3c9d6;
  font-size: 13.5px;
  white-space: pre-wrap;
}

.approval-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px solid rgba(38, 44, 56, 0.7);
}

.approval-actions .note { flex: 1 1 240px; }
.approval-actions .note label { margin-top: 0; }

.decision-note {
  margin-top: 11px;
  padding: 9px 12px;
  border-left: 2px solid var(--border-strong);
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
}

.payload {
  margin: 13px 0 0;
  padding: 13px 15px;
  background: #0a0d12;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #b9c4d6;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

/* --- Segurança / 2FA -------------------------------------------------------- */

.security { margin-top: 0; }

.security-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}

.twofa-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.twofa-qr {
  width: 220px;
  height: 220px;
  padding: 10px;
  background: #fff;
  border-radius: 12px;
}

.twofa-steps p { margin-top: 8px; }
.twofa-steps p:first-child { margin-top: 0; }

.twofa-uri {
  display: block;
  margin-top: 8px;
  padding: 10px 12px;
  background: #0a0d12;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #b9c4d6;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  word-break: break-all;
}

#twofa-confirm { margin-top: 8px; }

.recovery-codes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin: 14px 0 16px;
  padding: 0;
  list-style: none;
}

.recovery-codes li {
  padding: 10px 12px;
  background: #0a0d12;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 13.5px;
  letter-spacing: 0.8px;
  text-align: center;
}

/* --- Toast ----------------------------------------------------------------- */

.toast {
  position: fixed;
  right: 26px;
  bottom: 24px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 16px;
  background: #1d2330;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 13.5px;
}

.toast.is-ok { border-color: rgba(52, 211, 153, 0.5); }
.toast.is-error { border-color: rgba(248, 113, 113, 0.5); }

/* --- Responsivo ------------------------------------------------------------ */

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .brand { padding-bottom: 12px; }

  .nav { flex-direction: row; flex-wrap: wrap; }

  .nav-item { width: auto; }

  .nav-item .soon { display: none; }

  .sidebar-footer { margin-top: 12px; padding-top: 12px; }

  .sidebar-actions { flex-direction: row; }

  .main { padding: 22px 16px 48px; }

  .twofa-grid { grid-template-columns: 1fr; }
  .twofa-qr { justify-self: center; }
}
