:root {
    --bg: #f4f7fb;
    --bg-soft: rgba(255, 255, 255, 0.72);
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --border: rgba(148, 163, 184, 0.22);
    --primary: #7c3aed;
    --primary-2: #06b6d4;
    --shadow: 0 18px 60px rgba(15, 23, 42, 0.12);
    --success: #16a34a;
    --danger: #dc2626;
    --logo-filter: none;
}


html[data-theme="dark"] {
    --bg: #08111f;
    --bg-soft: rgba(15, 23, 42, 0.72);
    --surface: #0f172a;
    --surface-2: #172033;
    --text: #e5eefb;
    --muted: #9fb0c8;
    --border: rgba(148, 163, 184, 0.14);
    --shadow: 0 22px 70px rgba(0, 0, 0, 0.4);
    --logo-filter: brightness(0) invert(1) saturate(0) brightness(1.5);
}


* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: 'Inter', system-ui, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(124,58,237,0.12), transparent 30%),
        radial-gradient(circle at bottom right, rgba(6,182,212,0.12), transparent 35%),
        var(--bg);
    color: var(--text);
    padding: max(16px, env(safe-area-inset-top)) 14px max(24px, env(safe-area-inset-bottom));
    transition: background .3s ease, color .3s ease;
}

a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }

.bg-orb {
    position: fixed;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    filter: blur(32px);
    opacity: 0.24;
    z-index: 0;
    pointer-events: none;
}
.orb-1 { top: -40px; left: -40px; background: #8b5cf6; }
.orb-2 { right: -60px; bottom: 15%; background: #06b6d4; }

.app-shell {
    position: relative;
    z-index: 1;
    max-width: 480px;
    margin: 0 auto;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

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

.logo, .logo-inline {
    width: 152px;
    height: 52px;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(124, 58, 237, 0.25);
    flex-shrink: 0;
}
.logo-inline { margin-bottom: 12px; }
.logo img, .logo-inline img { width: 100%; height: 100%; display: block; object-fit: contain; padding: 8px; filter: var(--logo-filter); transition: filter .25s ease; }


.logo, .logo-inline {
    background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(247,250,255,0.92));
    border: 1px solid rgba(255,255,255,0.5);
}
html[data-theme="dark"] .logo,
html[data-theme="dark"] .logo-inline {
    background: linear-gradient(135deg, rgba(15,23,42,0.95), rgba(30,41,59,0.92));
    border-color: rgba(148,163,184,0.18);
}
.blocked-card { text-align: center; }
.blocked-card .admin-actions { justify-content: center; }
.blocked-icon { margin-inline: auto; background: linear-gradient(135deg, rgba(220,38,38,0.12), rgba(124,58,237,0.12)); }

.eyebrow {
    margin: 0 0 2px;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

h1 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.2;
}

.theme-toggle {
    border: 1px solid var(--border);
    background: var(--bg-soft);
    backdrop-filter: blur(20px);
    color: var(--text);
    border-radius: 999px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow);
}

.card {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    backdrop-filter: blur(22px);
    border-radius: 28px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.progress-wrap { margin-bottom: 18px; }
.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
    color: var(--muted);
    margin-bottom: 8px;
}
.progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(148, 163, 184, 0.18);
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar span {
    display: block;
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-2));
    border-radius: inherit;
    transition: width .25s ease;
}

.step { display: none; animation: fadeUp .28s ease; }
.step.active { display: block; }
.step-icon, .success-icon {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    font-size: 1.7rem;
    margin-bottom: 14px;
    background: linear-gradient(135deg, rgba(124,58,237,0.16), rgba(6,182,212,0.12));
}
.step-number {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(124,58,237,0.1);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 12px;
}
.step h2, .success-card h2 {
    margin: 0 0 10px;
    font-size: 1.35rem;
    line-height: 1.25;
}
.step p, .success-card p {
    margin: 0 0 12px;
    color: var(--muted);
    line-height: 1.55;
}
.step-subtitle { margin-top: -2px; }

.info-box {
    background: linear-gradient(135deg, rgba(124,58,237,0.12), rgba(6,182,212,0.08));
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 14px;
    display: grid;
    gap: 6px;
}

