:root {
    --primary: #031f8c;
    --primary-dark: #010f46;
    --primary-light: #2c6eea;
    --accent: #5ad7ff;
    --accent-soft: #e6f4ff;
    --neutral: #f6f9fc;
    --bg: #f6f9fc;
    --bg-card: #ffffff;
    --bg-card-strong: #eef2ff;
    --text: #1f1f1f;
    --text-soft: #6b7280;
    --border: rgba(3, 31, 140, 0.08);
    --shadow: 0 25px 50px rgba(3, 31, 140, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', 'Space Grotesk', 'Segoe UI', sans-serif;
    background: linear-gradient(120deg, #f9fbff 0%, #eef2ff 40%, #e0f7fa 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.4;
}

img {
    max-width: 100%;
    height: auto;
}

.login-layout {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) 480px;
    min-height: 100vh;
    background: linear-gradient(120deg, rgba(0, 10, 35, 0.92), rgba(3, 31, 140, 0.68));
}

.login-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: radial-gradient(circle at 25% 30%, rgba(90, 215, 255, 0.18), transparent 50%), rgba(3, 31, 140, 0.9);
}

.login-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(1, 11, 45, 0.75), rgba(3, 31, 140, 0.35));
}

.login-hero img {
    position: absolute;
    width: 100%;
    max-width:800px;
    opacity: 0.08;
    filter: drop-shadow(0 25px 35px rgba(0, 0, 0, 0.45));
}

.hero-text {
    position: relative;
    text-align: left;
    color: #f5f8ff;
    max-width: 520px;
    z-index: 1;
}

.hero-text .eyebrow {
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.25em;
}

.hero-text h1 {
    font-size: 2.6rem;
    margin: 0.6rem 0 0.8rem;
    line-height: 1.15;
}

.hero-text p {
    font-size: 1rem;
    color: rgba(245, 248, 255, 0.85);
}

.login-panel {
    background: linear-gradient(180deg, #ffffff, #f7f8ff);
    padding: 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: -40px 0 60px rgba(1, 15, 70, 0.2);
    border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.login-brand {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.login-brand span {
    color: var(--text-soft);
}

.login-brand strong {
    font-size: 1.4rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.9rem;
}

.login-form input {
    background: rgba(3, 31, 140, 0.08);
    border: 1px solid rgba(3, 31, 140, 0.2);
    border-radius: 10px;
    padding: 0.75rem;
    color: var(--text);
}

.login-error {
    color: #f87171;
    font-size: 0.85rem;
}

@media (max-width: 992px) {
    .login-layout {
        grid-template-columns: 1fr;
    }
    .login-hero {
        display: none;
    }
    .login-panel {
        min-height: 100vh;
        justify-content: center;
        padding: 2rem 1.25rem;
        box-shadow: none;
        border-left: none;
    }
}

.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
    background: transparent;
}

.mobile-nav-toggle,
.sidebar-close,
.mobile-nav-backdrop {
    display: none;
}

.mobile-nav-toggle {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 70;
    border: 1px solid rgba(3, 31, 140, 0.2);
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-dark);
    border-radius: 14px;
    padding: 0.55rem 0.75rem;
    box-shadow: 0 14px 28px rgba(3, 31, 140, 0.16);
    display: none;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
}

.mobile-nav-toggle span {
    width: 16px;
    height: 2px;
    background: var(--primary-dark);
    border-radius: 999px;
    display: block;
}

.mobile-nav-toggle strong {
    font-size: 0.85rem;
    line-height: 1;
    margin-left: 0.15rem;
}

.mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.45);
    z-index: 59;
}

.sidebar {
    position: sticky;
    top: 0;
    background: linear-gradient(205deg, rgba(3, 31, 140, 0.98), rgba(1, 15, 70, 0.98));
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    border-right: none;
    box-shadow: 0 24px 45px rgba(1, 15, 70, 0.55);
    color: #f5f8ff;
    height: 100vh;
    align-self: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}

.sidebar::before,
.sidebar::after {
    content: '';
    position: absolute;
    pointer-events: none;
    border-radius: 999px;
    filter: blur(45px);
}

.sidebar::before {
    width: 200px;
    height: 200px;
    top: -50px;
    right: -70px;
    background: linear-gradient(135deg, rgba(90, 215, 255, 0.45), rgba(3, 31, 140, 0));
}

