*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg: #F5F0EB;
    --bg-card: #FFFFFF;
    --primary: #2E7D32;
    --primary-light: #43A047;
    --primary-soft: rgba(46,125,50,.08);
    --accent: #8B5E3C;
    --accent-light: #A97C50;
    --text: #2C1810;
    --text-dim: #5D4E37;
    --text-muted: #8C7B6B;
    --border: #DDD2C4;
    --danger: #C62828;
    --danger-bg: #FFF0F0;
    --danger-border: #F5C6C6;
    --success: #2E7D32;
    --success-bg: #E8F5E9;
    --success-border: #A5D6A7;
    --warning: #F57F17;
    --warning-bg: #FFFDE7;
    --warning-border: #FFE082;
    --radius: 12px;
    --radius-lg: 20px;
    --shadow: 0 8px 30px rgba(44,24,16,.08);
}
html { min-height: 100%; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.installer {
    width: 100%;
    max-width: 680px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.installer-header {
    background: linear-gradient(135deg, #1B5E20, #2E7D32, #388E3C);
    padding: 32px 40px;
    color: white;
    text-align: center;
}
.installer-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
}
.installer-header p {
    font-size: 0.9rem;
    opacity: 0.85;
}
.installer-header .logo {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.15);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
}
.steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 20px 40px 0;
}
.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.3s;
}
.step-dot.active {
    background: var(--primary);
    width: 32px;
    border-radius: 5px;
}
.step-dot.done {
    background: var(--success);
}
.installer-body {
    padding: 32px 40px;
}
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title .icon {
    width: 28px;
    height: 28px;
    background: var(--primary-soft);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.section-title-sm {
    font-size: 0.95rem;
    margin-top: 20px;
    margin-bottom: 10px;
}

/* Requirements table */
.req-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 4px;
}
.req-table td {
    padding: 10px 14px;
    font-size: 0.88rem;
}
.req-table tr {
    background: #FAFAFA;
    border-radius: 8px;
}
.req-table tr td:first-child {
    border-radius: 8px 0 0 8px;
    font-weight: 500;
}
.req-table tr td:last-child {
    border-radius: 0 8px 8px 0;
    text-align: right;
}
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
}
.badge-ok {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
}
.badge-fail {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

/* Form */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-grid .full-width {
    grid-column: 1 / -1;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dim);
}
.form-group input, .form-group select {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #FAFAF8;
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46,125,50,0.1);
}
.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.form-separator {
    grid-column: 1 / -1;
    border: none;
    border-top: 1px solid var(--border);
    margin: 8px 0;
}
.form-section-label {
    grid-column: 1 / -1;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Alert */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 0.88rem;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger);
}
.alert-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success);
}
.alert-warning {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    color: #795548;
}
.alert-mt { margin-top: 20px; }

/* Buttons */
.btn-row {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}
.btn-row-center { justify-content: center; flex-wrap: wrap; }
.btn-row-wrap { flex-wrap: wrap; }
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, #2E7D32, #388E3C);
    color: white;
    box-shadow: 0 4px 12px rgba(46,125,50,0.3);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(46,125,50,0.4);
}
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.btn-secondary {
    background: #F5F5F5;
    color: var(--text-dim);
    border: 1px solid var(--border);
}

/* Complete screen */
.complete-screen {
    text-align: center;
    padding: 20px 0;
}
.complete-icon {
    width: 80px;
    height: 80px;
    background: var(--success-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 36px;
}
.complete-screen h2 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    color: var(--success);
}
.complete-screen p {
    color: var(--text-dim);
    margin-bottom: 8px;
    font-size: 0.9rem;
}
.complete-sub {
    margin-top: 4px;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.complete-warning {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    border-radius: 10px;
    padding: 16px;
    margin: 24px 0;
    font-size: 0.85rem;
    color: #795548;
}
.complete-warning strong {
    color: var(--warning);
}
.complete-warning-mt { margin-top: 20px; }
.credentials-box {
    background: #F8F6F3;
    border-radius: 10px;
    padding: 16px;
    margin: 16px 0;
    text-align: left;
}
.credentials-box .cred-label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--accent);
}
.credentials-box .cred-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.88rem;
}
.credentials-box .cred-row span:first-child {
    color: var(--text-muted);
}
.credentials-box .cred-row span:last-child {
    font-weight: 600;
    font-family: monospace;
}

/* Loading */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.loading-overlay.active { display: flex; }
.loading-box {
    background: white;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.loading-title {
    font-weight: 600;
    color: #333;
}
.loading-sub {
    font-size: 0.8rem;
    color: #888;
    margin-top: 4px;
}
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #E0E0E0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Stats grid for permissions */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}
.stat-card {
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}
.stat-card-green { background: #E8F5E9; }
.stat-card-blue { background: #E3F2FD; }
.stat-card-purple { background: #F3E5F5; }
.stat-card-red { background: #FFEBEE; }
.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
}
.stat-value-green { color: #2E7D32; }
.stat-value-blue { color: #1565C0; }
.stat-value-purple { color: #7B1FA2; }
.stat-value-red { color: #C62828; }
.stat-label {
    font-size: 0.75rem;
    color: #555;
    margin-top: 2px;
}

/* Permissions reference */
.perm-ref {
    margin-top: 24px;
    padding: 16px;
    background: #F8F6F3;
    border-radius: 10px;
    font-size: 0.82rem;
    color: #795548;
}
.perm-ref strong { display: block; margin-bottom: 8px; }
.perm-ref-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.perm-code {
    font-size: 0.78rem;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
}
.perm-code-blue { background: #e3f2fd; padding: 1px 6px; border-radius: 3px; }
.perm-code-purple { background: #f3e5f5; padding: 1px 6px; border-radius: 3px; }
.perm-code-yellow { background: #fff8e1; padding: 1px 6px; border-radius: 3px; }
.perm-code-small {
    font-size: 0.8rem;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}
.td-mono {
    font-family: monospace;
    font-size: 0.82rem;
}
.perm-color-orange { color: #F57F17; }
.perm-color-blue { color: #1565C0; }
.perm-color-purple { color: #7B1FA2; }

@media (max-width: 600px) {
    .installer-header { padding: 24px 20px; }
    .installer-body { padding: 24px 20px; }
    .form-grid { grid-template-columns: 1fr; }
    .steps { padding: 16px 20px 0; }
}
