:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --accent: #005fb8;
    --accent-dark: #004c95;
    --accent-2: #2e7d32;
    --accent-3: #00838f;
    --neutral: #f8f9fa;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    --danger-bg: #fef2f2;
    --danger-text: #991b1b;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 28%),
        radial-gradient(circle at top right, rgba(17, 94, 89, 0.08), transparent 22%),
        linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

.auth-body {
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-shell {
    width: 100%;
    max-width: 460px;
}

.auth-card,
.info-card,
.hero-panel {
    background: var(--panel);
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.auth-card {
    padding: 32px;
}

.card-heading h1,
.dashboard-hero h1 {
    margin: 0 0 10px;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.05;
}

.eyebrow {
    margin: 0 0 8px;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
}

.muted {
    color: var(--muted);
}

.form {
    margin-top: 24px;
    display: grid;
    gap: 18px;
}

.field {
    display: grid;
    gap: 8px;
}

.field label {
    font-weight: 700;
    font-size: 0.95rem;
}

.field input {
    width: 100%;
    appearance: none;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 1rem;
    background: #fff;
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
    outline: none;
    border-color: rgba(15, 118, 110, 0.6);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.field-help {
    color: var(--muted);
    font-size: 0.85rem;
}

.primary-button,
.nav-button {
    border: 0;
    border-radius: 14px;
    padding: 13px 18px;
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.2s ease, color 0.2s ease;
}

.primary-button {
    background: var(--accent);
    color: #fff;
}

.primary-button:hover,
.nav-button:hover {
    transform: translateY(-1px);
}

.nav-button {
    background: #e2e8f0;
    color: #111827;
}

.alert {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 14px;
    font-weight: 600;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.app-body {
    padding: 20px;
}

.site-header,
.app-main {
    width: min(1120px, 100%);
    margin: 0 auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 0 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
}

.brand-name {
    font-size: 1.1rem;
    font-weight: 800;
}

.brand-tag {
    color: var(--muted);
    font-size: 0.88rem;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-link {
    color: var(--muted);
    font-weight: 600;
}

.logout-form {
    margin: 0;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: 1.5fr 0.9fr;
    gap: 18px;
    align-items: stretch;
    margin-bottom: 18px;
}

.hero-copy,
.hero-panel,
.info-card {
    padding: 28px;
}

.hero-panel {
    display: grid;
    align-content: center;
    gap: 16px;
}

.stat {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.stat:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.stat-label {
    color: var(--muted);
}

.stat-value {
    font-weight: 800;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.info-card h2 {
    margin: 0 0 12px;
    font-size: 1.25rem;
}

.info-card p,
.info-card li {
    color: #374151;
    line-height: 1.65;
}

.check-list {
    margin: 0;
    padding-left: 18px;
}

@media (max-width: 780px) {
    .site-header,
    .dashboard-hero,
    .content-grid {
        grid-template-columns: 1fr;
        display: grid;
    }

    .site-header {
        gap: 16px;
    }

    .site-nav {
        justify-content: space-between;
    }

    .auth-card,
    .hero-copy,
    .hero-panel,
    .info-card {
        padding: 22px;
    }
}

.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 95, 184, 0.16);
    border-radius: 14px;
    padding: 13px 18px;
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    background: rgba(0, 95, 184, 0.08);
    color: #004f99;
    transition: transform 0.18s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.secondary-button:hover {
    transform: translateY(-1px);
    background: rgba(0, 95, 184, 0.12);
    box-shadow: 0 8px 24px rgba(0, 95, 184, 0.12);
}

.junta-hero {
    display: grid;
    grid-template-columns: 1.25fr 0.95fr;
    gap: 22px;
    align-items: stretch;
    margin-bottom: 22px;
}

.junta-hero-copy,
.junta-hero-visual,
.insight-card,
.table-shell,
.payment-card,
.modal-card,
.preview-panel {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(229, 231, 235, 0.95);
    border-radius: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.junta-hero-copy,
.junta-hero-visual,
.insight-card {
    padding: 30px;
}

.junta-hero-copy h1 {
    margin: 0 0 14px;
    max-width: 12ch;
    font-size: clamp(2.2rem, 5vw, 4.25rem);
    line-height: 0.98;
    letter-spacing: -0.04em;
}

.junta-hero-text {
    max-width: 62ch;
    font-size: 1.03rem;
    line-height: 1.75;
}

.hero-actions {
    margin-top: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-chips {
    margin-top: 24px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.hero-chip {
    padding: 16px 18px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(0, 95, 184, 0.06), rgba(46, 125, 50, 0.05));
    border: 1px solid rgba(0, 95, 184, 0.08);
}

.hero-chip span,
.visual-mini,
.detail-label,
.member-subcopy,
.section-note,
.payment-copy small {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
}

.hero-chip strong {
    display: block;
    margin-top: 4px;
    font-size: 0.98rem;
}

.junta-hero-visual {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at top left, rgba(0, 95, 184, 0.14), transparent 34%),
        radial-gradient(circle at bottom right, rgba(46, 125, 50, 0.12), transparent 30%),
        rgba(255, 255, 255, 0.88);
}

.junta-hero-visual::before,
.junta-hero-visual::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    filter: blur(4px);
    pointer-events: none;
}

.junta-hero-visual::before {
    inset: auto -40px 18px auto;
    width: 160px;
    height: 160px;
    background: rgba(0, 131, 143, 0.15);
}

.junta-hero-visual::after {
    inset: -42px auto auto -28px;
    width: 130px;
    height: 130px;
    background: rgba(0, 95, 184, 0.12);
}

.visual-shell {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 20px;
    height: 100%;
}

.visual-topline,
.visual-stats,
.section-heading,
.modal-header,
.modal-payments-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.visual-topline {
    align-items: center;
}

.visual-orbit {
    position: relative;
    min-height: 310px;
    display: grid;
    place-items: center;
    isolation: isolate;
}

.visual-orbit::before {
    content: "";
    position: absolute;
    width: min(100%, 340px);
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px dashed rgba(0, 95, 184, 0.18);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.18));
    box-shadow: inset 0 0 0 18px rgba(0, 95, 184, 0.04);
}

.orbit-avatar {
    position: absolute;
    width: 74px;
    height: 74px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    object-fit: cover;
    z-index: 2;
}

.orbit-one {
    top: 18%;
    left: 16%;
}

.orbit-two {
    top: 10%;
    right: 18%;
}

.orbit-three {
    bottom: 16%;
    left: 28%;
}

.visual-center {
    position: relative;
    z-index: 3;
    display: grid;
    gap: 8px;
    place-items: center;
    width: min(100%, 230px);
    padding: 30px;
    text-align: center;
    border-radius: 28px;
    background: linear-gradient(160deg, rgba(0, 95, 184, 0.96), rgba(0, 131, 143, 0.88));
    color: #fff;
    box-shadow: 0 18px 48px rgba(0, 95, 184, 0.26);
}

.visual-center-kicker {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.9;
}

.visual-center strong {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1;
}

.visual-center small {
    font-size: 0.92rem;
    opacity: 0.86;
}

.visual-stats {
    padding: 18px 20px;
    border-radius: 22px;
    background: rgba(248, 249, 250, 0.78);
    border: 1px solid rgba(229, 231, 235, 0.9);
}

.visual-stats span,
.section-summary span,
.payment-copy span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.85rem;
}

.visual-stats strong,
.section-summary strong {
    display: block;
    font-size: 1rem;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.insight-card h2,
.section-heading h2,
.modal-title-wrap h2,
.modal-payments-head h3 {
    margin: 0 0 12px;
    font-size: 1.3rem;
}

.metric-value {
    display: block;
    margin: 6px 0 14px;
    font-size: clamp(1.9rem, 3vw, 2.6rem);
    line-height: 1;
    letter-spacing: -0.03em;
    color: #0f172a;
}

.progress-track {
    margin: 14px 0 10px;
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: rgba(0, 95, 184, 0.08);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-3), var(--accent-2));
    box-shadow: 0 8px 18px rgba(0, 95, 184, 0.22);
}

.accent-card {
    background:
        radial-gradient(circle at top right, rgba(0, 131, 143, 0.08), transparent 30%),
        rgba(255, 255, 255, 0.88);
}

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.soft-pill,
.turn-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.88rem;
    background: rgba(0, 95, 184, 0.08);
    color: #004f99;
}

.members-section,
.payments-section {
    margin-bottom: 22px;
}

.section-heading {
    align-items: center;
    margin-bottom: 14px;
}

.section-summary {
    min-width: 168px;
    padding: 16px 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(229, 231, 235, 0.9);
    box-shadow: var(--shadow);
}

.table-shell {
    overflow: hidden;
}

.members-table {
    width: 100%;
    border-collapse: collapse;
}

.members-table thead th {
    padding: 18px 20px;
    text-align: left;
    font-size: 0.84rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    background: rgba(248, 249, 250, 0.92);
}

.member-row {
    transition: transform 0.2s ease, background 0.2s ease;
}

.member-row:hover {
    background: rgba(0, 95, 184, 0.03);
}

.member-row td {
    padding: 18px 20px;
    border-top: 1px solid rgba(229, 231, 235, 0.9);
    vertical-align: middle;
}

.member-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.member-name {
    display: block;
    margin-bottom: 4px;
}

.turn-badge {
    background: rgba(46, 125, 50, 0.1);
    color: #256029;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.88rem;
}

.status-paid {
    background: rgba(46, 125, 50, 0.12);
    color: #256029;
}

.status-pending {
    background: rgba(245, 158, 11, 0.16);
    color: #92400e;
}

.info-button {
    white-space: nowrap;
}

.payments-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.payment-card {
    padding: 14px;
    display: grid;
    gap: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.payment-card:hover,
.payment-item:hover,
.modal-card:hover {
    transform: translateY(-2px);
}

.payment-thumb {
    width: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.payment-thumb img {
    width: 100%;
    display: block;
    border-radius: 18px;
    border: 1px solid rgba(199, 215, 244, 0.9);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.payment-copy strong,
.payment-item strong {
    display: block;
    margin-bottom: 4px;
    font-size: 1rem;
}

.payment-copy span {
    margin-bottom: 4px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 50;
}

.modal-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-card {
    position: relative;
    width: min(100%, 940px);
    max-height: min(90vh, 920px);
    overflow: auto;
    padding: 28px;
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 95, 184, 0.08);
    color: #004f99;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
}

.modal-header {
    align-items: center;
    margin-bottom: 20px;
    padding-right: 46px;
}

.modal-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
}

.modal-title-wrap {
    flex: 1;
}

.modal-status-wrap {
    display: grid;
    gap: 10px;
    justify-items: end;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.detail-card {
    padding: 18px 20px;
    border-radius: 22px;
    background: rgba(248, 249, 250, 0.84);
    border: 1px solid rgba(229, 231, 235, 0.9);
}

.detail-card strong {
    display: block;
    margin: 4px 0 10px;
    font-size: 1.25rem;
}

.modal-payments-head {
    align-items: center;
    margin-bottom: 14px;
}

.payment-list {
    display: grid;
    gap: 12px;
}

.payment-item {
    width: 100%;
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 12px;
    border: 1px solid rgba(229, 231, 235, 0.95);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    text-align: left;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.payment-item:hover {
    border-color: rgba(0, 95, 184, 0.2);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.payment-item img {
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(199, 215, 244, 0.8);
}

.preview-panel {
    margin-top: 16px;
    padding: 16px;
    display: grid;
    grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
    gap: 16px;
    align-items: center;
}

.preview-image {
    width: 100%;
    border-radius: 20px;
    border: 1px solid rgba(199, 215, 244, 0.9);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.modal-open {
    overflow: hidden;
}

@media (max-width: 1080px) {
    .junta-hero,
    .insights-grid,
    .payments-grid {
        grid-template-columns: 1fr;
    }

    .junta-hero-copy h1 {
        max-width: none;
    }

    .visual-orbit {
        min-height: 280px;
    }
}

@media (max-width: 780px) {
    .junta-hero-copy,
    .junta-hero-visual,
    .insight-card,
    .modal-card {
        padding: 22px;
    }

    .hero-chips,
    .modal-grid,
    .preview-panel {
        grid-template-columns: 1fr;
    }

    .section-heading,
    .visual-topline,
    .modal-header,
    .modal-payments-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal-status-wrap {
        justify-items: start;
    }

    .members-table,
    .members-table thead,
    .members-table tbody,
    .members-table tr,
    .members-table td {
        display: block;
        width: 100%;
    }

    .members-table thead {
        display: none;
    }

    .member-row {
        margin-bottom: 14px;
        border: 1px solid rgba(229, 231, 235, 0.95);
        border-radius: 22px;
        overflow: hidden;
        background: rgba(255, 255, 255, 0.92);
    }

    .member-row td {
        border-top: 0;
        padding: 12px 16px;
        display: grid;
        grid-template-columns: 120px 1fr;
        gap: 10px;
        align-items: center;
    }

    .member-row td::before {
        content: attr(data-label);
        font-size: 0.8rem;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--muted);
    }

    .member-row td:nth-child(1) {
        grid-template-columns: 1fr;
    }

    .member-row td:nth-child(1)::before {
        margin-bottom: 8px;
    }

    .member-row td:nth-child(1) img {
        justify-self: start;
    }

    .member-row td:last-child {
        padding-bottom: 18px;
    }

    .info-button {
        width: 100%;
    }

    .payment-item {
        grid-template-columns: 1fr;
    }
}
