:root {
    --bg: #ffffff;
    --bg-subtle: #f8f8f8;
    --text: #1a1a1a;
    --muted: #666666;
    --subtle: #999999;
    --border: #e5e5e5;
    --accent: #1a1a1a;
    --accent-hover: #333333;
    --accent-light: #f5f5f5;
    --success: #059669;
    --warn: #d97706;
    --error: #dc2626;
    --radius: 6px;
    --font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    --mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

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

body {
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* --- Layout --- */

.screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.screen-inner {
    width: 100%;
    max-width: 560px;
}

.screen-wide .screen-inner {
    max-width: 800px;
}

/* --- Logo --- */

.logo {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--subtle);
    margin-bottom: 3rem;
    text-align: center;
}

/* --- Typography --- */

h1 {
    font-size: 1.75rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
    text-align: center;
}

.subline {
    font-size: 0.95rem;
    color: var(--muted);
    text-align: center;
    margin-bottom: 2.5rem;
}

h2 {
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--subtle);
    margin-bottom: 1rem;
}

/* --- Buttons --- */

.btn {
    display: inline-block;
    padding: 0.7rem 1.8rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, opacity 0.15s;
    text-align: center;
}

.btn:hover { background: var(--accent-hover); }

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

.btn-outline:hover { background: var(--accent-light); }

.btn-lg { padding: 0.85rem 2.5rem; font-size: 1rem; }

.btn-block { display: block; width: 100%; }

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 2rem;
}

.btn[disabled] { opacity: 0.4; pointer-events: none; }

/* --- Cards (profile, tier) --- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    text-align: center;
}

.card:hover {
    border-color: var(--accent);
}

.card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.card-name {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.card-desc {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.75rem;
}

.card-price {
    font-size: 1.25rem;
    font-weight: 400;
    letter-spacing: -0.02em;
}

.card-price-period {
    font-size: 0.75rem;
    color: var(--muted);
}

/* --- Modules (toggles) --- */

.module-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.module-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s;
}

.module-item:hover { border-color: var(--accent); }
.module-item.active { border-color: var(--accent); background: var(--accent-light); }

.module-info { flex: 1; }
.module-name { font-weight: 500; margin-bottom: 0.15rem; }
.module-desc { font-size: 0.8rem; color: var(--muted); }
.module-price { font-size: 0.9rem; font-weight: 500; white-space: nowrap; margin-left: 1rem; }

.plan-total {
    text-align: center;
    padding: 1rem;
    background: var(--bg-subtle);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.plan-total strong { color: var(--text); font-size: 1.1rem; }

/* --- Form --- */

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
}

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

.trial-notice {
    padding: 1rem 1.25rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: #166534;
    margin-bottom: 2rem;
    text-align: center;
}

/* --- Search --- */

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font);
    margin-bottom: 1rem;
}

.search-input:focus { outline: none; border-color: var(--accent); }

.search-results {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    min-height: 60px;
}

.search-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s;
}

.search-result:hover { border-color: var(--accent); }

.search-result-name { font-weight: 500; }
.search-result-meta { font-size: 0.8rem; color: var(--muted); }

.search-empty {
    text-align: center;
    padding: 1.5rem;
    color: var(--subtle);
    font-size: 0.85rem;
}

/* --- Progress / Spinner --- */

.spinner-container {
    text-align: center;
    padding: 3rem 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
}

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

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 1.5rem 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.progress-step {
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
}

/* --- Complete --- */

.checkmark {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    animation: pop 0.3s ease;
}

.checkmark::after {
    content: '';
    width: 20px;
    height: 10px;
    border-left: 3px solid #fff;
    border-bottom: 3px solid #fff;
    transform: rotate(-45deg) translateY(-2px);
}

@keyframes pop {
    0% { transform: scale(0); }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* --- Back link --- */

.back-link {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--subtle);
    text-decoration: none;
    margin-bottom: 1.5rem;
    cursor: pointer;
}

.back-link:hover { color: var(--text); }
.back-link::before { content: '← '; }

/* --- Link --- */

.text-link {
    color: var(--muted);
    text-decoration: underline;
    font-size: 0.85rem;
    cursor: pointer;
}

.text-link:hover { color: var(--text); }

/* --- Error --- */

.error-box {
    padding: 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    color: var(--error);
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

/* --- Responsive --- */

@media (max-width: 640px) {
    .screen { padding: 1.5rem 1rem; }
    h1 { font-size: 1.35rem; }
    .card-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
