*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --bg: #0b0e14;
    --surface: #14181f;
    --surface-raised: #1c212b;
    --border: #262e3b;
    --border-focus: #4a7cff;
    --text: #e4eaf2;
    --text-secondary: #8b95a8;
    --text-tertiary: #606b7e;
    --accent: #4a7cff;
    --accent-glow: rgba(74, 124, 255, .25);
    --green: #34d399;
    --red: #f87171;
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.wrap {
    max-width: 820px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

/* Header */
.hero {
    text-align: center;
    margin-bottom: 2rem;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    margin-bottom: .8rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.logo-text {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -.02em;
    background: linear-gradient(135deg, #4a7cff 0%, #7c5cfc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lead {
    color: var(--text-secondary);
    margin: 0 auto;
    max-width: 600px;
    font-size: 1rem;
}

/* Card */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: border-color .2s;
}

.card + .card {
    margin-top: 1.25rem;
}

/* Sections */
.form-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.form-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.form-section-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1rem;
}

.form-section-header h2 {
    margin: 0;
    font-size: .85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-secondary);
}

.form-section-header .icon {
    width: 18px;
    height: 18px;
    opacity: .5;
}

/* Fields */
.field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-bottom: .85rem;
}

.field:last-child {
    margin-bottom: 0;
}

.field-label {
    font-size: .9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.field-label small {
    font-weight: 400;
    color: var(--text-tertiary);
}

.field-hint {
    margin: 0;
    font-size: .85rem;
    color: var(--text-tertiary);
    line-height: 1.5;
}

.field-hint code {
    font-size: .82rem;
    background: rgba(255, 255, 255, .06);
    padding: .1em .4em;
    border-radius: 4px;
    color: var(--text);
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: .65rem .8rem;
    font: inherit;
    font-size: .95rem;
    transition: border-color .2s, box-shadow .2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea {
    resize: vertical;
    min-height: 100px;
    font-size: .9rem;
}

select {
    cursor: pointer;
}

/* Grid rows */
.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .85rem;
}

.row.folders {
    grid-template-columns: repeat(5, 1fr);
}

/* Checkboxes */
.checks {
    display: flex;
    gap: 1.25rem;
}

.checks label {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    user-select: none;
}

.checks input[type="checkbox"] {
    width: auto;
    accent-color: var(--accent);
}

/* Buttons */
.actions {
    display: flex;
    justify-content: center;
    margin-top: .5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border: 0;
    border-radius: var(--radius-sm);
    padding: .7rem 1.5rem;
    font: inherit;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s;
}

.btn.primary {
    background: var(--accent);
    color: #fff;
    min-width: 200px;
}

.btn.primary:hover {
    background: #5f8aff;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn.primary:disabled {
    opacity: .5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn.ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn.ghost:hover {
    background: rgba(255, 255, 255, .04);
    border-color: var(--text-tertiary);
}

/* Result */
.result {
    overflow: hidden;
}

.result.hidden {
    display: none;
}

.result.ok {
    border-color: rgba(52, 211, 153, .3);
}

.result.err {
    border-color: rgba(248, 113, 113, .3);
}

.result-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
}

.result-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.result.ok .result-icon {
    background: rgba(52, 211, 153, .15);
    color: var(--green);
}

.result.err .result-icon {
    background: rgba(248, 113, 113, .15);
    color: var(--red);
}

.result-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.result-msg {
    margin: 0;
    color: var(--text-secondary);
    font-size: .9rem;
}

.stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: .85rem 0;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: .8rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.warning-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .8rem;
    color: #fbbf24;
    background: rgba(251, 191, 36, .1);
    padding: .2rem .6rem;
    border-radius: 20px;
}

.result-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Spinner */
.spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .85rem;
    color: var(--text-secondary);
    padding: 1.5rem 0;
    font-size: .95rem;
}

.spinner::before {
    content: '';
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .65s linear infinite;
}

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

/* Footer */
.foot {
    margin-top: 2rem;
    color: var(--text-tertiary);
    font-size: .85rem;
    text-align: center;
}

.foot code {
    font-size: .82rem;
    background: rgba(255, 255, 255, .06);
    padding: .1em .4em;
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 720px) {
    .wrap {
        padding: 1.5rem 1rem 3rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .row,
    .row.folders {
        grid-template-columns: 1fr;
    }

    .stats {
        gap: 1rem;
    }

    .stat-value {
        font-size: 1.15rem;
    }

    .btn.primary {
        min-width: 0;
        width: 100%;
    }
}
