:root {
    --green-950: #063c2b;
    --green-900: #07553a;
    --green-800: #0a6846;
    --green-700: #0c7a50;
    --green-100: #dff5ea;
    --green-50: #effaf5;
    --ink-950: #101b17;
    --ink-800: #26332e;
    --ink-600: #5d6b65;
    --ink-500: #76837e;
    --line: #dfe7e3;
    --surface: #ffffff;
    --canvas: #f3f6f4;
    --danger: #b42318;
    --danger-bg: #fff1f0;
    --info: #175cd3;
    --info-bg: #eff8ff;
    --shadow-sm: 0 1px 2px rgba(16, 27, 23, .04);
    --shadow-md: 0 18px 48px rgba(9, 52, 37, .10);
    --radius-sm: 10px;
    --radius-md: 18px;
    --radius-lg: 28px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    color: var(--ink-950);
    background: var(--canvas);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    margin: 0;
}

button,
input,
select {
    font: inherit;
}

button,
select {
    cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(12, 122, 80, .24);
    outline-offset: 3px;
}

[hidden] {
    display: none !important;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--green-700);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.eyebrow--light {
    color: #a9e6ca;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-weight: 750;
    transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

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

.button svg {
    width: 20px;
    height: 20px;
}

.button--primary {
    color: #fff;
    background: var(--green-800);
    box-shadow: 0 8px 20px rgba(10, 104, 70, .18);
}

.button--primary:hover {
    background: var(--green-900);
}

.button--secondary {
    color: var(--green-900);
    border: 1px solid #b9d5c9;
    background: var(--surface);
}

.button--secondary:hover {
    border-color: var(--green-700);
    background: var(--green-50);
}

.button--quiet {
    min-height: 40px;
    color: var(--ink-600);
    border: 1px solid var(--line);
    background: transparent;
}

.button--quiet:hover {
    color: var(--green-900);
    border-color: #bdd3c8;
    background: var(--green-50);
}

.button--full {
    width: 100%;
}

.notice {
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: .9rem;
}

.notice--error {
    color: var(--danger);
    border-color: #fecdca;
    background: var(--danger-bg);
}

.notice--info {
    color: var(--info);
    border-color: #b2ddff;
    background: var(--info-bg);
}

/* Secure access */

.login-page {
    overflow-x: hidden;
    background: #eef3f0;
}

.login-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
}

.login-brand {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 100vh;
    overflow: hidden;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(34px, 5vw, 72px);
    color: #fff;
    background:
        radial-gradient(circle at 90% 15%, rgba(140, 228, 189, .16), transparent 31%),
        linear-gradient(145deg, #07553a 0%, #063423 100%);
}

.brand-mark {
    position: relative;
    z-index: 2;
}

.brand-mark img {
    display: block;
    width: min(330px, 80%);
    height: auto;
}

.brand-mark--light img {
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .12);
}

.login-brand__content {
    position: relative;
    z-index: 2;
    max-width: 590px;
    margin: auto 0;
    padding: 80px 0;
}

.login-brand h1 {
    max-width: 540px;
    margin: 0 0 22px;
    font-size: clamp(2.8rem, 5.8vw, 5.5rem);
    font-weight: 760;
    letter-spacing: -.055em;
    line-height: .97;
}

.login-brand__content > p:last-child {
    max-width: 520px;
    margin: 0;
    color: #cfe7da;
    font-size: clamp(1rem, 1.4vw, 1.18rem);
    line-height: 1.75;
}

.login-brand__footer {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #cfe7da;
    font-size: .88rem;
    font-weight: 650;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #61d7a2;
    box-shadow: 0 0 0 6px rgba(97, 215, 162, .12);
}

.brand-orbit {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 50%;
}

.brand-orbit--one {
    right: -240px;
    bottom: -170px;
    width: 650px;
    height: 650px;
}

.brand-orbit--two {
    right: -90px;
    bottom: -20px;
    width: 350px;
    height: 350px;
}

.login-access {
    display: grid;
    min-width: 0;
    min-height: 100vh;
    place-items: center;
    padding: 42px;
    background:
        radial-gradient(circle at 80% 15%, rgba(12, 122, 80, .07), transparent 26%),
        #f7f9f8;
}

.login-card {
    width: min(100%, 460px);
}

