/* Telas de autenticacao — consome auth/assets/tokens.css (carregar antes via <link>). */

* { box-sizing: border-box; }

.auth-page {
  min-height: 100vh;
  margin: 0;
  padding: 24px;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
}

/* ── Toggle de tema (mesmo visual do .theme-toggle do projeto) ── */
.theme-toggle {
  position: fixed;
  top: 20px;
  left: 24px;
  width: 32px;
  height: 32px;
  background: var(--panel2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-md);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--t-fast), color var(--t-fast);
  z-index: 100;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* Ícone via CSS (não JS): evita flash vazio/errado no primeiro paint e no refresh.
   Representa a ação do clique (destino), não o estado atual: escuro mostra sol (ir p/ claro), claro mostra lua (ir p/ escuro). */
.theme-toggle::after { content: '☀'; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .theme-toggle::after { content: '☾'; }
}
:root[data-theme="light"] .theme-toggle::after { content: '☾'; }

/* ── Cafe pixel art ── */
.auth-coffee {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.auth-coffee svg { width: 56px; height: 56px; }

/* ── Card ── */
.auth-shell { width: min(100%, 430px); }

.auth-card {
  width: 100%;
  padding: 28px;
  background: linear-gradient(160deg, var(--panel) 0%, var(--bg) 100%);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.auth-cmd { margin-bottom: 14px; }

.auth-panel-header {
  margin: 0 0 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.auth-title { margin: 8px 0 10px; font-size: 18px; font-weight: 500; color: var(--text); }
.auth-panel-header .auth-title { margin-top: 0; }
.auth-copy { color: var(--text-dim); line-height: 1.6; margin: 0; }

/* ── Formulario ── */
.auth-form { display: grid; gap: 10px; }

.auth-label {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.auth-field-control {
  display: flex;
  gap: 8px;
  align-items: stretch;
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.auth-field-control:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.auth-input {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}
.auth-input:focus-visible { outline: none; }
.auth-input::placeholder { color: var(--text-faint); opacity: 0.55; }
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--panel) inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 9999s ease-in-out 0s;
}

.password-toggle {
  flex: 0 0 auto;
  padding: 0 12px;
  border: 0;
  border-left: 1px solid var(--border2);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  transition: color var(--t-fast);
}
.password-toggle:hover { color: var(--accent); }

.auth-button {
  margin-top: 10px;
  padding: 11px 14px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #1a1a1a;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: background var(--t-fast), box-shadow var(--t-fast);
}
.auth-button:hover:not([disabled]) {
  background: var(--accent2);
  box-shadow: 0 2px 12px rgba(var(--accent-rgb), 0.3);
}
.auth-button[disabled] { cursor: wait; opacity: 0.3; }

/* Foco: anel padrao em todo elemento interativo */
.auth-button:focus-visible,
.auth-link:focus-visible,
.password-toggle:focus-visible,
.theme-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ── Mensagens ── */
.auth-message {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--text-dim);
  line-height: 1.5;
  font-size: 11px;
}
.auth-message.error {
  padding: 8px 12px;
  background: rgba(244,71,71,0.06);
  border: 1px solid rgba(244,71,71,0.2);
  border-radius: var(--radius-md);
  color: var(--red);
}
.auth-message.success {
  padding: 8px 12px;
  background: rgba(78,201,176,0.08);
  border: 1px solid rgba(78,201,176,0.25);
  border-radius: var(--radius-md);
  color: var(--green);
}

/* ── Links ── */
.auth-links { display: flex; justify-content: space-between; gap: 16px; margin-top: 18px; }
.auth-link { color: var(--text-dim); text-decoration: none; transition: color var(--t-fast); }
.auth-link:hover { color: var(--accent); }

.is-hidden { display: none !important; }

/* ── Barra de sessao do Hub ── */
.hub-context-bar {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  max-width: min(360px, calc(100% - 32px));
}
.hub-session {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
  color: var(--text-dim);
  font-size: 10px;
}
.hub-session__identity { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-session__button, .hub-session__link {
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}
.hub-session__button:hover, .hub-session__link:hover { text-decoration: underline; }

/* ── Pagina admin ── */
.admin-page { display: block; padding: 32px; }
.admin-shell { width: min(1100px, 100%); margin: 0 auto; }
.admin-header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--border2); }
.admin-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.admin-table th, .admin-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.admin-table th { color: var(--text-dim); font-size: 10px; text-transform: uppercase; }
.admin-table select, .admin-table button { padding: 6px 8px; border: 1px solid var(--border2); background: var(--panel2); color: var(--text); font: inherit; }
.admin-table button { cursor: pointer; }
.admin-table button:hover { border-color: var(--accent); }
.admin-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-toolbar { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 16px; }

/* Compat: telas admin/auth antigas usavam .auth-kicker e .auth-meta */
.auth-kicker, .auth-meta {
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Responsivo ── */
@media (max-width: 760px) {
  .hub-context-bar {
    position: static;
    max-width: 100%;
    margin: 12px 16px 0;
    justify-content: stretch;
  }
  .hub-session { flex-wrap: wrap; width: 100%; }
  .hub-session__identity { max-width: 100%; flex-basis: 100%; white-space: normal; overflow-wrap: anywhere; }
}

@media (max-width: 680px) {
  .auth-page, .admin-page { padding: 16px; }
  .auth-card { padding: 22px; }
  .admin-header { display: block; }
}