.options-grid {
    display: grid;
    gap: 12px;
}
.option-card,
.textarea-card,
.input-card,
.rating-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 14px;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}
.option-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    min-height: 68px;
}
.option-card:hover,
.textarea-card:focus-within,
.input-card:focus-within {
    transform: translateY(-1px);
    border-color: rgba(124,58,237,0.38);
    box-shadow: 0 18px 30px rgba(124, 58, 237, 0.12);
}
.option-card input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    margin-top: 2px;
    flex-shrink: 0;
}
.option-card span { font-weight: 600; line-height: 1.4; }
.option-card.selected {
    border-color: rgba(124,58,237,0.55);
    background: linear-gradient(135deg, rgba(124,58,237,0.10), rgba(6,182,212,0.08));
}

.textarea-card textarea,
.input-card input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    resize: vertical;
}
.textarea-card textarea::placeholder,
.input-card input::placeholder { color: var(--muted); }
.input-card span,
.rating-title {
    display: block;
    margin-bottom: 10px;
    font-size: 0.92rem;
    color: var(--muted);
    font-weight: 600;
}

.final-grid {
    display: grid;
    gap: 12px;
}
.star-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.star-btn,
.reset-rating {
    border: none;
    background: var(--surface-2);
    color: #c0c9d8;
    border-radius: 18px;
    min-width: 44px;
    min-height: 44px;
    display: grid;
    place-items: center;
    font-size: 1.4rem;
    font-weight: 700;
    transition: transform .18s ease, background .18s ease, color .18s ease;
}
.reset-rating {
    font-size: 0.95rem;
    color: var(--muted);
    padding: 0 12px;
}
.star-btn.active,
.reset-rating.selected {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white;
}

#ratingHint {
    display: block;
    margin-top: 8px;
    color: var(--muted);
}

.form-message {
    min-height: 22px;
    margin-top: 14px;
    color: var(--danger);
    font-weight: 600;
}

.nav-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
}
.nav-actions.single { grid-template-columns: 1fr; }
.btn {
    border: none;
    border-radius: 18px;
    min-height: 52px;
    padding: 12px 16px;
    font-weight: 700;
    cursor: pointer;
}
.btn-primary {
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 16px 28px rgba(124, 58, 237, 0.28);
}
.btn-secondary {
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
}
.btn[disabled] {
    opacity: .45;
    cursor: not-allowed;
}
.hidden { display: none !important; }
.success-shell { padding-top: 2vh; }
.success-card { text-align: center; }
.success-icon { margin-inline: auto; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 640px) {
    body { padding: 24px; }
    .card { padding: 24px; }
    h1 { font-size: 1.18rem; }
    .final-grid { grid-template-columns: 1fr; }
}

/* Admin */
.admin-shell {
    gap: 16px;
}

.admin-intro-card,
.admin-filter-card,
.admin-list-card,
.chart-card,
.stat-card {
    position: relative;
    overflow: hidden;
}

.admin-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.stats-grid,
.charts-grid {
    display: grid;
    gap: 14px;
}

.stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card {
    padding: 16px;
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.2;
}

.stat-date {
    font-size: 1rem;
}

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

.admin-filter-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 1fr;
}

.chart-card {
    min-height: 320px;
}

.chart-wrap {
    position: relative;
    height: 250px;
}

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

.response-list {
    display: grid;
    gap: 14px;
}

.response-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.response-card-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}

.response-card-header h3 {
    margin: 0 0 4px;
    font-size: 1.05rem;
}

.response-card-header p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.badge-rating {
    white-space: nowrap;
    border-radius: 999px;
    padding: 8px 12px;
    background: rgba(124,58,237,0.12);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
}

.response-section + .response-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.response-section h4 {
    margin: 0 0 6px;
    font-size: 0.92rem;
    color: var(--primary);
}

.response-section p {
    margin: 0;
    line-height: 1.55;
}

.chips-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(6,182,212,0.1);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 600;
}

.pagination {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.pagination-info {
    color: var(--muted);
    font-size: 0.92rem;
    text-align: center;
}

.btn.disabled {
    pointer-events: none;
    opacity: 0.5;
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .charts-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .admin-filter-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .pagination {
        flex-direction: column;
    }

    .response-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
