* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --gold: #c9a84c;
  --gold-light: #d4b86a;
  --dark: #0a0a0a;
  --darker: #050505;
  --card-bg: #111111;
  --card-bg-2: #161616;
  --card-border: #1f1f1f;
  --text: #e6e6e6;
  --text-muted: #8a8a8a;
  --ok: #4caf7d;
  --warn: #c9a84c;
  --bad: #b8564f;
  --radius: 14px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--darker);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .serif { font-family: 'Playfair Display', serif; }

a { color: var(--gold); text-decoration: none; }

button { font-family: inherit; cursor: pointer; }

.hidden { display: none !important; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
  border-radius: 999px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.25s, color 0.3s, transform 0.15s;
}

.btn:hover { background: var(--gold); color: var(--darker); }
.btn:active { transform: translateY(1px); }
.btn-gold { background: var(--gold); color: #1a1408; border-color: var(--gold); font-weight: 600; }
.btn-gold:hover { background: var(--gold-light); }
.btn-ghost { border-color: var(--card-border); color: var(--text-muted); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); background: transparent; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.lang-toggle {
  background: none;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  transition: all 0.25s;
}
.lang-toggle:hover { border-color: var(--gold); color: var(--gold); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.active { color: var(--ok); border-color: rgba(76, 175, 125, 0.4); }
.badge.pending { color: var(--warn); border-color: rgba(201, 168, 76, 0.4); }
.badge.suspended { color: var(--bad); border-color: rgba(184, 86, 79, 0.4); }
.badge.demo { color: var(--gold-light); border-color: rgba(201, 168, 76, 0.35); }

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: radial-gradient(ellipse at 20% 20%, #1a1510 0%, var(--darker) 65%);
}

.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 5vw, 5rem);
  border-right: 1px solid var(--card-border);
  overflow: hidden;
}
.auth-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23c9a84c' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.6;
}
.auth-brand > * { position: relative; z-index: 1; }
.auth-emblem {
  width: 92px;
  height: 92px;
  border: 2px solid var(--gold);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: 0 0 40px rgba(201, 168, 76, 0.2);
  background: radial-gradient(circle, #1a1510, var(--dark));
}
.auth-emblem img { width: 100%; height: 100%; object-fit: cover; }
.auth-brand h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--gold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.1;
}
.auth-brand .kicker {
  font-size: 0.8rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.auth-brand p.tag {
  margin-top: 1.5rem;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  color: var(--gold-light);
  opacity: 0.85;
  max-width: 34ch;
  line-height: 1.6;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3rem);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2.25rem;
  box-shadow: var(--shadow);
}
.auth-card h2 { font-size: 1.6rem; color: var(--text); margin-bottom: 0.4rem; }
.auth-card .sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; line-height: 1.5; }

.tabs {
  display: flex;
  gap: 0.4rem;
  background: var(--card-bg-2);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0.3rem;
  margin-bottom: 1.5rem;
}
.tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.6rem;
  border-radius: 8px;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all 0.25s;
}
.tab.active { background: var(--gold); color: #100d07; font-weight: 600; }

.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--card-bg-2);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text);
  padding: 0.85rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.field textarea { resize: vertical; min-height: 110px; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.12);
}

