/* R.·. L.·. Politeia Nro. 706 — estilos */
:root {
  --bg: #0a1222;
  --bg-2: #0f1b33;
  --panel: #132240;
  --panel-2: #182a4d;
  --ink: #f1ead6;
  --muted: #a7b0c4;
  --gold: #c9a959;
  --gold-2: #e6cd8b;
  --gold-ink: #1a1405;
  --line: rgba(201, 169, 89, 0.28);
  --line-soft: rgba(241, 234, 214, 0.1);
  --danger: #e07b7b;
  --ok: #78c69a;
  --warn: #e4b768;
  --radius: 10px;
  --font-display: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --font-serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--gold-2); }
a:hover { color: #fff; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.04em; line-height: 1.2; margin: 0 0 0.5em; }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ── Botones y formularios ───────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.65rem 1.3rem; border-radius: 6px; border: 1px solid var(--gold);
  background: var(--gold); color: var(--gold-ink); font: 600 0.95rem var(--font-ui);
  letter-spacing: 0.04em; cursor: pointer; text-decoration: none; transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: var(--gold-2); color: var(--gold-ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--gold-2); }
.btn-ghost:hover { background: rgba(201, 169, 89, 0.14); color: var(--gold-2); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: rgba(224, 123, 123, 0.14); color: var(--danger); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }

label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; letter-spacing: 0.03em; }
input, select, textarea {
  width: 100%; padding: 0.65rem 0.8rem; border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold-2); outline: none; box-shadow: 0 0 0 3px rgba(201, 169, 89, 0.2); }
input[type='checkbox'] { width: auto; accent-color: var(--gold); }
textarea { min-height: 100px; resize: vertical; }
.field { margin-bottom: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.form-msg { min-height: 1.4em; font-size: 0.92rem; margin: 0.5rem 0; }
.form-msg.error { color: var(--danger); }
.form-msg.ok { color: var(--ok); }
.check { display: flex; align-items: center; gap: 0.5rem; color: var(--ink); font-size: 0.95rem; }
.check label { margin: 0; color: var(--ink); }
.hp { position: absolute; left: -9999px; }

/* ── Landing ─────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.7rem clamp(1rem, 4vw, 3rem);
  background: rgba(10, 18, 34, 0.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; color: var(--ink); }
.brand img { width: 42px; height: 42px; }
.brand span { font-family: var(--font-display); letter-spacing: 0.08em; font-size: 0.95rem; }
.site-nav { display: flex; align-items: center; gap: 1.4rem; }
.site-nav a:not(.btn) { color: var(--muted); text-decoration: none; font-size: 0.92rem; letter-spacing: 0.06em; text-transform: uppercase; }
.site-nav a:not(.btn):hover { color: var(--gold-2); }
@media (max-width: 760px) { .site-nav a:not(.btn) { display: none; } }

.hero {
  position: relative; min-height: 88vh; display: grid; place-items: center; text-align: center;
  padding: 5rem 1.5rem; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(201, 169, 89, 0.16), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
}
.hero::before { /* suelo ajedrezado sutil (pavimento mosaico) */
  content: ''; position: absolute; inset: auto 0 0 0; height: 34%;
  background:
    conic-gradient(rgba(241, 234, 214, 0.05) 25%, transparent 0 50%, rgba(241, 234, 214, 0.05) 0 75%, transparent 0) 0 0 / 64px 64px;
  mask-image: linear-gradient(to top, #000, transparent); -webkit-mask-image: linear-gradient(to top, #000, transparent);
}
.hero-inner { position: relative; max-width: 780px; }
.hero-emblem { width: clamp(130px, 22vw, 190px); height: auto; margin-bottom: 1.5rem; filter: drop-shadow(0 6px 24px rgba(201, 169, 89, 0.3)); }
.eyebrow { font-family: var(--font-display); letter-spacing: 0.32em; text-transform: uppercase; font-size: 0.8rem; color: var(--gold); margin-bottom: 1rem; }
.hero h1 { font-size: clamp(2rem, 5.5vw, 3.6rem); margin-bottom: 0.4em; }
.hero h1 em { font-style: normal; color: var(--gold-2); }
.hero .lead { font-family: var(--font-serif); font-size: clamp(1.2rem, 2.4vw, 1.6rem); color: #d9d2bd; max-width: 620px; margin: 0 auto 2rem; }
.hero-cta { display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap; }
.divider { display: flex; align-items: center; gap: 1rem; max-width: 260px; margin: 1.6rem auto; color: var(--gold); }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.section { padding: clamp(3.5rem, 8vw, 6rem) clamp(1.2rem, 5vw, 3rem); }
.section.alt { background: var(--bg-2); border-block: 1px solid var(--line-soft); }
.wrap { max-width: 1100px; margin: 0 auto; }
.section-head { text-align: center; margin-bottom: 2.6rem; }
.section-head h2 { font-size: clamp(1.5rem, 3.4vw, 2.2rem); }
.section-head p { font-family: var(--font-serif); font-size: 1.3rem; color: var(--muted); max-width: 640px; margin: 0 auto; }
.prose { font-family: var(--font-serif); font-size: 1.32rem; line-height: 1.7; color: #ded7c2; max-width: 760px; margin: 0 auto; }
.prose p { margin: 0 0 1.1em; }
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-top: 3rem; }
@media (max-width: 820px) { .pillars { grid-template-columns: 1fr; } }
.pillar { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.8rem 1.4rem; text-align: center; background: linear-gradient(180deg, var(--panel), transparent); }
.pillar h3 { color: var(--gold-2); font-size: 1.15rem; }
.pillar p { font-family: var(--font-serif); font-size: 1.15rem; color: var(--muted); margin: 0; }

.videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.2rem; }
.video-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.video-card button.thumb { all: unset; display: block; position: relative; cursor: pointer; width: 100%; aspect-ratio: 16 / 9; }
.video-card button.thumb:focus-visible { outline: 2px solid var(--gold-2); outline-offset: -2px; }
.video-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-card .play { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(10, 18, 34, 0.35); transition: background 0.15s; }
.video-card button.thumb:hover .play { background: rgba(10, 18, 34, 0.15); }
.video-card .play span { width: 58px; height: 58px; border-radius: 50%; background: var(--gold); display: grid; place-items: center; color: var(--gold-ink); font-size: 1.4rem; padding-left: 4px; }
.video-card iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; }
.video-card .meta { padding: 0.9rem 1rem 1.1rem; }
.video-card h3 { font-family: var(--font-ui); font-size: 0.98rem; letter-spacing: 0; margin: 0 0 0.3rem; }
.video-card time { color: var(--muted); font-size: 0.82rem; }
.empty-box { text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); padding: 2.5rem 1rem; color: var(--muted); font-family: var(--font-serif); font-size: 1.2rem; }