.sidebar::after {
    width: 240px;
    height: 240px;
    bottom: -90px;
    left: -80px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25), rgba(3, 31, 140, 0));
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-close {
    margin-left: auto;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}

.logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.18);
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
}

.logo img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
}

.label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.company {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
}

.user-context {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.user-context .logout {
    color: #ffe0d2;
    font-size: 0.85rem;
    text-decoration: none;
    margin-top: 0.3rem;
}

.member-switch {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.member-switch label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
}

.member-switch select {
    background: rgba(216, 216, 216, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: var(--primary-dark);
    padding: 0.45rem 0.6rem;
    border-radius: 10px;
    font-weight: 500;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}

.member-switch option {
    color: var(--primary-dark);
    background: #ffffff;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

nav a {
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    transition: background 0.2s, color 0.2s;
}

nav a:hover,
nav a.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.sidebar-card {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-card h4 {
    margin-bottom: 0.8rem;
    color: #fff;
}

.sidebar-card ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    color: rgba(255, 255, 255, 0.75);
}

main {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: transparent;
}

.card,
.dashboard {
    background: linear-gradient(155deg, #ffffff 0%, #f3f6ff 70%);
    border-radius: 26px;
    padding: 1.5rem;
    border: 1px solid rgba(3, 31, 140, 0.08);
    box-shadow: var(--shadow);
    color: var(--text);
    position: relative;
    overflow: hidden;
}

.dashboard {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.card::before,
.dashboard::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: none;
    mix-blend-mode: soft-light;
}

.card::after,
.dashboard::after {
    content: '';
    position: absolute;
    top: 14px;
    left: 24px;
    right: 24px;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--primary-light));
    opacity: 0.7;
    pointer-events: none;
}

.score-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: none;
    box-shadow: 0 15px 30px rgba(3, 31, 140, 0.12);
}

.score-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.eyebrow {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--primary-light);
    margin-bottom: 0.4rem;
}

h1 {
    font-size: 3rem;
}

.progress {
    background: rgba(3, 31, 140, 0.1);
    border-radius: 999px;
    padding: 0.3rem;
    border: 1px solid rgba(3, 31, 140, 0.25);
}

.progress-bar {
    height: 14px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary-light), var(--primary));
    box-shadow: 0 0 20px rgba(3, 31, 140, 0.4);
}

.progress span {
    display: block;
    margin-top: 0.5rem;
    text-align: right;
    color: var(--text-soft);
}

.score-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.score-info p {
    color: var(--text-soft);
    font-size: 0.8rem;
}

.score-info strong {
    font-size: 1rem;
}

.mini-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.mini-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 1rem;
    border: 1px solid rgba(3, 31, 140, 0.12);
    box-shadow: var(--shadow);
}

.sparkline {
    display: flex;
    align-items: flex-end;
    gap: 0.2rem;
    height: 80px;
    margin-bottom: 0.5rem;
}

.sparkline span {
    width: 12px;
    background: var(--primary);
    border-radius: 8px 8px 0 0;
    opacity: 0.5;
}

.alert-list,
.rule-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alert {
    padding: 0.5rem 0.7rem;
    border-radius: 12px;
    font-size: 0.9rem;
}

