/* =========================================================
   Passcore — estilos
   Tema via [data-theme="dark"|"light"] no <html>.
   Paleta: neutros frios (slate) + acento índigo. Display em
   Space Grotesk, corpo em Inter.
   ========================================================= */

:root {
  /* Acento (igual nos dois temas, com leve ajuste no escuro) */
  --primary: #5b6cff;
  --primary-hover: #4656e6;
  --primary-soft: rgba(91, 108, 255, 0.12);

  /* Tema claro (padrão de fallback) */
  --bg: #f5f6f9;
  --surface: #ffffff;
  --surface-2: #f0f2f6;
  --text: #16181d;
  --text-muted: #5c6373;
  --border: #e3e6ee;
  --shadow: 0 1px 2px rgba(16, 18, 30, .04), 0 8px 24px rgba(16, 18, 30, .06);
  --danger: #e5484d;
  --success: #2faa6a;

  --radius: 14px;
  --radius-sm: 10px;
  --font-body: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-display: 'Space Grotesk', var(--font-body);
}

[data-theme="dark"] {
  --primary: #6f7dff;
  --primary-hover: #8290ff;
  --primary-soft: rgba(111, 125, 255, 0.16);

  --bg: #0e1014;
  --surface: #171a21;
  --surface-2: #1f232c;
  --text: #eef0f4;
  --text-muted: #9aa1b1;
  --border: #272b35;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35);
  --danger: #ff6369;
  --success: #46c787;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

.hidden { display: none !important; }

/* -------------------- Barra superior -------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
}
.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.topbar__actions { display: flex; align-items: center; gap: 8px; }

/* Ícone de tema: mostra sol no escuro (pra clarear) e lua no claro */
.theme-icon { display: none; }
[data-theme="dark"] .theme-icon--sun { display: block; }
[data-theme="light"] .theme-icon--moon { display: block; }

/* -------------------- Botões -------------------- */
.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn--block { width: 100%; }

.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-hover); }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover { background: var(--surface-2); }

.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease;
}
.icon-btn:hover { background: var(--surface-2); }

/* -------------------- Tela de autenticação -------------------- */
.auth {
  min-height: calc(100vh - 65px);
  display: grid;
  place-items: center;
  padding: 32px 18px;
}
.auth__card {
  width: 100%;
  max-width: 920px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.auth__hero {
  padding: 44px 40px;
  background:
    radial-gradient(120% 120% at 0% 0%, var(--primary-soft), transparent 60%),
    var(--surface-2);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}
.auth__badge {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 5px 11px;
  border-radius: 999px;
}
.auth__title {
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 4px 0 0;
}
.auth__title span { color: var(--primary); }
.auth__subtitle { color: var(--text-muted); margin: 0; max-width: 34ch; }

.auth__form { padding: 40px; display: flex; flex-direction: column; }

.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 22px;
}
.tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  padding: 9px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* -------------------- Campos de formulário -------------------- */
.field { display: block; margin-bottom: 16px; }
.field__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field input, .field textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.field__hint { display: block; font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.field__password { position: relative; display: flex; gap: 6px; }
.field__password input { flex: 1; }
.reveal {
  flex: 0 0 auto;
  width: 42px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
}
.reveal:hover { color: var(--text); }

.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 2px 0 10px; }

/* Medidor de força */
.strength {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin-top: 8px;
}
.strength span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width .25s ease, background .25s ease;
}

/* -------------------- Cofre / toolbar -------------------- */
.vault { max-width: 1000px; margin: 0 auto; padding: 24px 18px 60px; }
.vault__toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.search {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  color: var(--text-muted);
}
.search input {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--text);
  padding: 11px 0;
}
.search input:focus { outline: none; }

.vault__buttons { display: flex; gap: 8px; position: relative; }

.menu { position: relative; }
.menu__list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  min-width: 230px;
  padding: 6px;
  z-index: 30;
}
.menu__list button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 9px 11px;
  border-radius: 8px;
  cursor: pointer;
}
.menu__list button:hover { background: var(--surface-2); }

