/* ── CSS Variables ── */
:root {
    --bg: #f5f4f0;
    --surface: #ffffff;
    --border: #e2e0d9;
    --accent: #1a1a2e;
    --green: #2d6a4f;
    --red: #c1121f;
    --yellow: #e9c46a;
    --text: #1a1a1a;
    --muted: #6b6b6b;
    --mono: 'IBM Plex Mono', monospace;
    --sans: 'DM Sans', sans-serif;
}

/* ── Reset ── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ── Body ── */
body {
    font-family: var(--sans);
    background: var(--bg);
    background-image: radial-gradient(circle at 1px 1px, #d4d2cc 1px, transparent 0);
    background-size: 24px 24px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

/* ── Wrapper ── */
.wrap {
    width: 100%;
    max-width: 480px;
    animation: rise .5s cubic-bezier(.22, 1, .36, 1) both;
}

/* ── Brand ── */
.brand {
    text-align: center;
    margin-bottom: 2rem;
}

.brand-icon {
    width: 52px;
    height: 52px;
    background: var(--accent);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: .8rem;
    box-shadow: 4px 4px 0 #c5c3bb;
}

.brand h1 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text);
}

.brand p {
    font-size: .82rem;
    color: var(--muted);
    font-family: var(--mono);
    margin-top: .2rem;
}

/* ── Step Nav ── */
.steps-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.8rem;
}

.step-pill {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-family: var(--mono);
    font-size: .7rem;
    color: var(--muted);
}

.step-pill.active {
    color: var(--accent);
    font-weight: 600;
}

.step-pill.done {
    color: var(--green);
}

.step-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-family: var(--mono);
    font-weight: 600;
    color: var(--muted);
    background: var(--surface);
    transition: all .3s;
}

.step-pill.active .step-dot {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.step-pill.done .step-dot {
    background: var(--green);
    border-color: var(--green);
    color: white;
}

.step-line {
    width: 36px;
    height: 2px;
    background: var(--border);
    margin: 0 .3rem;
    transition: background .3s;
}

.step-line.done {
    background: var(--green);
}

/* ── Card ── */
.card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 6px 6px 0 #e2e0d9;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: .3rem;
}

.card-desc {
    font-size: .82rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* ── Alert ── */
.alert {
    padding: .8rem 1rem;
    border-radius: 8px;
    font-size: .82rem;
    margin-bottom: 1.2rem;
    display: none;
    align-items: flex-start;
    gap: .5rem;
}

.alert.error {
    background: #fdf0f0;
    border: 1px solid #f5c0c0;
    color: var(--red);
}

.alert.success {
    background: #f0faf4;
    border: 1px solid #b0dfc0;
    color: var(--green);
}

/* ── Form Field ── */
.field {
    margin-bottom: 1.1rem;
}

.field label {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: .4rem;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.field input {
    width: 100%;
    padding: .65rem .9rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: var(--sans);
    font-size: .9rem;
    color: var(--text);
    background: var(--bg);
    transition: border-color .2s;
    outline: none;
}

.field input:focus {
    border-color: var(--accent);
    background: white;
}

.field .hint {
    font-size: .72rem;
    color: var(--muted);
    margin-top: .3rem;
    font-family: var(--mono);
}

/* ── Grid Row ── */
.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .8rem;
}

/* ── Button ── */
.btn {
    width: 100%;
    padding: .75rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: var(--sans);
    font-size: .92rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: .5rem;
    box-shadow: 3px 3px 0 #c5c3bb;
    transition: transform .1s, box-shadow .1s, opacity .2s;
}

.btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 #c5c3bb;
}

.btn:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 #c5c3bb;
}

.btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 3px 3px 0 #c5c3bb;
}

/* ── Log Output ── */
.log {
    background: #1a1a2e;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    font-family: var(--mono);
    font-size: .75rem;
    color: #8892b0;
    max-height: 150px;
    overflow-y: auto;
    display: none;
}

.log .log-line {
    padding: .15rem 0;
}

.log .log-line.ok {
    color: #64ffda;
}

.log .log-line.err {
    color: #ff6b6b;
}

.log .log-line.inf {
    color: #8892b0;
}

/* ── Spinner ── */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    vertical-align: middle;
    margin-right: .4rem;
}

/* ── Section ── */
.section {
    display: none;
}

.section.active {
    display: block;
}

/* ── Done Screen ── */
.done-icon {
    width: 64px;
    height: 64px;
    background: #f0faf4;
    border: 2px solid #b0dfc0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 1rem;
}

.done-title {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--green);
    margin-bottom: .4rem;
}

.done-desc {
    text-align: center;
    font-size: .83rem;
    color: var(--muted);
    line-height: 1.6;
}

.done-note {
    margin-top: 1rem;
    padding: .7rem 1rem;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
    font-size: .78rem;
    color: #7a5c00;
    font-family: var(--mono);
    text-align: center;
}

/* ── Animations ── */
@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ── Responsive ── */
@media (max-width: 480px) {
    .row {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1.4rem;
    }
}

/* ── Universal Notice (Flow 2) ── */
.universal-notice {
    padding: .8rem 1rem;
    border-radius: 8px;
    font-size: .82rem;
    margin-bottom: 1.2rem;
    display: none;
    align-items: flex-start;
    gap: .5rem;
    font-family: var(--mono);
}

.universal-notice.created {
    background: #fff8e1;
    border: 1px solid #ffe082;
    color: #7a5c00;
}

.universal-notice.exists {
    background: #f0faf4;
    border: 1px solid #b0dfc0;
    color: var(--green);
}

/* ── DB Name Hint States ── */
.hint-error {
    color: #c1121f !important;
    font-weight: 600;
}

.hint-ok {
    color: #2d6a4f !important;
    font-weight: 600;
}

/* ── Alert Warning ── */
.alert.warning {
    background: #fff8e1;
    border: 1px solid #ffe082;
    color: #7a5c00;
}