:root {
    --bg: #f5f7fb;
    --card-bg: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --accent: #2563eb;
    --accent-soft: #dbeafe;
    --danger: #dc2626;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.5;
}

.ws-header {
    background: linear-gradient(135deg, #1d4ed8, #6d28d9);
    color: #fff;
    padding: 3rem 1.5rem;
}

.ws-header__content {
    width: 100%;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0 2.5rem;
}

.ws-header h1 {
    margin: 0.25rem 0;
    font-size: 2.5rem;
}

.subtitle {
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.75rem;
    margin: 0;
}

.tag {
    background: rgba(15, 23, 42, 0.2);
    padding: 0.35rem 1rem;
    border-radius: 999px;
    font-weight: 600;
}

.ws-main {
    width: 100%;
    margin: -2rem auto 3rem;
    padding: 0 2.5rem;
}

.ws-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    align-items: flex-start;
}

.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1.75rem;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
}

.form-card {
    position: relative;
}

.form-card.is-busy {
    opacity: 0.7;
}

.form-progress {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    background: rgba(245, 247, 251, 0.92);
    border-radius: 20px;
    backdrop-filter: blur(2px);
    z-index: 2;
}

.form-progress[hidden] {
    display: none;
}

.form-progress__body {
    display: flex;
    gap: 1rem;
    align-items: center;
    max-width: 22rem;
    width: 100%;
}

.form-progress__content {
    flex: 1;
}

.form-progress__spinner {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 3px solid var(--accent-soft);
    border-top-color: var(--accent);
    animation: ws-spin 0.9s linear infinite;
    flex-shrink: 0;
}

.form-progress__title {
    margin: 0;
    font-weight: 600;
    font-size: 1.05rem;
}

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

.form-progress__bar {
    width: 100%;
    height: 0.45rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.15);
    margin-top: 0.75rem;
    overflow: hidden;
}

.form-progress__bar-fill {
    width: 0%;
    height: 100%;
    background: var(--accent);
    border-radius: inherit;
    transition: width 0.25s ease;
}

.form-progress__log {
    list-style: none;
    margin: 1.25rem 0 0;
    padding: 0;
    width: 100%;
    max-width: 28rem;
    max-height: 9rem;
    overflow-y: auto;
    font-size: 0.9rem;
    color: var(--text);
}

.form-progress__log li + li {
    margin-top: 0.35rem;
}

.form-progress__log-stage {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-right: 0.4rem;
    color: var(--muted);
}

.form-progress--error .form-progress__spinner {
    border-top-color: var(--danger);
}

.form-progress--error .form-progress__bar-fill {
    background: var(--danger);
}

.form-progress--success .form-progress__spinner {
    border-top-color: #16a34a;
}

.form-progress--success .form-progress__bar-fill {
    background: #16a34a;
}

.share-card {
    position: sticky;
    top: 6rem;
}

.form__section + .form__section {
    margin-top: 1.5rem;
}

.form {
    display: flex;
    flex-direction: column;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

input[type="text"],
input[type="password"],
select,
textarea {
    width: 100%;
    border: 1px solid #cbd5f5;
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    font-size: 1rem;
    font-family: inherit;
}

textarea {
    resize: vertical;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    margin-top: 0.75rem;
}

.checkbox input {
    width: auto;
}

.form__actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.form__actions--inline {
    margin-top: 0.75rem;
}

button.primary {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.8rem 2.4rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 15px 35px rgba(37, 99, 235, 0.3);
}

button.primary:hover {
    background: #1d4ed8;
}

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

.side-column,
.results-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.results-column > .card {
    flex: 1;
}

.results-card {
    padding: 2rem;
}

.results-card__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.results-card__head h3 {
    margin: 0.15rem 0 0;
}

.results-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.threshold-field label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    display: inline-block;
}

.threshold-field__input {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.threshold-field__input input {
    width: 4rem;
    text-align: center;
    border-radius: 999px;
    font-weight: 600;
}

.pill-btn {
    border: 1px solid #cbd5f5;
    background: #fff;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
}

.download-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.download-actions .secondary {
    text-decoration: none;
}

.filter-empty-row td {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--muted);
}

.is-disabled {
    opacity: 0.6;
    pointer-events: none;
}

.meta {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0;
    text-align: right;
}

.results-card--empty {
    text-align: center;
}

.share-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #e2e8f0;
    padding: 0.75rem 0;
}

.share-row:first-of-type {
    border-top: none;
}

.share-row code {
    background: var(--accent-soft);
    padding: 0.3rem 0.7rem;
    border-radius: 10px;
}

@media (max-width: 1400px) {
    .ws-header__content,
    .ws-main {
        padding: 0 2rem;
    }
}

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

@media (max-width: 900px) {
    .ws-header__content {
        flex-direction: column;
        gap: 1.5rem;
        padding: 0 1.25rem;
    }
    .ws-main {
        padding: 0 1.25rem;
    }
    .ws-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

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

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

.results-table th,
.results-table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 0.65rem;
    vertical-align: top;
    text-align: left;
}

.thumb {
    width: 160px;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.2);
}

.score {
    font-weight: 700;
    padding: 0.15rem 0.9rem;
    border-radius: 999px;
    display: inline-block;
}

.score--unknown {
    background: #e2e8f0;
    color: #475569;
}

.score--0,
.score--1,
.score--2 {
    background: #dcfce7;
    color: #15803d;
}

.score--3,
.score--4,
.score--5,
.score--6 {
    background: #e0e7ff;
    color: #3730a3;
}

.score--7,
.score--8 {
    background: #ffedd5;
    color: #9a3412;
}

.score--9,
.score--10 {
    background: #fee2e2;
    color: #b91c1c;
}

.error {
    color: var(--danger);
    font-weight: 600;
}

.secondary {
    text-decoration: none;
    border: 1px solid #cbd5f5;
    border-radius: 999px;
    padding: 0.5rem 1.2rem;
    font-weight: 600;
    color: var(--accent);
}

.flash-container {
    margin-bottom: 1rem;
}

.flash {
    padding: 0.9rem 1.2rem;
    border-radius: 12px;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.flash--success {
    background: #dcfce7;
    color: #166534;
}

.flash--error {
    background: #fee2e2;
    color: #b91c1c;
}

@media (max-width: 960px) {
    .share-card {
        position: static;
    }

    .results-card__head {
        flex-direction: column;
        align-items: flex-start;
    }
}
