:root {
    --bg: #0d1117;
    --bg-soft: #161b22;
    --bg-card: #1a2029;
    --border: #2a3340;
    --text: #e6edf3;
    --muted: #8b98a5;
    --accent: #4f9dff;
    --accent-2: #37d99e;
    --danger: #f85149;
    --radius: 12px;
    --shadow: 0 6px 24px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: radial-gradient(1200px 600px at 80% -10%, #16263f 0%, var(--bg) 55%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--bg-soft); padding: 2px 6px; border-radius: 6px; font-size: .9em; }
h1, h2 { line-height: 1.2; }

/* Header */
.site-header {
    border-bottom: 1px solid var(--border);
    background: rgba(13,17,23,.8);
    backdrop-filter: blur(8px);
    position: sticky; top: 0; z-index: 20;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); font-size: 1.15rem; }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent-2); font-family: monospace; background: var(--bg-soft); padding: 4px 8px; border-radius: 8px; }
.nav { display: flex; align-items: center; gap: 18px; }
.nav a { color: var(--muted); font-size: .95rem; }
.nav a:hover { color: var(--text); text-decoration: none; }

/* Buttons */
.btn, .btn-ghost, .btn-sm {
    display: inline-block; cursor: pointer; border: 1px solid transparent;
    border-radius: 9px; font-size: .95rem; font-weight: 600; padding: 10px 18px;
    transition: .15s; font-family: inherit;
}
.btn { background: var(--accent); color: #06121f; }
.btn:hover { background: #6cb0ff; text-decoration: none; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: .85rem; background: var(--bg-soft); border-color: var(--border); color: var(--text); }
.btn-sm:hover { border-color: var(--accent); text-decoration: none; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* Flashes */
.flashes { margin: 20px 0 0; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 12px 16px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-soft); }
.flash-success { border-color: var(--accent-2); background: rgba(55,217,158,.12); }
.flash-error { border-color: var(--danger); background: rgba(248,81,73,.12); }

/* Hero */
.hero { padding: 54px 0 30px; text-align: center; }
.hero h1 { font-size: 2.4rem; margin: 0 0 10px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); max-width: 560px; margin: 0 auto 22px; }
.search { display: flex; gap: 8px; max-width: 520px; margin: 0 auto; }
.search input { flex: 1; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--text); }
.search button { padding: 12px 20px; border-radius: 10px; border: none; background: var(--accent); color: #06121f; font-weight: 600; cursor: pointer; }

/* Grid of cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin: 22px 0 60px; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; transition: .2s; }
.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.card-link { color: var(--text); flex: 1; }
.card-link:hover { text-decoration: none; }
.card-icon { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .08em; color: var(--accent-2); background: rgba(55,217,158,.1); border: 1px solid rgba(55,217,158,.3); padding: 3px 8px; border-radius: 6px; margin-bottom: 12px; }
.card h2 { font-size: 1.2rem; margin: 0 0 8px; }
.card-desc { color: var(--muted); font-size: .92rem; margin: 0; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.date { color: var(--muted); font-size: .82rem; }

/* Tags */
.tags { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: .72rem; color: var(--accent); background: rgba(79,157,255,.1); border: 1px solid rgba(79,157,255,.3); padding: 2px 8px; border-radius: 20px; }

/* Empty state */
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty h1 { font-size: 3rem; margin: 0 0 10px; }

/* Post view */
.post { padding: 30px 0 60px; }
.back { display: inline-block; margin-bottom: 18px; color: var(--muted); }
.post-header h1 { font-size: 2rem; margin: 0 0 10px; }
.post-meta { color: var(--muted); font-size: .9rem; margin-bottom: 10px; }
.post-desc { background: var(--bg-soft); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; padding: 16px 20px; margin: 20px 0; white-space: pre-wrap; }
.pdf-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }
.pdf-actions button.btn-ghost { font-family: inherit; }
.pdf-viewer {
    position: relative;
    /* Ancho completo de la ventana, saliendo de la columna centrada */
    left: 50%;
    right: 50%;
    width: 100vw;
    margin-left: -50vw;
    margin-right: -50vw;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    background: #2a2f37;
    height: 92vh;
    min-height: 600px;
    box-shadow: var(--shadow);
}
.pdf-viewer iframe { display: block; width: 100%; height: 100%; border: 0; }
.pdf-viewer:fullscreen { border-radius: 0; height: 100%; }
.pdf-viewer:fullscreen iframe { height: 100%; }
.pdf-loading {
    position: absolute; inset: 0; z-index: 2;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    color: var(--muted); background: var(--bg-soft);
}
.spinner {
    width: 34px; height: 34px; border-radius: 50%;
    border: 3px solid var(--border); border-top-color: var(--accent);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pdf-fallback { padding: 50px 20px; text-align: center; color: var(--muted); background: var(--bg-soft); }

/* Page head */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 34px 0 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 1.7rem; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; background: var(--bg-soft); }
.table tr:last-child td { border-bottom: none; }
.right { text-align: right; }
.actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.actions form { margin: 0; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .92rem; }
.form input, .form textarea { padding: 11px 14px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--text); font-family: inherit; font-size: 1rem; }
.form input:focus, .form textarea:focus { outline: none; border-color: var(--accent); }
.form textarea { resize: vertical; }
.hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
.form-actions { margin-top: 6px; }
.form-wide { max-width: 680px; }

/* Auth / profile boxes */
.auth-box { max-width: 420px; margin: 40px auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; }
.auth-box h1, .auth-box h2 { margin-top: 0; }
.profile-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 10px; }
.muted { color: var(--muted); }

/* Footer */
.site-footer { margin-top: auto; border-top: 1px solid var(--border); padding: 24px 0; color: var(--muted); font-size: .85rem; text-align: center; }

@media (max-width: 640px) {
    .hero h1 { font-size: 1.9rem; }
    .nav { gap: 12px; font-size: .9rem; }
    .table th:nth-child(2), .table td:nth-child(2) { display: none; }
    .pdf-viewer object { height: 500px; }
}
