:root {
    --blue: #0756a4;
    --blue-2: #003f7d;
    --blue-3: #e8f2ff;
    --cyan: #16a3c7;
    --green: #087443;
    --red: #b42318;
    --yellow: #a15c07;
    --text: #172033;
    --muted: #64748b;
    --line: #d9e4f2;
    --soft: #f4f8fd;
    --white: #ffffff;
    --shadow: 0 18px 45px rgba(15, 43, 76, .13);
    --shadow-soft: 0 10px 26px rgba(15, 43, 76, .08);
    --radius: 8px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background:
        linear-gradient(90deg, rgba(7, 86, 164, .035) 1px, transparent 1px),
        linear-gradient(180deg, #f8fbff 0, #ffffff 320px);
    background-size: 42px 42px, auto;
    line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
img { display: block; max-width: 100%; }

.topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    background: transparent;
    border-bottom: 0;
    backdrop-filter: none;
    padding: 22px 0;
}

.topbar .brand {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0;
    color: var(--blue);
    font-weight: 800;
}

.brand img {
    width: auto;
    height: 112px;
    object-fit: contain;
    filter: drop-shadow(0 8px 18px rgba(0, 28, 62, .22));
}

.survey-page .topbar {
    display: none;
}

.hero {
    position: relative;
    overflow: hidden;
    color: #fff;
    padding: 154px 20px 64px;
    background:
        linear-gradient(135deg, rgba(0, 63, 125, .96), rgba(7, 86, 164, .93)),
        linear-gradient(45deg, #0756a4, #16a3c7);
}

.hero::after {
    content: "";
    position: absolute;
    inset: auto -10% -58px 36%;
    height: 150px;
    background: rgba(255, 255, 255, .12);
    transform: skewY(-7deg);
    pointer-events: none;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(115deg, transparent 0 52%, rgba(255, 255, 255, .09) 52% 53%, transparent 53%),
        linear-gradient(125deg, transparent 0 68%, rgba(255, 255, 255, .07) 68% 69%, transparent 69%);
    pointer-events: none;
}

.hero div,
.content,
.survey-header {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.hero div { position: relative; z-index: 1; }

.hero h1,
.survey-header h1 {
    margin: 8px 0 12px;
    font-size: 3rem;
    line-height: 1.08;
    letter-spacing: 0;
}

.hero p {
    max-width: 680px;
    margin: 0;
    font-size: 1.12rem;
    color: rgba(255, 255, 255, .92);
}

.content { padding: 30px 0; }
.narrow { width: min(920px, calc(100% - 32px)); }

.survey-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin-top: -54px;
    position: relative;
    z-index: 2;
}

.survey-card,
.empty-state,
.form-panel,
.login-card,
.qr-box {
    border: 1px solid rgba(217, 228, 242, .95);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .98);
    box-shadow: var(--shadow-soft);
}

.survey-card {
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.survey-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: rgba(7, 86, 164, .24);
}

.survey-thumb {
    width: 100%;
    height: 184px;
    object-fit: cover;
    background: var(--blue-3);
}

.survey-card-body { padding: 18px; }

.survey-card h2 {
    margin: 12px 0 8px;
    font-size: 1.25rem;
    line-height: 1.25;
}

.survey-card p { color: var(--muted); }

.survey-meta {
    display: grid;
    gap: 4px;
    margin: 12px 0 16px;
    color: var(--muted);
    font-size: .88rem;
}

.empty-state {
    padding: 28px;
    margin-top: -36px;
    position: relative;
    z-index: 2;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--blue);
    padding: 10px 15px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform .14s ease, filter .14s ease, box-shadow .14s ease;
}

.button:hover,
button:hover {
    filter: brightness(.98);
    transform: translateY(-1px);
}

.button.primary,
button.primary {
    color: #fff;
    border-color: var(--blue);
    background: linear-gradient(135deg, var(--blue), var(--blue-2));
    box-shadow: 0 12px 24px rgba(7, 86, 164, .22);
}

.block { width: 100%; }
.large { min-height: 54px; padding: 14px 18px; font-size: 1.05rem; }
.button.disabled {
    color: #64748b;
    border-color: #d9e4f2;
    background: #eef3f8;
    cursor: not-allowed;
    box-shadow: none;
}
.button.disabled:hover {
    transform: none;
    filter: none;
}

.status {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    padding: 5px 11px;
    font-size: .78rem;
    font-weight: 800;
    background: #edf2f7;
    color: #344054;
}