.contact-card { max-width: 640px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.4rem, 4vw, 2.4rem); }
.site-footer { border-top: 1px solid var(--line); padding: 2.5rem 1.5rem; text-align: center; color: var(--muted); background: var(--bg); }
.footer-logos { display: flex; justify-content: center; align-items: center; gap: 2rem; margin-bottom: 1.2rem; }
.footer-logos img { height: 74px; width: auto; }
.site-footer p { margin: 0.2rem 0; font-size: 0.9rem; }
.site-footer .name { font-family: var(--font-display); letter-spacing: 0.1em; color: var(--ink); }

/* ── Login ───────────────────────────────────────────── */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(ellipse at 50% 0%, rgba(201, 169, 89, 0.14), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 2.2rem 2rem; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4); }
.login-card .logo { display: block; width: 96px; margin: 0 auto 1rem; }
.login-card h1 { text-align: center; font-size: 1.3rem; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 0.9rem; margin-bottom: 1.6rem; }
.login-card .btn { width: 100%; }
.login-card .back { display: block; text-align: center; margin-top: 1.2rem; font-size: 0.9rem; color: var(--muted); }
.qr-box { text-align: center; margin: 1rem 0; }
.qr-box img { background: #fff; padding: 8px; border-radius: 8px; }
.secret { font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.12em; font-size: 0.85rem; word-break: break-all; color: var(--gold-2); }
.otp { text-align: center; font-size: 1.6rem; letter-spacing: 0.5em; }

/* ── Aplicación privada ──────────────────────────────── */
body.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--line); padding: 1.4rem 1rem; display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { padding: 0 0.4rem 1rem; border-bottom: 1px solid var(--line-soft); }
.sidebar .brand img { width: 46px; height: 46px; }
.sidebar .brand span { font-size: 0.8rem; line-height: 1.3; }
.nav { display: flex; flex-direction: column; gap: 0.2rem; }
.nav a { display: flex; align-items: center; gap: 0.7rem; padding: 0.65rem 0.8rem; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.nav a:hover { background: rgba(201, 169, 89, 0.1); color: var(--ink); }
.nav a[aria-current='page'] { background: rgba(201, 169, 89, 0.16); color: var(--gold-2); box-shadow: inset 3px 0 0 var(--gold); }
.nav .ico { width: 1.2rem; text-align: center; }
.nav-sep { font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); margin: 0.8rem 0.8rem 0.2rem; }
.sidebar .user { margin-top: auto; border-top: 1px solid var(--line-soft); padding-top: 1rem; font-size: 0.88rem; }
.sidebar .user strong { display: block; color: var(--ink); }
.badge { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 99px; font-size: 0.75rem; border: 1px solid var(--line); color: var(--gold-2); background: rgba(201, 169, 89, 0.1); }
.badge.g1 { color: #9cc2e8; border-color: rgba(156, 194, 232, 0.4); background: rgba(156, 194, 232, 0.08); }
.badge.g2 { color: #b9a4e8; border-color: rgba(185, 164, 232, 0.4); background: rgba(185, 164, 232, 0.08); }
.badge.g4 { color: #e8a4a4; border-color: rgba(232, 164, 164, 0.4); background: rgba(232, 164, 164, 0.08); }
.badge.ok { color: var(--ok); border-color: rgba(120, 198, 154, 0.4); background: rgba(120, 198, 154, 0.08); }
.badge.warn { color: var(--warn); border-color: rgba(228, 183, 104, 0.4); background: rgba(228, 183, 104, 0.08); }
.badge.off { color: var(--muted); border-color: var(--line-soft); background: transparent; }
.sidebar .user .btn { margin-top: 0.7rem; width: 100%; }

.main { padding: clamp(1.2rem, 3vw, 2.4rem); min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.8rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: clamp(1.4rem, 3vw, 2rem); margin: 0; }
.page-head p { margin: 0.3rem 0 0; color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 1.3rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.card-link { display: block; text-decoration: none; color: var(--ink); background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 1.3rem; transition: border-color 0.15s, transform 0.15s; }
.card-link:hover { border-color: var(--gold); transform: translateY(-2px); color: var(--ink); }
.card-link .ico { font-size: 1.6rem; color: var(--gold); }
.card-link h3 { font-size: 1rem; margin: 0.6rem 0 0.2rem; }
.card-link p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.doc-list { display: grid; gap: 0.8rem; }
.doc { display: flex; gap: 1rem; align-items: center; justify-content: space-between; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 1rem 1.2rem; }
.doc h3 { font-family: var(--font-ui); letter-spacing: 0; font-size: 1.02rem; margin: 0 0 0.25rem; }
.doc p { margin: 0 0 0.35rem; color: var(--muted); font-size: 0.92rem; }
.doc .meta { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; font-size: 0.82rem; color: var(--muted); }
.doc .actions { display: flex; gap: 0.5rem; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) { .doc { flex-direction: column; align-items: flex-start; } }

.toolbar { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.toolbar input, .toolbar select { max-width: 280px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { background: var(--panel-2); color: var(--gold-2); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .row-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.group-title { font-size: 0.95rem; color: var(--gold); letter-spacing: 0.2em; text-transform: uppercase; margin: 2rem 0 1rem; display: flex; align-items: center; gap: 1rem; }
.group-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; }
.member { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.member.officer { border-color: var(--line); background: linear-gradient(180deg, var(--panel-2), var(--panel)); }
.member h3 { font-family: var(--font-ui); letter-spacing: 0; font-size: 1.05rem; margin: 0 0 0.2rem; }
.member .cargo { color: var(--gold-2); font-family: var(--font-display); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 0.5rem; }
.member dl { margin: 0.7rem 0 0; font-size: 0.85rem; display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.8rem; }
.member dt { color: var(--muted); }
.member dd { margin: 0; word-break: break-word; }

dialog { background: var(--panel); color: var(--ink); border: 1px solid var(--gold); border-radius: 14px; padding: 1.6rem; width: min(640px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); }
dialog::backdrop { background: rgba(4, 8, 16, 0.75); }
dialog h2 { font-size: 1.2rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }

#toasts { position: fixed; bottom: 1.2rem; right: 1.2rem; display: grid; gap: 0.6rem; z-index: 200; }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--gold); padding: 0.75rem 1rem; border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); max-width: 340px; }
.toast.error { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }

@media (max-width: 860px) {
  body.app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: column; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar .user { margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
.nowrap { white-space: nowrap; }

/* ── Logos oficiales: el escudo Politeia es gris sobre transparente, se apoya sobre un medallón marfil ── */
.brand img, .hero-emblem, .login-card .logo, .footer-logos img:last-child {
  background: radial-gradient(circle at 50% 38%, #fbf7ea, #e7ddc1);
  border-radius: 22%; object-fit: contain; aspect-ratio: 1; padding: 4px;
}
.hero-emblem { padding: 12px; box-shadow: 0 8px 40px rgba(201, 169, 89, 0.25); filter: none; }
.login-card .logo { padding: 7px; }
.footer-logos img:first-child { background: #f1ead6; border-radius: 10px; padding: 8px 14px; height: 74px; width: auto; }
.footer-logos img:last-child { height: 74px; width: 74px; padding: 5px; }
