:root {
    --navy: #071f3e;
    --navy-2: #0d2e57;
    --burgundy: #690c27;
    --red: #d6382f;
    --cream: #f5d995;
    --paper: #f8f2e6;
    --turquoise: #3fa5b9;
    --green: #75a61f;
    --orange: #ef7b12;
    --ink: #14213d;
    --muted: #67758c;
    --line: rgba(20, 33, 61, 0.13);
    --white: #ffffff;
    --shadow: 0 24px 70px rgba(7, 31, 62, 0.18);
    --radius: 22px;
    --heading: "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
    --body: Inter, Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--body);
    color: var(--ink);
    background: var(--navy);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .15;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(255,255,255,.13) 0 1px, transparent 1px),
        radial-gradient(circle at 80% 65%, rgba(255,255,255,.08) 0 1px, transparent 1px);
    background-size: 5px 5px, 7px 7px;
    z-index: 20;
    mix-blend-mode: soft-light;
}

.auth-view {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(390px, .65fr);
    background: var(--paper);
}

.identity-hero {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    background: var(--burgundy) url('../images/key-visual.png') center/cover no-repeat;
}
.identity-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(71, 5, 27, .18), rgba(7, 31, 62, .22)),
        linear-gradient(0deg, rgba(7, 31, 62, .92) 0%, rgba(7, 31, 62, .08) 58%);
}
.identity-copy {
    position: absolute;
    left: clamp(34px, 7vw, 96px);
    right: clamp(34px, 10vw, 140px);
    bottom: clamp(46px, 8vh, 88px);
    color: var(--cream);
    z-index: 2;
    max-width: 850px;
}
.edition-label, .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: .13em;
    font-weight: 800;
    font-size: 12px;
}
.edition-label {
    background: var(--red);
    padding: 10px 14px;
    color: var(--paper);
}
.wordmark {
    margin-top: 18px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(60px, 8vw, 120px);
    line-height: .88;
    letter-spacing: -.06em;
}
.identity-copy h1 {
    margin: 24px 0 12px;
    font-family: var(--heading);
    font-size: clamp(38px, 4vw, 66px);
    text-transform: uppercase;
    line-height: .98;
    max-width: 780px;
}
.identity-copy > p {
    font-size: clamp(16px, 1.45vw, 21px);
    line-height: 1.55;
    max-width: 700px;
    color: rgba(255, 244, 213, .92);
}
.dimension-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 26px;
}
.dimension-pills span {
    border: 1px solid rgba(245, 217, 149, .48);
    background: rgba(7, 31, 62, .58);
    border-radius: 999px;
    padding: 9px 13px;
    font-size: 12px;
    font-weight: 700;
}