.alert.critico {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.alert.projeto {
    background: rgba(34, 197, 94, 0.15);
    color: #34d399;
}

.alert.risco {
    background: #f8fbff;
    color: var(--text);
}

.alert.success {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.alert.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.section-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.btn {
    background: linear-gradient(120deg, var(--primary), var(--primary-light));
    border: none;
    color: #fff;
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn.ghost {
    background: rgba(3, 31, 140, 0.08);
    border: 1px solid rgba(3, 31, 140, 0.3);
    color: var(--primary);
}

.btn.small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn.full {
    width: 100%;
    justify-content: center;
}

.ranking-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.ranking-list li {
    display: grid;
    grid-template-columns: 60px 1fr 100px;
    align-items: center;
    background: #ffffff;
    border-radius: 16px;
    padding: 0.8rem 1rem;
    border: 1px solid rgba(3, 31, 140, 0.12);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.position {
    font-size: 1.1rem;
    color: var(--primary-light);
}

.points {
    text-align: right;
    font-weight: 600;
}

.grid {
    display: grid;
    grid-template-columns: 1.7fr 1fr;
    gap: 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead {
    background: #f1f5ff;
    color: var(--primary-dark);
    text-transform: uppercase;
    font-size: 0.82rem;
}

tbody tr {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

tbody tr:hover {
    transform: translateX(4px);
    box-shadow: 0 6px 16px rgba(3, 31, 140, 0.08);
}

th, td {
    padding: 0.7rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

th {
    text-align: left;
    color: var(--primary-dark);
}

.demand-form,
.presence-actions,
.defesa-form,
.project-rules,
.event-form,
.gamification {
    background: #ffffff;
    border-radius: 20px;
    padding: 1.2rem;
    border: 1px solid #e4e8f1;
    box-shadow: var(--shadow);
}

.project-rules {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-self: flex-start;
}

.project-rules .rules-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.project-rules .rules-header .eyebrow {
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-size: 0.75rem;
    margin-bottom: 0.3rem;
}

.project-rules .rules-header p.muted {
    margin-top: 0.3rem;
}

.project-rules .rule-pill {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border-radius: 16px;
    padding: 0.7rem 1rem;
    text-align: right;
    min-width: 150px;
    box-shadow: 0 12px 25px rgba(3, 31, 140, 0.35);
}

.project-rules .rule-pill span {
    display: block;
    font-weight: 600;
    font-size: 1rem;
}

.project-rules .rule-pill small {
    display: block;
    font-size: 0.75rem;
    opacity: 0.85;
}

.project-rules .checklist.fancy li {
    border-radius: 14px;
    border: 1px solid rgba(3, 31, 140, 0.15);
    padding: 0.6rem 0.75rem;
    background: rgba(246, 249, 252, 0.9);
    box-shadow: 0 8px 18px rgba(3, 31, 140, 0.08);
    list-style: none;
}

.project-rules .checklist.fancy li::before {
    color: var(--primary);
}

.rule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.6rem;
}

.rule-grid div {
    border: 1px solid rgba(3, 31, 140, 0.15);
    border-radius: 14px;
    padding: 0.6rem 0.8rem;
    background: rgba(246, 249, 252, 0.85);
    box-shadow: 0 10px 20px rgba(3, 31, 140, 0.08);
}

.rule-grid strong {
    display: block;
    font-size: 1.1rem;
    color: var(--primary-dark);
}

.rule-grid span {
    font-size: 0.85rem;
    color: var(--text-soft);
}

.rules-hero {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: center;
}

.pill-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.6rem;
}

.pill-list li {
    border: 1px solid rgba(3, 31, 140, 0.12);
    border-radius: 16px;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 24px rgba(3, 31, 140, 0.08);
}

.pill-list strong {
    display: block;
    font-size: 1.3rem;
    color: var(--primary-dark);
}

.pill-list span {
    font-size: 0.85rem;
    color: var(--text-soft);
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.rules-grid.two {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.rules-card {
    border: 1px solid rgba(3, 31, 140, 0.12);
    border-radius: 18px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 16px 28px rgba(3, 31, 140, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.rules-card small {
    color: var(--text-soft);
}

.checklist {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    color: var(--text-soft);
}

.checklist li {
    position: relative;
    padding-left: 1.1rem;
    line-height: 1.4;
}

.checklist li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    position: absolute;
    left: 0;
    top: 0.55rem;
}

.checklist.compact li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0;
    border-bottom: 1px dashed rgba(3, 31, 140, 0.12);
    padding-left: 0;
}

.checklist.compact li::before {
    display: none;
}

.checklist.compact strong {
    color: var(--primary-dark);
    font-weight: 600;
}

.checklist.fancy li {
    padding-left: 0;
}

.checklist.fancy li::before {
    display: none;
}

.pdf-panel {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.pdf-panel .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.8rem 0;
}

.pdf-viewer {
    flex: 1;
    min-width: 280px;
    min-height: 360px;
    border: 1px solid rgba(3, 31, 140, 0.12);
    border-radius: 18px;
    box-shadow: 0 18px 32px rgba(3, 31, 140, 0.12);
}

@media (max-width: 768px) {
    .rules-hero {
        flex-direction: column;
    }
}

.defense-metrics {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.defense-metrics h4 {
    margin-bottom: 0.2rem;
}

.defense-tags {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem;
}

.defense-tags span {
    background: rgba(3, 31, 140, 0.08);
    border: 1px solid rgba(3, 31, 140, 0.15);
    border-radius: 12px;
    padding: 0.45rem 0.7rem;
    font-size: 0.9rem;
    color: var(--primary-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.4rem;
}

.defense-tags span strong {
    font-weight: 600;
}

form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--text-soft);
}

input, select, textarea {
    background: rgba(3, 31, 140, 0.08);
    border: 1px solid rgba(3, 31, 140, 0.18);
    border-radius: 12px;
    padding: 0.6rem 0.8rem;
    color: var(--text);
    font-family: inherit;
}

textarea {
    resize: vertical;
}

.two-columns {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1.5rem;
    align-items: flex-start;
}

.presence-list,
.defesa-list,
.project-list,
.event-list,
.timeline {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.presence-list li,
.defesa-list li,
.project-list li,
.event-list li {
    background: #ffffff;
    border-radius: 18px;
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid rgba(3, 31, 140, 0.08);
    box-shadow: 0 14px 28px rgba(3, 31, 140, 0.08);
    position: relative;
    overflow: hidden;
    list-style: none;
}

.presence-list li::before,
.defesa-list li::before,
.project-list li::before,
.event-list li::before,
.timeline li::before,
.ranking-list li::before,
.manifest-list li::before,
.project-ranking-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 18px 0 0 18px;
    background: linear-gradient(180deg, var(--accent), var(--primary-light));
}

.event-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-left: auto;
    flex-wrap: wrap;
}

.status {
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    text-transform: lowercase;
}

.status.presente {
    background: rgba(34, 197, 94, 0.15);
    color: #34d399;
}

.status.falta-justificada {
    background: rgba(250, 204, 21, 0.15);
    color: #facc15;
}

.status.falta-sem-justificativa {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.status.justificativa-especial {
    background: rgba(129, 140, 248, 0.2);
    color: #a5b4fc;
}

.impacto {
    margin-left: auto;
    font-weight: 600;
}

.toggle {
    position: relative;
    width: 42px;
    height: 22px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle span {
    position: absolute;
    cursor: pointer;
    background: rgba(148, 163, 184, 0.3);
    border-radius: 999px;
    inset: 0;
}

.toggle span::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}

.toggle input:checked + span {
    background: rgba(59, 130, 246, 0.5);
}

.toggle input:checked + span::after {
    transform: translateX(20px);
}

.defesa-list p {
    color: var(--text-soft);
}

.actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.project-list .badge,
.status-badge {
    margin-left: auto;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    font-size: 0.85rem;
}

.badge.ok {
    background: rgba(34, 197, 94, 0.15);
    color: #34d399;
}

.badge.blocked {
    background: rgba(248, 113, 113, 0.2);
    color: #f87171;
}

.badge.warning {
    background: rgba(250, 204, 21, 0.25);
    color: #d97706;
}

.badge.muted {
    background: rgba(148, 163, 184, 0.3);
    color: #475569;
}

.timeline li {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid rgba(3, 31, 140, 0.08);
    background: #ffffff;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.timeline li:last-child {
    border-bottom: none;
}

.qr-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.qr-box img {
    background: #fff;
    border-radius: 12px;
    padding: 0.4rem;
}

.qr-modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 50;
}

.qr-modal[hidden] {
    display: none;
}

.qr-modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.5rem;
    max-width: 360px;
    width: 100%;
    text-align: center;
    position: relative;
}

.qr-modal-content img {
    background: #fff;
    border-radius: 16px;
    padding: 0.8rem;
    margin: 1rem auto;
}

.qr-modal .close {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-soft);
    cursor: pointer;
}

.dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 0.3rem;
}

.filters {
    display: flex;
    gap: 0.5rem;
}

.filters .btn.small {
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.15);
}

.filters .btn.small.active {
    background: var(--primary);
}

.gamification .stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}

.gamification p {
    color: var(--text-soft);
}

.hint {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.8);
    display: grid;
    place-items: center;
    padding: 2rem;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 2rem;
    width: min(480px, 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    position: relative;
}

.close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.4rem;
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

@media (max-width: 1024px) {
    .layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: min(86vw, 340px);
        height: 100vh;
        z-index: 60;
        transform: translateX(-105%);
        transition: transform 0.24s ease;
        flex-direction: column;
        flex-wrap: nowrap;
        overflow-y: auto;
        overflow-x: hidden;
        gap: 1.25rem;
        padding: 1rem;
        border-radius: 0 20px 20px 0;
    }
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }
    .mobile-nav-toggle {
        display: inline-flex;
    }
    .mobile-nav-backdrop {
        display: block;
    }
    .mobile-nav-backdrop[hidden] {
        display: none;
    }
    .sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    main {
        padding-top: 4.25rem;
    }
    .dashboard {
        grid-template-columns: 1fr;
    }
    .mini-cards,
    .grid,
    .two-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    main {
        padding: 1rem;
    }
    .card,
    .dashboard,
    .score-card,
    .demand-form,
    .presence-actions,
    .defesa-form,
    .project-rules,
    .event-form,
    .gamification {
        padding: 1rem;
        border-radius: 18px;
    }
    .section-header {
        align-items: flex-start;
    }
    .section-header .chip {
        width: 100%;
        text-align: center;
    }
    .btn {
        width: 100%;
        text-align: center;
    }
    .btn.small {
        width: auto;
    }
    .filters {
        width: 100%;
        flex-wrap: wrap;
    }
    .filters .btn.small {
        flex: 1 1 calc(50% - 0.25rem);
        text-align: center;
    }
    .score-info {
        grid-template-columns: 1fr;
    }
    .score-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    h1 {
        font-size: 2rem;
    }
    .ranking-list li {
        grid-template-columns: 40px 1fr 80px;
        gap: 0.6rem;
        padding: 0.75rem;
    }
    .position {
        font-size: 1rem;
    }
    .points {
        font-size: 0.9rem;
    }
    .presence-list li,
    .defesa-list li,
    .project-list li,
    .event-list li {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .impacto,
    .project-list .badge,
    .status-badge {
        margin-left: 0;
    }
    .actions,
    .event-actions,
    .project-actions,
    .manifest-list .actions {
        width: 100%;
        flex-wrap: wrap;
    }
    .actions .btn,
    .event-actions .btn,
    .project-actions .btn,
    .manifest-list .actions .btn {
        flex: 1 1 100%;
    }
    .timeline li {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.85rem;
    }
    .dot {
        margin-top: 0;
    }
    .timeline li > div {
        width: 100%;
    }
    .qr-box {
        width: 100%;
        align-items: stretch;
    }
    .qr-box .btn.small {
        width: 100%;
    }
    .team-line {
        gap: 0.25rem;
    }
    .team-line span {
        display: block;
        width: 100%;
    }
    .manifest-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }
    .project-rules .rules-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .project-rules .rule-pill {
        width: 100%;
        text-align: left;
        min-width: 0;
    }
    .modal,
    .qr-modal {
        padding: 0.75rem;
    }
    .modal-content,
    .qr-modal-content {
        border-radius: 16px;
        padding: 1rem;
    }
    .qr-modal-content img {
        width: min(100%, 260px);
        margin: 0.75rem auto;
    }
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        font-size: 0.85rem;
    }
    thead,
    tbody {
        white-space: nowrap;
    }
    th,
    td {
        padding: 0.55rem 0.6rem;
    }
    input,
    select,
    textarea {
        width: 100%;
        font-size: 16px;
    }
    select[multiple] {
        min-height: 140px;
    }
}

