/* Maquina Social: una sola hoja, sin dependencias externas. Movil primero. */

:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --text: #14171f;
  --muted: #5b6472;
  --line: #dfe3ea;
  --accent: #1f4fd8;
  --accent-text: #ffffff;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1117;
    --surface: #171b24;
    --text: #e9ecf2;
    --muted: #9aa4b2;
    --line: #2a303c;
    --accent: #7aa2ff;
    --accent-text: #0b1020;
    --danger: #ff9a8f;
    --danger-bg: #3a1512;
    --ok: #75e0a7;
    --ok-bg: #0f2c1e;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1 {
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 0 0 0.75rem;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 0.4rem;
}

p {
  margin: 0 0 0.9rem;
}

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

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* --- Pantallas de ingreso (una tarjeta al centro) --- */

.gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
}

.gate .brand {
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
  color: var(--muted);
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 20px;
}

.lead {
  color: var(--muted);
}

.fine {
  max-width: 420px;
  margin: 14px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.hint {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 6px;
}

/* --- Formularios --- */

label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin: 16px 0 6px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  font: inherit;
  /* 16px o mas: iOS hace zoom al enfocar campos con letra mas chica. */
  font-size: 17px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}

input:focus {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

input.code {
  font-family: var(--mono);
  font-size: 1.6rem;
  letter-spacing: 0.3em;
  text-align: center;
}

input.code-long {
  font-size: 1.05rem;
  letter-spacing: 0.08em;
}

.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary,
button.btn-primary {
  width: 100%;
  margin-top: 20px;
  color: var(--accent-text);
  background: var(--accent);
  border-color: var(--accent);
}

.btn-quiet,
button.btn-quiet {
  min-height: 40px;
  padding: 6px 12px;
  background: transparent;
}

.btn-link {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}

.error,
.notice {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.95rem;
}

.error {
  color: var(--danger);
  background: var(--danger-bg);
}

.notice {
  color: var(--ok);
  background: var(--ok-bg);
}

.error-code {
  font-family: var(--mono);
  color: var(--muted);
  margin-bottom: 4px;
}

/* --- Alta de la app de autenticacion --- */

.steps {
  margin: 0 0 16px;
  padding-left: 1.25rem;
  color: var(--muted);
}

.steps li {
  margin-bottom: 6px;
}

.qr-box {
  display: flex;
  justify-content: center;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.qr {
  width: 100%;
  max-width: 240px;
  height: auto;
}

.manual {
  margin: 12px 0 4px;
  font-size: 0.92rem;
  color: var(--muted);
}

.manual summary {
  cursor: pointer;
  color: var(--accent);
}

.secret {
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--text);
  word-spacing: 0.2em;
  overflow-wrap: anywhere;
  user-select: all;
}

.codes {
  list-style: none;
  margin: 0 0 12px;
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 1.02rem;
  letter-spacing: 0.04em;
  user-select: all;
}

@media (min-width: 420px) {
  .codes {
    grid-template-columns: 1fr 1fr;
  }
}

/* --- Panel --- */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
}

.topbar .brand {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.nav {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.nav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.nav a[aria-current="page"] {
  color: var(--text);
  background: var(--bg);
}

.logout {
  margin: 0;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 22px 16px calc(40px + env(safe-area-inset-bottom));
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 14px;
}

.panel p:last-child,
.panel form:last-child {
  margin-bottom: 0;
}

.rows {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.rows li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 2px;
}

.rows li:first-child {
  border-top: 0;
  padding-top: 2px;
}

.row-main {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.row-sub {
  font-size: 0.86rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ok);
  background: var(--ok-bg);
}