.status.active { background: #dcfae6; color: var(--green); }
.status.voted { background: #e8f2ff; color: var(--blue); }
.status.ended,
.status.inactive { background: #fee4e2; color: var(--red); }
.status.scheduled { background: #fef0c7; color: var(--yellow); }

.survey-header {
    position: relative;
    margin-top: 0;
    padding: 0 0 12px;
}

.survey-feature {
    display: grid;
    gap: 0;
    width: 100%;
    margin: 0;
    padding: 62px 20px 0;
    background:
        linear-gradient(135deg, rgba(0, 63, 125, .96), rgba(7, 86, 164, .93)),
        linear-gradient(45deg, #0756a4, #16a3c7);
    overflow: hidden;
}

.survey-feature::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(115deg, transparent 0 52%, rgba(255, 255, 255, .09) 52% 53%, transparent 53%),
        linear-gradient(125deg, transparent 0 68%, rgba(255, 255, 255, .07) 68% 69%, transparent 69%);
    pointer-events: none;
}

.survey-feature .banner {
    width: 100%;
    max-width: 1120px;
    max-height: 380px;
    object-fit: cover;
    border-radius: var(--radius);
    margin: 0 auto;
    box-shadow: var(--shadow);
    background: var(--blue-3);
    position: relative;
    z-index: 1;
}

.survey-title-card {
    position: relative;
    z-index: 2;
    width: min(920px, calc(100% - 24px));
    margin: -38px auto 0;
    border: 1px solid rgba(217, 228, 242, .95);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .97);
    box-shadow: var(--shadow);
    padding: 22px;
}

.survey-feature:not(:has(.banner)) .survey-title-card {
    margin-top: 0;
    margin-bottom: 44px;
}

.thanks-feature {
    min-height: 62vh;
    align-items: center;
    padding-bottom: 64px;
}

.thanks-card {
    position: relative;
    z-index: 1;
    width: min(680px, calc(100% - 32px));
    margin: 0 auto;
    border: 1px solid rgba(217, 228, 242, .95);
    border-radius: var(--radius);
    background: rgba(255,255,255,.98);
    box-shadow: var(--shadow);
    padding: 26px;
}

.thanks-card h1 {
    margin: 10px 0;
    color: var(--blue-2);
}

.thanks-card p {
    color: var(--muted);
}

.loading-bar {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e7eef8;
    margin: 18px 0;
}

.loading-bar span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--blue), var(--cyan));
    animation: loadingReturn 2s linear forwards;
}

@keyframes loadingReturn {
    to { width: 100%; }
}

.survey-header h1 { color: var(--blue-2); }

.survey-header p {
    max-width: 820px;
    color: var(--muted);
    font-size: 1.05rem;
}

.survey-context-card {
    border: 1px solid rgba(217, 228, 242, .95);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--shadow-soft);
    padding: 18px;
}

.vote-form {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-soft);
}

.vote-form-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.vote-form-head h2 {
    margin: 0;
    color: var(--blue-2);
}

.vote-form-head span {
    color: var(--muted);
    font-weight: 800;
    font-size: .9rem;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
    margin: 8px 0 18px;
}

.option-card {
    position: relative;
    display: grid;
    gap: 11px;
    min-height: 100%;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    padding: 13px;
    background: linear-gradient(180deg, #fff, #fafdff);
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.option-card:not(:has(.option-media)) {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 64px;
    padding-left: 18px;
    padding-right: 14px;
}

.option-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
    border-color: rgba(7, 86, 164, .38);
}

.option-card:has(input:checked) {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(7, 86, 164, .12), var(--shadow-soft);
    background: #fff;
}

.option-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-check {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, .95);
    border-radius: 50%;
    background: rgba(7, 86, 164, .7);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .22);
    z-index: 1;
}

.option-card:not(:has(.option-media)) .option-check {
    position: static;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
}

.option-card input:checked + .option-check,
.option-card:has(input:checked) .option-check {
    background: var(--blue);
}

.option-card input:checked + .option-check::after,
.option-card:has(input:checked) .option-check::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 3px;
    width: 7px;
    height: 12px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.option-media {
    display: block;
    overflow: hidden;
    border-radius: 6px;
    background: #eef3f8;
}

.option-card img {
    width: 100%;
    height: 178px;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: center;
    background: #eef3f8;
    transition: transform .22s ease;
}

.option-card:hover img {
    transform: scale(1.025);
}