@media (max-width: 420px) {
    .login-panel {
        padding: 1.25rem 1rem;
    }
    .hero-text h1 {
        font-size: 2rem;
    }
    .sidebar {
        width: 92vw;
        padding: 0.75rem;
        gap: 0.75rem;
    }
    nav a {
        padding: 0.55rem 0.65rem;
    }
    .mobile-nav-toggle {
        top: 0.6rem;
        left: 0.6rem;
        padding: 0.5rem 0.65rem;
    }
    .mobile-nav-toggle strong {
        font-size: 0.8rem;
    }
    .chip {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }
    .ranking-list li {
        grid-template-columns: 34px 1fr 70px;
    }
    .qr-modal-content img {
        width: min(100%, 220px);
    }
}

/* ------- Enhancements for rule automation ------- */
.score-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.alert-list.horizontal {
    flex-direction: row;
    flex-wrap: wrap;
}
.alert-list.horizontal .alert {
    margin-right: 0.5rem;
}
.alert.alerta {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
}
.alert.ok {
    background: rgba(34, 197, 94, 0.15);
    color: #34d399;
}

.timeline-weekly {
    display: flex;
    gap: 0.8rem;
}
.timeline-weekly div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}
.timeline-weekly span {
    width: 16px;
    background: var(--primary);
    border-radius: 6px 6px 0 0;
    display: block;
}
.timeline-weekly small {
    font-size: 0.65rem;
    color: var(--text-soft);
}

