:root {
  --ink: #352e3a;
  --ink-soft: #665d6d;
  --forest: #67566f;
  --forest-deep: #493c50;
  --mint: #e7dfea;
  --cream: #f1edf3;
  --paper: #fbf9fc;
  --coral: #985d78;
  --gold: #d4b4c3;
  --line: #dcd3e0;
  --danger: #9a4758;
  --shadow: 0 22px 60px rgba(73,60,80,.13);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--cream); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
button, input, select { font: inherit; }
a { color: inherit; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-size: .92rem; font-weight: 800; }
.brand-copy { display: grid; gap: 2px; line-height: 1.08; }
.brand-copy strong { font-size: .9rem; }
.brand-copy small { color: var(--ink-soft); font-size: .6rem; font-weight: 650; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--cream); background: var(--forest); font-family: Georgia, serif; font-size: 1.25rem; }
.button { min-height: 46px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; padding: 10px 20px; border: 1px solid transparent; border-radius: 999px; cursor: pointer; font-weight: 780; text-decoration: none; transition: .16s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--coral); }
.button-primary:hover { background: #7c4861; }
.button-secondary { color: var(--ink); border-color: #bdb1c2; background: transparent; }
.button-danger { color: var(--danger); border-color: #dcb8c1; background: #fff; }
.button-small { min-height: 36px; padding: 7px 14px; font-size: .78rem; }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.form-field { margin-bottom: 18px; }
.form-field label { display: block; margin-bottom: 7px; font-size: .8rem; font-weight: 780; }
.form-field input, .form-field select, .filter-input { width: 100%; height: 48px; padding: 10px 13px; border: 1.5px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; outline: none; }
.form-field input:focus, .form-field select:focus, .filter-input:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(103,86,111,.12); }
.error-message { min-height: 22px; color: var(--danger); font-size: .82rem; font-weight: 700; }
.subtle { color: var(--ink-soft); }
.auth-page { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth-visual { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(32px, 6vw, 75px); color: #fff; background: var(--forest); }
.auth-visual::after { content: ""; position: absolute; width: 440px; height: 440px; left: -230px; bottom: -250px; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.018); }
.auth-visual .brand { color: #fff; position: relative; z-index: 1; }
.auth-visual .brand-mark { color: var(--forest); background: var(--gold); }
.auth-copy { position: relative; z-index: 1; max-width: 570px; }
.auth-copy .eyebrow { color: #e5c7d5; font-size: .72rem; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.auth-copy h1 { margin: 10px 0 20px; font-family: Georgia, serif; font-size: clamp(2.8rem, 6vw, 5.3rem); font-weight: 500; line-height: .98; letter-spacing: -.045em; }
.auth-copy p { max-width: 500px; color: rgba(255,255,255,.72); font-size: 1.02rem; }
.auth-form-side { display: grid; place-items: center; padding: 35px; }
.auth-card { width: min(430px, 100%); }
.auth-card h2 { margin: 0 0 8px; font-family: Georgia, serif; font-size: 2.1rem; font-weight: 500; }
.auth-card > p { margin: 0 0 30px; color: var(--ink-soft); }
.auth-card .button { width: 100%; }
.auth-links { display: flex; justify-content: space-between; gap: 15px; margin-top: 20px; color: var(--ink-soft); font-size: .78rem; }

.dashboard-shell { min-height: 100vh; display: grid; grid-template-columns: 245px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 20px; color: rgba(255,255,255,.75); background: var(--forest-deep); }
.sidebar .brand { padding-inline: 8px; color: #fff; }
.sidebar .brand-copy small, .auth-visual .brand-copy small { color: rgba(255,255,255,.68); }
.sidebar .brand-mark { color: var(--forest); background: var(--gold); }
.side-nav { display: grid; gap: 7px; margin-top: 55px; }
.side-nav button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; border-radius: 10px; color: inherit; background: transparent; cursor: pointer; text-align: left; font-weight: 700; }
.side-nav button:hover, .side-nav button.is-active { color: #fff; background: rgba(255,255,255,.1); }
.side-icon { width: 22px; text-align: center; color: #e5c7d5; }
.sidebar-footer { margin-top: auto; padding: 19px 8px 0; border-top: 1px solid rgba(255,255,255,.12); }
.admin-identity { margin-bottom: 12px; }
.admin-identity strong, .admin-identity span { display: block; overflow: hidden; text-overflow: ellipsis; }
.admin-identity strong { color: #fff; font-size: .8rem; }
.admin-identity span { margin-top: 2px; font-size: .69rem; }
.logout-button { border: 0; padding: 0; color: #e5c7d5; background: transparent; cursor: pointer; font-size: .76rem; font-weight: 750; }
.dashboard-main { min-width: 0; padding: 34px clamp(22px, 4vw, 55px) 60px; background: #f3eff4; }
.dashboard-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 30px; }
.dashboard-header h1 { margin: 0; font-family: Georgia, serif; font-size: 2.4rem; font-weight: 500; letter-spacing: -.03em; }
.dashboard-header p { margin: 4px 0 0; color: var(--ink-soft); font-size: .85rem; }
.view { display: none; }
.view.is-active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card, .panel { border: 1px solid rgba(103,86,111,.08); border-radius: 17px; background: #fff; box-shadow: 0 8px 28px rgba(73,60,80,.05); }
.stat-card { padding: 22px; }
.stat-card span { color: var(--ink-soft); font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; }
.stat-card strong { display: block; margin-top: 8px; font-family: Georgia, serif; font-size: 2.2rem; font-weight: 500; }
.dashboard-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: 18px; margin-top: 18px; }
.panel { padding: 25px; }
.panel-header { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 21px; }
.panel-header h2 { margin: 0; font-family: Georgia, serif; font-size: 1.3rem; font-weight: 600; }
.panel-header span { color: var(--ink-soft); font-size: .72rem; }
.distribution-list { display: grid; gap: 16px; }
.distribution-row { display: grid; grid-template-columns: 100px 1fr 36px; gap: 12px; align-items: center; font-size: .78rem; }
.distribution-row > span:first-child { font-weight: 750; text-transform: capitalize; }
.bar-track { height: 9px; overflow: hidden; border-radius: 99px; background: #eee8f0; }
.bar-track i { display: block; height: 100%; border-radius: inherit; background: var(--coral); }
.activity-chart { min-height: 205px; display: flex; align-items: end; justify-content: space-around; gap: 12px; padding-top: 22px; }
.activity-column { flex: 1; display: grid; justify-items: center; gap: 9px; color: var(--ink-soft); font-size: .65rem; }
.activity-column i { width: min(30px, 70%); min-height: 5px; border-radius: 7px 7px 2px 2px; background: var(--forest); }
.table-panel { margin-top: 18px; overflow: hidden; border: 1px solid rgba(103,86,111,.08); border-radius: 17px; background: #fff; }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 21px 23px; border-bottom: 1px solid var(--line); }
.table-toolbar h2 { margin: 0; font-family: Georgia, serif; font-size: 1.3rem; }
.filters { display: flex; gap: 9px; }
.filter-input { height: 39px; width: 230px; font-size: .78rem; }
select.filter-input { width: 155px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 18px; color: var(--ink-soft); background: #f8f5f9; font-size: .66rem; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
td { padding: 14px 18px; border-top: 1px solid #eee8f0; font-size: .78rem; white-space: nowrap; }
td strong, td span { display: block; }
td span { margin-top: 2px; color: var(--ink-soft); font-size: .7rem; }
.style-pill { display: inline-flex; padding: 5px 9px; border-radius: 99px; color: var(--forest); background: var(--mint); font-size: .66rem; font-weight: 800; text-transform: capitalize; }
.style-pill.autoritario { color: #854634; background: #f6e4dd; }
.style-pill.permisivo { color: #78601e; background: #f8efcf; }
.style-pill.negligente { color: #595e64; background: #e8ebed; }
.row-button { border: 0; color: var(--forest); background: transparent; cursor: pointer; font-size: .75rem; font-weight: 800; }
.pagination { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .75rem; }
.pagination-buttons { display: flex; gap: 7px; }
.pagination-buttons button { width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
dialog { width: min(820px, calc(100% - 30px)); max-height: 88vh; padding: 0; border: 0; border-radius: 20px; color: var(--ink); box-shadow: 0 30px 90px rgba(45,34,50,.3); }
dialog::backdrop { background: rgba(45,34,50,.55); backdrop-filter: blur(3px); }
.dialog-content { padding: 30px; }
.dialog-header { display: flex; justify-content: space-between; gap: 20px; }
.dialog-header h2 { margin: 0; font-family: Georgia, serif; font-size: 1.8rem; font-weight: 500; }
.close-dialog { width: 35px; height: 35px; border: 0; border-radius: 50%; background: var(--mint); cursor: pointer; }
.participant-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 25px 0; }
.meta-item { padding: 13px; border-radius: 10px; background: #f6f2f7; }
.meta-item small, .meta-item strong { display: block; }
.meta-item small { color: var(--ink-soft); font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; }
.meta-item strong { margin-top: 4px; font-size: .8rem; }
.admin-code-panel { display: grid; grid-template-columns: 1fr auto; gap: 15px 22px; align-items: center; margin: 0 0 26px; padding: 18px; border: 1px solid #d8c8de; border-radius: 13px; background: #f6f0f7; }
.admin-code-panel small, .admin-code-panel strong { display: block; }
.admin-code-panel small { color: var(--ink-soft); font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.admin-code-panel strong { margin-top: 5px; color: var(--forest); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.25rem; letter-spacing: .1em; user-select: all; }
.admin-code-panel p { margin: 6px 0 0; color: var(--ink-soft); font-size: .74rem; }
.admin-code-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.admin-code-panel .code-status { grid-column: 1 / -1; min-height: 18px; margin: -4px 0 0; color: var(--forest); font-weight: 750; }
.history-list { max-height: 52vh; overflow: auto; padding-right: 5px; }
.history-item { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 13px 0; border-top: 1px solid var(--line); }
.history-item time { color: var(--ink-soft); font-size: .75rem; }
.admin-result-detail { border-top: 1px solid var(--line); }
.admin-result-detail summary { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 16px 4px; cursor: pointer; list-style-position: outside; }
.admin-result-detail summary > span { display: flex; align-items: center; gap: 10px; min-width: 0; }
.admin-result-detail summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }
.admin-result-detail summary time { flex: 0 0 auto; color: var(--ink-soft); font-size: .72rem; }
.admin-result-body { margin: 0 3px 18px; padding: 20px; border-radius: 13px; background: #f7f3f8; }
.admin-result-body > p { margin: 0 0 18px; color: var(--ink-soft); }
.result-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.result-detail-grid section, .result-recommendations { padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.result-detail-grid h3, .result-detail-grid h4, .result-recommendations h3, .result-recommendations h4 { margin: 0 0 9px; font-family: Georgia, serif; font-size: 1rem; }
.result-detail-grid ul, .result-recommendations ol { margin: 0; padding-left: 20px; color: var(--ink-soft); }
.result-detail-grid li, .result-recommendations li { margin: 7px 0; }
.result-recommendations { margin-top: 14px; }
.report-row { display: flex; justify-content: flex-end; margin-top: 15px; }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--line); }
.empty-state { padding: 38px 20px; color: var(--ink-soft); text-align: center; }
.loading { opacity: .55; pointer-events: none; }

.history-page { min-height: 100vh; }
.simple-header { width: min(1040px, calc(100% - 32px)); height: 84px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.simple-header a:last-child { color: var(--ink-soft); font-size: .78rem; font-weight: 750; text-decoration: none; }
.history-main { width: min(900px, calc(100% - 32px)); margin: 45px auto 80px; }
.history-hero { padding: clamp(30px, 6vw, 55px); border-radius: 25px; color: #fff; background: var(--forest); }
.history-hero h1 { margin: 0 0 10px; font-family: Georgia, serif; font-size: clamp(2.3rem, 5vw, 4rem); font-weight: 500; letter-spacing: -.04em; }
.history-hero p { margin: 0; color: rgba(255,255,255,.72); }
.history-cards { display: grid; gap: 13px; margin-top: 22px; }
.history-card { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.history-card h2 { margin: 0 0 5px; font-family: Georgia, serif; font-size: 1.25rem; font-weight: 600; }
.history-card time { color: var(--ink-soft); font-size: .76rem; }
.history-card.detailed-result { display: block; padding: clamp(22px, 4vw, 34px); }
.result-detail-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.result-detail-header h2 { margin-bottom: 2px; font-size: 1.65rem; }
.result-kicker { margin: 0 0 6px; color: var(--coral); font-size: .68rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.result-tagline { margin: 0 0 7px; color: var(--ink); font-weight: 750; }
.history-card .result-summary { margin: 23px 0; color: var(--ink-soft); font-size: .94rem; line-height: 1.7; }
.privacy-document { width: min(820px, calc(100% - 32px)); margin: 35px auto 80px; padding: clamp(27px, 6vw, 60px); border-radius: 22px; background: #fff; box-shadow: var(--shadow); }
.privacy-document h1 { margin-top: 0; font-family: Georgia, serif; font-size: clamp(2.2rem, 5vw, 3.5rem); font-weight: 500; }
.privacy-document h2 { margin-top: 30px; font-family: Georgia, serif; font-size: 1.35rem; }
.privacy-document p, .privacy-document li { color: var(--ink-soft); }
.not-found { min-height: 100vh; }

@media (max-width: 940px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { min-height: 330px; }
  .dashboard-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 15px; padding: 14px 17px; }
  .side-nav { display: flex; margin: 0 0 0 auto; }
  .side-nav button { width: auto; }
  .side-nav span:not(.side-icon) { display: none; }
  .sidebar-footer { margin: 0; padding: 0; border: 0; }
  .admin-identity { display: none; }
  .logout-button { font-size: 0; }
  .logout-button::after { content: "Salir"; font-size: .73rem; }
  .dashboard-main { padding: 25px 15px 50px; }
  .dashboard-header { align-items: flex-start; }
  .filters { width: 100%; }
  .table-toolbar { align-items: flex-start; flex-direction: column; }
  .filter-input, select.filter-input { flex: 1; width: 100%; }
}
@media (max-width: 520px) {
  .auth-form-side { padding: 35px 22px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { padding: 16px; }
  .stat-card strong { font-size: 1.7rem; }
  .dashboard-header { flex-direction: column; }
  .participant-meta { grid-template-columns: 1fr; }
  .admin-code-panel { grid-template-columns: 1fr; }
  .admin-code-actions { justify-content: flex-start; }
  .history-card { align-items: flex-start; flex-direction: column; }
  .result-detail-grid { grid-template-columns: 1fr; }
  .result-detail-header, .admin-result-detail summary { align-items: flex-start; flex-direction: column; }
  .admin-result-detail summary > span { align-items: flex-start; flex-direction: column; }
  .admin-result-detail summary strong { white-space: normal; }
  .sidebar .brand-copy small { display: none; }
}