/* -------------------- Cards de senha -------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .15s, transform .08s;
}
.card:hover { border-color: var(--primary); }
.card__head { display: flex; align-items: center; gap: 12px; }
.card__avatar {
  width: 38px; height: 38px;
  flex: 0 0 auto;
  border-radius: 10px;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: #fff;
}
.card__title { font-weight: 600; line-height: 1.2; word-break: break-word; }
.card__sub { font-size: 12.5px; color: var(--text-muted); word-break: break-all; }

.card__row {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13.5px;
}
.card__row code { font-family: var(--font-body); letter-spacing: .12em; flex: 1; }
.card__mini {
  border: 0; background: transparent; cursor: pointer;
  color: var(--text-muted); font-size: 14px; padding: 2px 4px; border-radius: 6px;
}
.card__mini:hover { color: var(--text); background: var(--surface); }

.card__actions { display: flex; gap: 8px; margin-top: 2px; }
.card__actions button {
  flex: 1; font: inherit; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: transparent; color: var(--text);
  border-radius: 9px; padding: 7px; cursor: pointer;
}
.card__actions button:hover { background: var(--surface-2); }
.card__actions .is-danger:hover { color: var(--danger); border-color: var(--danger); }

/* -------------------- Estado vazio -------------------- */
.empty { text-align: center; padding: 70px 20px; color: var(--text-muted); }
.empty__art {
  width: 76px; height: 76px; margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 20px; color: var(--primary);
  background: var(--primary-soft);
}
.empty h2 { font-family: var(--font-display); color: var(--text); margin: 0 0 6px; }

/* -------------------- Modal -------------------- */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 18px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(8, 10, 16, .55); backdrop-filter: blur(2px); }
.modal__panel {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal__head h2 { font-family: var(--font-display); margin: 0; font-size: 19px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* -------------------- Toast -------------------- */
.toast {
  position: fixed;
  bottom: 22px; left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 11px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  z-index: 60;
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

/* -------------------- Derivador de senhas -------------------- */
.derive-intro { color: var(--text-muted); font-size: 13.5px; margin: 0 0 16px; }
.derive-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; }
.derive-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.derive-item code {
  flex: 1; font-family: var(--font-body);
  font-size: 14px; word-break: break-all; letter-spacing: .02em;
}
.derive-strength {
  flex: 0 0 auto; width: 10px; height: 10px; border-radius: 999px;
}

/* -------------------- Rodapé -------------------- */
.site-footer {
  text-align: center;
  padding: 22px 18px 28px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
}
.site-footer a { color: var(--primary); text-decoration: none; font-weight: 600; }
.site-footer a:hover { text-decoration: underline; }

/* -------------------- Responsivo -------------------- */
@media (max-width: 760px) {
  .auth__card { grid-template-columns: 1fr; max-width: 440px; }
  .auth__hero { padding: 32px 28px 8px; }
  .auth__form { padding: 28px; }
  .auth__title { font-size: 28px; }
}

/* Acessibilidade: foco visível e respeito a movimento reduzido */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* =========================================================
   Passcore Admin — estilos extras (tabela de usuários)
   ========================================================= */
.admin-wrap { max-width: 1080px; margin: 0 auto; padding: 24px 18px 50px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.admin-head h1 { font-family: var(--font-display); font-size: 22px; margin: 0; }
.admin-head .count { color: var(--text-muted); font-size: 13.5px; }

.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.utable { width: 100%; border-collapse: collapse; font-size: 14px; }
.utable th, .utable td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.utable th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; background: var(--surface-2); }
.utable tr:last-child td { border-bottom: 0; }
.utable td.email { font-weight: 600; word-break: break-all; }
.utable .muted { color: var(--text-muted); }

.badge {
  display: inline-block; font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
}
.badge--user { background: var(--surface-2); color: var(--text-muted); }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions button {
  font: inherit; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border); background: transparent; color: var(--text);
  border-radius: 8px; padding: 6px 10px; cursor: pointer;
}
.row-actions button:hover { background: var(--surface-2); }
.row-actions .is-danger:hover { color: var(--danger); border-color: var(--danger); }
.row-actions .is-warn:hover { color: #c98a00; border-color: #c98a00; }

.temp-pass {
  margin-top: 10px; padding: 12px;
  background: var(--surface-2); border: 1px dashed var(--primary);
  border-radius: var(--radius-sm); font-size: 13.5px;
}
.temp-pass code { font-weight: 700; color: var(--primary); user-select: all; }

/* Responsivo: vira cartões no celular */
@media (max-width: 720px) {
  .utable thead { display: none; }
  .utable, .utable tbody, .utable tr, .utable td { display: block; width: 100%; }
  .utable tr { border-bottom: 1px solid var(--border); padding: 6px 0; }
  .utable td { border: 0; padding: 6px 14px; }
  .utable td::before { content: attr(data-label); display: block; font-size: 11px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px; }
  .utable td.actions::before { content: ""; }
}