.chip {
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(3, 31, 140, 0.2);
    font-size: 0.85rem;
}
.chip.ok {
    background: rgba(34, 197, 94, 0.15);
    color: #34d399;
}
.chip.warning {
    background: rgba(250, 204, 21, 0.15);
    color: #facc15;
}
.chip.critico,
.chip.blocked {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}
.chip.exception {
    background: rgba(129, 140, 248, 0.2);
    color: #a5b4fc;
}

.auto-score {
    background: rgba(3, 31, 140, 0.08);
    border: 1px dashed rgba(3, 31, 140, 0.25);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    margin: 0.6rem 0;
}
.auto-score strong {
    font-size: 1.4rem;
}

.rules,
.notice,
.priority,
.presence-insights,
.metas {
    margin-top: 1rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    padding: 1rem;
    background: #f8fbff;
}
.rules ul,
.metas ul {
    list-style: square inside;
    margin-top: 0.5rem;
    color: var(--text-soft);
}
.notice {
    background: var(--accent-soft);
}

.project-list.extended li {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.4rem;
}

.project-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.team-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-soft);
}

.project-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.project-form label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.9rem;
}

.project-form input,
.project-form select,
.project-form textarea {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(3, 31, 140, 0.2);
    border-radius: 10px;
    padding: 0.6rem;
    color: var(--primary-dark);
}