.alert {
  border-radius: 10px;
  padding: 0.8rem 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 1.1rem;
  display: none;
}
.alert.show { display: block; }
.alert.error { background: rgba(184, 86, 79, 0.14); border: 1px solid rgba(184, 86, 79, 0.4); color: #e3a9a4; }
.alert.info { background: rgba(201, 168, 76, 0.1); border: 1px solid rgba(201, 168, 76, 0.3); color: var(--gold-light); }
.alert.success { background: rgba(76, 175, 125, 0.12); border: 1px solid rgba(76, 175, 125, 0.35); color: #9fd9ba; }

.steps { list-style: none; margin: 0 0 1.4rem; counter-reset: step; }
.steps li {
  position: relative;
  padding-left: 2.4rem;
  margin-bottom: 0.9rem;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  border: 1px solid var(--gold);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.auth-foot {
  margin-top: 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
}
.auth-foot a { color: var(--text-muted); }
.auth-foot a:hover { color: var(--gold); }

.tally-frame-wrap { height: 60vh; min-height: 420px; border: 1px solid var(--card-border); border-radius: 12px; overflow: hidden; margin-bottom: 1.2rem; }
.tally-frame-wrap iframe { width: 100%; height: 100%; border: 0; }

.portal { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.6rem;
  background: rgba(5, 5, 5, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-border);
}
.topbar .brand { display: flex; align-items: center; gap: 0.8rem; text-decoration: none; }
.topbar .brand img { width: 34px; height: 34px; border-radius: 7px; border: 1px solid var(--gold); object-fit: cover; }
.topbar .brand .txt { line-height: 1.15; }
.topbar .brand .txt strong { font-family: 'Playfair Display', serif; color: var(--gold); letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.95rem; display: block; }
.topbar .brand .txt span { font-size: 0.66rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-muted); }
.topbar .tools { display: flex; align-items: center; gap: 0.8rem; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.3rem 0.9rem 0.3rem 0.4rem;
}
.avatar {
  width: 30px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #7d6428);
  color: #100d07;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}
.topbar .user-chip .name { font-size: 0.85rem; }
.topbar .user-chip .num { font-size: 0.68rem; color: var(--text-muted); letter-spacing: 0.08em; }

.portal-body { flex: 1; display: grid; grid-template-columns: 250px 1fr; }
.sidebar {
  border-right: 1px solid var(--card-border);
  padding: 1.4rem 1rem;
  background: var(--dark);
  position: sticky;
  top: 57px;
  align-self: start;
  height: calc(100vh - 57px);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  transition: all 0.2s;
}
.nav-item .ic { font-size: 1.05rem; }
.nav-item:hover { color: var(--text); background: var(--card-bg); }
.nav-item.active { color: var(--gold); background: rgba(201, 168, 76, 0.08); border-color: rgba(201, 168, 76, 0.3); }

.content { padding: 2rem clamp(1.2rem, 3vw, 2.6rem) 4rem; max-width: 1080px; }

.section { display: none; }
.section.active { display: block; animation: fade 0.35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-title { font-size: clamp(1.5rem, 3vw, 2rem); color: var(--text); margin-bottom: 0.35rem; }
.page-sub { color: var(--text-muted); margin-bottom: 1.8rem; font-size: 0.92rem; }
.block-title { font-size: 1.15rem; color: var(--gold); margin: 2.2rem 0 0.3rem; }
.block-sub { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1.1rem; }
.block-title:first-of-type { margin-top: 0; }

.cards { display: grid; gap: 1rem; }
.cards.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.4rem;
  transition: border-color 0.25s, transform 0.25s;
}
.card.hover:hover { border-color: rgba(201, 168, 76, 0.4); transform: translateY(-2px); }

.identity {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.4rem;
  align-items: center;
  background: linear-gradient(120deg, #161208 0%, var(--card-bg) 55%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.6rem;
  margin-bottom: 0.5rem;
}
.identity .avatar-lg {
  width: 64px; height: 64px; border-radius: 16px;
  border: 1px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif; font-size: 1.6rem; color: var(--gold);
  background: radial-gradient(circle, #1a1510, var(--dark));
}
.identity h2 { font-size: 1.5rem; margin-bottom: 0.3rem; }
.identity .num { font-family: monospace; color: var(--gold-light); letter-spacing: 0.12em; font-size: 0.9rem; margin-bottom: 0.7rem; }
.identity .meta { display: flex; flex-wrap: wrap; gap: 0.6rem 1.4rem; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.6rem; }
.identity .meta b { color: var(--text); font-weight: 500; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-top: 1.2rem; }
.stat { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.stat .k { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.5rem; }
.stat .v { font-size: 1.05rem; color: var(--text); }

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.1rem 1.2rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  margin-bottom: 0.8rem;
}
.list-item h4 { font-size: 1rem; margin-bottom: 0.35rem; }
.list-item p { color: var(--text-muted); font-size: 0.88rem; line-height: 1.55; }
.list-item .meta { font-size: 0.75rem; color: var(--text-muted); letter-spacing: 0.05em; margin-top: 0.5rem; }
.tag {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.1em;
  border: 1px solid var(--card-border); border-radius: 999px;
  padding: 0.25rem 0.6rem; color: var(--gold-light); white-space: nowrap;
}

.option {
  display: flex; align-items: center; gap: 0.9rem;
  width: 100%; text-align: left;
  background: var(--card-bg-2); border: 1px solid var(--card-border);
  color: var(--text); border-radius: 10px; padding: 0.85rem 1rem;
  margin-bottom: 0.6rem; cursor: pointer; transition: all 0.2s;
  position: relative; overflow: hidden;
}
.option:hover:not([disabled]) { border-color: var(--gold); }
.option .fill { position: absolute; inset: 0; width: 0; background: rgba(201, 168, 76, 0.12); transition: width 0.5s ease; z-index: 0; }
.option .label, .option .pct { position: relative; z-index: 1; }
.option .label { flex: 1; }
.option .pct { color: var(--gold-light); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.option.chosen { border-color: var(--gold); }
.option[disabled] { cursor: default; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.muted { color: var(--text-muted); }
.small { font-size: 0.8rem; }

.forum-post { border-left: 2px solid var(--gold); padding-left: 1rem; margin-bottom: 1.2rem; }
.forum-post .head { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 0.35rem; }
.forum-post .head strong { color: var(--text); font-weight: 600; font-size: 0.92rem; }
.forum-post .head span { color: var(--text-muted); font-size: 0.75rem; }
.forum-post p { font-size: 0.92rem; line-height: 1.55; }
.forum-post.mine { border-left-color: var(--gold-light); }

.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.contact-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 1.4rem; transition: all 0.25s;
}
.contact-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.contact-card .ic { font-size: 1.3rem; color: var(--gold); margin-bottom: 0.7rem; }
.contact-card h3 { font-size: 1rem; margin-bottom: 0.3rem; }
.contact-card p { color: var(--text-muted); font-size: 0.85rem; word-break: break-word; }

.empty { color: var(--text-muted); font-size: 0.9rem; padding: 1rem 0; }

.admin-panel {
  border: 1px dashed rgba(201, 168, 76, 0.55);
  background: linear-gradient(120deg, rgba(201, 168, 76, 0.06), var(--card-bg));
  margin-top: 1.2rem;
}

.card.mine { border-left: 3px solid var(--gold); }

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0 0.4rem;
}

.req-item {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-top: 0.7rem;
  background: rgba(0, 0, 0, 0.15);
}

.req-item .req-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.req-item .req-type {
  color: var(--gold);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.req-item .req-meta { color: var(--text-muted); font-size: 0.78rem; }
.req-item .req-contact { color: var(--gold); font-size: 0.85rem; margin: 0.15rem 0 0; }
.req-item .req-body { margin: 0.2rem 0 0; white-space: pre-wrap; }

.certificate {
  background: linear-gradient(160deg, #14110a, var(--card-bg));
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 2rem;
  position: relative;
}
.certificate::after {
  content: ''; position: absolute; inset: 8px; border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 8px; pointer-events: none;
}
.certificate .crest { width: 56px; height: 56px; border: 1px solid var(--gold); border-radius: 10px; object-fit: cover; margin-bottom: 1rem; }
.certificate h3 { color: var(--gold); letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.95rem; margin-bottom: 1.4rem; }
.certificate .line { font-size: 1rem; line-height: 1.8; }
.certificate .name { font-family: 'Playfair Display', serif; font-size: 1.9rem; color: var(--text); margin: 0.6rem 0; }
.certificate .grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-top: 1.4rem; }
.certificate .grid2 div span { display: block; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.3rem; }
.certificate .grid2 div b { color: var(--gold-light); font-family: monospace; letter-spacing: 0.08em; }
.certificate .sign { margin-top: 2rem; border-top: 1px solid var(--card-border); padding-top: 0.7rem; font-size: 0.78rem; color: var(--text-muted); }

.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(120%);
  background: var(--card-bg); border: 1px solid var(--gold); color: var(--text);
  padding: 0.85rem 1.4rem; border-radius: 10px; font-size: 0.88rem; z-index: 100;
  box-shadow: var(--shadow); transition: transform 0.35s ease; max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }

.portal-footer { border-top: 1px solid var(--card-border); padding: 1.6rem; text-align: center; color: var(--text-muted); font-size: 0.78rem; letter-spacing: 0.06em; }

.mobile-nav { display: none; }

@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .portal { padding-bottom: 72px; }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    height: auto; z-index: 50;
    display: flex; gap: 0.3rem; padding: 0.5rem;
    border-right: none; border-top: 1px solid var(--card-border);
    background: rgba(5, 5, 5, 0.97); backdrop-filter: blur(10px);
  }
  .nav-item { flex-direction: column; gap: 0.25rem; font-size: 0.62rem; text-align: center; padding: 0.5rem 0.3rem; margin: 0; letter-spacing: 0.04em; }
  .nav-item .ic { font-size: 1.15rem; }
  .content { padding-bottom: 2rem; }
  .topbar .brand .txt span { display: none; }
  .topbar .user-chip .txt { display: none; }
}

@media print {
  body { background: #fff; color: #111; }
  .topbar, .sidebar, .portal-footer, .no-print, .mobile-nav { display: none !important; }
  .content { padding: 0; max-width: none; }
  .section { display: none !important; }
  #section-documentos { display: block !important; }
  .certificate { border-color: #b8952f; color: #111; box-shadow: none; }
  .certificate .name, .certificate .line { color: #111; }
  .certificate .grid2 div b { color: #7a5f10; }
  .block-title, .block-sub, .documents-extra { display: none !important; }
}