.login-card__icon {
    display: grid;
    width: 54px;
    height: 54px;
    margin-bottom: 28px;
    place-items: center;
    color: var(--green-800);
    border: 1px solid #c6e3d5;
    border-radius: 16px;
    background: var(--green-50);
}

.login-card__icon svg {
    width: 27px;
    height: 27px;
}

.login-card h2 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.75rem);
    letter-spacing: -.045em;
    line-height: 1.08;
}

.login-card__intro {
    margin: 14px 0 30px;
    color: var(--ink-600);
    font-size: 1rem;
}

.login-card .notice {
    margin-bottom: 18px;
}

.login-form {
    display: grid;
    gap: 12px;
}

.login-form label {
    color: var(--ink-800);
    font-size: .87rem;
    font-weight: 750;
}

.password-field input {
    width: 100%;
    height: 54px;
    color: var(--ink-950);
    border: 1px solid #ccd8d2;
    border-radius: 12px;
    padding: 0 15px;
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: border-color .18s ease, box-shadow .18s ease;
}

.password-field input:hover {
    border-color: #9fb8ac;
}

.password-field input:focus {
    border-color: var(--green-700);
    outline: none;
    box-shadow: 0 0 0 4px rgba(12, 122, 80, .1);
}

.login-form .button {
    height: 54px;
    margin-top: 7px;
}

.security-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 24px 0 0;
    color: var(--ink-500);
    font-size: .82rem;
    line-height: 1.55;
}

.security-note svg {
    width: 18px;
    min-width: 18px;
    margin-top: 1px;
}

/* Dashboard shell */

.dashboard-page {
    background: var(--canvas);
}

.topbar {
    position: sticky;
    z-index: 50;
    top: 0;
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid var(--line);
    padding: 11px clamp(20px, 4vw, 56px);
    background: rgba(255, 255, 255, .94);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(14px);
}

.topbar__brand {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--ink-950);
    text-decoration: none;
}

.topbar__brand img {
    width: 156px;
    height: 45px;
    object-fit: contain;
    object-position: left center;
}

.topbar__brand span {
    display: none;
}

.topbar__brand strong,
.topbar__brand small {
    display: block;
}

.topbar__brand strong {
    font-size: .9rem;
    letter-spacing: .02em;
}

.topbar__brand small {
    color: var(--ink-500);
    font-size: .72rem;
}

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

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip__avatar {
    display: grid;
    width: 39px;
    height: 39px;
    place-items: center;
    color: #fff;
    border-radius: 12px;
    background: var(--green-800);
    font-size: .9rem;
    font-weight: 800;
}

.user-chip__text strong,
.user-chip__text small {
    display: block;
}

