:root {
    --bg: #f7f4ee;
    --panel: #ffffff;
    --ink: #1f2933;
    --muted: #5f6c7b;
    --primary: #005f73;
    --primary-2: #0a9396;
    --danger: #ae2012;
    --success: #2a9d8f;
    --border: #d8dee7;
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top right, #e9f2f2, var(--bg) 60%);
    color: var(--ink);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.layout {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: 0 8px 25px rgba(31, 41, 51, 0.05);
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.title {
    margin: 0;
    font-size: 1.25rem;
}

.muted {
    color: var(--muted);
    font-size: 0.95rem;
}

.btn {
    display: inline-block;
    border: 0;
    border-radius: 10px;
    padding: 0.65rem 0.95rem;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}

.btn-secondary {
    background: var(--primary-2);
}

.btn-danger {
    background: var(--danger);
}

.btn-link {
    background: transparent;
    color: var(--primary);
    padding: 0;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    font: inherit;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.form-row {
    margin-bottom: 0.85rem;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.form-inline > * {
    flex: 1 1 auto;
}

.flash {
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.flash.success {
    background: #e0f2ef;
    color: #1b6f66;
}

.flash.error {
    background: #fde7e5;
    color: #8f1f17;
}

.table-wrap {
    overflow-x: auto;
}

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

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

.pill {
    display: inline-block;
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.82rem;
    background: #d9e5ef;
    color: #1f3d5b;
}

.pill.draft {
    background: #f0f0f0;
    color: #505050;
}

.pill.active {
    background: #dff4f1;
    color: #1b6f66;
}

.pill.closed {
    background: #fde7e5;
    color: #8f1f17;
}

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.question-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.question-item.active {
    border-color: var(--primary-2);
    background: #eff8f8;
}

.participant {
    max-width: 560px;
    margin: 2rem auto;
}

.participant h1,
.participant h2 {
    margin-top: 0;
}

.center {
    text-align: center;
}

.big-code {
    font-size: 1.7rem;
    letter-spacing: 0.18em;
    font-weight: 700;
}

.answer-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.bar-row {
    margin-bottom: 0.7rem;
}

.bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.92rem;
    margin-bottom: 0.2rem;
}

.bar-track {
    width: 100%;
    height: 14px;
    border-radius: 999px;
    background: #e8eef5;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-2));
}

.bar-row.is-correct .bar-fill {
    background: linear-gradient(90deg, #2a9d8f, #52b788);
}

.tag-correct {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.05rem 0.35rem;
    border-radius: 999px;
    background: #dff4f1;
    color: #1b6f66;
    font-size: 0.72rem;
    font-weight: 600;
}

.wordcloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.85rem;
    align-items: baseline;
}

.wordcloud span {
    line-height: 1;
    color: var(--primary);
}

.open-results li {
    background: #f4f7fb;
    border-radius: 8px;
    margin-bottom: 0.45rem;
    padding: 0.55rem 0.7rem;
}

.status-line {
    margin-top: 0.75rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.7rem;
    margin-bottom: 0.9rem;
}

.kpi-card {
    border: 1px solid var(--border);
    background: #f8fbfd;
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
}

.kpi-label {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
}

.kpi-card strong {
    font-size: 1.25rem;
}

.progress-wrap {
    margin-bottom: 1rem;
}

.progress-title {
    margin: 0 0 0.4rem 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.progress-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.45rem 0.6rem;
    margin-bottom: 0.45rem;
}

.progress-item-header {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.progress-item-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

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

@media (max-width: 640px) {
    .layout {
        padding: 0.7rem;
    }

    .participant {
        margin: 0.75rem auto;
    }

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

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