/* ============================================================
   PAINEL ADMIN — CSS autocontido (site próprio, hosting separado
   do app principal — por isso não importa css/core/tokens.css, só
   copia os valores usados aqui). Paleta "premium preto/grafite",
   mesma do app (ver css/core/tokens.css).
   ============================================================ */

:root {
  --color-primary: #17181c;
  --color-primary-dark: #000000;
  --color-bg: #f2f2f4;
  --color-surface: #ffffff;
  --color-surface-2: #f5f5f7;
  --color-border: #ececef;
  --color-border-strong: #dcdce1;
  --color-text: #17181c;
  --color-text-secondary: #5c5e68;
  --color-text-muted: #8f919c;
  --color-danger: #ef4444;
  --color-danger-soft: #fee2e2;
  --color-success: #16a34a;
  --color-success-soft: #dcfce7;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1.25rem;
  --shadow-md: 0 4px 16px rgba(20, 20, 24, 0.06);
  --shadow-lg: 0 20px 50px rgba(20, 20, 24, 0.12);
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
}
em {
  font-style: italic;
  font-weight: 300;
}
.input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}
.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(23, 24, 28, 0.1);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
}
.btn--primary {
  background: var(--color-primary);
  color: #fff;
}
.btn--primary:hover {
  background: var(--color-primary-dark);
}
.btn--ghost {
  background: transparent;
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.btn--ghost:hover {
  background: var(--color-surface-2);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1rem;
}
.field label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.erro {
  color: var(--color-danger);
  font-size: 0.875rem;
  font-weight: 600;
  margin: -0.25rem 0 1rem;
}

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

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #0a0a0c 0%, #1c1d22 45%, #313339 100%);
}
/* [hidden] tem a mesma especificidade de uma classe — sem isto, o
   `display: grid` acima ganha da regra padrão do navegador e a tela de
   login nunca some, mesmo com `hidden` de verdade no elemento (mesmo
   bug já documentado no app principal pra `.field`/`.cliente-picker__item`). */
.login-screen[hidden] {
  display: none;
}
.login-card {
  width: min(22rem, 90vw);
  padding: 2.5rem;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  box-shadow: 0 30px 80px rgba(10, 8, 40, 0.45);
}
.login-card__brand {
  margin-bottom: 2rem;
}
.login-card__app {
  color: #fff;
  font-weight: 700;
  font-size: 1.25rem;
}
.login-card__tag {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.8125rem;
  margin-top: 0.25rem;
}
.login-screen .field label {
  color: rgba(255, 255, 255, 0.7);
}
.login-screen .input {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.login-screen .btn--primary {
  width: 100%;
  justify-content: center;
  background: #fff;
  color: #17181c;
}
.login-screen .btn--primary:hover {
  background: #e4e4e7;
}

/* ---------------- App shell ---------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.875rem 1.5rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar__brand {
  font-weight: 700;
  font-size: 1.0625rem;
}
.topbar__brand span {
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.8125rem;
  margin-left: 0.25rem;
}
.tabs {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}
.tab {
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
}
.tab:hover {
  background: var(--color-surface-2);
}
.tab.is-active {
  background: var(--color-primary);
  color: #fff;
}
.main {
  padding: 1.5rem;
  max-width: 72rem;
  margin: 0 auto;
}
.painel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.painel__head h1 {
  font-size: 1.25rem;
  margin: 0;
}
.painel__head-tools {
  display: flex;
  gap: 0.75rem;
}
.painel__head-tools .input {
  width: 20rem;
  max-width: 60vw;
}

/* ---------------- KPIs / cards de escritório ---------------- */

.kpis {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.kpi {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  min-width: 9rem;
}
.kpi__valor {
  font-size: 1.5rem;
  font-weight: 800;
}
.kpi__rotulo {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 600;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
}
.card-escritorio {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.125rem 1.25rem;
  box-shadow: var(--shadow-md);
}
.card-escritorio__nome {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}
.card-escritorio__id {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-family: ui-monospace, monospace;
  margin-bottom: 0.75rem;
  word-break: break-all;
}
.card-escritorio__linha {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  padding: 0.25rem 0;
}

/* ---------------- Tabela de usuários ---------------- */

.tabela {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.tabela th,
.tabela td {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--color-border);
}
.tabela th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
  background: var(--color-surface-2);
}
.tabela tbody tr:last-child td {
  border-bottom: none;
}
.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge--ativo {
  background: var(--color-success-soft);
  color: var(--color-success);
}
.badge--sem-login {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
}

.vazio {
  padding: 2rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* ---------------- Modal "Mandar aviso" ---------------- */

.modal-root[hidden] {
  display: none;
}
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 12, 0.45);
}
.modal {
  position: relative;
  width: min(26rem, 92vw);
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}
.modal h2 {
  margin: 0 0 0.25rem;
  font-size: 1.0625rem;
}
.modal__destinatario {
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  margin: 0 0 1.25rem;
}
.modal__acoes {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

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

.toast-root {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
}
.toast--erro {
  background: var(--color-danger);
}