.project-form select {
    font-weight: 500;
}

.project-form option {
    color: var(--primary-dark);
    background: #ffffff;
}

.project-form.finalize {
    margin-top: 0.75rem;
    border: 1px dashed rgba(3, 31, 140, 0.25);
    padding: 0.75rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
}

.project-form.finalize .inline-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem;
}

.project-form.finalize textarea {
    min-height: 60px;
}

.project-form.finalize label.inline-checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-soft);
}

.project-form.finalize label.inline-checkbox input[type="checkbox"] {
    width: auto;
    accent-color: var(--primary);
}

.project-summary {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    background: rgba(3, 31, 140, 0.08);
    color: var(--primary-dark);
    font-size: 0.85rem;
}

.manifest-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.manifest-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid rgba(3, 31, 140, 0.09);
    border-radius: 18px;
    padding: 0.8rem 1rem;
    background: #ffffff;
    box-shadow: 0 16px 28px rgba(3, 31, 140, 0.08);
    position: relative;
    overflow: hidden;
}

.manifest-list .actions {
    display: flex;
    gap: 0.4rem;
}

.project-filter label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
}

.project-filter select {
    background: rgba(3, 31, 140, 0.08);
    border: 1px solid rgba(3, 31, 140, 0.2);
    border-radius: 8px;
    color: var(--text);
    padding: 0.4rem 0.6rem;
}

.project-ranking-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.project-ranking-card {
    border: 1px solid rgba(3, 31, 140, 0.08);
    border-radius: 18px;
    padding: 1rem;
    background: #ffffff;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.awards-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.muted {
    color: var(--text-soft);
    font-size: 0.85rem;
}
.priority strong {
    display: block;
    font-size: 1.2rem;
    margin-top: 0.4rem;
}

.presence-insights ul {
    list-style: none;
    padding: 0;
    margin: 0.4rem 0;
}
.presence-insights ul li {
    font-size: 0.9rem;
    color: var(--text-soft);
}

.event-list.eventos .impacto-extra {
    font-size: 0.8rem;
    color: var(--primary-light);
}

.metas li {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px dashed rgba(148, 163, 184, 0.3);
}
.metas li:last-child {
    border-bottom: none;
}

.prototype-feedback {
    display: block;
    margin-top: 0.5rem;
}
