/* Flashcards MX · Sistema de diseño */
:root {
    --bg: #f5f6fb;
    --surface: #ffffff;
    --surface-2: #fafbff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e6e8ef;
    --accent: #2563eb;
    --accent-700: #1d4ed8;
    --accent-soft: #eaf0ff;
    --success: #16a34a;
    --success-soft: #e9f8ef;
    --danger: #dc2626;
    --danger-soft: #fdecec;
    --warning: #b45309;
    --warning-soft: #fdf4e3;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .6rem 1.1rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text); font-weight: 600; font-size: .92rem;
    cursor: pointer; transition: .15s ease; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-700); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: .4rem .7rem; font-size: .82rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Tarjetas / paneles ---------- */
.panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.panel-pad { padding: 1.4rem 1.5rem; }

/* ---------- Formularios ---------- */
.field { margin-bottom: 1.05rem; }
.label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: .4rem; color: #334155; }
.hint { font-size: .8rem; color: var(--muted); margin-top: .35rem; }
.input, .select, .textarea {
    width: 100%; padding: .65rem .8rem; font-size: .94rem; font-family: inherit;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); transition: .15s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { resize: vertical; min-height: 90px; }
.input-color { padding: .25rem; height: 42px; width: 56px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.1rem; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Alertas ---------- */
.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1.1rem; font-size: .9rem; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: #14532d; border-color: #c5ebd3; }
.alert-error { background: var(--danger-soft); color: #7f1d1d; border-color: #f6cccc; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 600; }
.badge-success { background: var(--success-soft); color: #14532d; }
.badge-muted { background: #eef1f6; color: var(--muted); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }

/* ---------- Tablas ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .7rem 1rem; border-bottom: 1px solid var(--border); }
.table td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-2); }

/* ---------- Layout Admin ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: #0f172a; color: #cbd5e1; padding: 1.4rem 1rem; display: flex; flex-direction: column; gap: .2rem; }
.sidebar .brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 700; font-size: 1.05rem; padding: .3rem .6rem 1.3rem; }
.sidebar .brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; font-size: 1rem; }
.sidebar .nav-link { display: flex; align-items: center; gap: .7rem; padding: .62rem .75rem; border-radius: var(--radius-sm); color: #cbd5e1; font-size: .92rem; font-weight: 500; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar .nav-link.is-active { background: var(--accent); color: #fff; }
.sidebar .nav-sep { margin-top: auto; }
.sidebar .ico { width: 18px; text-align: center; opacity: .9; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.8rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 1.15rem; margin: 0; }
.topbar .user { display: flex; align-items: center; gap: .7rem; font-size: .88rem; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-700); display: grid; place-items: center; font-weight: 700; }
.content { padding: 1.8rem; max-width: 1100px; width: 100%; }

@media (max-width: 820px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; padding: .7rem 1rem; }
    .sidebar .brand { padding: .2rem .4rem; }
    .sidebar .nav-sep { margin: 0; }
}

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; margin-bottom: 1.6rem; }
@media (max-width: 720px) { .stats { grid-template-columns: 1fr; } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: var(--shadow-sm); }
.stat .n { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: .86rem; }
.stat .ico { float: right; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-700); display: grid; place-items: center; font-size: 1.1rem; }

/* ---------- Encabezado de sección ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.3rem; gap: 1rem; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: .2rem 0 0; font-size: .92rem; }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty .big { font-size: 2.2rem; margin-bottom: .6rem; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background:
    radial-gradient(1200px 500px at 50% -10%, #e7edff 0%, transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 2rem 1.9rem; }
.auth-card .brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.15rem; margin-bottom: .3rem; }
.auth-card .brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.auth-card .sub { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }

/* ---------- Iconos ---------- */
.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.btn .icon { margin-top: -1px; }

/* ---------- Landing pública ---------- */
.pub-page { background: radial-gradient(1100px 460px at 80% -8%, #eef2ff 0%, transparent 55%), var(--bg); }
.pub-nav { display: flex; align-items: center; justify-content: space-between; padding: 1.2rem 6vw; max-width: 1140px; margin: 0 auto; }
.pub-nav .brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.18rem; letter-spacing: -.01em; }
.brand-mark { display: block; border-radius: 10px; }

.hero { max-width: 1140px; margin: 0 auto; padding: 3.6rem 6vw 3rem; display: grid; grid-template-columns: 1.05fr .95fr; gap: 3rem; align-items: center; }
@media (max-width: 880px) { .hero { grid-template-columns: 1fr; padding-top: 2.4rem; text-align: center; } }
.hero-copy .kicker { display: inline-flex; align-items: center; gap: .45rem; background: var(--accent-soft); color: var(--accent-700); font-weight: 600; font-size: .8rem; padding: .35rem .85rem; border-radius: 999px; margin-bottom: 1.3rem; }
.hero-copy h1 { font-size: clamp(2.1rem, 5vw, 3.35rem); letter-spacing: -.03em; line-height: 1.07; margin-bottom: 1.05rem; }
.hero-copy h1 .grad { background: linear-gradient(90deg, var(--accent), #7c3aed); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-copy .lead { font-size: 1.13rem; color: var(--muted); max-width: 520px; margin: 0 0 1.8rem; }
@media (max-width: 880px) { .hero-copy .lead { margin-left: auto; margin-right: auto; } }
.hero-cta { display: flex; gap: .7rem; flex-wrap: wrap; }
@media (max-width: 880px) { .hero-cta { justify-content: center; } }
.hero-note { margin-top: 1.1rem; font-size: .85rem; color: var(--muted); display: inline-flex; align-items: center; gap: .45rem; }
.hero-note .icon { color: var(--success); }

.hero-visual { display: flex; justify-content: center; }
.phone { width: 264px; background: #0f172a; border-radius: 36px; padding: 11px; box-shadow: 0 34px 64px -22px rgba(15, 23, 42, .45); }
.phone-screen { background: #fff; border-radius: 26px; overflow: hidden; }
.pp-head { height: 84px; background: linear-gradient(135deg, var(--accent), #7c3aed); }
.pp-body { padding: 0 18px 20px; margin-top: -36px; text-align: center; }
.pp-avatar { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; background: #e2e8f0; margin: 0 auto; display: grid; place-items: center; color: #94a3b8; }
.pp-name { font-weight: 700; font-size: 1.02rem; margin-top: .55rem; color: var(--text); }
.pp-role { font-size: .74rem; color: var(--muted); }
.pp-btn { margin-top: .7rem; height: 30px; border-radius: 8px; background: var(--accent); }
.pp-btn.ghost { background: #eef1f6; }
.pp-row { display: flex; gap: .4rem; margin-top: .5rem; }
.pp-row span { flex: 1; height: 26px; border-radius: 7px; background: #f1f5f9; }
.pp-qr { margin: .9rem auto 0; width: 58px; height: 58px; border-radius: 8px; background: repeating-conic-gradient(#0f172a 0 25%, #fff 0 50%) 0 0 / 11.6px 11.6px; }

.section { max-width: 1140px; margin: 0 auto; padding: 3.4rem 6vw; }
.section-head { text-align: center; max-width: 600px; margin: 0 auto 2.4rem; }
.section-head .eyebrow { color: var(--accent-700); font-weight: 700; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; }
.section-head h2 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); letter-spacing: -.02em; margin: .4rem 0 .5rem; }
.section-head p { color: var(--muted); margin: 0; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.3rem; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }
.step { padding: 1.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.step-num { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: .88rem; margin-bottom: .9rem; }
.step h3 { font-size: 1.05rem; margin-bottom: .35rem; }
.step p { color: var(--muted); font-size: .92rem; margin: 0; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
@media (max-width: 760px) { .features { grid-template-columns: 1fr; } }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-sm); }
.feature .ico { width: 44px; height: 44px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-700); display: grid; place-items: center; margin-bottom: 1rem; }
.feature h3 { font-size: 1.05rem; margin-bottom: .35rem; }
.feature p { color: var(--muted); font-size: .92rem; margin: 0; }

.cta-band { max-width: 1140px; margin: 1.5rem auto 3.5rem; padding: 0 6vw; }
.cta-inner { background: linear-gradient(135deg, var(--accent), #7c3aed); border-radius: 22px; padding: 3rem 2rem; text-align: center; color: #fff; }
.cta-inner h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin-bottom: .55rem; letter-spacing: -.02em; }
.cta-inner p { opacity: .92; margin: 0 auto 1.6rem; max-width: 460px; }
.cta-inner .btn { background: #fff; color: var(--accent-700); border-color: #fff; }
.cta-inner .btn:hover { background: #f1f5f9; }

.pub-footer { border-top: 1px solid var(--border); background: var(--surface); }
.pub-footer .inner { max-width: 1140px; margin: 0 auto; padding: 1.7rem 6vw; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--muted); font-size: .86rem; }
.pub-footer .brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--text); }

/* ---------- Portal público de tarjeta (básico, Fase 3 lo amplía) ---------- */
.portal { min-height: 100vh; display: grid; place-items: start center; padding: 2.5rem 1.2rem; }
.portal-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.portal-head { height: 110px; }
.portal-body { padding: 0 1.6rem 1.8rem; margin-top: -54px; text-align: center; }
.portal-photo { width: 108px; height: 108px; border-radius: 50%; border: 4px solid var(--surface); background: #e2e8f0; object-fit: cover; margin: 0 auto; display: block; }
.portal-photo.placeholder { display: grid; place-items: center; font-size: 2.2rem; color: #94a3b8; }
.portal-name { font-size: 1.4rem; font-weight: 700; margin: .8rem 0 .1rem; }
.portal-role { color: var(--muted); }
.portal-bio { color: #475569; font-size: .95rem; margin: 1rem 0; }
.portal-actions { display: grid; gap: .6rem; margin-top: 1.2rem; }
.portal-head { position: relative; }
.portal-logo { position: absolute; top: 14px; left: 16px; max-height: 30px; max-width: 120px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.2)); }
.portal-links { display: grid; gap: .5rem; margin-top: 1.1rem; }
.link-pill { display: flex; align-items: center; gap: .7rem; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: 12px; color: var(--text); font-weight: 600; font-size: .92rem; background: var(--surface); transition: .15s; text-decoration: none; }
.link-pill:hover { border-color: var(--accent); background: var(--surface-2); text-decoration: none; }
.link-ico { display: inline-flex; align-items: center; justify-content: center; width: 22px; color: var(--accent); }
.portal-docs { margin-top: 1.2rem; text-align: left; }
.portal-docs-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .5rem; }
.doc-row { display: flex; align-items: center; gap: .5rem; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 10px; margin-bottom: .45rem; color: var(--text); font-size: .9rem; text-decoration: none; }
.doc-row .icon { color: var(--accent); }
.doc-row:hover { border-color: var(--accent); text-decoration: none; }
.portal-qr { margin-top: 1.6rem; padding-top: 1.4rem; border-top: 1px solid var(--border); }
.portal-qr img { width: 148px; height: 148px; border-radius: 12px; }
.portal-foot { margin-top: 1.6rem; font-size: .78rem; color: var(--muted); }
/* ---------- Mockup tarjeta física ---------- */
.mockup { position: relative; width: 340px; height: 214px; border-radius: 14px; padding: 18px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.mockup .mk-brand { height: 36px; }
.mockup .mk-brand img { max-height: 36px; max-width: 140px; object-fit: contain; }
.mockup .mk-brand span { font-weight: 700; font-size: 1.05rem; }
.mockup .mk-info { margin-top: auto; max-width: 215px; }
.mockup .mk-name { font-size: 1.15rem; font-weight: 700; line-height: 1.15; }
.mockup .mk-title { font-size: .78rem; opacity: .85; margin-top: .15rem; }
.mockup .mk-qr { position: absolute; right: 16px; bottom: 16px; width: 66px; height: 66px; background: #fff; border-radius: 8px; padding: 3px; }
.mockup .mk-qr-ph { display: grid; place-items: center; color: #111; font-weight: 700; font-size: .8rem; }
.mockup .mk-nfc { position: absolute; right: 16px; top: 16px; font-size: .6rem; letter-spacing: .12em; border: 1px solid currentColor; border-radius: 5px; padding: 2px 5px; opacity: .75; }
.mockup[data-style="centered"] .mk-brand { text-align: center; }
.mockup[data-style="centered"] .mk-info { text-align: center; margin-left: auto; margin-right: auto; }
.mockup[data-style="minimal"] .mk-title { display: none; }
.mockup.is-glossy::after { content: ""; position: absolute; inset: 0; background: linear-gradient(130deg, rgba(255,255,255,.28), rgba(255,255,255,0) 45%); pointer-events: none; }
.muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: .6rem; } .mt-2 { margin-top: 1.2rem; } .mb-0 { margin-bottom: 0; }