.user-chip__text strong {
    max-width: 190px;
    overflow: hidden;
    font-size: .82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip__text small {
    color: var(--ink-500);
    font-size: .72rem;
}

.dashboard {
    width: min(1500px, calc(100% - 40px));
    margin: 0 auto;
    padding: 42px 0 70px;
}

.dashboard-hero {
    position: relative;
    display: flex;
    overflow: hidden;
    min-height: 220px;
    align-items: flex-end;
    justify-content: space-between;
    gap: 40px;
    border-radius: var(--radius-lg);
    padding: clamp(30px, 4vw, 54px);
    color: #fff;
    background:
        radial-gradient(circle at 85% 0%, rgba(121, 224, 178, .22), transparent 31%),
        linear-gradient(130deg, #06452f 0%, #0a6846 100%);
    box-shadow: var(--shadow-md);
}

.dashboard-hero::after {
    position: absolute;
    right: -85px;
    bottom: -240px;
    width: 480px;
    height: 480px;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 50%;
    content: "";
}

.dashboard-hero > * {
    position: relative;
    z-index: 1;
}

.live-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    color: #bcebd4;
    font-size: .73rem;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.live-label span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6ce1aa;
    box-shadow: 0 0 0 5px rgba(108, 225, 170, .13);
    animation: livePulse 1.8s ease-out infinite;
}

@keyframes livePulse {
    0% { box-shadow: 0 0 0 0 rgba(108, 225, 170, .35); }
    70% { box-shadow: 0 0 0 9px rgba(108, 225, 170, 0); }
    100% { box-shadow: 0 0 0 0 rgba(108, 225, 170, 0); }
}

.dashboard-hero h1 {
    margin: 0;
    font-size: clamp(2.4rem, 5vw, 4.3rem);
    letter-spacing: -.055em;
    line-height: 1;
}

.dashboard-hero p {
    margin: 14px 0 0;
    color: #cde6da;
    font-size: 1rem;
}

.hero-meta {
    display: grid;
    min-width: 220px;
    gap: 3px;
    text-align: right;
}

.hero-meta span {
    color: #a9d9c2;
    font-size: .74rem;
    font-weight: 750;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.hero-meta strong {
    font-size: 1.55rem;
}

.hero-meta small {
    margin-top: 5px;
    color: #bcd7ca;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 22px 0;
}

.summary-card {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 20px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.summary-card__icon {
    display: grid;
    width: 46px;
    height: 46px;
    min-width: 46px;
    place-items: center;
    border-radius: 13px;
}

.summary-card__icon svg {
    width: 23px;
    height: 23px;
}

.summary-card__icon--green {
    color: #067647;
    background: #ecfdf3;
}

.summary-card__icon--blue {
    color: #175cd3;
    background: #eff8ff;
}

.summary-card__icon--amber {
    color: #b54708;
    background: #fffaeb;
}

.summary-card__icon--violet {
    color: #6941c6;
    background: #f4f3ff;
}

.summary-card span,
.summary-card strong {
    display: block;
}

.summary-card span {
    overflow: hidden;
    color: var(--ink-500);
    font-size: .76rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summary-card strong {
    margin-top: 2px;
    font-size: clamp(1.35rem, 2vw, 1.85rem);
    letter-spacing: -.035em;
}

.filter-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 24px;
    background: var(--surface);
}

.filter-bar h2,
.section-heading h2 {
    margin: 0;
    font-size: 1.4rem;
    letter-spacing: -.025em;
}

.filter-bar p:last-child {
    max-width: 660px;
    margin: 7px 0 0;
    color: var(--ink-600);
    font-size: .88rem;
}

.filter-actions {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.select-field {
    display: grid;
    min-width: 310px;
    gap: 6px;
}

.select-field span {
    color: var(--ink-600);
    font-size: .74rem;
    font-weight: 750;
}

.select-field select {
    width: 100%;
    height: 44px;
    color: var(--ink-800);
    border: 1px solid #cbd8d2;
    border-radius: var(--radius-sm);
    padding: 0 38px 0 12px;
    background: #fff;
}

.dashboard-notice {
    margin-top: 22px;
}

.loading-panel {
    display: flex;
    min-height: 180px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--ink-600);
}

.spinner {
    width: 22px;
    height: 22px;
    border: 2px solid #c9d8d1;
    border-top-color: var(--green-700);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.results-section {
    margin-top: 44px;
}

.results-section--faculty {
    margin-top: 58px;
    border-top: 1px solid var(--line);
    padding-top: 44px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 17px;
}

.section-count {
    color: var(--ink-500);
    font-size: .82rem;
    font-weight: 650;
}

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

.result-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.result-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #edf1ef;
    padding: 20px 22px;
}

.result-card__title {
    min-width: 0;
}

.result-card__title h3 {
    overflow: hidden;
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: -.015em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-card__title p {
    margin: 4px 0 0;
    color: var(--ink-500);
    font-size: .76rem;
}

.vote-total {
    flex: none;
    border-radius: 999px;
    padding: 6px 10px;
    color: var(--green-900);
    background: var(--green-50);
    font-size: .74rem;
    font-weight: 800;
}

.result-card__body {
    display: grid;
    grid-template-columns: minmax(210px, .84fr) minmax(290px, 1.16fr);
    min-height: 330px;
}

.chart-wrap {
    position: relative;
    display: grid;
    min-height: 305px;
    place-items: center;
    border-right: 1px solid #edf1ef;
    padding: 20px;
}

.chart-wrap canvas {
    width: 100% !important;
    max-height: 265px;
}

.candidate-list {
    overflow-x: auto;
    padding: 10px 18px 18px;
}

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

.candidate-table th {
    padding: 10px 6px;
    color: var(--ink-500);
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-align: left;
    text-transform: uppercase;
}

.candidate-table th:last-child,
.candidate-table td:last-child {
    text-align: right;
}

.candidate-table td {
    border-top: 1px solid #edf1ef;
    padding: 11px 6px;
    vertical-align: middle;
}

.candidate-cell {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
}

.candidate-photo,
.candidate-initials {
    display: grid;
    width: 38px;
    height: 38px;
    min-width: 38px;
    overflow: hidden;
    place-items: center;
    border-radius: 12px;
}

.candidate-photo {
    object-fit: cover;
    background: #e8efeb;
}

.candidate-initials {
    color: var(--green-900);
    background: var(--green-100);
    font-size: .7rem;
    font-weight: 850;
}

.candidate-name {
    min-width: 0;
}

.candidate-name strong,
.candidate-name small {
    display: block;
}

.candidate-name strong {
    overflow: hidden;
    max-width: 210px;
    font-size: .78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.candidate-name small {
    margin-top: 2px;
    color: var(--ink-500);
    font-size: .65rem;
}

.rank {
    color: var(--ink-500);
    font-size: .72rem;
    font-weight: 750;
}

.vote-cell strong,
.vote-cell small {
    display: block;
}

.vote-cell strong {
    font-size: .82rem;
}

.vote-cell small {
    color: var(--ink-500);
    font-size: .67rem;
}

.leader-badge {
    display: inline-flex;
    margin-top: 4px;
    border-radius: 999px;
    padding: 2px 6px;
    color: #067647;
    background: #ecfdf3;
    font-size: .58rem;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.empty-card {
    display: grid;
    min-height: 180px;
    place-items: center;
    color: var(--ink-500);
    border: 1px dashed #bdcec6;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, .55);
    text-align: center;
}

.dashboard-footer {
    display: flex;
    width: min(1500px, calc(100% - 40px));
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 0 auto;
    border-top: 1px solid var(--line);
    padding: 24px 0 38px;
    color: var(--ink-500);
    font-size: .76rem;
}

.dashboard-footer p {
    margin: 0;
}

@media (min-width: 1200px) {
    .topbar__brand span {
        display: block;
    }
}

@media (max-width: 1180px) {
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .results-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-brand {
        min-height: 420px;
        padding: 34px;
    }

    .login-brand__content {
        padding: 70px 0 50px;
    }

    .login-brand h1 {
        font-size: clamp(2.6rem, 10vw, 4.4rem);
    }

    .login-access {
        min-height: auto;
        padding: 65px 24px;
    }

    .dashboard-hero,
    .filter-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero-meta {
        min-width: 0;
        text-align: left;
    }

    .filter-actions {
        width: 100%;
    }

    .select-field {
        min-width: 0;
        flex: 1;
    }
}

@media (max-width: 720px) {
    .topbar {
        min-height: 66px;
        padding: 9px 16px;
    }

    .topbar__brand img {
        width: 120px;
        height: 38px;
    }

    .user-chip__text {
        display: none;
    }

    .button--quiet span {
        display: none;
    }

    .button--quiet {
        width: 40px;
        padding: 0;
    }

    .dashboard {
        width: min(100% - 24px, 1500px);
        padding-top: 18px;
    }

    .dashboard-hero {
        min-height: 270px;
        border-radius: 20px;
        padding: 28px 24px;
    }

    .summary-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .summary-card {
        align-items: flex-start;
        flex-direction: column;
        gap: 11px;
        padding: 16px;
    }

    .summary-card__icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    .summary-card span {
        white-space: normal;
    }

    .filter-bar {
        padding: 19px;
    }

    .filter-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .result-card__body {
        grid-template-columns: 1fr;
    }

    .chart-wrap {
        min-height: 270px;
        border-right: 0;
        border-bottom: 1px solid #edf1ef;
    }

    .candidate-list {
        padding: 8px 12px 15px;
    }

    .dashboard-footer {
        width: min(100% - 24px, 1500px);
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 430px) {
    .login-brand {
        min-height: 360px;
        padding: 26px 22px;
    }

    .login-brand__content {
        padding: 52px 0 36px;
    }

    .login-brand h1 {
        font-size: 2.55rem;
    }

    .login-brand__content > p:last-child {
        font-size: .93rem;
    }

    .login-brand__footer {
        font-size: .76rem;
    }

    .login-access {
        padding: 52px 20px;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
