/* Tunbuild · pantallas de acceso (login, registro, verificación, recuperar contraseña) */
:root {
  --ink: #1d2721;
  --ink-2: #26332b;
  --camel: #b08d57;
  --camel-2: #c9a774;
  --cream: #f6f1e7;
  --paper: #fffdf8;
  --line: #e4dccb;
  --text: #1f2a24;
  --muted: #6b665c;
  --danger: #8e2c2c;
  --danger-bg: #f7e9e6;
  --ok: #2f5a3f;
  --ok-bg: #e7efe7;
  --focus: rgba(176, 141, 87, .35);
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--cream); color: var(--text); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); }
[hidden] { display: none !important; }

.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .auth { grid-template-columns: minmax(380px, 46%) minmax(0, 1fr); } }

/* Panel de marca (solo compu) */
.auth-aside { display: none; position: relative; overflow: hidden; background: var(--ink); color: #efe8da; padding: 48px 56px; flex-direction: column; justify-content: space-between; }
@media (min-width: 960px) { .auth-aside { display: flex; } }
.auth-aside::before { content: ''; position: absolute; right: -180px; top: -180px; width: 520px; height: 520px; border-radius: 50%; border: 1px solid rgba(201, 167, 116, .18); }
.auth-aside::after { content: ''; position: absolute; right: -90px; top: -90px; width: 340px; height: 340px; border-radius: 50%; border: 1px solid rgba(201, 167, 116, .12); }
.aside-brand { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.aside-brand svg { width: 44px; height: 44px; }
.aside-brand b { font: 600 17px var(--serif); letter-spacing: .32em; }
.aside-main { position: relative; z-index: 1; max-width: 460px; }
.aside-main h2 { font: 500 clamp(32px, 3.2vw, 44px)/1.12 var(--serif); margin: 0 0 18px; letter-spacing: -.01em; color: #f6f1e7; }
.aside-main h2 em { font-style: italic; color: var(--camel-2); }
.aside-main p { margin: 0 0 30px; color: #c9c1b1; font-size: 16px; }
.aside-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.aside-list li { display: flex; gap: 12px; align-items: flex-start; color: #e3dccd; }
.aside-list svg { flex: 0 0 22px; width: 22px; height: 22px; stroke: var(--camel-2); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; margin-top: 1px; }
.aside-foot { position: relative; z-index: 1; color: #8f8879; font-size: 13px; }

/* Formulario */
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 16px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.mobile-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.mobile-brand svg { width: 40px; height: 40px; }
.mobile-brand b { font: 600 15px var(--serif); letter-spacing: .3em; color: var(--ink); }
@media (min-width: 960px) { .mobile-brand { display: none; } .auth-main { padding: 48px 32px; } }

.auth-card h1 { font: 500 30px/1.15 var(--serif); margin: 0 0 8px; letter-spacing: -.01em; color: var(--ink); }
.auth-sub { margin: 0 0 26px; color: var(--muted); }
.auth-sub strong { color: var(--text); font-weight: 600; }

.btn { appearance: none; width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid transparent; font: 600 15px var(--sans); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 18px; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover:not([disabled]) { background: var(--ink-2); }
.btn-google { background: #fff; color: #1f1f1f; border-color: #d9d2c3; }
.btn-google:hover { background: #faf8f3; border-color: #c9c0ad; }
.btn-google svg { width: 20px; height: 20px; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not([disabled]) { background: #efe8da; }
.btn .spin { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.divider { display: flex; align-items: center; gap: 14px; margin: 22px 0; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.field { margin-bottom: 16px; }
.field label { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; font-size: 13.5px; margin-bottom: 7px; color: var(--text); }
.field label a { font-weight: 500; color: var(--muted); text-decoration: none; }
.field label a:hover { color: var(--ink); text-decoration: underline; }
.input { position: relative; }
.input input { width: 100%; height: 48px; border-radius: 12px; border: 1px solid #d9d2c3; background: var(--paper); padding: 0 14px; font: 15px var(--sans); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.input input::placeholder { color: #a39c8e; }
.input input:focus { outline: none; border-color: var(--camel); box-shadow: 0 0 0 4px var(--focus); }
.input input[aria-invalid="true"] { border-color: var(--danger); }
.input.has-eye input { padding-right: 48px; }
.eye { position: absolute; right: 6px; top: 6px; width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.eye:hover { color: var(--ink); background: #efe8da; }
.eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.alert { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 12px 14px; margin-bottom: 18px; font-size: 14px; }
.alert svg { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }

.auth-alt { margin: 24px 0 0; text-align: center; color: var(--muted); font-size: 14px; }
.auth-alt a { font-weight: 600; text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }
.legal { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }

/* Código de 6 dígitos */
.code { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 4px 0 20px; }
.code input { width: 100%; height: 58px; border-radius: 12px; border: 1px solid #d9d2c3; background: var(--paper); text-align: center; font: 600 24px var(--sans); color: var(--ink); caret-color: var(--camel); }
.code input:focus { outline: none; border-color: var(--camel); box-shadow: 0 0 0 4px var(--focus); }
.code.invalid input { border-color: var(--danger); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.icon-badge { width: 56px; height: 56px; border-radius: 16px; background: var(--ink); display: flex; align-items: center; justify-content: center; margin-bottom: 20px; }
.icon-badge svg { width: 26px; height: 26px; fill: none; stroke: var(--camel-2); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.row-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; font-size: 14px; }
.link-btn { background: none; border: 0; padding: 0; font: 600 14px var(--sans); color: var(--ink); cursor: pointer; }
.link-btn[disabled] { color: var(--muted); cursor: default; font-weight: 500; }
.link-muted { color: var(--muted); text-decoration: none; }
.link-muted:hover { color: var(--ink); text-decoration: underline; }

/* Idioma */
.lang { display: flex; gap: 6px; justify-content: center; margin-top: 32px; }
.lang button { border: 1px solid transparent; background: transparent; color: var(--muted); font: 500 13px var(--sans); padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.lang button:hover { color: var(--ink); }
.lang button[aria-pressed="true"] { border-color: var(--line); color: var(--ink); background: var(--paper); }

/* Fortaleza de contraseña */
.meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; }
.meter i { height: 4px; border-radius: 2px; background: var(--line); }
.meter[data-level="1"] i:nth-child(-n+1) { background: #b5533c; }
.meter[data-level="2"] i:nth-child(-n+2) { background: #c58b3a; }
.meter[data-level="3"] i:nth-child(-n+3) { background: #7d9a5b; }
.meter[data-level="4"] i { background: #2f5a3f; }

/* ===== Modo oscuro: sigue al sistema; "data-theme" (elegido en el panel) manda ===== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cream: #111513;
    --cream-2: #1b211e;
    --paper: #181e1b;
    --line: #2a322e;
    --text: #e6e0d4;
    --muted: #a39c8e;
    --ink: #f1ebdf;
    --focus: rgba(201, 167, 116, .3);
    --danger: #f0a5a0;
    --danger-bg: #3a1f1f;
    --ok: #9fd2b0;
    --ok-bg: #1d3527;
  }
  html:not([data-theme="light"]) body { color-scheme: dark; }
  html:not([data-theme="light"]) .auth-aside { background: #1a221e; border-right: 1px solid #2a322e; }
  html:not([data-theme="light"]) .btn-primary { background: #c9a774; color: #15120c; }
  html:not([data-theme="light"]) .btn-primary:hover:not([disabled]) { background: #d8b98a; }
  html:not([data-theme="light"]) .btn-google { border-color: #3a423e; }
  html:not([data-theme="light"]) .btn-ghost:hover:not([disabled]) { background: #1b211e; }
  html:not([data-theme="light"]) .input input { border-color: #333b37; }
  html:not([data-theme="light"]) .input input::placeholder { color: #6f6a60; }
  html:not([data-theme="light"]) .code input { border-color: #333b37; }
  html:not([data-theme="light"]) .eye:hover { background: #222a26; }
  html:not([data-theme="light"]) .icon-badge { background: #1d2721; border: 1px solid #2f3b34; }
  html:not([data-theme="light"]) .mobile-brand svg rect { fill: #26332b; }
}
:root[data-theme="dark"] {
  --cream: #111513;
  --cream-2: #1b211e;
  --paper: #181e1b;
  --line: #2a322e;
  --text: #e6e0d4;
  --muted: #a39c8e;
  --ink: #f1ebdf;
  --focus: rgba(201, 167, 116, .3);
  --danger: #f0a5a0;
  --danger-bg: #3a1f1f;
  --ok: #9fd2b0;
  --ok-bg: #1d3527;
}
html[data-theme="dark"] body { color-scheme: dark; }
html[data-theme="dark"] .auth-aside { background: #1a221e; border-right: 1px solid #2a322e; }
html[data-theme="dark"] .btn-primary { background: #c9a774; color: #15120c; }
html[data-theme="dark"] .btn-primary:hover:not([disabled]) { background: #d8b98a; }
html[data-theme="dark"] .btn-google { border-color: #3a423e; }
html[data-theme="dark"] .btn-ghost:hover:not([disabled]) { background: #1b211e; }
html[data-theme="dark"] .input input { border-color: #333b37; }
html[data-theme="dark"] .input input::placeholder { color: #6f6a60; }
html[data-theme="dark"] .code input { border-color: #333b37; }
html[data-theme="dark"] .eye:hover { background: #222a26; }
html[data-theme="dark"] .icon-badge { background: #1d2721; border: 1px solid #2f3b34; }
html[data-theme="dark"] .mobile-brand svg rect { fill: #26332b; }