.option-card strong {
    display: block;
    padding-left: 2px;
    font-size: 1.02rem;
    line-height: 1.3;
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.privacy {
    margin: 12px 0 16px;
    border-left: 4px solid var(--cyan);
    border-radius: var(--radius);
    background: #eef8fc;
    color: #315566;
    padding: 12px 14px;
    font-size: .93rem;
}

.hp-field { position: absolute; left: -9999px; }

.notice,
.success,
.alert {
    border-radius: var(--radius);
    padding: 14px 16px;
    margin: 14px 0;
}

.notice { background: #fff8e7; color: #7a4a00; border: 1px solid #fde7af; }
.success,
.alert.success { background: #ecfdf3; color: #05603a; border: 1px solid #abefc6; }
.alert.error { background: #fef3f2; color: #b42318; border: 1px solid #fecdca; }

.results {
    margin-top: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 18px;
    box-shadow: var(--shadow-soft);
}

.results h2 { margin-top: 0; }
.total { color: var(--muted); }

.result-row { margin: 15px 0; }

.result-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 7px;
}

.bar {
    height: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #e7eef8;
}

.bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 28px;
    padding: 24px 20px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    text-align: center;
    background: #fff;
}

.footer img {
    width: auto;
    height: 42px;
    object-fit: contain;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        linear-gradient(135deg, rgba(7, 86, 164, .08), rgba(22, 163, 199, .08)),
        var(--soft);
}

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

.login-card h1 { margin-top: 0; color: var(--blue-2); }

.login-card label,
.form-panel label {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
    font-weight: 800;
}

.login-card input,
.form-panel input,
.form-panel textarea,
.form-panel select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 11px 12px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.login-card input:focus,
.form-panel input:focus,
.form-panel textarea:focus,
.form-panel select:focus {
    outline: 3px solid rgba(7, 86, 164, .15);
    border-color: var(--blue);
}

.form-panel textarea { min-height: 110px; resize: vertical; }

.admin-body {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
    background: var(--soft);
}

.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid rgba(255,255,255,.14);
    background: linear-gradient(180deg, var(--blue-2), #062f5d);
    padding: 22px;
    color: #fff;
}

.admin-logo {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.admin-logo img {
    width: 170px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.admin-sidebar strong {
    color: #fff;
    font-size: 1.25rem;
}

.admin-sidebar nav {
    display: grid;
    gap: 8px;
    margin: 22px 0;
}

.admin-sidebar a {
    border-radius: var(--radius);
    padding: 10px 12px;
    color: rgba(255,255,255,.9);
    font-weight: 800;
}

.admin-sidebar a:hover { background: rgba(255,255,255,.12); color:#fff; }
.admin-sidebar small { color: rgba(255,255,255,.74); }

.admin-main {
    min-width: 0;
    padding: 26px;
}

.admin-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 16px 18px;
    box-shadow: var(--shadow-soft);
}

.admin-top span {
    color: var(--muted);
    font-weight: 800;
    font-size: .86rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.admin-top h1 {
    margin: 2px 0 0;
    color: var(--blue-2);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metrics div {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 18px;
    box-shadow: var(--shadow-soft);
}

.metrics strong {
    display: block;
    color: var(--blue);
    font-size: 2rem;
}

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

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0 18px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-soft);
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    background: #f8fafc;
    color: #344054;
}

.actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.actions form { display: inline; }
.actions button { min-height: 34px; padding: 6px 10px; }

.form-panel {
    max-width: 980px;
    margin-bottom: 22px;
    padding: 0;
    overflow: hidden;
}

.form-panel.compact { max-width: 640px; }

.form-section {
    padding: 18px;
    border-bottom: 1px solid var(--line);
}

.form-section h2 {
    margin: 0 0 14px;
    color: var(--blue-2);
    font-size: 1.12rem;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 18px;
    background: #f8fafc;
}

.two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.checks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 4px 14px;
    margin-bottom: 14px;
}

.checks label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
}

.checks input { width: auto; }

.mini-img {
    width: 86px;
    height: 58px;
    object-fit: cover;
    border-radius: 6px;
    background: #eef3f8;
}

.help-text {
    margin-top: -4px;
    color: var(--muted);
}

.option-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
    margin: 12px 0 18px;
}

.option-admin-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fafc;
    padding: 14px;
}

.option-admin-card label { margin-bottom: 10px; }

.option-admin-card .mini-img {
    width: 100%;
    height: 96px;
    object-fit: cover;
    object-position: center;
}

.result-admin {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 20px;
    align-items: start;
}

.result-admin > div,
.qr-box {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 18px;
    box-shadow: var(--shadow-soft);
}

.qr-box img { margin: auto; }

.qr-box small {
    display: block;
    margin-top: 10px;
    color: var(--muted);
    word-break: break-all;
}

.ua {
    max-width: 440px;
    word-break: break-word;
}

@media (max-width: 760px) {
    body { background: #fff; }
    .topbar { padding: 14px 0; }
    .topbar .brand { width: calc(100% - 28px); }
    .brand img { height: 78px; }
    .hero { padding: 112px 16px 56px; }
    .hero div,
    .content,
    .survey-header,
    .narrow { width: calc(100% - 28px); }
    .hero h1,
    .survey-header h1 { font-size: 2rem; }
    .survey-grid {
        grid-template-columns: 1fr;
        margin-top: -42px;
    }
    .survey-feature { padding: 32px 14px 0; }
    .survey-title-card {
        width: calc(100% - 12px);
        margin-top: -24px;
        padding: 16px;
    }
    .survey-context-card {
        padding: 12px;
        box-shadow: none;
    }
    .vote-form-head {
        display: grid;
    }
    .survey-card-body,
    .vote-form,
    .results { padding: 15px; }
    .survey-thumb { height: 156px; }
    .option-grid { grid-template-columns: 1fr; }
    .option-card { padding: 12px; }
    .option-card:not(:has(.option-media)) {
        padding-left: 14px;
        padding-right: 12px;
    }
    .option-card img { height: 154px; }
    .button,
    button { width: 100%; }
    .admin-body { display: block; }
    .admin-sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .admin-sidebar nav { grid-template-columns: repeat(2, 1fr); }
    .admin-main { padding: 18px; }
    .admin-top {
        display: grid;
    }
    .admin-top .button {
        width: 100%;
    }
    .two-cols,
    .result-admin { grid-template-columns: 1fr; }
    .actions .button,
    .actions button,
    .actions a { width: auto; }
    .footer img { height: 36px; }
}