.auth-panel {
    position: relative;
    min-height: 100vh;
    padding: clamp(28px, 5vw, 72px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    background:
        linear-gradient(150deg, rgba(117, 166, 31, .12), transparent 42%),
        var(--paper);
}
.auth-panel::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    width: 145px;
    height: 100%;
    opacity: .17;
    background:
        repeating-linear-gradient(135deg, var(--red) 0 9px, transparent 9px 18px),
        repeating-linear-gradient(45deg, var(--turquoise) 0 10px, transparent 10px 20px);
    clip-path: polygon(55% 0, 100% 0, 100% 100%, 0 100%);
    pointer-events: none;
}
.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
    position: relative;
    z-index: 1;
}
.auth-brand img {
    width: 72px;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 10px 28px rgba(7, 31, 62, .18);
}
.auth-brand span { display: block; color: var(--burgundy); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; }
.auth-brand strong { display: block; margin-top: 4px; color: var(--navy); font-size: 18px; }
.auth-card {
    width: min(100%, 480px);
    position: relative;
    z-index: 1;
}
.auth-card .eyebrow { color: var(--red); }
.auth-card h2 {
    margin: 10px 0 14px;
    font-family: var(--heading);
    color: var(--navy);
    font-size: clamp(38px, 4vw, 56px);
    line-height: 1;
    text-transform: uppercase;
}
.auth-card > p { color: var(--muted); line-height: 1.6; }
label {
    display: block;
    font-size: 13px;
    font-weight: 800;
    color: var(--navy);
    margin: 22px 0 8px;
}
input, select {
    width: 100%;
    min-height: 48px;
    border: 1px solid rgba(7,31,62,.18);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--ink);
    background: rgba(255,255,255,.9);
    outline: none;
    transition: border .2s, box-shadow .2s, transform .2s;
}
input:focus, select:focus {
    border-color: var(--turquoise);
    box-shadow: 0 0 0 4px rgba(63, 165, 185, .16);
}
.code-input {
    letter-spacing: .48em;
    text-align: center;
    font-size: 30px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.primary-button, .secondary-button, .outline-button {
    border: 0;
    border-radius: 12px;
    min-height: 48px;
    padding: 12px 18px;
    font-weight: 800;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.primary-button {
    background: linear-gradient(135deg, var(--red), #aa1325);
    color: white;
    box-shadow: 0 12px 24px rgba(178, 28, 41, .24);
}
.auth-card .primary-button { width: 100%; margin-top: 18px; }
.primary-button:hover, .secondary-button:hover, .outline-button:hover { transform: translateY(-1px); }
.primary-button:disabled, .secondary-button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.secondary-button { background: #e8edf4; color: var(--navy); }
.outline-button { background: transparent; border: 1px solid rgba(245,217,149,.35); color: var(--cream); min-height: 42px; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--burgundy); font-weight: 800; }
.form-message { min-height: 22px; margin: 12px 0 0; color: var(--burgundy); font-size: 14px; }
.form-message.success { color: #1d7b4f; }
.privacy-note { position: relative; z-index: 1; margin-top: 28px; color: var(--muted); font-size: 12px; max-width: 420px; }

.voting-view {
    min-height: 100vh;
    background:
        linear-gradient(160deg, rgba(63,165,185,.13), transparent 30%),
        linear-gradient(15deg, rgba(214,56,47,.15), transparent 32%),
        #eef2f6;
}
.topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    min-height: 76px;
    padding: 14px clamp(18px, 3vw, 42px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(7, 31, 62, .97);
    color: var(--cream);
    border-bottom: 4px solid var(--red);
    box-shadow: 0 10px 30px rgba(7,31,62,.18);
}
.topbar-brand, .topbar-actions, .user-meta { display: flex; align-items: center; }
.topbar-brand { gap: 12px; }
.topbar-brand strong { display: block; font-family: Georgia, serif; font-size: 22px; }
.topbar-brand small, .user-meta small { display: block; color: rgba(245,217,149,.72); margin-top: 2px; }
.mini-seal {
    width: 48px; height: 48px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--cream); color: var(--burgundy);
    font-family: Georgia, serif; font-weight: 900;
    box-shadow: 0 0 0 5px rgba(63,165,185,.22);
}
.topbar-actions { gap: 18px; }
.user-meta { align-items: flex-end; flex-direction: column; }
.user-meta span { font-weight: 800; }
.closed-notice {
    background: #fff0cf;
    color: #664500;
    padding: 14px 28px;
    border-bottom: 1px solid #ebcf8c;
    text-align: center;
    font-weight: 700;
}
.voting-layout {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 22px;
    padding: 22px;
    min-height: calc(100vh - 80px);
}
.brand-sidebar {
    min-height: calc(100vh - 124px);
    border-radius: var(--radius);
    background: rgba(255,255,255,.94);
    box-shadow: var(--shadow);
    padding: 18px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.progress-card {
    background:
        linear-gradient(135deg, rgba(63,165,185,.22), transparent 52%),
        var(--navy);
    color: white;
    padding: 18px;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}
.progress-card::after {
    content: "7";
    position: absolute;
    right: -8px;
    bottom: -36px;
    font-family: var(--heading);
    font-size: 130px;
    color: rgba(255,255,255,.05);
}
.progress-heading { display: flex; justify-content: space-between; align-items: center; }
.progress-heading strong { color: var(--cream); font-size: 24px; }
.progress-track { height: 9px; border-radius: 999px; background: rgba(255,255,255,.16); overflow: hidden; margin: 14px 0 10px; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--turquoise), var(--green)); transition: width .35s ease; }
.progress-card p { margin: 0; color: rgba(255,255,255,.72); font-size: 13px; }
.filter-stack { padding: 4px 2px 12px; }
.filter-stack label { margin-top: 14px; }
.brand-list-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 4px 10px; border-top: 1px solid var(--line); }
.brand-list-header span { font-family: var(--heading); font-size: 19px; font-weight: 800; text-transform: uppercase; }
.brand-list-header small { color: var(--muted); }
.brand-list {
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    padding-right: 4px;
    min-height: 220px;
}
.brand-item {
    width: 100%;
    border: 1px solid var(--line);
    background: white;
    border-radius: 13px;
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    text-align: left;
    color: var(--ink);
    transition: border .2s, transform .2s, box-shadow .2s;
}
.brand-item:hover, .brand-item.active { border-color: var(--turquoise); transform: translateY(-1px); box-shadow: 0 9px 18px rgba(7,31,62,.08); }
.brand-item.active { background: #eefafd; }
.brand-item strong { display: block; font-size: 13px; line-height: 1.3; }
.brand-item small { display: block; color: var(--muted); margin-top: 4px; font-size: 11px; }
.brand-state { align-self: center; width: 10px; height: 10px; border-radius: 50%; background: #cfd6df; }
.brand-state.draft { background: var(--orange); }
.brand-state.completed { background: var(--green); }
.pagination-controls { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 14px; }
.icon-button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: white; color: var(--navy); }

.evaluation-stage { min-width: 0; }
.empty-evaluation, .evaluation-card {
    min-height: calc(100vh - 124px);
    background: rgba(255,255,255,.96);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.empty-evaluation {
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    padding: 40px;
    overflow: hidden;
    position: relative;
}
.empty-evaluation::before {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 120px;
    background: repeating-linear-gradient(135deg, rgba(214,56,47,.08) 0 18px, rgba(63,165,185,.08) 18px 36px);
}
.empty-evaluation img { width: 160px; border-radius: 50%; margin-bottom: 20px; }
.empty-evaluation .eyebrow { color: var(--red); }
.empty-evaluation h2 { font-family: var(--heading); text-transform: uppercase; color: var(--navy); font-size: clamp(36px, 5vw, 62px); margin: 8px 0 10px; }
.empty-evaluation p:last-child { color: var(--muted); max-width: 620px; line-height: 1.65; }
.evaluation-card { padding: clamp(22px, 3vw, 42px); }
.evaluation-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}
.evaluation-header .eyebrow { color: var(--red); }
.evaluation-header h1 {
    margin: 6px 0 10px;
    font-family: var(--heading);
    text-transform: uppercase;
    color: var(--navy);
    font-size: clamp(42px, 5vw, 72px);
    line-height: .95;
}
.evaluation-header p:last-child { max-width: 780px; color: var(--muted); line-height: 1.55; margin-bottom: 0; }
.status-badge { display: inline-flex; white-space: nowrap; border-radius: 999px; padding: 9px 13px; background: #e9edf3; color: var(--muted); font-size: 12px; font-weight: 800; }
.status-badge.draft { background: #fff2d6; color: #8a5700; }
.status-badge.completed { background: #dff5e9; color: #1e6e46; }
.criteria-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 24px 0; }
.criterion-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 20px;
    background: linear-gradient(145deg, #fff, #fbfcfd);
    transition: border .2s, box-shadow .2s;
}
.criterion-card.has-value { border-color: rgba(63,165,185,.56); box-shadow: 0 10px 26px rgba(7,31,62,.06); }
.criterion-head { display: grid; grid-template-columns: 44px 1fr; gap: 13px; align-items: start; }
.criterion-number { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: var(--cream); font-family: var(--heading); font-size: 20px; }
.criterion-card h3 { margin: 0; color: var(--navy); font-family: var(--heading); font-size: 24px; text-transform: uppercase; }
.criterion-card p { margin: 7px 0 0; color: var(--muted); line-height: 1.45; font-size: 13px; }
.rating-scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 18px; }
.rating-button {
    border: 1px solid var(--line);
    background: white;
    min-height: 48px;
    border-radius: 12px;
    color: var(--navy);
    font-weight: 900;
    font-size: 17px;
    transition: .18s ease;
}
.rating-button:hover { border-color: var(--turquoise); background: #eefafd; }
.rating-button.selected { background: var(--red); border-color: var(--red); color: white; box-shadow: 0 8px 18px rgba(214,56,47,.23); }
.rating-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; margin-top: 7px; }
.evaluation-footer { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding-top: 20px; border-top: 1px solid var(--line); }
.save-indicator { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.save-indicator span:first-child { width: 9px; height: 9px; border-radius: 50%; background: #9aa6b5; }
.save-indicator.saving span:first-child { background: var(--orange); animation: pulse 1s infinite; }
.save-indicator.saved span:first-child { background: var(--green); }
.save-indicator.error span:first-child { background: var(--red); }
.evaluation-actions { display: flex; gap: 10px; }
@keyframes pulse { 50% { opacity: .35; } }

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 50;
    max-width: 360px;
    background: var(--navy);
    color: white;
    padding: 14px 18px;
    border-radius: 13px;
    box-shadow: var(--shadow);
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: .25s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--burgundy); }

@media (max-width: 1080px) {
    .auth-view { grid-template-columns: 1fr 430px; }
    .identity-copy { right: 42px; }
    .voting-layout { grid-template-columns: 300px minmax(0,1fr); }
    .criteria-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .auth-view { grid-template-columns: 1fr; }
    .identity-hero { min-height: 52vh; }
    .identity-copy { left: 28px; right: 28px; bottom: 34px; }
    .identity-copy h1 { font-size: 39px; }
    .wordmark { font-size: 68px; }
    .auth-panel { min-height: 48vh; padding: 36px 26px 48px; }
    .auth-card { max-width: none; }
    .voting-layout { grid-template-columns: 1fr; padding: 14px; }
    .brand-sidebar { min-height: auto; }
    .brand-list { max-height: 330px; }
    .empty-evaluation, .evaluation-card { min-height: auto; }
    .topbar { padding: 12px 16px; }
    .user-meta { display: none; }
}

@media (max-width: 560px) {
    .identity-hero { min-height: 58vh; }
    .dimension-pills { display: none; }
    .identity-copy > p { font-size: 15px; }
    .auth-brand img { width: 60px; }
    .topbar-brand small { display: none; }
    .topbar-brand strong { font-size: 18px; }
    .mini-seal { width: 42px; height: 42px; }
    .evaluation-card { padding: 20px 15px; }
    .evaluation-header { flex-direction: column; }
    .evaluation-header h1 { font-size: 42px; }
    .criterion-card { padding: 16px; }
    .criterion-head { grid-template-columns: 36px 1fr; }
    .criterion-number { width: 36px; height: 36px; font-size: 17px; }
    .criterion-card h3 { font-size: 20px; }
    .rating-scale { gap: 5px; }
    .rating-button { min-height: 44px; }
    .evaluation-footer { align-items: stretch; flex-direction: column; }
    .evaluation-actions { display: grid; grid-template-columns: 1fr 1.35fr; }
    .empty-evaluation img { width: 120px; }
    .empty-evaluation { padding: 34px 20px; }
    .empty-evaluation h2 { font-size: 38px; }
}

/* Autenticação por palavra-passe */
.password-field {
    position: relative;
}
.password-field input {
    padding-right: 86px;
}
.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--navy);
    font-size: 12px;
    font-weight: 800;
    padding: 8px;
}
.password-toggle:hover { color: var(--red); }
.password-rule,
.access-help {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}
.access-help {
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

/* Botão permanente para guardar o progresso */
.voting-view {
    padding-bottom: 104px;
}
.save-progress-dock {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 45;
    width: min(680px, calc(100vw - 32px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 14px 12px 18px;
    border: 1px solid rgba(245, 217, 149, .35);
    border-radius: 18px;
    background: rgba(7, 31, 62, .96);
    color: white;
    box-shadow: 0 18px 48px rgba(7, 31, 62, .34);
    backdrop-filter: blur(14px);
}
.save-progress-dock > div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.save-progress-dock strong {
    color: var(--cream);
    font-family: var(--heading);
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.save-progress-dock small {
    color: rgba(255, 255, 255, .7);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.manual-save-button {
    flex: 0 0 auto;
    min-height: 48px;
    border: 0;
    border-radius: 13px;
    padding: 0 18px;
    background: var(--red);
    color: white;
    font-weight: 900;
    box-shadow: 0 9px 22px rgba(214, 56, 47, .28);
}
.manual-save-button:hover:not(:disabled) {
    transform: translateY(-1px);
    background: #ec443a;
}
.manual-save-button:disabled {
    cursor: not-allowed;
    opacity: .52;
    box-shadow: none;
}
.toast { bottom: 116px; }

@media (max-width: 560px) {
    .voting-view { padding-bottom: 128px; }
    .save-progress-dock {
        bottom: 10px;
        width: calc(100vw - 20px);
        align-items: stretch;
        flex-direction: column;
        gap: 9px;
        padding: 12px;
    }
    .save-progress-dock > div { text-align: center; }
    .save-progress-dock small { white-space: normal; }
    .manual-save-button { width: 100%; }
    .toast { right: 10px; bottom: 144px; left: 10px; max-width: none; }
}
